@jixo/cli 0.10.1 → 0.11.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.
Files changed (34) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +2 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/prompts/list.js +2 -2
  5. package/dist/commands/prompts/list.js.map +1 -1
  6. package/dist/commands/tasks/ai-tools.d.ts +280 -8
  7. package/dist/commands/tasks/ai-tools.d.ts.map +1 -1
  8. package/dist/commands/tasks/ai-tools.js +49 -14
  9. package/dist/commands/tasks/ai-tools.js.map +1 -1
  10. package/dist/commands/tasks/run-ai-task.d.ts +1 -1
  11. package/dist/commands/tasks/run-ai-task.d.ts.map +1 -1
  12. package/dist/commands/tasks/run-ai-task.js +71 -24
  13. package/dist/commands/tasks/run-ai-task.js.map +1 -1
  14. package/dist/commands/tasks/run.d.ts.map +1 -1
  15. package/dist/commands/tasks/run.js +20 -11
  16. package/dist/commands/tasks/run.js.map +1 -1
  17. package/dist/helper/ai-retry-error.d.ts +1 -1
  18. package/dist/helper/ai-retry-error.d.ts.map +1 -1
  19. package/dist/helper/ai-retry-error.js +63 -30
  20. package/dist/helper/ai-retry-error.js.map +1 -1
  21. package/dist/helper/handle-ai-error.d.ts +5 -0
  22. package/dist/helper/handle-ai-error.d.ts.map +1 -0
  23. package/dist/helper/handle-ai-error.js +122 -0
  24. package/dist/helper/handle-ai-error.js.map +1 -0
  25. package/dist/helper/prompts-loader.d.ts +9 -3
  26. package/dist/helper/prompts-loader.d.ts.map +1 -1
  27. package/dist/helper/prompts-loader.js +16 -16
  28. package/dist/helper/prompts-loader.js.map +1 -1
  29. package/dist/helper/resolve-ai-tasks.d.ts +21 -8
  30. package/dist/helper/resolve-ai-tasks.d.ts.map +1 -1
  31. package/dist/helper/resolve-ai-tasks.js +58 -19
  32. package/dist/helper/resolve-ai-tasks.js.map +1 -1
  33. package/dist/prompts.json +14 -2
  34. package/package.json +4 -3
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM,GAAU,OAAM,MAAM,EAAiB,kBAqHzD,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,MAAM,GAAU,OAAM,MAAM,EAAiB,kBAsHzD,CAAC"}
package/dist/cli.js CHANGED
@@ -2,6 +2,7 @@ import { cwdResolver } from "@gaubee/node";
2
2
  import { match, P } from "ts-pattern";
3
3
  import yargs from "yargs";
4
4
  import { hideBin } from "yargs/helpers";
5
+ import packageJson from "../package.json" with { type: "json" };
5
6
  import { doctor } from "./commands/doctor/index.js";
6
7
  import { init } from "./commands/init.js";
7
8
  import { listPrompts } from "./commands/prompts/list.js";
@@ -10,6 +11,7 @@ import { run } from "./commands/tasks/run.js";
10
11
  export const runCli = async (args = process.argv) => {
11
12
  const cli = await yargs(hideBin(args))
12
13
  .scriptName("jixo")
14
+ .version(packageJson.version)
13
15
  .command("doctor", "Check the requirements for run jixo", (yargs) => yargs, () => {
14
16
  doctor();
15
17
  })
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,KAAK,EAAE,CAAC,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,E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OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {cwdResolver} from \"@gaubee/node\";\nimport {match, P} from \"ts-pattern\";\nimport yargs from \"yargs\";\nimport {hideBin} from \"yargs/helpers\";\nimport {doctor} from \"./commands/doctor/index.js\";\nimport {init} from \"./commands/init.js\";\nimport {listPrompts} from \"./commands/prompts/list.js\";\nimport {upgradePrompts} from \"./commands/prompts/upgrade.js\";\nimport {run} from \"./commands/tasks/run.js\";\n\nexport const runCli = async (args: string[] = process.argv) => {\n const cli = await yargs(hideBin(args))\n .scriptName(\"jixo\")\n .command(\n \"doctor\",\n \"Check the requirements for run jixo\",\n (yargs) => yargs,\n () => {\n doctor();\n },\n )\n .command(\n \"init [dir]\",\n \"Create a new JIXO project\",\n (yargs) => {\n return yargs.positional(\"dir\", {\n describe: \"The directory to create the JIXO config\",\n default: \"./\",\n });\n },\n (argv) => {\n init(cwdResolver(argv.dir));\n },\n )\n .command(\n \"run [filter...]\",\n \"Run JIXO tasks\",\n (yargs) => {\n return yargs\n .positional(\"filter\", {\n describe: 'Fliter tasks by name or directory(starts with \"./\")',\n array: true,\n default: [],\n })\n .option(\"dir\", {\n alias: \"D\",\n type: \"string\",\n description: \"The project directory with JIXO config\",\n })\n .option(\"force\", {\n alias: \"F\",\n type: \"boolean\",\n description: \"Tasks are forced to run, even at 100% progress. It is suitable for running after modifying the content of the task\",\n })\n .option(\"once\", {\n alias: \"O\",\n type: \"boolean\",\n description: \"The task is executed only once in the loop, equal to --step=1\",\n })\n .option(\"step\", {\n alias: \"S\",\n type: \"number\",\n description: \"The task is executed N times in the loop\",\n });\n },\n (argv) => {\n const filters = argv.filter.map((v) => v.toString().split(/[\\s,]+/)).flat();\n const nameFilter: string[] = [];\n const dirFilter: string[] = [];\n for (const f of filters) {\n if (f.startsWith(\"./\") || f.startsWith(\"../\") || f.startsWith(\"~/\")) {\n dirFilter.push(f);\n } else {\n nameFilter.push(f);\n }\n }\n run(cwdResolver(argv.dir ?? \"\"), {\n nameFilter,\n dirFilter,\n force: argv.force,\n loopTimes: match(argv)\n .with({step: P.number.gt(0).select()}, (step) => step)\n .with({once: P.boolean.select()}, (once) => (once ? 1 : Infinity))\n .otherwise(() => Infinity),\n });\n },\n )\n .command(\n \"prompts\",\n \"Manage prompts\",\n (yargs) => {\n return (\n yargs\n //\n .option(\"dir\", {\n alias: \"D\",\n type: \"string\",\n description: \"The project directory with JIXO config\",\n })\n .option(\"mirrorUrl\", {\n alias: \"M\",\n type: \"string\",\n description: \"The Url for download prompts\",\n })\n .option(\"upgrade\", {\n alias: \"U\",\n type: \"boolean\",\n description: \"Upgrade builtin prompts\",\n })\n );\n },\n async (argv) => {\n if (argv.upgrade) {\n upgradePrompts(argv.dir ? cwdResolver(argv.dir) : cwdResolver(), {mirrorUrl: argv.mirrorUrl});\n } else {\n listPrompts();\n }\n },\n )\n .strict();\n const argv = await cli.parse();\n\n if (argv._.length === 0) {\n cli.showHelp();\n console.log(\" \" + \"─\".repeat(Math.max(4, process.stdout.columns - 2)));\n await doctor();\n }\n};\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,KAAK,EAAE,CAAC,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAC9D,OAAO,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC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AG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {cwdResolver} from \"@gaubee/node\";\nimport {match, P} from \"ts-pattern\";\nimport yargs from \"yargs\";\nimport {hideBin} from \"yargs/helpers\";\nimport packageJson from \"../package.json\" with {type: \"json\"};\nimport {doctor} from \"./commands/doctor/index.js\";\nimport {init} from \"./commands/init.js\";\nimport {listPrompts} from \"./commands/prompts/list.js\";\nimport {upgradePrompts} from \"./commands/prompts/upgrade.js\";\nimport {run} from \"./commands/tasks/run.js\";\n\nexport const runCli = async (args: string[] = process.argv) => {\n const cli = await yargs(hideBin(args))\n .scriptName(\"jixo\")\n .version(packageJson.version)\n .command(\n \"doctor\",\n \"Check the requirements for run jixo\",\n (yargs) => yargs,\n () => {\n doctor();\n },\n )\n .command(\n \"init [dir]\",\n \"Create a new JIXO project\",\n (yargs) => {\n return yargs.positional(\"dir\", {\n describe: \"The directory to create the JIXO config\",\n default: \"./\",\n });\n },\n (argv) => {\n init(cwdResolver(argv.dir));\n },\n )\n .command(\n \"run [filter...]\",\n \"Run JIXO tasks\",\n (yargs) => {\n return yargs\n .positional(\"filter\", {\n describe: 'Fliter tasks by name or directory(starts with \"./\")',\n array: true,\n default: [],\n })\n .option(\"dir\", {\n alias: \"D\",\n type: \"string\",\n description: \"The project directory with JIXO config\",\n })\n .option(\"force\", {\n alias: \"F\",\n type: \"boolean\",\n description: \"Tasks are forced to run, even at 100% progress. It is suitable for running after modifying the content of the task\",\n })\n .option(\"once\", {\n alias: \"O\",\n type: \"boolean\",\n description: \"The task is executed only once in the loop, equal to --step=1\",\n })\n .option(\"step\", {\n alias: \"S\",\n type: \"number\",\n description: \"The task is executed N times in the loop\",\n });\n },\n (argv) => {\n const filters = argv.filter.map((v) => v.toString().split(/[\\s,]+/)).flat();\n const nameFilter: string[] = [];\n const dirFilter: string[] = [];\n for (const f of filters) {\n if (f.startsWith(\"./\") || f.startsWith(\"../\") || f.startsWith(\"~/\")) {\n dirFilter.push(f);\n } else {\n nameFilter.push(f);\n }\n }\n run(cwdResolver(argv.dir ?? \"\"), {\n nameFilter,\n dirFilter,\n force: argv.force,\n loopTimes: match(argv)\n .with({step: P.number.gt(0).select()}, (step) => step)\n .with({once: P.boolean.select()}, (once) => (once ? 1 : Infinity))\n .otherwise(() => Infinity),\n });\n },\n )\n .command(\n \"prompts\",\n \"Manage prompts\",\n (yargs) => {\n return (\n yargs\n //\n .option(\"dir\", {\n alias: \"D\",\n type: \"string\",\n description: \"The project directory with JIXO config\",\n })\n .option(\"mirrorUrl\", {\n alias: \"M\",\n type: \"string\",\n description: \"The Url for download prompts\",\n })\n .option(\"upgrade\", {\n alias: \"U\",\n type: \"boolean\",\n description: \"Upgrade builtin prompts\",\n })\n );\n },\n async (argv) => {\n if (argv.upgrade) {\n upgradePrompts(argv.dir ? cwdResolver(argv.dir) : cwdResolver(), {mirrorUrl: argv.mirrorUrl});\n } else {\n listPrompts();\n }\n },\n )\n .strict();\n const argv = await cli.parse();\n\n if (argv._.length === 0) {\n cli.showHelp();\n console.log(\" \" + \"─\".repeat(Math.max(4, process.stdout.columns - 2)));\n await doctor();\n }\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  import { cyan, gray } from "@gaubee/nodekit";
2
2
  import { obj_props } from "@gaubee/util";
3
- import { getPromptConfigs } from "../../helper/prompts-loader.js";
3
+ import { getAllPromptConfigs } from "../../helper/prompts-loader.js";
4
4
  export const listPrompts = async () => {
5
- const configs = await getPromptConfigs();
5
+ const configs = await getAllPromptConfigs();
6
6
  for (const key of obj_props(configs)) {
7
7
  const config = configs[key];
8
8
  console.log(`- ${cyan(key)}: ${gray(config.content.split("\n")[0])}...`);
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/prompts/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IACpC,MAAM,OAAO,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACzC,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzE,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {cyan, gray} from \"@gaubee/nodekit\";\nimport {obj_props} from \"@gaubee/util\";\nimport {getPromptConfigs} from \"../../helper/prompts-loader.js\";\n\nexport const listPrompts = async () => {\n const configs = await getPromptConfigs();\n for (const key of obj_props(configs)) {\n const config = configs[key];\n console.log(`- ${cyan(key)}: ${gray(config.content.split(\"\\n\")[0])}...`);\n if (config.data.parent.length) {\n console.log(` parent: ${config.data.parent.map(cyan).join(\", \")}`);\n }\n }\n};\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/prompts/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AAEnE,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IACpC,MAAM,OAAO,GAAG,MAAM,mBAAmB,EAAE,CAAC;IAC5C,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzE,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["import {cyan, gray} from \"@gaubee/nodekit\";\nimport {obj_props} from \"@gaubee/util\";\nimport {getAllPromptConfigs} from \"../../helper/prompts-loader.js\";\n\nexport const listPrompts = async () => {\n const configs = await getAllPromptConfigs();\n for (const key of obj_props(configs)) {\n const config = configs[key];\n console.log(`- ${cyan(key)}: ${gray(config.content.split(\"\\n\")[0])}...`);\n if (config.data.parent.length) {\n console.log(` parent: ${config.data.parent.map(cyan).join(\", \")}`);\n }\n }\n};\n"]}
@@ -1,8 +1,270 @@
1
1
  import { type ToolSet } from "ai";
2
2
  import z from "zod";
3
+ import type { AiTask } from "../../helper/resolve-ai-tasks.js";
3
4
  export declare const tools: {
4
5
  fileSystem: (cwd: string) => Promise<ToolSet>;
5
6
  memory: (memory_filepath: string) => Promise<ToolSet>;
7
+ pnpm: import("@gaubee/util").FuncRemember<() => Promise<{
8
+ [x: string]: import("ai").Tool<unknown, z.objectOutputType<{
9
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
10
+ } & {
11
+ content: z.ZodArray<z.ZodUnion<[z.ZodObject<{
12
+ type: z.ZodLiteral<"text">;
13
+ text: z.ZodString;
14
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
15
+ type: z.ZodLiteral<"text">;
16
+ text: z.ZodString;
17
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
18
+ type: z.ZodLiteral<"text">;
19
+ text: z.ZodString;
20
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
21
+ type: z.ZodLiteral<"image">;
22
+ data: z.ZodString;
23
+ mimeType: z.ZodString;
24
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
25
+ type: z.ZodLiteral<"image">;
26
+ data: z.ZodString;
27
+ mimeType: z.ZodString;
28
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
29
+ type: z.ZodLiteral<"image">;
30
+ data: z.ZodString;
31
+ mimeType: z.ZodString;
32
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
33
+ type: z.ZodLiteral<"resource">;
34
+ resource: z.ZodUnion<[z.ZodObject<{
35
+ uri: z.ZodString;
36
+ mimeType: z.ZodOptional<z.ZodString>;
37
+ } & {
38
+ text: z.ZodString;
39
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
40
+ uri: z.ZodString;
41
+ mimeType: z.ZodOptional<z.ZodString>;
42
+ } & {
43
+ text: z.ZodString;
44
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
45
+ uri: z.ZodString;
46
+ mimeType: z.ZodOptional<z.ZodString>;
47
+ } & {
48
+ text: z.ZodString;
49
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
50
+ uri: z.ZodString;
51
+ mimeType: z.ZodOptional<z.ZodString>;
52
+ } & {
53
+ blob: z.ZodString;
54
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
55
+ uri: z.ZodString;
56
+ mimeType: z.ZodOptional<z.ZodString>;
57
+ } & {
58
+ blob: z.ZodString;
59
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
60
+ uri: z.ZodString;
61
+ mimeType: z.ZodOptional<z.ZodString>;
62
+ } & {
63
+ blob: z.ZodString;
64
+ }, z.ZodTypeAny, "passthrough">>]>;
65
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
66
+ type: z.ZodLiteral<"resource">;
67
+ resource: z.ZodUnion<[z.ZodObject<{
68
+ uri: z.ZodString;
69
+ mimeType: z.ZodOptional<z.ZodString>;
70
+ } & {
71
+ text: z.ZodString;
72
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
73
+ uri: z.ZodString;
74
+ mimeType: z.ZodOptional<z.ZodString>;
75
+ } & {
76
+ text: z.ZodString;
77
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
78
+ uri: z.ZodString;
79
+ mimeType: z.ZodOptional<z.ZodString>;
80
+ } & {
81
+ text: z.ZodString;
82
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
83
+ uri: z.ZodString;
84
+ mimeType: z.ZodOptional<z.ZodString>;
85
+ } & {
86
+ blob: z.ZodString;
87
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
88
+ uri: z.ZodString;
89
+ mimeType: z.ZodOptional<z.ZodString>;
90
+ } & {
91
+ blob: z.ZodString;
92
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
93
+ uri: z.ZodString;
94
+ mimeType: z.ZodOptional<z.ZodString>;
95
+ } & {
96
+ blob: z.ZodString;
97
+ }, z.ZodTypeAny, "passthrough">>]>;
98
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
99
+ type: z.ZodLiteral<"resource">;
100
+ resource: z.ZodUnion<[z.ZodObject<{
101
+ uri: z.ZodString;
102
+ mimeType: z.ZodOptional<z.ZodString>;
103
+ } & {
104
+ text: z.ZodString;
105
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
106
+ uri: z.ZodString;
107
+ mimeType: z.ZodOptional<z.ZodString>;
108
+ } & {
109
+ text: z.ZodString;
110
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
111
+ uri: z.ZodString;
112
+ mimeType: z.ZodOptional<z.ZodString>;
113
+ } & {
114
+ text: z.ZodString;
115
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
116
+ uri: z.ZodString;
117
+ mimeType: z.ZodOptional<z.ZodString>;
118
+ } & {
119
+ blob: z.ZodString;
120
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
121
+ uri: z.ZodString;
122
+ mimeType: z.ZodOptional<z.ZodString>;
123
+ } & {
124
+ blob: z.ZodString;
125
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
126
+ uri: z.ZodString;
127
+ mimeType: z.ZodOptional<z.ZodString>;
128
+ } & {
129
+ blob: z.ZodString;
130
+ }, z.ZodTypeAny, "passthrough">>]>;
131
+ }, z.ZodTypeAny, "passthrough">>]>, "many">;
132
+ isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
133
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
134
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
135
+ } & {
136
+ toolResult: z.ZodUnknown;
137
+ }, z.ZodTypeAny, "passthrough">> & Required<Pick<import("ai").Tool<unknown, z.objectOutputType<{
138
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
139
+ } & {
140
+ content: z.ZodArray<z.ZodUnion<[z.ZodObject<{
141
+ type: z.ZodLiteral<"text">;
142
+ text: z.ZodString;
143
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
144
+ type: z.ZodLiteral<"text">;
145
+ text: z.ZodString;
146
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
147
+ type: z.ZodLiteral<"text">;
148
+ text: z.ZodString;
149
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
150
+ type: z.ZodLiteral<"image">;
151
+ data: z.ZodString;
152
+ mimeType: z.ZodString;
153
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
154
+ type: z.ZodLiteral<"image">;
155
+ data: z.ZodString;
156
+ mimeType: z.ZodString;
157
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
158
+ type: z.ZodLiteral<"image">;
159
+ data: z.ZodString;
160
+ mimeType: z.ZodString;
161
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
162
+ type: z.ZodLiteral<"resource">;
163
+ resource: z.ZodUnion<[z.ZodObject<{
164
+ uri: z.ZodString;
165
+ mimeType: z.ZodOptional<z.ZodString>;
166
+ } & {
167
+ text: z.ZodString;
168
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
169
+ uri: z.ZodString;
170
+ mimeType: z.ZodOptional<z.ZodString>;
171
+ } & {
172
+ text: z.ZodString;
173
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
174
+ uri: z.ZodString;
175
+ mimeType: z.ZodOptional<z.ZodString>;
176
+ } & {
177
+ text: z.ZodString;
178
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
179
+ uri: z.ZodString;
180
+ mimeType: z.ZodOptional<z.ZodString>;
181
+ } & {
182
+ blob: z.ZodString;
183
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
184
+ uri: z.ZodString;
185
+ mimeType: z.ZodOptional<z.ZodString>;
186
+ } & {
187
+ blob: z.ZodString;
188
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
189
+ uri: z.ZodString;
190
+ mimeType: z.ZodOptional<z.ZodString>;
191
+ } & {
192
+ blob: z.ZodString;
193
+ }, z.ZodTypeAny, "passthrough">>]>;
194
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
195
+ type: z.ZodLiteral<"resource">;
196
+ resource: z.ZodUnion<[z.ZodObject<{
197
+ uri: z.ZodString;
198
+ mimeType: z.ZodOptional<z.ZodString>;
199
+ } & {
200
+ text: z.ZodString;
201
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
202
+ uri: z.ZodString;
203
+ mimeType: z.ZodOptional<z.ZodString>;
204
+ } & {
205
+ text: z.ZodString;
206
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
207
+ uri: z.ZodString;
208
+ mimeType: z.ZodOptional<z.ZodString>;
209
+ } & {
210
+ text: z.ZodString;
211
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
212
+ uri: z.ZodString;
213
+ mimeType: z.ZodOptional<z.ZodString>;
214
+ } & {
215
+ blob: z.ZodString;
216
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
217
+ uri: z.ZodString;
218
+ mimeType: z.ZodOptional<z.ZodString>;
219
+ } & {
220
+ blob: z.ZodString;
221
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
222
+ uri: z.ZodString;
223
+ mimeType: z.ZodOptional<z.ZodString>;
224
+ } & {
225
+ blob: z.ZodString;
226
+ }, z.ZodTypeAny, "passthrough">>]>;
227
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
228
+ type: z.ZodLiteral<"resource">;
229
+ resource: z.ZodUnion<[z.ZodObject<{
230
+ uri: z.ZodString;
231
+ mimeType: z.ZodOptional<z.ZodString>;
232
+ } & {
233
+ text: z.ZodString;
234
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
235
+ uri: z.ZodString;
236
+ mimeType: z.ZodOptional<z.ZodString>;
237
+ } & {
238
+ text: z.ZodString;
239
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
240
+ uri: z.ZodString;
241
+ mimeType: z.ZodOptional<z.ZodString>;
242
+ } & {
243
+ text: z.ZodString;
244
+ }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
245
+ uri: z.ZodString;
246
+ mimeType: z.ZodOptional<z.ZodString>;
247
+ } & {
248
+ blob: z.ZodString;
249
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
250
+ uri: z.ZodString;
251
+ mimeType: z.ZodOptional<z.ZodString>;
252
+ } & {
253
+ blob: z.ZodString;
254
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
255
+ uri: z.ZodString;
256
+ mimeType: z.ZodOptional<z.ZodString>;
257
+ } & {
258
+ blob: z.ZodString;
259
+ }, z.ZodTypeAny, "passthrough">>]>;
260
+ }, z.ZodTypeAny, "passthrough">>]>, "many">;
261
+ isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
262
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
263
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
264
+ } & {
265
+ toolResult: z.ZodUnknown;
266
+ }, z.ZodTypeAny, "passthrough">>, "execute">>;
267
+ }>, void | ((this: unknown) => any)>;
6
268
  sequentialThinking: import("@gaubee/util").FuncRemember<() => Promise<{
7
269
  [x: string]: import("ai").Tool<unknown, z.objectOutputType<{
8
270
  _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
@@ -526,13 +788,23 @@ export declare const tools: {
526
788
  }, z.ZodTypeAny, "passthrough">>, "execute">>;
527
789
  }>, void | ((this: unknown) => any)>;
528
790
  git: (repo: string) => Promise<ToolSet>;
529
- jixoSkill: import("@gaubee/util").FuncRemember<() => {
530
- allSkillNavList: Record<string, string>;
531
- tools: {
532
- get_jixo_skill: import("ai").Tool<{
533
- name: string;
534
- }, any>;
535
- };
536
- }, void | ((this: unknown) => any)>;
791
+ jixo: (ai_task: AiTask) => {
792
+ jixo_log_lock: import("ai").Tool<{}, {
793
+ type: string;
794
+ filepath: string;
795
+ content: string;
796
+ }>;
797
+ jixo_log_unlock: import("ai").Tool<{}, {
798
+ type: string;
799
+ }>;
800
+ jixo_task_exit: import("ai").Tool<{
801
+ reason: string;
802
+ }, {
803
+ type: string;
804
+ }>;
805
+ get_jixo_skill: import("ai").Tool<{
806
+ name: string;
807
+ }, any>;
808
+ };
537
809
  };
538
810
  //# sourceMappingURL=ai-tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-tools.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/ai-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,KAAK,OAAO,EAAC,MAAM,IAAI,CAAC;AAEvF,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,KAAK;sBAGD,MAAM;8BAeM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAiDjB,MAAM;oBAkBH,MAAM;;;;;;;;;;;;;;;;;;CA8C1B,CAAC"}
@@ -1,8 +1,8 @@
1
- import { func_lazy, func_remember, map_get_or_put_async, obj_props } from "@gaubee/util";
1
+ import { func_lazy, func_remember, map_get_or_put_async } from "@gaubee/util";
2
2
  import { experimental_createMCPClient as createMCPClient, tool } from "ai";
3
3
  import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
4
4
  import z from "zod";
5
- import { getPromptConfigs } from "../../helper/prompts-loader.js";
5
+ import { getAllPromptConfigs, getAllSkillMap } from "../../helper/prompts-loader.js";
6
6
  export const tools = {
7
7
  fileSystem: func_lazy(() => {
8
8
  const map = new Map();
@@ -37,6 +37,16 @@ export const tools = {
37
37
  });
38
38
  };
39
39
  }),
40
+ pnpm: func_remember(async () => {
41
+ const mcpClient = await createMCPClient({
42
+ transport: new Experimental_StdioMCPTransport({
43
+ command: "pnpx",
44
+ args: ["@jixo/mcp-pnpm"],
45
+ }),
46
+ });
47
+ const tools = await mcpClient.tools();
48
+ return tools;
49
+ }),
40
50
  sequentialThinking: func_remember(async () => {
41
51
  const mcpClient = await createMCPClient({
42
52
  transport: new Experimental_StdioMCPTransport({
@@ -72,29 +82,54 @@ export const tools = {
72
82
  });
73
83
  };
74
84
  }),
75
- jixoSkill: func_remember(() => {
76
- const configs = getPromptConfigs();
77
- const skills = obj_props(configs).filter((key) => key.endsWith(".skill"));
78
- const allSkillNavList = skills.reduce((tree, skill) => {
79
- tree[skill] = configs[skill].content.split("\n")[0];
80
- return tree;
81
- }, Object.create(null));
82
- return {
83
- allSkillNavList,
84
- tools: {
85
+ jixo: func_lazy(() => {
86
+ // const map = new Map<string, ToolSet>();
87
+ const configs = getAllPromptConfigs();
88
+ const allSkillMap = getAllSkillMap();
89
+ return (ai_task) => {
90
+ // return map_get_or_put_async(map, ai_task.name, async () => {
91
+ // });
92
+ return {
85
93
  get_jixo_skill: tool({
86
94
  description: "Get the JIXO skill prompt by name",
87
95
  parameters: z.object({
88
96
  name: z.string().describe("The name to get the skill for"),
89
97
  }),
90
98
  execute: async ({ name }) => {
91
- if (name in allSkillNavList) {
99
+ if (name in allSkillMap) {
92
100
  return Reflect.get(configs, name);
93
101
  }
94
102
  return { type: "error", message: "Skill not found" };
95
103
  },
96
104
  }),
97
- },
105
+ ...(() => {
106
+ // TODO: use process shared lock-manager
107
+ return {
108
+ jixo_log_lock: tool({
109
+ description: "Lock the log file for writing, will return log file content",
110
+ parameters: z.object({}),
111
+ execute: async () => {
112
+ return { type: "success", filepath: ai_task.log.filepath, content: ai_task.log.content };
113
+ },
114
+ }),
115
+ jixo_log_unlock: tool({
116
+ description: "Unlock the log file, for other locker can read the log file and then write.",
117
+ parameters: z.object({}),
118
+ execute: async () => {
119
+ return { type: "success" };
120
+ },
121
+ }),
122
+ jixo_task_exit: tool({
123
+ description: "Exit the task.",
124
+ parameters: z.object({ reason: z.string() }),
125
+ execute: async ({ reason }) => {
126
+ ai_task.exit(reason);
127
+ return { type: "success" };
128
+ },
129
+ }),
130
+ };
131
+ })(),
132
+ };
98
133
  };
99
134
  }),
100
135
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ai-tools.js","sourceRoot":"","sources":["../../../src/commands/tasks/ai-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACvF,OAAO,EAAC,4BAA4B,IAAI,eAAe,EAAE,IAAI,EAAe,MAAM,IAAI,CAAC;AACvF,OAAO,EAAC,8BAA8B,EAAC,MAAM,cAAc,CAAC;AAC5D,OAAO,CAAC,MAAM,KAAK,CA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gB,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1E,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC;QACd,CAAC,EACD,MAAM,CAAC,MAAM,CAAC,IAAI,CAA2B,CAC9C,CAAC;QACF,OAAO;YACL,eAAe;YACf,KAAK,EAAE;gBACL,cAAc,EAAE,IAAI,CAAC;oBACnB,WAAW,EAAE,mCAAmC;oBAChD,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;wBACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;qBAC3D,CAAC;oBACF,OAAO,EAAE,KAAK,EAAE,EAAC,IAAI,EAAC,EAAE,EAAE;wBACxB,IAAI,IAAI,IAAI,eAAe,EAAE,CAAC;4BAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;wBACpC,CAAC;wBACD,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAC,CAAC;oBACrD,CAAC;iBACF,CAAC;aACH;SACF,CAAC;IACJ,CAAC,CAAC;CACH,CAAC","sourcesContent":["import {func_lazy, func_remember, map_get_or_put_async, obj_props} from \"@gaubee/util\";\nimport {experimental_createMCPClient as createMCPClient, tool, type ToolSet} from \"ai\";\nimport {Experimental_StdioMCPTransport} from \"ai/mcp-stdio\";\nimport z from \"zod\";\nimport {getPromptConfigs} from \"../../helper/prompts-loader.js\";\n\nexport const tools = {\n fileSystem: func_lazy(() => {\n const map = new Map<string, ToolSet>();\n return (cwd: string) => {\n return map_get_or_put_async(map, cwd, async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"pnpx\",\n args: [\"@modelcontextprotocol/server-filesystem\", cwd],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n });\n };\n }),\n memory: func_lazy(() => {\n const map = new Map<string, ToolSet>();\n return (memory_filepath: string) => {\n return map_get_or_put_async(map, memory_filepath, async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"pnpx\",\n args: [\"@modelcontextprotocol/server-memory\"],\n env: {\n MEMORY_FILE_PATH: memory_filepath,\n },\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n });\n };\n }),\n sequentialThinking: func_remember(async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"pnpx\",\n args: [\"@modelcontextprotocol/server-sequential-thinking\"],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n }),\n fetch: func_remember(async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"uvx\",\n args: [\"mcp-server-fetch\"],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n }),\n git: func_lazy(() => {\n const map = new Map<string, ToolSet>();\n\n return (repo: string) => {\n return map_get_or_put_async(map, repo, async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"uvx\",\n args: [\"mcp-server-git\", \"--repository\", repo],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n });\n };\n }),\n\n jixoSkill: func_remember(() => {\n const configs = getPromptConfigs();\n const skills = obj_props(configs).filter((key) => key.endsWith(\".skill\"));\n const allSkillNavList = skills.reduce(\n (tree, skill) => {\n tree[skill] = configs[skill].content.split(\"\\n\")[0];\n return tree;\n },\n Object.create(null) as Record<string, string>,\n );\n return {\n allSkillNavList,\n tools: {\n get_jixo_skill: tool({\n description: \"Get the JIXO skill prompt by name\",\n parameters: z.object({\n name: z.string().describe(\"The name to get the skill for\"),\n }),\n execute: async ({name}) => {\n if (name in allSkillNavList) {\n return Reflect.get(configs, name);\n }\n return {type: \"error\", message: \"Skill not found\"};\n },\n }),\n },\n };\n }),\n};\n"]}
1
+ {"version":3,"file":"ai-tools.js","sourceRoot":"","sources":["../../../src/commands/tasks/ai-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,aAAa,EAAE,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAC,4BAA4B,IAAI,eAAe,EAAE,IAAI,EAAe,MAAM,IAAI,CAAC;AACvF,OAAO,EAAC,8BAA8B,EAAC,MAAM,cAAc,CAAC;AAC5D,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAGnF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,UAAU,EAAE,SAAS,CAAC,GAAG,EAAE;QACzB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAmB,CAAC;QACvC,OAAO,CAAC,GAAW,EAAE,EAAE;YACrB,OAAO,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE;gBAC/C,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC;oBACtC,SAAS,EAAE,IAAI,8BAA8B,CAAC;wBAC5C,OAAO,EAAE,MAAM;wBACf,IAAI,EAAE,CAAC,yCAAyC,EAAE,GAAG,CAAC;qBACvD,CAAC;iBACH,CAAC,CAAC;gBACH,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;gBACtC,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,EAAE,SAAS,CAAC,GAAG,EAAE;QACrB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAmB,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,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;CACH,CAAC","sourcesContent":["import {func_lazy, func_remember, map_get_or_put_async} from \"@gaubee/util\";\nimport {experimental_createMCPClient as createMCPClient, tool, type ToolSet} from \"ai\";\nimport {Experimental_StdioMCPTransport} from \"ai/mcp-stdio\";\nimport z from \"zod\";\nimport {getAllPromptConfigs, getAllSkillMap} from \"../../helper/prompts-loader.js\";\nimport type {AiTask} from \"../../helper/resolve-ai-tasks.js\";\n\nexport const tools = {\n fileSystem: func_lazy(() => {\n const map = new Map<string, ToolSet>();\n return (cwd: string) => {\n return map_get_or_put_async(map, cwd, async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"pnpx\",\n args: [\"@modelcontextprotocol/server-filesystem\", cwd],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n });\n };\n }),\n memory: func_lazy(() => {\n const map = new Map<string, ToolSet>();\n return (memory_filepath: string) => {\n return map_get_or_put_async(map, memory_filepath, async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"pnpx\",\n args: [\"@modelcontextprotocol/server-memory\"],\n env: {\n MEMORY_FILE_PATH: memory_filepath,\n },\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n });\n };\n }),\n pnpm: func_remember(async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"pnpx\",\n args: [\"@jixo/mcp-pnpm\"],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n }),\n sequentialThinking: func_remember(async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"pnpx\",\n args: [\"@modelcontextprotocol/server-sequential-thinking\"],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n }),\n fetch: func_remember(async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"uvx\",\n args: [\"mcp-server-fetch\"],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n }),\n git: func_lazy(() => {\n const map = new Map<string, ToolSet>();\n\n return (repo: string) => {\n return map_get_or_put_async(map, repo, async () => {\n const mcpClient = await createMCPClient({\n transport: new Experimental_StdioMCPTransport({\n command: \"uvx\",\n args: [\"mcp-server-git\", \"--repository\", repo],\n }),\n });\n const tools = await mcpClient.tools();\n return tools;\n });\n };\n }),\n\n jixo: func_lazy(() => {\n // const map = new Map<string, ToolSet>();\n const configs = getAllPromptConfigs();\n const allSkillMap = getAllSkillMap();\n return (ai_task: AiTask) => {\n // return map_get_or_put_async(map, ai_task.name, async () => {\n // });\n return {\n get_jixo_skill: tool({\n description: \"Get the JIXO skill prompt by name\",\n parameters: z.object({\n name: z.string().describe(\"The name to get the skill for\"),\n }),\n execute: async ({name}) => {\n if (name in allSkillMap) {\n return Reflect.get(configs, name);\n }\n return {type: \"error\", message: \"Skill not found\"};\n },\n }),\n ...(() => {\n // TODO: use process shared lock-manager\n return {\n jixo_log_lock: tool({\n description: \"Lock the log file for writing, will return log file content\",\n parameters: z.object({}),\n execute: async () => {\n return {type: \"success\", filepath: ai_task.log.filepath, content: ai_task.log.content};\n },\n }),\n jixo_log_unlock: tool({\n description: \"Unlock the log file, for other locker can read the log file and then write.\",\n parameters: z.object({}),\n execute: async () => {\n return {type: \"success\"};\n },\n }),\n jixo_task_exit: tool({\n description: \"Exit the task.\",\n parameters: z.object({reason: z.string()}),\n execute: async ({reason}) => {\n ai_task.exit(reason);\n return {type: \"success\"};\n },\n }),\n };\n })(),\n };\n };\n }),\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  import { FileEntry } from "@gaubee/nodekit";
2
2
  import type { AiTask } from "../../helper/resolve-ai-tasks.js";
3
- export declare const runAiTask: (ai_task: AiTask, allFiles: FileEntry[], changedFilesSet: Record<string, FileEntry[]>) => Promise<void>;
3
+ export declare const runAiTask: (ai_task: AiTask, loopTimes: number, allFiles: FileEntry[], changedFilesSet: Record<string, FileEntry[]>) => Promise<void>;
4
4
  //# sourceMappingURL=run-ai-task.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-ai-task.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/run-ai-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAwD,MAAM,iBAAiB,CAAC;AAU7G,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAyD7D,eAAO,MAAM,SAAS,GAAU,SAAS,MAAM,EAAE,UAAU,SAAS,EAAE,EAAE,iBAAiB,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,kBAenH,CAAC"}
1
+ {"version":3,"file":"run-ai-task.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/run-ai-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAwD,MAAM,iBAAiB,CAAC;AAU7G,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAyD7D,eAAO,MAAM,SAAS,GAAU,SAAS,MAAM,EAAE,WAAW,MAAM,EAAE,UAAU,SAAS,EAAE,EAAE,iBAAiB,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,kBAsDtI,CAAC"}