@aigne/core 1.72.0-beta.1 → 1.72.0-beta.2

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 (67) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/cjs/agents/chat-model.d.ts +7 -0
  3. package/lib/cjs/agents/chat-model.js +3 -0
  4. package/lib/cjs/agents/image-model.d.ts +5 -0
  5. package/lib/cjs/agents/image-model.js +2 -0
  6. package/lib/cjs/agents/video-model.d.ts +5 -0
  7. package/lib/cjs/agents/video-model.js +2 -0
  8. package/lib/cjs/aigne/usage.d.ts +1 -0
  9. package/lib/cjs/prompt/context/afs/index.js +1 -2
  10. package/lib/cjs/prompt/skills/afs/base.d.ts +4 -0
  11. package/lib/cjs/prompt/skills/afs/base.js +8 -0
  12. package/lib/cjs/prompt/skills/afs/delete.d.ts +3 -2
  13. package/lib/cjs/prompt/skills/afs/delete.js +2 -2
  14. package/lib/cjs/prompt/skills/afs/edit.d.ts +3 -2
  15. package/lib/cjs/prompt/skills/afs/edit.js +2 -2
  16. package/lib/cjs/prompt/skills/afs/exec.d.ts +3 -2
  17. package/lib/cjs/prompt/skills/afs/exec.js +7 -4
  18. package/lib/cjs/prompt/skills/afs/list.d.ts +3 -2
  19. package/lib/cjs/prompt/skills/afs/list.js +6 -13
  20. package/lib/cjs/prompt/skills/afs/read.d.ts +3 -2
  21. package/lib/cjs/prompt/skills/afs/read.js +2 -2
  22. package/lib/cjs/prompt/skills/afs/rename.d.ts +3 -2
  23. package/lib/cjs/prompt/skills/afs/rename.js +2 -2
  24. package/lib/cjs/prompt/skills/afs/search.d.ts +3 -2
  25. package/lib/cjs/prompt/skills/afs/search.js +2 -2
  26. package/lib/cjs/prompt/skills/afs/write.d.ts +3 -2
  27. package/lib/cjs/prompt/skills/afs/write.js +2 -2
  28. package/lib/dts/agents/chat-model.d.ts +7 -0
  29. package/lib/dts/agents/image-model.d.ts +5 -0
  30. package/lib/dts/agents/video-model.d.ts +5 -0
  31. package/lib/dts/aigne/usage.d.ts +1 -0
  32. package/lib/dts/prompt/skills/afs/base.d.ts +4 -0
  33. package/lib/dts/prompt/skills/afs/delete.d.ts +3 -2
  34. package/lib/dts/prompt/skills/afs/edit.d.ts +3 -2
  35. package/lib/dts/prompt/skills/afs/exec.d.ts +3 -2
  36. package/lib/dts/prompt/skills/afs/list.d.ts +3 -2
  37. package/lib/dts/prompt/skills/afs/read.d.ts +3 -2
  38. package/lib/dts/prompt/skills/afs/rename.d.ts +3 -2
  39. package/lib/dts/prompt/skills/afs/search.d.ts +3 -2
  40. package/lib/dts/prompt/skills/afs/write.d.ts +3 -2
  41. package/lib/esm/agents/chat-model.d.ts +7 -0
  42. package/lib/esm/agents/chat-model.js +3 -0
  43. package/lib/esm/agents/image-model.d.ts +5 -0
  44. package/lib/esm/agents/image-model.js +2 -0
  45. package/lib/esm/agents/video-model.d.ts +5 -0
  46. package/lib/esm/agents/video-model.js +2 -0
  47. package/lib/esm/aigne/usage.d.ts +1 -0
  48. package/lib/esm/prompt/context/afs/index.js +1 -2
  49. package/lib/esm/prompt/skills/afs/base.d.ts +4 -0
  50. package/lib/esm/prompt/skills/afs/base.js +4 -0
  51. package/lib/esm/prompt/skills/afs/delete.d.ts +3 -2
  52. package/lib/esm/prompt/skills/afs/delete.js +2 -2
  53. package/lib/esm/prompt/skills/afs/edit.d.ts +3 -2
  54. package/lib/esm/prompt/skills/afs/edit.js +2 -2
  55. package/lib/esm/prompt/skills/afs/exec.d.ts +3 -2
  56. package/lib/esm/prompt/skills/afs/exec.js +7 -4
  57. package/lib/esm/prompt/skills/afs/list.d.ts +3 -2
  58. package/lib/esm/prompt/skills/afs/list.js +6 -13
  59. package/lib/esm/prompt/skills/afs/read.d.ts +3 -2
  60. package/lib/esm/prompt/skills/afs/read.js +2 -2
  61. package/lib/esm/prompt/skills/afs/rename.d.ts +3 -2
  62. package/lib/esm/prompt/skills/afs/rename.js +2 -2
  63. package/lib/esm/prompt/skills/afs/search.d.ts +3 -2
  64. package/lib/esm/prompt/skills/afs/search.js +2 -2
  65. package/lib/esm/prompt/skills/afs/write.d.ts +3 -2
  66. package/lib/esm/prompt/skills/afs/write.js +2 -2
  67. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [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)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **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))
9
+ * **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))
10
+ * **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))
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * The following workspace dependencies were updated
16
+ * dependencies
17
+ * @aigne/afs bumped to 1.4.0-beta.2
18
+ * @aigne/afs-history bumped to 1.2.0-beta.2
19
+
3
20
  ## [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)
4
21
 
5
22
 
@@ -492,17 +492,24 @@ export interface ChatModelOutputUsage {
492
492
  * AIGNE Hub credit usage
493
493
  */
494
494
  aigneHubCredits?: number;
495
+ /**
496
+ * Credit prefix
497
+ */
498
+ creditPrefix?: "$" | "€" | "¥";
495
499
  }
496
500
  export declare const chatModelOutputUsageSchema: z.ZodObject<{
497
501
  inputTokens: z.ZodNumber;
498
502
  outputTokens: z.ZodNumber;
499
503
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
504
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
500
505
  }, "strip", z.ZodTypeAny, {
501
506
  inputTokens: number;
502
507
  outputTokens: number;
503
508
  aigneHubCredits?: number | undefined;
509
+ creditPrefix?: "$" | "€" | "¥" | undefined;
504
510
  }, {
505
511
  inputTokens: number;
506
512
  outputTokens: number;
507
513
  aigneHubCredits?: number | undefined;
514
+ creditPrefix?: "$" | "€" | "¥" | undefined;
508
515
  }>;
@@ -225,6 +225,8 @@ class ChatModel extends model_js_1.Model {
225
225
  options.context.usage.inputTokens += usage.inputTokens;
226
226
  if (usage.aigneHubCredits)
227
227
  options.context.usage.aigneHubCredits += usage.aigneHubCredits;
228
+ if (usage.creditPrefix)
229
+ options.context.usage.creditPrefix = usage.creditPrefix;
228
230
  }
229
231
  }
230
232
  async processAgentOutput(input, output, options) {
@@ -377,6 +379,7 @@ exports.chatModelOutputUsageSchema = zod_1.z.object({
377
379
  inputTokens: zod_1.z.number(),
378
380
  outputTokens: zod_1.z.number(),
379
381
  aigneHubCredits: (0, schema_js_1.optionalize)(zod_1.z.number()),
382
+ creditPrefix: (0, schema_js_1.optionalize)(zod_1.z.union([zod_1.z.literal("$"), zod_1.z.literal("€"), zod_1.z.literal("¥")])),
380
383
  });
381
384
  const chatModelOutputSchema = zod_1.z.object({
382
385
  text: (0, schema_js_1.optionalize)(zod_1.z.string()),
@@ -196,14 +196,17 @@ export declare const imageModelOutputSchema: z.ZodObject<{
196
196
  inputTokens: z.ZodNumber;
197
197
  outputTokens: z.ZodNumber;
198
198
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
199
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
199
200
  }, "strip", z.ZodTypeAny, {
200
201
  inputTokens: number;
201
202
  outputTokens: number;
202
203
  aigneHubCredits?: number | undefined;
204
+ creditPrefix?: "$" | "€" | "¥" | undefined;
203
205
  }, {
204
206
  inputTokens: number;
205
207
  outputTokens: number;
206
208
  aigneHubCredits?: number | undefined;
209
+ creditPrefix?: "$" | "€" | "¥" | undefined;
207
210
  }>>;
208
211
  model: z.ZodOptional<z.ZodString>;
209
212
  }, "strip", z.ZodTypeAny, {
@@ -228,6 +231,7 @@ export declare const imageModelOutputSchema: z.ZodObject<{
228
231
  inputTokens: number;
229
232
  outputTokens: number;
230
233
  aigneHubCredits?: number | undefined;
234
+ creditPrefix?: "$" | "€" | "¥" | undefined;
231
235
  } | undefined;
232
236
  }, {
233
237
  images: ({
@@ -251,5 +255,6 @@ export declare const imageModelOutputSchema: z.ZodObject<{
251
255
  inputTokens: number;
252
256
  outputTokens: number;
253
257
  aigneHubCredits?: number | undefined;
258
+ creditPrefix?: "$" | "€" | "¥" | undefined;
254
259
  } | undefined;
255
260
  }>;
@@ -61,6 +61,8 @@ class ImageModel extends model_js_1.Model {
61
61
  options.context.usage.inputTokens += usage.inputTokens;
62
62
  if (usage.aigneHubCredits)
63
63
  options.context.usage.aigneHubCredits += usage.aigneHubCredits;
64
+ if (usage.creditPrefix)
65
+ options.context.usage.creditPrefix = usage.creditPrefix;
64
66
  }
65
67
  }
66
68
  async processAgentOutput(input, output, options) {
@@ -203,14 +203,17 @@ export declare const videoModelOutputSchema: z.ZodObject<{
203
203
  inputTokens: z.ZodNumber;
204
204
  outputTokens: z.ZodNumber;
205
205
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
206
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
206
207
  }, "strip", z.ZodTypeAny, {
207
208
  inputTokens: number;
208
209
  outputTokens: number;
209
210
  aigneHubCredits?: number | undefined;
211
+ creditPrefix?: "$" | "€" | "¥" | undefined;
210
212
  }, {
211
213
  inputTokens: number;
212
214
  outputTokens: number;
213
215
  aigneHubCredits?: number | undefined;
216
+ creditPrefix?: "$" | "€" | "¥" | undefined;
214
217
  }>>;
215
218
  model: z.ZodOptional<z.ZodString>;
216
219
  seconds: z.ZodOptional<z.ZodNumber>;
@@ -236,6 +239,7 @@ export declare const videoModelOutputSchema: z.ZodObject<{
236
239
  inputTokens: number;
237
240
  outputTokens: number;
238
241
  aigneHubCredits?: number | undefined;
242
+ creditPrefix?: "$" | "€" | "¥" | undefined;
239
243
  } | undefined;
240
244
  seconds?: number | undefined;
241
245
  }, {
@@ -260,6 +264,7 @@ export declare const videoModelOutputSchema: z.ZodObject<{
260
264
  inputTokens: number;
261
265
  outputTokens: number;
262
266
  aigneHubCredits?: number | undefined;
267
+ creditPrefix?: "$" | "€" | "¥" | undefined;
263
268
  } | undefined;
264
269
  seconds?: number | undefined;
265
270
  }>;
@@ -34,6 +34,8 @@ class VideoModel extends model_js_1.Model {
34
34
  options.context.usage.inputTokens += usage.inputTokens;
35
35
  if (usage.aigneHubCredits)
36
36
  options.context.usage.aigneHubCredits += usage.aigneHubCredits;
37
+ if (usage.creditPrefix)
38
+ options.context.usage.creditPrefix = usage.creditPrefix;
37
39
  }
38
40
  }
39
41
  async processAgentOutput(input, output, options) {
@@ -5,6 +5,7 @@ export interface ContextUsage {
5
5
  inputTokens: number;
6
6
  outputTokens: number;
7
7
  aigneHubCredits: number;
8
+ creditPrefix?: "$" | "€" | "¥";
8
9
  agentCalls: number;
9
10
  duration: number;
10
11
  }
@@ -31,8 +31,7 @@ function createAFSContext(agent, context) {
31
31
  async list(path, options) {
32
32
  if (!afs)
33
33
  throw new Error("AFS is not configured for this agent.");
34
- return (await afs.list(path, { ...options, context, format: options?.format || "tree" }))
35
- .data;
34
+ return (await afs.list(path, { ...options, context, format: options?.format || "simple-list" })).data;
36
35
  },
37
36
  async read(path) {
38
37
  if (!afs)
@@ -0,0 +1,4 @@
1
+ import { Agent, type Message } from "../../../agents/agent.js";
2
+ export declare abstract class AFSSkillBase<I extends Message = Message, O extends Message = Message> extends Agent<I, O> {
3
+ tag: string;
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AFSSkillBase = void 0;
4
+ const agent_js_1 = require("../../../agents/agent.js");
5
+ class AFSSkillBase extends agent_js_1.Agent {
6
+ tag = "AFS";
7
+ }
8
+ exports.AFSSkillBase = AFSSkillBase;
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSDeleteInput extends Message {
3
4
  path: string;
4
5
  recursive?: boolean;
@@ -12,7 +13,7 @@ export interface AFSDeleteOutput extends Message {
12
13
  export interface AFSDeleteAgentOptions extends AgentOptions<AFSDeleteInput, AFSDeleteOutput> {
13
14
  afs: NonNullable<AgentOptions<AFSDeleteInput, AFSDeleteOutput>["afs"]>;
14
15
  }
15
- export declare class AFSDeleteAgent extends Agent<AFSDeleteInput, AFSDeleteOutput> {
16
+ export declare class AFSDeleteAgent extends AFSSkillBase<AFSDeleteInput, AFSDeleteOutput> {
16
17
  constructor(options: AFSDeleteAgentOptions);
17
18
  process(input: AFSDeleteInput, _options: AgentInvokeOptions): Promise<AFSDeleteOutput>;
18
19
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSDeleteAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSDeleteAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSDeleteAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_delete",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface Patch {
3
4
  start_line: number;
4
5
  end_line: number;
@@ -19,7 +20,7 @@ export interface AFSEditOutput extends Message {
19
20
  export interface AFSEditAgentOptions extends AgentOptions<AFSEditInput, AFSEditOutput> {
20
21
  afs: NonNullable<AgentOptions<AFSEditInput, AFSEditOutput>["afs"]>;
21
22
  }
22
- export declare class AFSEditAgent extends Agent<AFSEditInput, AFSEditOutput> {
23
+ export declare class AFSEditAgent extends AFSSkillBase<AFSEditInput, AFSEditOutput> {
23
24
  constructor(options: AFSEditAgentOptions);
24
25
  process(input: AFSEditInput, _options: AgentInvokeOptions): Promise<AFSEditOutput>;
25
26
  applyCustomPatches(text: string, patches: Patch[]): string;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSEditAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSEditAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSEditAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_edit",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSExecInput extends Message {
3
4
  path: string;
4
5
  args: string;
@@ -9,7 +10,7 @@ export interface AFSExecOutput extends Message {
9
10
  export interface AFSExecAgentOptions extends AgentOptions<AFSExecInput, AFSExecOutput> {
10
11
  afs: NonNullable<AgentOptions<AFSExecInput, AFSExecOutput>["afs"]>;
11
12
  }
12
- export declare class AFSExecAgent extends Agent<AFSExecInput, AFSExecOutput> {
13
+ export declare class AFSExecAgent extends AFSSkillBase<AFSExecInput, AFSExecOutput> {
13
14
  constructor(options: AFSExecAgentOptions);
14
15
  process(input: AFSExecInput, options: AgentInvokeOptions): Promise<AFSExecOutput>;
15
16
  }
@@ -2,15 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSExecAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSExecAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSExecAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_exec",
10
- description: "Execute functions or commands from AFS modules. Use when running operations provided by mounted modules.",
10
+ description: `
11
+ Execute files marked as executable in the Agentic File System (AFS).
12
+ Use this to run executable files registered at a given path with specified arguments.
13
+ `.trim(),
11
14
  ...options,
12
15
  inputSchema: zod_1.z.object({
13
- path: zod_1.z.string().describe("Absolute path to the executable function in AFS"),
16
+ path: zod_1.z.string().describe("Absolute path to the executable file in AFS"),
14
17
  args: zod_1.z.string().describe("JSON string of arguments matching the function's input schema"),
15
18
  }),
16
19
  outputSchema: zod_1.z.object({
@@ -1,5 +1,6 @@
1
1
  import type { AFSListOptions } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSListInput extends Message {
4
5
  path: string;
5
6
  options?: AFSListOptions;
@@ -15,7 +16,7 @@ export interface AFSListOutput extends Message {
15
16
  export interface AFSListAgentOptions extends AgentOptions<AFSListInput, AFSListOutput> {
16
17
  afs: NonNullable<AgentOptions<AFSListInput, AFSListOutput>["afs"]>;
17
18
  }
18
- export declare class AFSListAgent extends Agent<AFSListInput, AFSListOutput> {
19
+ export declare class AFSListAgent extends AFSSkillBase<AFSListInput, AFSListOutput> {
19
20
  constructor(options: AFSListAgentOptions);
20
21
  process(input: AFSListInput, _options: AgentInvokeOptions): Promise<AFSListOutput>;
21
22
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSListAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSListAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSListAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_list",
@@ -23,10 +23,10 @@ class AFSListAgent extends agent_js_1.Agent {
23
23
  .optional()
24
24
  .describe("Maximum number of children to list per directory"),
25
25
  format: zod_1.z
26
- .union([zod_1.z.literal("tree"), zod_1.z.literal("list")])
26
+ .union([zod_1.z.literal("simple-list"), zod_1.z.literal("tree")])
27
27
  .optional()
28
- .default("tree")
29
- .describe("Output format, either 'tree' or 'list' (default: 'tree')"),
28
+ .default("simple-list")
29
+ .describe("Output format, either 'simple-list', or 'tree', default is 'simple-list'"),
30
30
  })
31
31
  .optional(),
32
32
  }),
@@ -34,14 +34,7 @@ class AFSListAgent extends agent_js_1.Agent {
34
34
  status: zod_1.z.string(),
35
35
  tool: zod_1.z.string(),
36
36
  path: zod_1.z.string(),
37
- options: zod_1.z
38
- .object({
39
- maxDepth: zod_1.z.number().optional(),
40
- disableGitignore: zod_1.z.boolean().optional(),
41
- maxChildren: zod_1.z.number().optional(),
42
- format: zod_1.z.union([zod_1.z.literal("tree"), zod_1.z.literal("list")]).optional(),
43
- })
44
- .optional(),
37
+ options: zod_1.z.record(zod_1.z.any()).optional(),
45
38
  message: zod_1.z.string().optional(),
46
39
  data: zod_1.z.unknown(),
47
40
  }),
@@ -1,5 +1,6 @@
1
1
  import type { AFSEntry } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSReadInput extends Message {
4
5
  path: string;
5
6
  withLineNumbers?: boolean;
@@ -15,7 +16,7 @@ export interface AFSReadOutput extends Message {
15
16
  export interface AFSReadAgentOptions extends AgentOptions<AFSReadInput, AFSReadOutput> {
16
17
  afs: NonNullable<AgentOptions<AFSReadInput, AFSReadOutput>["afs"]>;
17
18
  }
18
- export declare class AFSReadAgent extends Agent<AFSReadInput, AFSReadOutput> {
19
+ export declare class AFSReadAgent extends AFSSkillBase<AFSReadInput, AFSReadOutput> {
19
20
  constructor(options: AFSReadAgentOptions);
20
21
  process(input: AFSReadInput, _options: AgentInvokeOptions): Promise<AFSReadOutput>;
21
22
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSReadAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSReadAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSReadAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_read",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSRenameInput extends Message {
3
4
  oldPath: string;
4
5
  newPath: string;
@@ -14,7 +15,7 @@ export interface AFSRenameOutput extends Message {
14
15
  export interface AFSRenameAgentOptions extends AgentOptions<AFSRenameInput, AFSRenameOutput> {
15
16
  afs: NonNullable<AgentOptions<AFSRenameInput, AFSRenameOutput>["afs"]>;
16
17
  }
17
- export declare class AFSRenameAgent extends Agent<AFSRenameInput, AFSRenameOutput> {
18
+ export declare class AFSRenameAgent extends AFSSkillBase<AFSRenameInput, AFSRenameOutput> {
18
19
  constructor(options: AFSRenameAgentOptions);
19
20
  process(input: AFSRenameInput, _options: AgentInvokeOptions): Promise<AFSRenameOutput>;
20
21
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSRenameAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSRenameAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSRenameAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_rename",
@@ -1,5 +1,6 @@
1
1
  import type { AFSEntry, AFSSearchOptions } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSSearchInput extends Message {
4
5
  path: string;
5
6
  query: string;
@@ -17,7 +18,7 @@ export interface AFSSearchOutput extends Message {
17
18
  export interface AFSSearchAgentOptions extends AgentOptions<AFSSearchInput, AFSSearchOutput> {
18
19
  afs: NonNullable<AgentOptions<AFSSearchInput, AFSSearchOutput>["afs"]>;
19
20
  }
20
- export declare class AFSSearchAgent extends Agent<AFSSearchInput, AFSSearchOutput> {
21
+ export declare class AFSSearchAgent extends AFSSkillBase<AFSSearchInput, AFSSearchOutput> {
21
22
  constructor(options: AFSSearchAgentOptions);
22
23
  process(input: AFSSearchInput, _options: AgentInvokeOptions): Promise<AFSSearchOutput>;
23
24
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSSearchAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSSearchAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSSearchAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_search",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSWriteInput extends Message {
3
4
  path: string;
4
5
  content: string;
@@ -13,7 +14,7 @@ export interface AFSWriteOutput extends Message {
13
14
  export interface AFSWriteAgentOptions extends AgentOptions<AFSWriteInput, AFSWriteOutput> {
14
15
  afs: NonNullable<AgentOptions<AFSWriteInput, AFSWriteOutput>["afs"]>;
15
16
  }
16
- export declare class AFSWriteAgent extends Agent<AFSWriteInput, AFSWriteOutput> {
17
+ export declare class AFSWriteAgent extends AFSSkillBase<AFSWriteInput, AFSWriteOutput> {
17
18
  constructor(options: AFSWriteAgentOptions);
18
19
  process(input: AFSWriteInput, _options: AgentInvokeOptions): Promise<AFSWriteOutput>;
19
20
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AFSWriteAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const agent_js_1 = require("../../../agents/agent.js");
6
- class AFSWriteAgent extends agent_js_1.Agent {
5
+ const base_js_1 = require("./base.js");
6
+ class AFSWriteAgent extends base_js_1.AFSSkillBase {
7
7
  constructor(options) {
8
8
  super({
9
9
  name: "afs_write",
@@ -492,17 +492,24 @@ export interface ChatModelOutputUsage {
492
492
  * AIGNE Hub credit usage
493
493
  */
494
494
  aigneHubCredits?: number;
495
+ /**
496
+ * Credit prefix
497
+ */
498
+ creditPrefix?: "$" | "€" | "¥";
495
499
  }
496
500
  export declare const chatModelOutputUsageSchema: z.ZodObject<{
497
501
  inputTokens: z.ZodNumber;
498
502
  outputTokens: z.ZodNumber;
499
503
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
504
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
500
505
  }, "strip", z.ZodTypeAny, {
501
506
  inputTokens: number;
502
507
  outputTokens: number;
503
508
  aigneHubCredits?: number | undefined;
509
+ creditPrefix?: "$" | "€" | "¥" | undefined;
504
510
  }, {
505
511
  inputTokens: number;
506
512
  outputTokens: number;
507
513
  aigneHubCredits?: number | undefined;
514
+ creditPrefix?: "$" | "€" | "¥" | undefined;
508
515
  }>;
@@ -196,14 +196,17 @@ export declare const imageModelOutputSchema: z.ZodObject<{
196
196
  inputTokens: z.ZodNumber;
197
197
  outputTokens: z.ZodNumber;
198
198
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
199
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
199
200
  }, "strip", z.ZodTypeAny, {
200
201
  inputTokens: number;
201
202
  outputTokens: number;
202
203
  aigneHubCredits?: number | undefined;
204
+ creditPrefix?: "$" | "€" | "¥" | undefined;
203
205
  }, {
204
206
  inputTokens: number;
205
207
  outputTokens: number;
206
208
  aigneHubCredits?: number | undefined;
209
+ creditPrefix?: "$" | "€" | "¥" | undefined;
207
210
  }>>;
208
211
  model: z.ZodOptional<z.ZodString>;
209
212
  }, "strip", z.ZodTypeAny, {
@@ -228,6 +231,7 @@ export declare const imageModelOutputSchema: z.ZodObject<{
228
231
  inputTokens: number;
229
232
  outputTokens: number;
230
233
  aigneHubCredits?: number | undefined;
234
+ creditPrefix?: "$" | "€" | "¥" | undefined;
231
235
  } | undefined;
232
236
  }, {
233
237
  images: ({
@@ -251,5 +255,6 @@ export declare const imageModelOutputSchema: z.ZodObject<{
251
255
  inputTokens: number;
252
256
  outputTokens: number;
253
257
  aigneHubCredits?: number | undefined;
258
+ creditPrefix?: "$" | "€" | "¥" | undefined;
254
259
  } | undefined;
255
260
  }>;
@@ -203,14 +203,17 @@ export declare const videoModelOutputSchema: z.ZodObject<{
203
203
  inputTokens: z.ZodNumber;
204
204
  outputTokens: z.ZodNumber;
205
205
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
206
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
206
207
  }, "strip", z.ZodTypeAny, {
207
208
  inputTokens: number;
208
209
  outputTokens: number;
209
210
  aigneHubCredits?: number | undefined;
211
+ creditPrefix?: "$" | "€" | "¥" | undefined;
210
212
  }, {
211
213
  inputTokens: number;
212
214
  outputTokens: number;
213
215
  aigneHubCredits?: number | undefined;
216
+ creditPrefix?: "$" | "€" | "¥" | undefined;
214
217
  }>>;
215
218
  model: z.ZodOptional<z.ZodString>;
216
219
  seconds: z.ZodOptional<z.ZodNumber>;
@@ -236,6 +239,7 @@ export declare const videoModelOutputSchema: z.ZodObject<{
236
239
  inputTokens: number;
237
240
  outputTokens: number;
238
241
  aigneHubCredits?: number | undefined;
242
+ creditPrefix?: "$" | "€" | "¥" | undefined;
239
243
  } | undefined;
240
244
  seconds?: number | undefined;
241
245
  }, {
@@ -260,6 +264,7 @@ export declare const videoModelOutputSchema: z.ZodObject<{
260
264
  inputTokens: number;
261
265
  outputTokens: number;
262
266
  aigneHubCredits?: number | undefined;
267
+ creditPrefix?: "$" | "€" | "¥" | undefined;
263
268
  } | undefined;
264
269
  seconds?: number | undefined;
265
270
  }>;
@@ -5,6 +5,7 @@ export interface ContextUsage {
5
5
  inputTokens: number;
6
6
  outputTokens: number;
7
7
  aigneHubCredits: number;
8
+ creditPrefix?: "$" | "€" | "¥";
8
9
  agentCalls: number;
9
10
  duration: number;
10
11
  }
@@ -0,0 +1,4 @@
1
+ import { Agent, type Message } from "../../../agents/agent.js";
2
+ export declare abstract class AFSSkillBase<I extends Message = Message, O extends Message = Message> extends Agent<I, O> {
3
+ tag: string;
4
+ }
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSDeleteInput extends Message {
3
4
  path: string;
4
5
  recursive?: boolean;
@@ -12,7 +13,7 @@ export interface AFSDeleteOutput extends Message {
12
13
  export interface AFSDeleteAgentOptions extends AgentOptions<AFSDeleteInput, AFSDeleteOutput> {
13
14
  afs: NonNullable<AgentOptions<AFSDeleteInput, AFSDeleteOutput>["afs"]>;
14
15
  }
15
- export declare class AFSDeleteAgent extends Agent<AFSDeleteInput, AFSDeleteOutput> {
16
+ export declare class AFSDeleteAgent extends AFSSkillBase<AFSDeleteInput, AFSDeleteOutput> {
16
17
  constructor(options: AFSDeleteAgentOptions);
17
18
  process(input: AFSDeleteInput, _options: AgentInvokeOptions): Promise<AFSDeleteOutput>;
18
19
  }
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface Patch {
3
4
  start_line: number;
4
5
  end_line: number;
@@ -19,7 +20,7 @@ export interface AFSEditOutput extends Message {
19
20
  export interface AFSEditAgentOptions extends AgentOptions<AFSEditInput, AFSEditOutput> {
20
21
  afs: NonNullable<AgentOptions<AFSEditInput, AFSEditOutput>["afs"]>;
21
22
  }
22
- export declare class AFSEditAgent extends Agent<AFSEditInput, AFSEditOutput> {
23
+ export declare class AFSEditAgent extends AFSSkillBase<AFSEditInput, AFSEditOutput> {
23
24
  constructor(options: AFSEditAgentOptions);
24
25
  process(input: AFSEditInput, _options: AgentInvokeOptions): Promise<AFSEditOutput>;
25
26
  applyCustomPatches(text: string, patches: Patch[]): string;
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSExecInput extends Message {
3
4
  path: string;
4
5
  args: string;
@@ -9,7 +10,7 @@ export interface AFSExecOutput extends Message {
9
10
  export interface AFSExecAgentOptions extends AgentOptions<AFSExecInput, AFSExecOutput> {
10
11
  afs: NonNullable<AgentOptions<AFSExecInput, AFSExecOutput>["afs"]>;
11
12
  }
12
- export declare class AFSExecAgent extends Agent<AFSExecInput, AFSExecOutput> {
13
+ export declare class AFSExecAgent extends AFSSkillBase<AFSExecInput, AFSExecOutput> {
13
14
  constructor(options: AFSExecAgentOptions);
14
15
  process(input: AFSExecInput, options: AgentInvokeOptions): Promise<AFSExecOutput>;
15
16
  }
@@ -1,5 +1,6 @@
1
1
  import type { AFSListOptions } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSListInput extends Message {
4
5
  path: string;
5
6
  options?: AFSListOptions;
@@ -15,7 +16,7 @@ export interface AFSListOutput extends Message {
15
16
  export interface AFSListAgentOptions extends AgentOptions<AFSListInput, AFSListOutput> {
16
17
  afs: NonNullable<AgentOptions<AFSListInput, AFSListOutput>["afs"]>;
17
18
  }
18
- export declare class AFSListAgent extends Agent<AFSListInput, AFSListOutput> {
19
+ export declare class AFSListAgent extends AFSSkillBase<AFSListInput, AFSListOutput> {
19
20
  constructor(options: AFSListAgentOptions);
20
21
  process(input: AFSListInput, _options: AgentInvokeOptions): Promise<AFSListOutput>;
21
22
  }
@@ -1,5 +1,6 @@
1
1
  import type { AFSEntry } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSReadInput extends Message {
4
5
  path: string;
5
6
  withLineNumbers?: boolean;
@@ -15,7 +16,7 @@ export interface AFSReadOutput extends Message {
15
16
  export interface AFSReadAgentOptions extends AgentOptions<AFSReadInput, AFSReadOutput> {
16
17
  afs: NonNullable<AgentOptions<AFSReadInput, AFSReadOutput>["afs"]>;
17
18
  }
18
- export declare class AFSReadAgent extends Agent<AFSReadInput, AFSReadOutput> {
19
+ export declare class AFSReadAgent extends AFSSkillBase<AFSReadInput, AFSReadOutput> {
19
20
  constructor(options: AFSReadAgentOptions);
20
21
  process(input: AFSReadInput, _options: AgentInvokeOptions): Promise<AFSReadOutput>;
21
22
  }
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSRenameInput extends Message {
3
4
  oldPath: string;
4
5
  newPath: string;
@@ -14,7 +15,7 @@ export interface AFSRenameOutput extends Message {
14
15
  export interface AFSRenameAgentOptions extends AgentOptions<AFSRenameInput, AFSRenameOutput> {
15
16
  afs: NonNullable<AgentOptions<AFSRenameInput, AFSRenameOutput>["afs"]>;
16
17
  }
17
- export declare class AFSRenameAgent extends Agent<AFSRenameInput, AFSRenameOutput> {
18
+ export declare class AFSRenameAgent extends AFSSkillBase<AFSRenameInput, AFSRenameOutput> {
18
19
  constructor(options: AFSRenameAgentOptions);
19
20
  process(input: AFSRenameInput, _options: AgentInvokeOptions): Promise<AFSRenameOutput>;
20
21
  }
@@ -1,5 +1,6 @@
1
1
  import type { AFSEntry, AFSSearchOptions } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSSearchInput extends Message {
4
5
  path: string;
5
6
  query: string;
@@ -17,7 +18,7 @@ export interface AFSSearchOutput extends Message {
17
18
  export interface AFSSearchAgentOptions extends AgentOptions<AFSSearchInput, AFSSearchOutput> {
18
19
  afs: NonNullable<AgentOptions<AFSSearchInput, AFSSearchOutput>["afs"]>;
19
20
  }
20
- export declare class AFSSearchAgent extends Agent<AFSSearchInput, AFSSearchOutput> {
21
+ export declare class AFSSearchAgent extends AFSSkillBase<AFSSearchInput, AFSSearchOutput> {
21
22
  constructor(options: AFSSearchAgentOptions);
22
23
  process(input: AFSSearchInput, _options: AgentInvokeOptions): Promise<AFSSearchOutput>;
23
24
  }
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSWriteInput extends Message {
3
4
  path: string;
4
5
  content: string;
@@ -13,7 +14,7 @@ export interface AFSWriteOutput extends Message {
13
14
  export interface AFSWriteAgentOptions extends AgentOptions<AFSWriteInput, AFSWriteOutput> {
14
15
  afs: NonNullable<AgentOptions<AFSWriteInput, AFSWriteOutput>["afs"]>;
15
16
  }
16
- export declare class AFSWriteAgent extends Agent<AFSWriteInput, AFSWriteOutput> {
17
+ export declare class AFSWriteAgent extends AFSSkillBase<AFSWriteInput, AFSWriteOutput> {
17
18
  constructor(options: AFSWriteAgentOptions);
18
19
  process(input: AFSWriteInput, _options: AgentInvokeOptions): Promise<AFSWriteOutput>;
19
20
  }
@@ -492,17 +492,24 @@ export interface ChatModelOutputUsage {
492
492
  * AIGNE Hub credit usage
493
493
  */
494
494
  aigneHubCredits?: number;
495
+ /**
496
+ * Credit prefix
497
+ */
498
+ creditPrefix?: "$" | "€" | "¥";
495
499
  }
496
500
  export declare const chatModelOutputUsageSchema: z.ZodObject<{
497
501
  inputTokens: z.ZodNumber;
498
502
  outputTokens: z.ZodNumber;
499
503
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
504
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
500
505
  }, "strip", z.ZodTypeAny, {
501
506
  inputTokens: number;
502
507
  outputTokens: number;
503
508
  aigneHubCredits?: number | undefined;
509
+ creditPrefix?: "$" | "€" | "¥" | undefined;
504
510
  }, {
505
511
  inputTokens: number;
506
512
  outputTokens: number;
507
513
  aigneHubCredits?: number | undefined;
514
+ creditPrefix?: "$" | "€" | "¥" | undefined;
508
515
  }>;
@@ -188,6 +188,8 @@ export class ChatModel extends Model {
188
188
  options.context.usage.inputTokens += usage.inputTokens;
189
189
  if (usage.aigneHubCredits)
190
190
  options.context.usage.aigneHubCredits += usage.aigneHubCredits;
191
+ if (usage.creditPrefix)
192
+ options.context.usage.creditPrefix = usage.creditPrefix;
191
193
  }
192
194
  }
193
195
  async processAgentOutput(input, output, options) {
@@ -339,6 +341,7 @@ export const chatModelOutputUsageSchema = z.object({
339
341
  inputTokens: z.number(),
340
342
  outputTokens: z.number(),
341
343
  aigneHubCredits: optionalize(z.number()),
344
+ creditPrefix: optionalize(z.union([z.literal("$"), z.literal("€"), z.literal("¥")])),
342
345
  });
343
346
  const chatModelOutputSchema = z.object({
344
347
  text: optionalize(z.string()),
@@ -196,14 +196,17 @@ export declare const imageModelOutputSchema: z.ZodObject<{
196
196
  inputTokens: z.ZodNumber;
197
197
  outputTokens: z.ZodNumber;
198
198
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
199
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
199
200
  }, "strip", z.ZodTypeAny, {
200
201
  inputTokens: number;
201
202
  outputTokens: number;
202
203
  aigneHubCredits?: number | undefined;
204
+ creditPrefix?: "$" | "€" | "¥" | undefined;
203
205
  }, {
204
206
  inputTokens: number;
205
207
  outputTokens: number;
206
208
  aigneHubCredits?: number | undefined;
209
+ creditPrefix?: "$" | "€" | "¥" | undefined;
207
210
  }>>;
208
211
  model: z.ZodOptional<z.ZodString>;
209
212
  }, "strip", z.ZodTypeAny, {
@@ -228,6 +231,7 @@ export declare const imageModelOutputSchema: z.ZodObject<{
228
231
  inputTokens: number;
229
232
  outputTokens: number;
230
233
  aigneHubCredits?: number | undefined;
234
+ creditPrefix?: "$" | "€" | "¥" | undefined;
231
235
  } | undefined;
232
236
  }, {
233
237
  images: ({
@@ -251,5 +255,6 @@ export declare const imageModelOutputSchema: z.ZodObject<{
251
255
  inputTokens: number;
252
256
  outputTokens: number;
253
257
  aigneHubCredits?: number | undefined;
258
+ creditPrefix?: "$" | "€" | "¥" | undefined;
254
259
  } | undefined;
255
260
  }>;
@@ -58,6 +58,8 @@ export class ImageModel extends Model {
58
58
  options.context.usage.inputTokens += usage.inputTokens;
59
59
  if (usage.aigneHubCredits)
60
60
  options.context.usage.aigneHubCredits += usage.aigneHubCredits;
61
+ if (usage.creditPrefix)
62
+ options.context.usage.creditPrefix = usage.creditPrefix;
61
63
  }
62
64
  }
63
65
  async processAgentOutput(input, output, options) {
@@ -203,14 +203,17 @@ export declare const videoModelOutputSchema: z.ZodObject<{
203
203
  inputTokens: z.ZodNumber;
204
204
  outputTokens: z.ZodNumber;
205
205
  aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
206
+ creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
206
207
  }, "strip", z.ZodTypeAny, {
207
208
  inputTokens: number;
208
209
  outputTokens: number;
209
210
  aigneHubCredits?: number | undefined;
211
+ creditPrefix?: "$" | "€" | "¥" | undefined;
210
212
  }, {
211
213
  inputTokens: number;
212
214
  outputTokens: number;
213
215
  aigneHubCredits?: number | undefined;
216
+ creditPrefix?: "$" | "€" | "¥" | undefined;
214
217
  }>>;
215
218
  model: z.ZodOptional<z.ZodString>;
216
219
  seconds: z.ZodOptional<z.ZodNumber>;
@@ -236,6 +239,7 @@ export declare const videoModelOutputSchema: z.ZodObject<{
236
239
  inputTokens: number;
237
240
  outputTokens: number;
238
241
  aigneHubCredits?: number | undefined;
242
+ creditPrefix?: "$" | "€" | "¥" | undefined;
239
243
  } | undefined;
240
244
  seconds?: number | undefined;
241
245
  }, {
@@ -260,6 +264,7 @@ export declare const videoModelOutputSchema: z.ZodObject<{
260
264
  inputTokens: number;
261
265
  outputTokens: number;
262
266
  aigneHubCredits?: number | undefined;
267
+ creditPrefix?: "$" | "€" | "¥" | undefined;
263
268
  } | undefined;
264
269
  seconds?: number | undefined;
265
270
  }>;
@@ -31,6 +31,8 @@ export class VideoModel extends Model {
31
31
  options.context.usage.inputTokens += usage.inputTokens;
32
32
  if (usage.aigneHubCredits)
33
33
  options.context.usage.aigneHubCredits += usage.aigneHubCredits;
34
+ if (usage.creditPrefix)
35
+ options.context.usage.creditPrefix = usage.creditPrefix;
34
36
  }
35
37
  }
36
38
  async processAgentOutput(input, output, options) {
@@ -5,6 +5,7 @@ export interface ContextUsage {
5
5
  inputTokens: number;
6
6
  outputTokens: number;
7
7
  aigneHubCredits: number;
8
+ creditPrefix?: "$" | "€" | "¥";
8
9
  agentCalls: number;
9
10
  duration: number;
10
11
  }
@@ -28,8 +28,7 @@ export function createAFSContext(agent, context) {
28
28
  async list(path, options) {
29
29
  if (!afs)
30
30
  throw new Error("AFS is not configured for this agent.");
31
- return (await afs.list(path, { ...options, context, format: options?.format || "tree" }))
32
- .data;
31
+ return (await afs.list(path, { ...options, context, format: options?.format || "simple-list" })).data;
33
32
  },
34
33
  async read(path) {
35
34
  if (!afs)
@@ -0,0 +1,4 @@
1
+ import { Agent, type Message } from "../../../agents/agent.js";
2
+ export declare abstract class AFSSkillBase<I extends Message = Message, O extends Message = Message> extends Agent<I, O> {
3
+ tag: string;
4
+ }
@@ -0,0 +1,4 @@
1
+ import { Agent } from "../../../agents/agent.js";
2
+ export class AFSSkillBase extends Agent {
3
+ tag = "AFS";
4
+ }
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSDeleteInput extends Message {
3
4
  path: string;
4
5
  recursive?: boolean;
@@ -12,7 +13,7 @@ export interface AFSDeleteOutput extends Message {
12
13
  export interface AFSDeleteAgentOptions extends AgentOptions<AFSDeleteInput, AFSDeleteOutput> {
13
14
  afs: NonNullable<AgentOptions<AFSDeleteInput, AFSDeleteOutput>["afs"]>;
14
15
  }
15
- export declare class AFSDeleteAgent extends Agent<AFSDeleteInput, AFSDeleteOutput> {
16
+ export declare class AFSDeleteAgent extends AFSSkillBase<AFSDeleteInput, AFSDeleteOutput> {
16
17
  constructor(options: AFSDeleteAgentOptions);
17
18
  process(input: AFSDeleteInput, _options: AgentInvokeOptions): Promise<AFSDeleteOutput>;
18
19
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSDeleteAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSDeleteAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_delete",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface Patch {
3
4
  start_line: number;
4
5
  end_line: number;
@@ -19,7 +20,7 @@ export interface AFSEditOutput extends Message {
19
20
  export interface AFSEditAgentOptions extends AgentOptions<AFSEditInput, AFSEditOutput> {
20
21
  afs: NonNullable<AgentOptions<AFSEditInput, AFSEditOutput>["afs"]>;
21
22
  }
22
- export declare class AFSEditAgent extends Agent<AFSEditInput, AFSEditOutput> {
23
+ export declare class AFSEditAgent extends AFSSkillBase<AFSEditInput, AFSEditOutput> {
23
24
  constructor(options: AFSEditAgentOptions);
24
25
  process(input: AFSEditInput, _options: AgentInvokeOptions): Promise<AFSEditOutput>;
25
26
  applyCustomPatches(text: string, patches: Patch[]): string;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSEditAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSEditAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_edit",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSExecInput extends Message {
3
4
  path: string;
4
5
  args: string;
@@ -9,7 +10,7 @@ export interface AFSExecOutput extends Message {
9
10
  export interface AFSExecAgentOptions extends AgentOptions<AFSExecInput, AFSExecOutput> {
10
11
  afs: NonNullable<AgentOptions<AFSExecInput, AFSExecOutput>["afs"]>;
11
12
  }
12
- export declare class AFSExecAgent extends Agent<AFSExecInput, AFSExecOutput> {
13
+ export declare class AFSExecAgent extends AFSSkillBase<AFSExecInput, AFSExecOutput> {
13
14
  constructor(options: AFSExecAgentOptions);
14
15
  process(input: AFSExecInput, options: AgentInvokeOptions): Promise<AFSExecOutput>;
15
16
  }
@@ -1,13 +1,16 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSExecAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSExecAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_exec",
7
- description: "Execute functions or commands from AFS modules. Use when running operations provided by mounted modules.",
7
+ description: `
8
+ Execute files marked as executable in the Agentic File System (AFS).
9
+ Use this to run executable files registered at a given path with specified arguments.
10
+ `.trim(),
8
11
  ...options,
9
12
  inputSchema: z.object({
10
- path: z.string().describe("Absolute path to the executable function in AFS"),
13
+ path: z.string().describe("Absolute path to the executable file in AFS"),
11
14
  args: z.string().describe("JSON string of arguments matching the function's input schema"),
12
15
  }),
13
16
  outputSchema: z.object({
@@ -1,5 +1,6 @@
1
1
  import type { AFSListOptions } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSListInput extends Message {
4
5
  path: string;
5
6
  options?: AFSListOptions;
@@ -15,7 +16,7 @@ export interface AFSListOutput extends Message {
15
16
  export interface AFSListAgentOptions extends AgentOptions<AFSListInput, AFSListOutput> {
16
17
  afs: NonNullable<AgentOptions<AFSListInput, AFSListOutput>["afs"]>;
17
18
  }
18
- export declare class AFSListAgent extends Agent<AFSListInput, AFSListOutput> {
19
+ export declare class AFSListAgent extends AFSSkillBase<AFSListInput, AFSListOutput> {
19
20
  constructor(options: AFSListAgentOptions);
20
21
  process(input: AFSListInput, _options: AgentInvokeOptions): Promise<AFSListOutput>;
21
22
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSListAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSListAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_list",
@@ -20,10 +20,10 @@ export class AFSListAgent extends Agent {
20
20
  .optional()
21
21
  .describe("Maximum number of children to list per directory"),
22
22
  format: z
23
- .union([z.literal("tree"), z.literal("list")])
23
+ .union([z.literal("simple-list"), z.literal("tree")])
24
24
  .optional()
25
- .default("tree")
26
- .describe("Output format, either 'tree' or 'list' (default: 'tree')"),
25
+ .default("simple-list")
26
+ .describe("Output format, either 'simple-list', or 'tree', default is 'simple-list'"),
27
27
  })
28
28
  .optional(),
29
29
  }),
@@ -31,14 +31,7 @@ export class AFSListAgent extends Agent {
31
31
  status: z.string(),
32
32
  tool: z.string(),
33
33
  path: z.string(),
34
- options: z
35
- .object({
36
- maxDepth: z.number().optional(),
37
- disableGitignore: z.boolean().optional(),
38
- maxChildren: z.number().optional(),
39
- format: z.union([z.literal("tree"), z.literal("list")]).optional(),
40
- })
41
- .optional(),
34
+ options: z.record(z.any()).optional(),
42
35
  message: z.string().optional(),
43
36
  data: z.unknown(),
44
37
  }),
@@ -1,5 +1,6 @@
1
1
  import type { AFSEntry } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSReadInput extends Message {
4
5
  path: string;
5
6
  withLineNumbers?: boolean;
@@ -15,7 +16,7 @@ export interface AFSReadOutput extends Message {
15
16
  export interface AFSReadAgentOptions extends AgentOptions<AFSReadInput, AFSReadOutput> {
16
17
  afs: NonNullable<AgentOptions<AFSReadInput, AFSReadOutput>["afs"]>;
17
18
  }
18
- export declare class AFSReadAgent extends Agent<AFSReadInput, AFSReadOutput> {
19
+ export declare class AFSReadAgent extends AFSSkillBase<AFSReadInput, AFSReadOutput> {
19
20
  constructor(options: AFSReadAgentOptions);
20
21
  process(input: AFSReadInput, _options: AgentInvokeOptions): Promise<AFSReadOutput>;
21
22
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSReadAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSReadAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_read",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSRenameInput extends Message {
3
4
  oldPath: string;
4
5
  newPath: string;
@@ -14,7 +15,7 @@ export interface AFSRenameOutput extends Message {
14
15
  export interface AFSRenameAgentOptions extends AgentOptions<AFSRenameInput, AFSRenameOutput> {
15
16
  afs: NonNullable<AgentOptions<AFSRenameInput, AFSRenameOutput>["afs"]>;
16
17
  }
17
- export declare class AFSRenameAgent extends Agent<AFSRenameInput, AFSRenameOutput> {
18
+ export declare class AFSRenameAgent extends AFSSkillBase<AFSRenameInput, AFSRenameOutput> {
18
19
  constructor(options: AFSRenameAgentOptions);
19
20
  process(input: AFSRenameInput, _options: AgentInvokeOptions): Promise<AFSRenameOutput>;
20
21
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSRenameAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSRenameAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_rename",
@@ -1,5 +1,6 @@
1
1
  import type { AFSEntry, AFSSearchOptions } from "@aigne/afs";
2
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
2
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
3
+ import { AFSSkillBase } from "./base.js";
3
4
  export interface AFSSearchInput extends Message {
4
5
  path: string;
5
6
  query: string;
@@ -17,7 +18,7 @@ export interface AFSSearchOutput extends Message {
17
18
  export interface AFSSearchAgentOptions extends AgentOptions<AFSSearchInput, AFSSearchOutput> {
18
19
  afs: NonNullable<AgentOptions<AFSSearchInput, AFSSearchOutput>["afs"]>;
19
20
  }
20
- export declare class AFSSearchAgent extends Agent<AFSSearchInput, AFSSearchOutput> {
21
+ export declare class AFSSearchAgent extends AFSSkillBase<AFSSearchInput, AFSSearchOutput> {
21
22
  constructor(options: AFSSearchAgentOptions);
22
23
  process(input: AFSSearchInput, _options: AgentInvokeOptions): Promise<AFSSearchOutput>;
23
24
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSSearchAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSSearchAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_search",
@@ -1,4 +1,5 @@
1
- import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../../../agents/agent.js";
1
+ import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
2
+ import { AFSSkillBase } from "./base.js";
2
3
  export interface AFSWriteInput extends Message {
3
4
  path: string;
4
5
  content: string;
@@ -13,7 +14,7 @@ export interface AFSWriteOutput extends Message {
13
14
  export interface AFSWriteAgentOptions extends AgentOptions<AFSWriteInput, AFSWriteOutput> {
14
15
  afs: NonNullable<AgentOptions<AFSWriteInput, AFSWriteOutput>["afs"]>;
15
16
  }
16
- export declare class AFSWriteAgent extends Agent<AFSWriteInput, AFSWriteOutput> {
17
+ export declare class AFSWriteAgent extends AFSSkillBase<AFSWriteInput, AFSWriteOutput> {
17
18
  constructor(options: AFSWriteAgentOptions);
18
19
  process(input: AFSWriteInput, _options: AgentInvokeOptions): Promise<AFSWriteOutput>;
19
20
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { Agent, } from "../../../agents/agent.js";
3
- export class AFSWriteAgent extends Agent {
2
+ import { AFSSkillBase } from "./base.js";
3
+ export class AFSWriteAgent extends AFSSkillBase {
4
4
  constructor(options) {
5
5
  super({
6
6
  name: "afs_write",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/core",
3
- "version": "1.72.0-beta.1",
3
+ "version": "1.72.0-beta.2",
4
4
  "description": "The functional core of agentic AI",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -92,8 +92,8 @@
92
92
  "zod": "^3.25.67",
93
93
  "zod-from-json-schema": "^0.0.5",
94
94
  "zod-to-json-schema": "^3.24.6",
95
- "@aigne/afs": "^1.4.0-beta.1",
96
- "@aigne/afs-history": "^1.2.0-beta.1",
95
+ "@aigne/afs": "^1.4.0-beta.2",
96
+ "@aigne/afs-history": "^1.2.0-beta.2",
97
97
  "@aigne/observability-api": "^0.11.14-beta",
98
98
  "@aigne/platform-helpers": "^0.6.7-beta"
99
99
  },