@aigne/cli 1.74.0-beta → 1.74.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 (128) hide show
  1. package/README.md +153 -14
  2. package/dist/commands/aigne.cjs +3 -4
  3. package/dist/commands/aigne.mjs +3 -4
  4. package/dist/commands/aigne.mjs.map +1 -1
  5. package/dist/commands/app/agent.cjs +2 -27
  6. package/dist/commands/app/agent.mjs +2 -26
  7. package/dist/commands/app/agent.mjs.map +1 -1
  8. package/dist/commands/create.cjs +1 -1
  9. package/dist/commands/create.mjs +1 -1
  10. package/dist/commands/eval.cjs +42 -3
  11. package/dist/commands/eval.mjs +43 -4
  12. package/dist/commands/eval.mjs.map +1 -1
  13. package/dist/commands/explain.cjs +340 -0
  14. package/dist/commands/explain.mjs +340 -0
  15. package/dist/commands/explain.mjs.map +1 -0
  16. package/dist/commands/hub.cjs +111 -14
  17. package/dist/commands/hub.mjs +111 -14
  18. package/dist/commands/hub.mjs.map +1 -1
  19. package/dist/commands/observe.cjs +44 -1
  20. package/dist/commands/observe.mjs +44 -1
  21. package/dist/commands/observe.mjs.map +1 -1
  22. package/dist/commands/run-skill.cjs +29 -13
  23. package/dist/commands/run-skill.mjs +29 -13
  24. package/dist/commands/run-skill.mjs.map +1 -1
  25. package/dist/commands/run.cjs +5 -4
  26. package/dist/commands/run.mjs +5 -4
  27. package/dist/commands/run.mjs.map +1 -1
  28. package/dist/commands/serve-mcp.cjs +49 -4
  29. package/dist/commands/serve-mcp.mjs +49 -3
  30. package/dist/commands/serve-mcp.mjs.map +1 -1
  31. package/dist/commands/shell.cjs +106 -0
  32. package/dist/commands/shell.mjs +105 -0
  33. package/dist/commands/shell.mjs.map +1 -0
  34. package/dist/shell/repl.cjs +544 -0
  35. package/dist/shell/repl.mjs +543 -0
  36. package/dist/shell/repl.mjs.map +1 -0
  37. package/dist/shell/tools/ask-user.cjs +191 -0
  38. package/dist/shell/tools/ask-user.mjs +187 -0
  39. package/dist/shell/tools/ask-user.mjs.map +1 -0
  40. package/dist/shell/tools/index.cjs +2 -0
  41. package/dist/shell/tools/index.mjs +4 -0
  42. package/dist/shell/tools/render.cjs +189 -0
  43. package/dist/shell/tools/render.mjs +186 -0
  44. package/dist/shell/tools/render.mjs.map +1 -0
  45. package/dist/tracer/terminal.cjs +120 -133
  46. package/dist/tracer/terminal.mjs +121 -134
  47. package/dist/tracer/terminal.mjs.map +1 -1
  48. package/dist/ui/utils/terminal-select.cjs +73 -0
  49. package/dist/ui/utils/terminal-select.mjs +72 -0
  50. package/dist/ui/utils/terminal-select.mjs.map +1 -0
  51. package/dist/utils/agent-v1.cjs +2 -2
  52. package/dist/utils/agent-v1.mjs +2 -2
  53. package/dist/utils/aigne-hub/credential.cjs +3 -3
  54. package/dist/utils/aigne-hub/credential.mjs +3 -3
  55. package/dist/utils/aigne-hub/model.cjs +2 -2
  56. package/dist/utils/aigne-hub/model.mjs +1 -1
  57. package/dist/utils/ascii-logo.cjs +12 -13
  58. package/dist/utils/ascii-logo.d.cts.map +1 -1
  59. package/dist/utils/ascii-logo.d.mts.map +1 -1
  60. package/dist/utils/ascii-logo.mjs +12 -13
  61. package/dist/utils/ascii-logo.mjs.map +1 -1
  62. package/dist/utils/evaluation/evaluator.cjs +1 -1
  63. package/dist/utils/evaluation/evaluator.mjs +1 -1
  64. package/dist/utils/evaluation/reporter.cjs +78 -1
  65. package/dist/utils/evaluation/reporter.mjs +76 -1
  66. package/dist/utils/evaluation/reporter.mjs.map +1 -1
  67. package/dist/utils/exit-codes.cjs +73 -0
  68. package/dist/utils/exit-codes.d.cts +52 -0
  69. package/dist/utils/exit-codes.d.cts.map +1 -0
  70. package/dist/utils/exit-codes.d.mts +52 -0
  71. package/dist/utils/exit-codes.d.mts.map +1 -0
  72. package/dist/utils/exit-codes.mjs +71 -0
  73. package/dist/utils/exit-codes.mjs.map +1 -0
  74. package/dist/utils/output.cjs +61 -0
  75. package/dist/utils/output.d.cts +43 -0
  76. package/dist/utils/output.d.cts.map +1 -0
  77. package/dist/utils/output.d.mts +43 -0
  78. package/dist/utils/output.d.mts.map +1 -0
  79. package/dist/utils/output.mjs +56 -0
  80. package/dist/utils/output.mjs.map +1 -0
  81. package/dist/utils/run-chat-loop.cjs +1 -1
  82. package/dist/utils/run-chat-loop.mjs +1 -1
  83. package/dist/utils/run-with-aigne.cjs +10 -3
  84. package/dist/utils/run-with-aigne.d.cts.map +1 -1
  85. package/dist/utils/run-with-aigne.d.mts.map +1 -1
  86. package/dist/utils/run-with-aigne.mjs +10 -3
  87. package/dist/utils/run-with-aigne.mjs.map +1 -1
  88. package/dist/utils/serve-mcp.cjs +1 -1
  89. package/dist/utils/serve-mcp.mjs +1 -1
  90. package/dist/utils/view.cjs +34 -0
  91. package/dist/utils/view.d.cts +47 -0
  92. package/dist/utils/view.d.cts.map +1 -0
  93. package/dist/utils/view.d.mts +47 -0
  94. package/dist/utils/view.d.mts.map +1 -0
  95. package/dist/utils/view.mjs +33 -0
  96. package/dist/utils/view.mjs.map +1 -0
  97. package/dist/utils/yargs.cjs +27 -5
  98. package/dist/utils/yargs.d.cts +13 -0
  99. package/dist/utils/yargs.d.cts.map +1 -1
  100. package/dist/utils/yargs.d.mts +14 -1
  101. package/dist/utils/yargs.d.mts.map +1 -1
  102. package/dist/utils/yargs.mjs +32 -10
  103. package/dist/utils/yargs.mjs.map +1 -1
  104. package/package.json +20 -16
  105. package/dist/commands/app/app.cjs +0 -92
  106. package/dist/commands/app/app.mjs +0 -90
  107. package/dist/commands/app/app.mjs.map +0 -1
  108. package/dist/commands/app/cli.cjs +0 -6
  109. package/dist/commands/app/cli.d.cts +0 -1
  110. package/dist/commands/app/cli.d.mts +0 -1
  111. package/dist/commands/app/cli.mjs +0 -8
  112. package/dist/commands/app/cli.mjs.map +0 -1
  113. package/dist/commands/app/upgrade.cjs +0 -243
  114. package/dist/commands/app/upgrade.mjs +0 -240
  115. package/dist/commands/app/upgrade.mjs.map +0 -1
  116. package/dist/commands/app.cjs +0 -53
  117. package/dist/commands/app.mjs +0 -53
  118. package/dist/commands/app.mjs.map +0 -1
  119. package/dist/commands/deploy.cjs +0 -237
  120. package/dist/commands/deploy.mjs +0 -237
  121. package/dist/commands/deploy.mjs.map +0 -1
  122. package/dist/utils/listr.cjs +0 -226
  123. package/dist/utils/listr.d.cts +0 -71
  124. package/dist/utils/listr.d.cts.map +0 -1
  125. package/dist/utils/listr.d.mts +0 -71
  126. package/dist/utils/listr.d.mts.map +0 -1
  127. package/dist/utils/listr.mjs +0 -222
  128. package/dist/utils/listr.mjs.map +0 -1
@@ -1,3 +1,5 @@
1
+ import { formatJSON, formatLLMDSL } from "../utils/output.mjs";
2
+ import { createViewContext, detectView } from "../utils/view.mjs";
1
3
  import chalk from "chalk";
2
4
  import { tryOrThrow } from "@aigne/core/utils/type-utils";
3
5
  import { startObservabilityCLIServer } from "@aigne/observability-api/cli";
@@ -24,15 +26,56 @@ function createObservabilityCommand() {
24
26
  }).option("port", {
25
27
  type: "number",
26
28
  describe: "Port to run the observability server on"
29
+ }).option("json", {
30
+ type: "boolean",
31
+ describe: "Output in JSON format",
32
+ default: false
33
+ }).option("view", {
34
+ type: "string",
35
+ describe: "Output view type (human, json, llm, default)",
36
+ choices: [
37
+ "default",
38
+ "json",
39
+ "llm",
40
+ "human"
41
+ ]
27
42
  });
28
43
  },
29
44
  handler: async (options) => {
30
45
  const port = await detectPort(options.port || DEFAULT_PORT());
31
46
  const dbUrl = getObservabilityDbPath();
47
+ const view = detectView({
48
+ view: options.view,
49
+ json: options.json
50
+ }, {}, createViewContext());
32
51
  process.once("SIGINT", async () => {
33
52
  process.exit(0);
34
53
  });
35
- console.log("Observability database path:", chalk.greenBright(dbUrl));
54
+ const serverInfo = {
55
+ status: "running",
56
+ url: `http://${options.host}:${port}`,
57
+ host: options.host,
58
+ port,
59
+ dbPath: dbUrl
60
+ };
61
+ switch (view) {
62
+ case "json":
63
+ console.log(formatJSON(serverInfo));
64
+ break;
65
+ case "llm":
66
+ case "default":
67
+ console.log(formatLLMDSL(serverInfo, [
68
+ "status",
69
+ "url",
70
+ "host",
71
+ "port",
72
+ "dbPath"
73
+ ]));
74
+ break;
75
+ default:
76
+ console.log("Observability database path:", chalk.greenBright(dbUrl));
77
+ break;
78
+ }
36
79
  await startObservabilityCLIServer({
37
80
  port,
38
81
  dbUrl
@@ -1 +1 @@
1
- {"version":3,"file":"observe.mjs","names":[],"sources":["../../src/commands/observe.ts"],"sourcesContent":["import { tryOrThrow } from \"@aigne/core/utils/type-utils\";\nimport { startObservabilityCLIServer } from \"@aigne/observability-api/cli\";\nimport getObservabilityDbPath from \"@aigne/observability-api/db-path\";\nimport chalk from \"chalk\";\nimport detectPort from \"detect-port\";\nimport type { CommandModule } from \"yargs\";\n\ninterface ServeMCPOptions {\n host: string;\n port?: number;\n}\n\nconst DEFAULT_PORT = () =>\n tryOrThrow(\n () => {\n const { PORT } = process.env;\n if (!PORT) return 7890;\n const port = Number.parseInt(PORT, 10);\n if (!port || !Number.isInteger(port)) throw new Error(`Invalid PORT: ${PORT}`);\n return port;\n },\n (error) => new Error(`parse PORT error ${error.message}`),\n );\n\nexport function createObservabilityCommand(): CommandModule<unknown, ServeMCPOptions> {\n return {\n command: \"observe\",\n describe: \"Start the observability server\",\n builder: (yargs) => {\n return yargs\n .option(\"host\", {\n type: \"string\",\n describe:\n \"Host to run the observability server on, use 0.0.0.0 to publicly expose the server\",\n default: \"localhost\",\n })\n .option(\"port\", {\n type: \"number\",\n describe: \"Port to run the observability server on\",\n });\n },\n handler: async (options) => {\n const port = await detectPort(options.port || DEFAULT_PORT());\n const dbUrl = getObservabilityDbPath();\n\n process.once(\"SIGINT\", async () => {\n process.exit(0);\n });\n\n console.log(\"Observability database path:\", chalk.greenBright(dbUrl));\n await startObservabilityCLIServer({ port, dbUrl });\n },\n };\n}\n"],"mappings":";;;;;;;AAYA,MAAM,qBACJ,iBACQ;CACJ,MAAM,EAAE,SAAS,QAAQ;AACzB,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,OAAO,OAAO,SAAS,MAAM,GAAG;AACtC,KAAI,CAAC,QAAQ,CAAC,OAAO,UAAU,KAAK,CAAE,OAAM,IAAI,MAAM,iBAAiB,OAAO;AAC9E,QAAO;IAER,0BAAU,IAAI,MAAM,oBAAoB,MAAM,UAAU,CAC1D;AAEH,SAAgB,6BAAsE;AACpF,QAAO;EACL,SAAS;EACT,UAAU;EACV,UAAU,UAAU;AAClB,UAAO,MACJ,OAAO,QAAQ;IACd,MAAM;IACN,UACE;IACF,SAAS;IACV,CAAC,CACD,OAAO,QAAQ;IACd,MAAM;IACN,UAAU;IACX,CAAC;;EAEN,SAAS,OAAO,YAAY;GAC1B,MAAM,OAAO,MAAM,WAAW,QAAQ,QAAQ,cAAc,CAAC;GAC7D,MAAM,QAAQ,wBAAwB;AAEtC,WAAQ,KAAK,UAAU,YAAY;AACjC,YAAQ,KAAK,EAAE;KACf;AAEF,WAAQ,IAAI,gCAAgC,MAAM,YAAY,MAAM,CAAC;AACrE,SAAM,4BAA4B;IAAE;IAAM;IAAO,CAAC;;EAErD"}
1
+ {"version":3,"file":"observe.mjs","names":[],"sources":["../../src/commands/observe.ts"],"sourcesContent":["import { tryOrThrow } from \"@aigne/core/utils/type-utils\";\nimport { startObservabilityCLIServer } from \"@aigne/observability-api/cli\";\nimport getObservabilityDbPath from \"@aigne/observability-api/db-path\";\nimport chalk from \"chalk\";\nimport detectPort from \"detect-port\";\nimport type { CommandModule } from \"yargs\";\nimport { formatJSON, formatLLMDSL } from \"../utils/output.js\";\nimport { createViewContext, detectView, type ViewType } from \"../utils/view.js\";\n\ninterface ServeMCPOptions {\n host: string;\n port?: number;\n json?: boolean;\n view?: ViewType;\n}\n\nconst DEFAULT_PORT = () =>\n tryOrThrow(\n () => {\n const { PORT } = process.env;\n if (!PORT) return 7890;\n const port = Number.parseInt(PORT, 10);\n if (!port || !Number.isInteger(port)) throw new Error(`Invalid PORT: ${PORT}`);\n return port;\n },\n (error) => new Error(`parse PORT error ${error.message}`),\n );\n\nexport function createObservabilityCommand(): CommandModule<unknown, ServeMCPOptions> {\n return {\n command: \"observe\",\n describe: \"Start the observability server\",\n builder: (yargs) => {\n return yargs\n .option(\"host\", {\n type: \"string\",\n describe:\n \"Host to run the observability server on, use 0.0.0.0 to publicly expose the server\",\n default: \"localhost\",\n })\n .option(\"port\", {\n type: \"number\",\n describe: \"Port to run the observability server on\",\n })\n .option(\"json\", {\n type: \"boolean\",\n describe: \"Output in JSON format\",\n default: false,\n })\n .option(\"view\", {\n type: \"string\",\n describe: \"Output view type (human, json, llm, default)\",\n choices: [\"default\", \"json\", \"llm\", \"human\"] as const,\n });\n },\n handler: async (options) => {\n const port = await detectPort(options.port || DEFAULT_PORT());\n const dbUrl = getObservabilityDbPath();\n\n // Detect view based on options and context\n const view = detectView(\n { view: options.view as ViewType, json: options.json },\n {},\n createViewContext(),\n );\n\n process.once(\"SIGINT\", async () => {\n process.exit(0);\n });\n\n const serverInfo = {\n status: \"running\",\n url: `http://${options.host}:${port}`,\n host: options.host,\n port,\n dbPath: dbUrl,\n };\n\n switch (view) {\n case \"json\":\n console.log(formatJSON(serverInfo));\n break;\n case \"llm\":\n case \"default\":\n console.log(formatLLMDSL(serverInfo, [\"status\", \"url\", \"host\", \"port\", \"dbPath\"]));\n break;\n default:\n console.log(\"Observability database path:\", chalk.greenBright(dbUrl));\n break;\n }\n\n await startObservabilityCLIServer({ port, dbUrl });\n },\n };\n}\n"],"mappings":";;;;;;;;;AAgBA,MAAM,qBACJ,iBACQ;CACJ,MAAM,EAAE,SAAS,QAAQ;AACzB,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,OAAO,OAAO,SAAS,MAAM,GAAG;AACtC,KAAI,CAAC,QAAQ,CAAC,OAAO,UAAU,KAAK,CAAE,OAAM,IAAI,MAAM,iBAAiB,OAAO;AAC9E,QAAO;IAER,0BAAU,IAAI,MAAM,oBAAoB,MAAM,UAAU,CAC1D;AAEH,SAAgB,6BAAsE;AACpF,QAAO;EACL,SAAS;EACT,UAAU;EACV,UAAU,UAAU;AAClB,UAAO,MACJ,OAAO,QAAQ;IACd,MAAM;IACN,UACE;IACF,SAAS;IACV,CAAC,CACD,OAAO,QAAQ;IACd,MAAM;IACN,UAAU;IACX,CAAC,CACD,OAAO,QAAQ;IACd,MAAM;IACN,UAAU;IACV,SAAS;IACV,CAAC,CACD,OAAO,QAAQ;IACd,MAAM;IACN,UAAU;IACV,SAAS;KAAC;KAAW;KAAQ;KAAO;KAAQ;IAC7C,CAAC;;EAEN,SAAS,OAAO,YAAY;GAC1B,MAAM,OAAO,MAAM,WAAW,QAAQ,QAAQ,cAAc,CAAC;GAC7D,MAAM,QAAQ,wBAAwB;GAGtC,MAAM,OAAO,WACX;IAAE,MAAM,QAAQ;IAAkB,MAAM,QAAQ;IAAM,EACtD,EAAE,EACF,mBAAmB,CACpB;AAED,WAAQ,KAAK,UAAU,YAAY;AACjC,YAAQ,KAAK,EAAE;KACf;GAEF,MAAM,aAAa;IACjB,QAAQ;IACR,KAAK,UAAU,QAAQ,KAAK,GAAG;IAC/B,MAAM,QAAQ;IACd;IACA,QAAQ;IACT;AAED,WAAQ,MAAR;IACE,KAAK;AACH,aAAQ,IAAI,WAAW,WAAW,CAAC;AACnC;IACF,KAAK;IACL,KAAK;AACH,aAAQ,IAAI,aAAa,YAAY;MAAC;MAAU;MAAO;MAAQ;MAAQ;MAAS,CAAC,CAAC;AAClF;IACF;AACE,aAAQ,IAAI,gCAAgC,MAAM,YAAY,MAAM,CAAC;AACrE;;AAGJ,SAAM,4BAA4B;IAAE;IAAM;IAAO,CAAC;;EAErD"}
@@ -2,9 +2,10 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_utils_aigne_hub_model = require('../utils/aigne-hub/model.cjs');
3
3
  const require_utils_yargs = require('../utils/yargs.cjs');
4
4
  const require_agent = require('./app/agent.cjs');
5
+ let _aigne_core_utils_logger = require("@aigne/core/utils/logger");
5
6
  let node_path = require("node:path");
6
- let _aigne_core = require("@aigne/core");
7
7
  let zod = require("zod");
8
+ let _aigne_core = require("@aigne/core");
8
9
  let _aigne_afs_history = require("@aigne/afs-history");
9
10
  let _aigne_afs_local_fs = require("@aigne/afs-local-fs");
10
11
  let _aigne_agent_library_agent_skill_manager = require("@aigne/agent-library/agent-skill-manager");
@@ -15,28 +16,43 @@ let _aigne_agent_library_bash = require("@aigne/agent-library/bash");
15
16
  _aigne_agent_library_bash = require_rolldown_runtime.__toESM(_aigne_agent_library_bash);
16
17
 
17
18
  //#region src/commands/run-skill.ts
19
+ /**
20
+ * Creates the 'run skill' subcommand for running Agent Skills.
21
+ *
22
+ * Usage:
23
+ * aigne run skill <path...> [options]
24
+ *
25
+ * Examples:
26
+ * aigne run skill ./my-skill
27
+ * aigne run skill ./skill1 ./skill2 --interactive
28
+ * aigne run skill ./skill -i "hello"
29
+ */
18
30
  function createRunSkillCommand() {
19
31
  return {
20
- command: ["run-skill"],
21
- describe: "Run Agent Skill for the specified path",
32
+ command: "skill <paths..>",
33
+ describe: "Run Agent Skills from specified directories",
22
34
  builder: async (yargs) => {
23
- return require_utils_yargs.withAgentInputSchema(yargs.option("skill", {
24
- array: true,
35
+ return require_utils_yargs.withAgentInputSchema(yargs.positional("paths", {
25
36
  type: "string",
26
- describe: "Path to the Agent Skill directory"
37
+ array: true,
38
+ describe: "Paths to Agent Skill directories"
27
39
  }).option("interactive", {
28
40
  describe: "Run in interactive chat mode",
29
41
  type: "boolean",
30
42
  default: false,
31
43
  alias: ["chat"]
32
- }).demandOption("skill"), {
33
- inputSchema: zod.z.object({ message: zod.z.string() }),
44
+ }).example("$0 run skill ./my-skill", "Run a single skill").example("$0 run skill ./skill1 ./skill2", "Run multiple skills").example("$0 run skill ./skill --interactive", "Run skill in interactive mode").example("$0 run skill ./skill -i \"hello world\"", "Run skill with input"), {
45
+ inputSchema: zod.z.object({ message: zod.z.string().describe("Input message for the skill") }),
34
46
  optionalInputs: ["message"]
35
47
  });
36
48
  },
37
49
  handler: async (options) => {
38
- if (!Array.isArray(options.skill) || options.skill.length === 0) throw new Error("At least one skill path must be provided.");
39
- const aigne = new _aigne_core.AIGNE({ model: await require_utils_aigne_hub_model.loadChatModel({ model: options.model || "aignehub/anthropic/claude-sonnet-4-5" }) });
50
+ if (!Array.isArray(options.paths) || options.paths.length === 0) throw new Error("At least one skill path must be provided.");
51
+ if (options.logLevel) _aigne_core_utils_logger.logger.level = options.logLevel;
52
+ const aigne = new _aigne_core.AIGNE({ model: await require_utils_aigne_hub_model.loadChatModel({
53
+ model: options.model || "aignehub/anthropic/claude-sonnet-4-5",
54
+ aigneHubUrl: options.aigneHubUrl
55
+ }) });
40
56
  const approvedCmds = /* @__PURE__ */ new Set();
41
57
  await require_agent.invokeAgent({
42
58
  aigne,
@@ -47,9 +63,9 @@ function createRunSkillCommand() {
47
63
  sandbox: false,
48
64
  permissions: {
49
65
  defaultMode: "ask",
50
- guard: _aigne_core.FunctionAgent.from(async (input, options$1) => {
66
+ guard: _aigne_core.FunctionAgent.from(async (input, ctx) => {
51
67
  if (approvedCmds.has(input.script || "")) return { approved: true };
52
- const confirm = options$1.prompts?.confirm;
68
+ const confirm = ctx.prompts?.confirm;
53
69
  if (!confirm) throw new Error("No confirm prompt available for permission guard.");
54
70
  const approved = await confirm({ message: `Run command ${input.script}?` });
55
71
  if (approved && input.script) approvedCmds.add(input.script);
@@ -66,7 +82,7 @@ function createRunSkillCommand() {
66
82
  Current working directory. All temporary files should be written here using absolute AFS paths (e.g., /modules/workspace/temp.py).
67
83
  Note: Bash is already running in this directory, so do NOT use 'cd /modules/workspace' in scripts. Use relative paths directly (e.g., python temp.py).`
68
84
  }),
69
- ...options.skill.map((path) => new _aigne_afs_local_fs.LocalFS({
85
+ ...options.paths.map((path) => new _aigne_afs_local_fs.LocalFS({
70
86
  name: (0, node_path.basename)((0, node_path.resolve)(path)),
71
87
  localPath: path,
72
88
  description: "Contains Agent Skills. Use 'Skill' tool to invoke skills from this module.",
@@ -1,9 +1,10 @@
1
1
  import { loadChatModel } from "../utils/aigne-hub/model.mjs";
2
2
  import { withAgentInputSchema } from "../utils/yargs.mjs";
3
3
  import { invokeAgent } from "./app/agent.mjs";
4
+ import { logger } from "@aigne/core/utils/logger";
4
5
  import { basename, resolve } from "node:path";
5
- import { AIGNE, FunctionAgent } from "@aigne/core";
6
6
  import { z as z$1 } from "zod";
7
+ import { AIGNE, FunctionAgent } from "@aigne/core";
7
8
  import { AFSHistory } from "@aigne/afs-history";
8
9
  import { LocalFS } from "@aigne/afs-local-fs";
9
10
  import AgentSkillManager from "@aigne/agent-library/agent-skill-manager";
@@ -11,28 +12,43 @@ import AskUserQuestion from "@aigne/agent-library/ask-user-question";
11
12
  import BashAgent from "@aigne/agent-library/bash";
12
13
 
13
14
  //#region src/commands/run-skill.ts
15
+ /**
16
+ * Creates the 'run skill' subcommand for running Agent Skills.
17
+ *
18
+ * Usage:
19
+ * aigne run skill <path...> [options]
20
+ *
21
+ * Examples:
22
+ * aigne run skill ./my-skill
23
+ * aigne run skill ./skill1 ./skill2 --interactive
24
+ * aigne run skill ./skill -i "hello"
25
+ */
14
26
  function createRunSkillCommand() {
15
27
  return {
16
- command: ["run-skill"],
17
- describe: "Run Agent Skill for the specified path",
28
+ command: "skill <paths..>",
29
+ describe: "Run Agent Skills from specified directories",
18
30
  builder: async (yargs) => {
19
- return withAgentInputSchema(yargs.option("skill", {
20
- array: true,
31
+ return withAgentInputSchema(yargs.positional("paths", {
21
32
  type: "string",
22
- describe: "Path to the Agent Skill directory"
33
+ array: true,
34
+ describe: "Paths to Agent Skill directories"
23
35
  }).option("interactive", {
24
36
  describe: "Run in interactive chat mode",
25
37
  type: "boolean",
26
38
  default: false,
27
39
  alias: ["chat"]
28
- }).demandOption("skill"), {
29
- inputSchema: z$1.object({ message: z$1.string() }),
40
+ }).example("$0 run skill ./my-skill", "Run a single skill").example("$0 run skill ./skill1 ./skill2", "Run multiple skills").example("$0 run skill ./skill --interactive", "Run skill in interactive mode").example("$0 run skill ./skill -i \"hello world\"", "Run skill with input"), {
41
+ inputSchema: z$1.object({ message: z$1.string().describe("Input message for the skill") }),
30
42
  optionalInputs: ["message"]
31
43
  });
32
44
  },
33
45
  handler: async (options) => {
34
- if (!Array.isArray(options.skill) || options.skill.length === 0) throw new Error("At least one skill path must be provided.");
35
- const aigne = new AIGNE({ model: await loadChatModel({ model: options.model || "aignehub/anthropic/claude-sonnet-4-5" }) });
46
+ if (!Array.isArray(options.paths) || options.paths.length === 0) throw new Error("At least one skill path must be provided.");
47
+ if (options.logLevel) logger.level = options.logLevel;
48
+ const aigne = new AIGNE({ model: await loadChatModel({
49
+ model: options.model || "aignehub/anthropic/claude-sonnet-4-5",
50
+ aigneHubUrl: options.aigneHubUrl
51
+ }) });
36
52
  const approvedCmds = /* @__PURE__ */ new Set();
37
53
  await invokeAgent({
38
54
  aigne,
@@ -43,9 +59,9 @@ function createRunSkillCommand() {
43
59
  sandbox: false,
44
60
  permissions: {
45
61
  defaultMode: "ask",
46
- guard: FunctionAgent.from(async (input, options$1) => {
62
+ guard: FunctionAgent.from(async (input, ctx) => {
47
63
  if (approvedCmds.has(input.script || "")) return { approved: true };
48
- const confirm = options$1.prompts?.confirm;
64
+ const confirm = ctx.prompts?.confirm;
49
65
  if (!confirm) throw new Error("No confirm prompt available for permission guard.");
50
66
  const approved = await confirm({ message: `Run command ${input.script}?` });
51
67
  if (approved && input.script) approvedCmds.add(input.script);
@@ -62,7 +78,7 @@ function createRunSkillCommand() {
62
78
  Current working directory. All temporary files should be written here using absolute AFS paths (e.g., /modules/workspace/temp.py).
63
79
  Note: Bash is already running in this directory, so do NOT use 'cd /modules/workspace' in scripts. Use relative paths directly (e.g., python temp.py).`
64
80
  }),
65
- ...options.skill.map((path$1) => new LocalFS({
81
+ ...options.paths.map((path$1) => new LocalFS({
66
82
  name: basename(resolve(path$1)),
67
83
  localPath: path$1,
68
84
  description: "Contains Agent Skills. Use 'Skill' tool to invoke skills from this module.",
@@ -1 +1 @@
1
- {"version":3,"file":"run-skill.mjs","names":["z","options","path"],"sources":["../../src/commands/run-skill.ts"],"sourcesContent":["import { basename, resolve } from \"node:path\";\nimport { AFSHistory } from \"@aigne/afs-history\";\nimport { LocalFS } from \"@aigne/afs-local-fs\";\nimport AgentSkillManager from \"@aigne/agent-library/agent-skill-manager\";\nimport AskUserQuestion from \"@aigne/agent-library/ask-user-question\";\nimport BashAgent from \"@aigne/agent-library/bash\";\nimport { AIGNE, FunctionAgent } from \"@aigne/core\";\nimport type { CommandModule } from \"yargs\";\nimport { z } from \"zod\";\nimport { loadChatModel } from \"../utils/aigne-hub/model.js\";\nimport { type AgentRunCommonOptions, withAgentInputSchema } from \"../utils/yargs.js\";\nimport { invokeAgent } from \"./app/agent.js\";\n\nexport function createRunSkillCommand(): CommandModule<\n unknown,\n { skill?: string[]; interactive?: boolean } & AgentRunCommonOptions\n> {\n return {\n command: [\"run-skill\"],\n describe: \"Run Agent Skill for the specified path\",\n builder: async (yargs) => {\n return withAgentInputSchema(\n yargs\n .option(\"skill\", {\n array: true,\n type: \"string\",\n describe: \"Path to the Agent Skill directory\",\n })\n .option(\"interactive\", {\n describe: \"Run in interactive chat mode\",\n type: \"boolean\",\n default: false,\n alias: [\"chat\"],\n })\n .demandOption(\"skill\"),\n {\n inputSchema: z.object({\n message: z.string(),\n }),\n optionalInputs: [\"message\"],\n },\n );\n },\n handler: async (options) => {\n if (!Array.isArray(options.skill) || options.skill.length === 0) {\n throw new Error(\"At least one skill path must be provided.\");\n }\n\n const model = await loadChatModel({\n model: options.model || \"aignehub/anthropic/claude-sonnet-4-5\",\n });\n\n const aigne = new AIGNE({ model });\n\n const approvedCmds = new Set<string>();\n\n const agent = new AgentSkillManager({\n inputKey: \"message\",\n taskRenderMode: \"collapse\",\n skills: [\n new BashAgent({\n sandbox: false,\n permissions: {\n defaultMode: \"ask\",\n guard: FunctionAgent.from(async (input, options) => {\n if (approvedCmds.has(input.script || \"\")) {\n return {\n approved: true,\n };\n }\n\n const confirm = options.prompts?.confirm;\n if (!confirm) throw new Error(\"No confirm prompt available for permission guard.\");\n\n const approved = await confirm({ message: `Run command ${input.script}?` });\n\n if (approved && input.script) {\n approvedCmds.add(input.script);\n }\n\n return {\n approved,\n };\n }),\n },\n }),\n new AskUserQuestion(),\n ],\n afs: {\n modules: [\n new AFSHistory({}),\n new LocalFS({\n name: \"workspace\",\n localPath: process.cwd(),\n description: `\\\nCurrent working directory. All temporary files should be written here using absolute AFS paths (e.g., /modules/workspace/temp.py).\nNote: Bash is already running in this directory, so do NOT use 'cd /modules/workspace' in scripts. Use relative paths directly (e.g., python temp.py).`,\n }),\n ...options.skill.map(\n (path) =>\n new LocalFS({\n name: basename(resolve(path)),\n localPath: path,\n description:\n \"Contains Agent Skills. Use 'Skill' tool to invoke skills from this module.\",\n agentSkills: true,\n }),\n ),\n ],\n },\n });\n\n await invokeAgent({\n aigne,\n agent,\n input: {\n ...options,\n },\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,wBAGd;AACA,QAAO;EACL,SAAS,CAAC,YAAY;EACtB,UAAU;EACV,SAAS,OAAO,UAAU;AACxB,UAAO,qBACL,MACG,OAAO,SAAS;IACf,OAAO;IACP,MAAM;IACN,UAAU;IACX,CAAC,CACD,OAAO,eAAe;IACrB,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO,CAAC,OAAO;IAChB,CAAC,CACD,aAAa,QAAQ,EACxB;IACE,aAAaA,IAAE,OAAO,EACpB,SAASA,IAAE,QAAQ,EACpB,CAAC;IACF,gBAAgB,CAAC,UAAU;IAC5B,CACF;;EAEH,SAAS,OAAO,YAAY;AAC1B,OAAI,CAAC,MAAM,QAAQ,QAAQ,MAAM,IAAI,QAAQ,MAAM,WAAW,EAC5D,OAAM,IAAI,MAAM,4CAA4C;GAO9D,MAAM,QAAQ,IAAI,MAAM,EAAE,OAJZ,MAAM,cAAc,EAChC,OAAO,QAAQ,SAAS,wCACzB,CAAC,EAE+B,CAAC;GAElC,MAAM,+BAAe,IAAI,KAAa;AA0DtC,SAAM,YAAY;IAChB;IACA,OA1DY,IAAI,kBAAkB;KAClC,UAAU;KACV,gBAAgB;KAChB,QAAQ,CACN,IAAI,UAAU;MACZ,SAAS;MACT,aAAa;OACX,aAAa;OACb,OAAO,cAAc,KAAK,OAAO,OAAO,cAAY;AAClD,YAAI,aAAa,IAAI,MAAM,UAAU,GAAG,CACtC,QAAO,EACL,UAAU,MACX;QAGH,MAAM,UAAUC,UAAQ,SAAS;AACjC,YAAI,CAAC,QAAS,OAAM,IAAI,MAAM,oDAAoD;QAElF,MAAM,WAAW,MAAM,QAAQ,EAAE,SAAS,eAAe,MAAM,OAAO,IAAI,CAAC;AAE3E,YAAI,YAAY,MAAM,OACpB,cAAa,IAAI,MAAM,OAAO;AAGhC,eAAO,EACL,UACD;SACD;OACH;MACF,CAAC,EACF,IAAI,iBAAiB,CACtB;KACD,KAAK,EACH,SAAS;MACP,IAAI,WAAW,EAAE,CAAC;MAClB,IAAI,QAAQ;OACV,MAAM;OACN,WAAW,QAAQ,KAAK;OACxB,aAAa;;;OAGd,CAAC;MACF,GAAG,QAAQ,MAAM,KACd,WACC,IAAI,QAAQ;OACV,MAAM,SAAS,QAAQC,OAAK,CAAC;OAC7B,WAAWA;OACX,aACE;OACF,aAAa;OACd,CAAC,CACL;MACF,EACF;KACF,CAAC;IAKA,OAAO,EACL,GAAG,SACJ;IACF,CAAC;;EAEL"}
1
+ {"version":3,"file":"run-skill.mjs","names":["z","path"],"sources":["../../src/commands/run-skill.ts"],"sourcesContent":["import { basename, resolve } from \"node:path\";\nimport { AFSHistory } from \"@aigne/afs-history\";\nimport { LocalFS } from \"@aigne/afs-local-fs\";\nimport AgentSkillManager from \"@aigne/agent-library/agent-skill-manager\";\nimport AskUserQuestion from \"@aigne/agent-library/ask-user-question\";\nimport BashAgent from \"@aigne/agent-library/bash\";\nimport { AIGNE, FunctionAgent } from \"@aigne/core\";\nimport { logger } from \"@aigne/core/utils/logger\";\nimport type { CommandModule } from \"yargs\";\nimport { z } from \"zod\";\nimport { loadChatModel } from \"../utils/aigne-hub/model.js\";\nimport { type AgentRunCommonOptions, withAgentInputSchema } from \"../utils/yargs.js\";\nimport { invokeAgent } from \"./app/agent.js\";\n\n/**\n * Creates the 'run skill' subcommand for running Agent Skills.\n *\n * Usage:\n * aigne run skill <path...> [options]\n *\n * Examples:\n * aigne run skill ./my-skill\n * aigne run skill ./skill1 ./skill2 --interactive\n * aigne run skill ./skill -i \"hello\"\n */\nexport function createRunSkillCommand(): CommandModule<\n unknown,\n { paths?: string[]; interactive?: boolean } & AgentRunCommonOptions\n> {\n return {\n command: \"skill <paths..>\",\n describe: \"Run Agent Skills from specified directories\",\n builder: async (yargs) => {\n return withAgentInputSchema(\n yargs\n .positional(\"paths\", {\n type: \"string\",\n array: true,\n describe: \"Paths to Agent Skill directories\",\n })\n .option(\"interactive\", {\n describe: \"Run in interactive chat mode\",\n type: \"boolean\",\n default: false,\n alias: [\"chat\"],\n })\n .example(\"$0 run skill ./my-skill\", \"Run a single skill\")\n .example(\"$0 run skill ./skill1 ./skill2\", \"Run multiple skills\")\n .example(\"$0 run skill ./skill --interactive\", \"Run skill in interactive mode\")\n .example('$0 run skill ./skill -i \"hello world\"', \"Run skill with input\"),\n {\n inputSchema: z.object({\n message: z.string().describe(\"Input message for the skill\"),\n }),\n optionalInputs: [\"message\"],\n },\n );\n },\n handler: async (options) => {\n if (!Array.isArray(options.paths) || options.paths.length === 0) {\n throw new Error(\"At least one skill path must be provided.\");\n }\n\n if (options.logLevel) logger.level = options.logLevel;\n\n const model = await loadChatModel({\n model: options.model || \"aignehub/anthropic/claude-sonnet-4-5\",\n aigneHubUrl: options.aigneHubUrl,\n });\n\n const aigne = new AIGNE({ model });\n\n const approvedCmds = new Set<string>();\n\n const agent = new AgentSkillManager({\n inputKey: \"message\",\n taskRenderMode: \"collapse\",\n skills: [\n new BashAgent({\n sandbox: false,\n permissions: {\n defaultMode: \"ask\",\n guard: FunctionAgent.from(async (input, ctx) => {\n if (approvedCmds.has(input.script || \"\")) {\n return {\n approved: true,\n };\n }\n\n const confirm = ctx.prompts?.confirm;\n if (!confirm) throw new Error(\"No confirm prompt available for permission guard.\");\n\n const approved = await confirm({ message: `Run command ${input.script}?` });\n\n if (approved && input.script) {\n approvedCmds.add(input.script);\n }\n\n return {\n approved,\n };\n }),\n },\n }),\n new AskUserQuestion(),\n ],\n afs: {\n modules: [\n new AFSHistory({}),\n new LocalFS({\n name: \"workspace\",\n localPath: process.cwd(),\n description: `\\\nCurrent working directory. All temporary files should be written here using absolute AFS paths (e.g., /modules/workspace/temp.py).\nNote: Bash is already running in this directory, so do NOT use 'cd /modules/workspace' in scripts. Use relative paths directly (e.g., python temp.py).`,\n }),\n ...options.paths.map(\n (path) =>\n new LocalFS({\n name: basename(resolve(path)),\n localPath: path,\n description:\n \"Contains Agent Skills. Use 'Skill' tool to invoke skills from this module.\",\n agentSkills: true,\n }),\n ),\n ],\n },\n });\n\n await invokeAgent({\n aigne,\n agent,\n input: {\n ...options,\n },\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,wBAGd;AACA,QAAO;EACL,SAAS;EACT,UAAU;EACV,SAAS,OAAO,UAAU;AACxB,UAAO,qBACL,MACG,WAAW,SAAS;IACnB,MAAM;IACN,OAAO;IACP,UAAU;IACX,CAAC,CACD,OAAO,eAAe;IACrB,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO,CAAC,OAAO;IAChB,CAAC,CACD,QAAQ,2BAA2B,qBAAqB,CACxD,QAAQ,kCAAkC,sBAAsB,CAChE,QAAQ,sCAAsC,gCAAgC,CAC9E,QAAQ,2CAAyC,uBAAuB,EAC3E;IACE,aAAaA,IAAE,OAAO,EACpB,SAASA,IAAE,QAAQ,CAAC,SAAS,8BAA8B,EAC5D,CAAC;IACF,gBAAgB,CAAC,UAAU;IAC5B,CAC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require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_constants = require('../constants.cjs');
3
- const require_utils_download = require('../utils/download.cjs');
4
3
  const require_utils_load_aigne = require('../utils/load-aigne.cjs');
5
4
  const require_utils_agent_v1 = require('../utils/agent-v1.cjs');
5
+ const require_utils_download = require('../utils/download.cjs');
6
6
  const require_utils_url = require('../utils/url.cjs');
7
7
  const require_utils_yargs = require('../utils/yargs.cjs');
8
8
  const require_agent = require('./app/agent.cjs');
9
+ const require_run_skill = require('./run-skill.cjs');
9
10
  let _aigne_core_utils_logger = require("@aigne/core/utils/logger");
10
11
  let dotenv_flow = require("dotenv-flow");
11
12
  let yargs = require("yargs");
12
13
  yargs = require_rolldown_runtime.__toESM(yargs);
13
- let node_path = require("node:path");
14
14
  let node_fs_promises = require("node:fs/promises");
15
+ let node_path = require("node:path");
16
+ let _aigne_agent_library_utils_fs = require("@aigne/agent-library/utils/fs");
15
17
  let _aigne_listr2 = require("@aigne/listr2");
16
18
  let _aigne_core_utils_type_utils = require("@aigne/core/utils/type-utils");
17
19
  let node_os = require("node:os");
18
- let _aigne_agent_library_utils_fs = require("@aigne/agent-library/utils/fs");
19
20
  let _aigne_core_loader = require("@aigne/core/loader");
20
21
 
21
22
  //#region src/commands/run.ts
@@ -42,7 +43,7 @@ function createRunCommand({ aigneFilePath } = {}) {
42
43
  type: "boolean",
43
44
  default: false,
44
45
  alias: ["chat"]
45
- }).help(false).version(false).strict(false);
46
+ }).command(require_run_skill.createRunSkillCommand()).help(false).version(false).strict(false);
46
47
  },
47
48
  handler: async (options) => {
48
49
  if (options.version) {
@@ -1,19 +1,20 @@
1
1
  import { AIGNE_CLI_VERSION, CHAT_MODEL_OPTIONS } from "../constants.mjs";
2
- import { downloadAndExtract } from "../utils/download.mjs";
3
2
  import { loadAIGNE } from "../utils/load-aigne.mjs";
4
3
  import { isV1Package, toAIGNEPackage } from "../utils/agent-v1.mjs";
4
+ import { downloadAndExtract } from "../utils/download.mjs";
5
5
  import { isUrl } from "../utils/url.mjs";
6
6
  import { withRunAgentCommonOptions } from "../utils/yargs.mjs";
7
7
  import { agentCommandModule, cliAgentCommandModule } from "./app/agent.mjs";
8
+ import { createRunSkillCommand } from "./run-skill.mjs";
8
9
  import { logger } from "@aigne/core/utils/logger";
9
10
  import { config } from "dotenv-flow";
10
11
  import yargs from "yargs";
11
- import { isAbsolute, join, resolve } from "node:path";
12
12
  import { cp, mkdir, rm } from "node:fs/promises";
13
+ import { isAbsolute, join, resolve } from "node:path";
14
+ import { exists } from "@aigne/agent-library/utils/fs";
13
15
  import { Listr, PRESET_TIMER } from "@aigne/listr2";
14
16
  import { flat, isNonNullable, pick } from "@aigne/core/utils/type-utils";
15
17
  import { homedir } from "node:os";
16
- import { exists } from "@aigne/agent-library/utils/fs";
17
18
  import { findAIGNEFile } from "@aigne/core/loader";
18
19
 
19
20
  //#region src/commands/run.ts
@@ -40,7 +41,7 @@ function createRunCommand({ aigneFilePath } = {}) {
40
41
  type: "boolean",
41
42
  default: false,
42
43
  alias: ["chat"]
43
- }).help(false).version(false).strict(false);
44
+ }).command(createRunSkillCommand()).help(false).version(false).strict(false);
44
45
  },
45
46
  handler: async (options) => {
46
47
  if (options.version) {
@@ -1 +1 @@
1
- {"version":3,"file":"run.mjs","names":["yargs","path"],"sources":["../../src/commands/run.ts"],"sourcesContent":["import { cp, mkdir, rm } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { exists } from \"@aigne/agent-library/utils/fs\";\nimport { findAIGNEFile } from \"@aigne/core/loader\";\nimport { logger } from \"@aigne/core/utils/logger\";\nimport { flat, isNonNullable, pick } from \"@aigne/core/utils/type-utils\";\nimport { Listr, PRESET_TIMER } from \"@aigne/listr2\";\nimport { config } from \"dotenv-flow\";\nimport type { Argv, CommandModule } from \"yargs\";\nimport yargs from \"yargs\";\nimport { AIGNE_CLI_VERSION, CHAT_MODEL_OPTIONS } from \"../constants.js\";\nimport { isV1Package, toAIGNEPackage } from \"../utils/agent-v1.js\";\nimport { downloadAndExtract } from \"../utils/download.js\";\nimport { loadAIGNE } from \"../utils/load-aigne.js\";\nimport { isUrl } from \"../utils/url.js\";\nimport { withRunAgentCommonOptions } from \"../utils/yargs.js\";\nimport { agentCommandModule, cliAgentCommandModule } from \"./app/agent.js\";\n\nlet yargsInstance: Argv | null = null;\n\nexport function createRunCommand({\n aigneFilePath,\n}: {\n aigneFilePath?: string;\n} = {}): CommandModule<\n unknown,\n { version?: boolean; path?: string; entryAgent?: string; interactive?: boolean }\n> {\n return {\n // $0 must place after 'run' to make positional args work correctly\n command: [\"run [path] [entry-agent]\", \"$0\"],\n describe: \"Run AIGNE for the specified path\",\n builder: async (yargs) => {\n yargsInstance = yargs;\n\n return yargs\n .positional(\"path\", {\n type: \"string\",\n describe: \"Path to the agents directory or URL to an aigne project\",\n default: \".\",\n })\n .positional(\"entry-agent\", {\n type: \"string\",\n describe: \"Name of the agent to run (defaults to the entry agent if not specified)\",\n })\n .option(\"version\", {\n type: \"boolean\",\n alias: \"v\",\n describe: \"Show version number\",\n })\n .option(\"interactive\", {\n describe: \"Run in interactive chat mode\",\n type: \"boolean\",\n default: false,\n alias: [\"chat\"],\n })\n .help(false)\n .version(false)\n .strict(false);\n },\n handler: async (options) => {\n if (options.version) {\n console.log(AIGNE_CLI_VERSION);\n process.exit(0);\n return;\n }\n\n if (!options.entryAgent && options.path) {\n if (!(await exists(options.path)) && !isUrl(options.path)) {\n options.entryAgent = options.path;\n options.path = undefined;\n }\n }\n\n const path = aigneFilePath || options.path || \".\";\n if (\n !isUrl(path) &&\n !(await findAIGNEFile(path).catch((error) => {\n if (options._[0] !== \"run\") {\n yargsInstance?.showHelp();\n } else {\n throw error;\n }\n return false;\n }))\n ) {\n return;\n }\n\n // Parse model options for loading application\n const opts = withRunAgentCommonOptions(\n yargs(process.argv).help(false).version(false).strict(false),\n ).parseSync();\n logger.level = opts.logLevel;\n\n const { aigne } = await loadApplication(path, {\n modelOptions: pick(opts, CHAT_MODEL_OPTIONS),\n imageModelOptions: { model: opts.imageModel },\n });\n\n const subYargs = yargs().scriptName(\"\").usage(\"aigne run <path> <agent> [...options]\");\n\n if (aigne.cli.chat) {\n subYargs.command({\n ...agentCommandModule({ aigne, agent: aigne.cli.chat, interactive: true }),\n command: \"$0\",\n });\n }\n\n // Allow user to run all of agents in the AIGNE instances\n const allAgents = flat(aigne.agents, aigne.skills, aigne.cli.chat, aigne.mcpServer.agents);\n for (const agent of allAgents) {\n subYargs.command(agentCommandModule({ aigne, agent, interactive: options.interactive }));\n }\n\n for (const cliAgent of aigne.cli.agents ?? []) {\n subYargs.command(\n cliAgentCommandModule({\n aigne,\n cliAgent,\n }),\n );\n }\n\n const argv = process.argv.slice(aigneFilePath ? 3 : 2);\n if (argv[0] === \"run\") argv.shift(); // remove 'run' command\n\n // For compatibility with old `run` command like: `aigne run --path /xx/xx --entry-agent xx --xx`\n if (argv[0] === \"--path\" || argv[0] === \"--url\") argv.shift(); // remove --path flag\n if (argv[0] === options.path) argv.shift(); // remove path/url args\n if (argv[0] === \"--entry-agent\") argv.shift();\n\n const firstAgent = aigne.agents[0]?.name;\n if (!options.entryAgent && firstAgent && !argv.some((i) => [\"-h\", \"--help\"].includes(i))) {\n argv.unshift(firstAgent);\n }\n\n await subYargs\n .strict()\n .demandCommand()\n .alias(\"h\", \"help\")\n .alias(\"v\", \"version\")\n .fail((message, error, yargs) => {\n // We catch all errors below, here just print the help message non-error case like demandCommand\n if (!error) {\n yargs.showHelp();\n\n console.error(`\\n${message}`);\n process.exit(1);\n }\n })\n .parseAsync(argv);\n },\n };\n}\n\nasync function loadApplication(path: string, options: Parameters<typeof loadAIGNE>[0] = {}) {\n const { cacheDir, dir } = prepareDirs(path);\n\n if (cacheDir) {\n await new Listr(\n [\n {\n title: \"Download package\",\n task: () => downloadPackage(path, cacheDir),\n },\n {\n title: \"Extract package\",\n task: () => extractPackage(cacheDir, dir),\n },\n ],\n {\n rendererOptions: {\n collapseSubtasks: false,\n showErrorMessage: false,\n timer: PRESET_TIMER,\n },\n },\n ).run();\n }\n\n // Load env files in the aigne directory\n config({ path: dir, silent: true });\n\n const aigne = await loadAIGNE({ ...options, path: dir });\n\n return { aigne, path: dir };\n}\n\nasync function downloadPackage(url: string, cacheDir: string) {\n await rm(cacheDir, { recursive: true, force: true });\n\n await mkdir(cacheDir, { recursive: true });\n\n await downloadAndExtract(url, cacheDir);\n}\n\nasync function extractPackage(cacheDir: string, dir: string) {\n await mkdir(dir, { recursive: true });\n\n if (await isV1Package(cacheDir)) {\n await toAIGNEPackage(cacheDir, dir);\n } else {\n await cp(cacheDir, dir, { recursive: true, force: true });\n }\n}\n\nfunction prepareDirs(path: string) {\n let dir: string;\n let cacheDir: string | undefined;\n\n if (!path.startsWith(\"http\")) {\n dir = isAbsolute(path) ? path : resolve(process.cwd(), path);\n } else {\n dir = getLocalPackagePathFromUrl(path);\n cacheDir = getLocalPackagePathFromUrl(path, { subdir: \".download\" });\n }\n\n return { cacheDir, dir };\n}\n\nfunction getLocalPackagePathFromUrl(url: string, { subdir }: { subdir?: string } = {}) {\n const root = [homedir(), \".aigne\", subdir].filter(isNonNullable);\n const u = new URL(url);\n return join(...root, u.hostname, u.pathname);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAI,gBAA6B;AAEjC,SAAgB,iBAAiB,EAC/B,kBAGE,EAAE,EAGJ;AACA,QAAO;EAEL,SAAS,CAAC,4BAA4B,KAAK;EAC3C,UAAU;EACV,SAAS,OAAO,YAAU;AACxB,mBAAgBA;AAEhB,UAAOA,QACJ,WAAW,QAAQ;IAClB,MAAM;IACN,UAAU;IACV,SAAS;IACV,CAAC,CACD,WAAW,eAAe;IACzB,MAAM;IACN,UAAU;IACX,CAAC,CACD,OAAO,WAAW;IACjB,MAAM;IACN,OAAO;IACP,UAAU;IACX,CAAC,CACD,OAAO,eAAe;IACrB,UAAU;IACV,MAAM;IACN,SAAS;IACT,OAAO,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M;EAAK;;AAG7B,eAAe,gBAAgB,KAAa,UAAkB;AAC5D,OAAM,GAAG,UAAU;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;AAEpD,OAAM,MAAM,UAAU,EAAE,WAAW,MAAM,CAAC;AAE1C,OAAM,mBAAmB,KAAK,SAAS;;AAGzC,eAAe,eAAe,UAAkB,KAAa;AAC3D,OAAM,MAAM,KAAK,EAAE,WAAW,MAAM,CAAC;AAErC,KAAI,MAAM,YAAY,SAAS,CAC7B,OAAM,eAAe,UAAU,IAAI;KAEnC,OAAM,GAAG,UAAU,KAAK;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;;AAI7D,SAAS,YAAY,QAAc;CACjC,IAAI;CACJ,IAAI;AAEJ,KAAI,CAACA,OAAK,WAAW,OAAO,CAC1B,OAAM,WAAWA,OAAK,GAAGA,SAAO,QAAQ,QAAQ,KAAK,EAAEA,OAAK;MACvD;AACL,QAAM,2BAA2BA,OAAK;AACtC,aAAW,2BAA2BA,QAAM,EAAE,QAAQ,aAAa,CAAC;;AAGtE,QAAO;EAAE;EAAU;EAAK;;AAG1B,SAAS,2BAA2B,KAAa,EAAE,WAAgC,EAAE,EAAE;CACrF,MAAM,OAAO;EAAC,SAAS;EAAE;EAAU;EAAO,CAAC,OAAO,cAAc;CAChE,MAAM,IAAI,IAAI,IAAI,IAAI;AACtB,QAAO,KAAK,GAAG,MAAM,EAAE,UAAU,EAAE,SAAS"}
1
+ {"version":3,"file":"run.mjs","names":["yargs","path"],"sources":["../../src/commands/run.ts"],"sourcesContent":["import { cp, mkdir, rm } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { exists } from \"@aigne/agent-library/utils/fs\";\nimport { findAIGNEFile } from \"@aigne/core/loader\";\nimport { logger } from \"@aigne/core/utils/logger\";\nimport { flat, isNonNullable, pick } from \"@aigne/core/utils/type-utils\";\nimport { Listr, PRESET_TIMER } from \"@aigne/listr2\";\nimport { config } from \"dotenv-flow\";\nimport type { Argv, CommandModule } from \"yargs\";\nimport yargs from \"yargs\";\nimport { AIGNE_CLI_VERSION, CHAT_MODEL_OPTIONS } from \"../constants.js\";\nimport { isV1Package, toAIGNEPackage } from \"../utils/agent-v1.js\";\nimport { downloadAndExtract } from \"../utils/download.js\";\nimport { loadAIGNE } from \"../utils/load-aigne.js\";\nimport { isUrl } from \"../utils/url.js\";\nimport { withRunAgentCommonOptions } from \"../utils/yargs.js\";\nimport { agentCommandModule, cliAgentCommandModule } from \"./app/agent.js\";\nimport { createRunSkillCommand } from \"./run-skill.js\";\n\nlet yargsInstance: Argv | null = null;\n\nexport function createRunCommand({\n aigneFilePath,\n}: {\n aigneFilePath?: string;\n} = {}): CommandModule<\n unknown,\n { version?: boolean; path?: string; entryAgent?: string; interactive?: boolean }\n> {\n return {\n // $0 must place after 'run' to make positional args work correctly\n command: [\"run [path] [entry-agent]\", \"$0\"],\n describe: \"Run AIGNE for the specified path\",\n builder: async (yargs) => {\n yargsInstance = yargs;\n\n return yargs\n .positional(\"path\", {\n type: \"string\",\n describe: \"Path to the agents directory or URL to an aigne project\",\n default: \".\",\n })\n .positional(\"entry-agent\", {\n type: \"string\",\n describe: \"Name of the agent to run (defaults to the entry agent if not specified)\",\n })\n .option(\"version\", {\n type: \"boolean\",\n alias: \"v\",\n describe: \"Show version number\",\n })\n .option(\"interactive\", {\n describe: \"Run in interactive chat mode\",\n type: \"boolean\",\n default: false,\n alias: [\"chat\"],\n })\n .command(createRunSkillCommand())\n .help(false)\n .version(false)\n .strict(false);\n },\n handler: async (options) => {\n if (options.version) {\n console.log(AIGNE_CLI_VERSION);\n process.exit(0);\n return;\n }\n\n if (!options.entryAgent && options.path) {\n if (!(await exists(options.path)) && !isUrl(options.path)) {\n options.entryAgent = options.path;\n options.path = undefined;\n }\n }\n\n const path = aigneFilePath || options.path || \".\";\n if (\n !isUrl(path) &&\n !(await findAIGNEFile(path).catch((error) => {\n if (options._[0] !== \"run\") {\n yargsInstance?.showHelp();\n } else {\n throw error;\n }\n return false;\n }))\n ) {\n return;\n }\n\n // Parse model options for loading application\n const opts = withRunAgentCommonOptions(\n yargs(process.argv).help(false).version(false).strict(false),\n ).parseSync();\n logger.level = opts.logLevel;\n\n const { aigne } = await loadApplication(path, {\n modelOptions: pick(opts, CHAT_MODEL_OPTIONS),\n imageModelOptions: { model: opts.imageModel },\n });\n\n const subYargs = yargs().scriptName(\"\").usage(\"aigne run <path> <agent> [...options]\");\n\n if (aigne.cli.chat) {\n subYargs.command({\n ...agentCommandModule({ aigne, agent: aigne.cli.chat, interactive: true }),\n command: \"$0\",\n });\n }\n\n // Allow user to run all of agents in the AIGNE instances\n const allAgents = flat(aigne.agents, aigne.skills, aigne.cli.chat, aigne.mcpServer.agents);\n for (const agent of allAgents) {\n subYargs.command(agentCommandModule({ aigne, agent, interactive: options.interactive }));\n }\n\n for (const cliAgent of aigne.cli.agents ?? []) {\n subYargs.command(\n cliAgentCommandModule({\n aigne,\n cliAgent,\n }),\n );\n }\n\n const argv = process.argv.slice(aigneFilePath ? 3 : 2);\n if (argv[0] === \"run\") argv.shift(); // remove 'run' command\n\n // For compatibility with old `run` command like: `aigne run --path /xx/xx --entry-agent xx --xx`\n if (argv[0] === \"--path\" || argv[0] === \"--url\") argv.shift(); // remove --path flag\n if (argv[0] === options.path) argv.shift(); // remove path/url args\n if (argv[0] === \"--entry-agent\") argv.shift();\n\n const firstAgent = aigne.agents[0]?.name;\n if (!options.entryAgent && firstAgent && !argv.some((i) => [\"-h\", \"--help\"].includes(i))) {\n argv.unshift(firstAgent);\n }\n\n await subYargs\n .strict()\n .demandCommand()\n .alias(\"h\", \"help\")\n .alias(\"v\", \"version\")\n .fail((message, error, yargs) => {\n // We catch all errors below, here just print the help message non-error case like demandCommand\n if (!error) {\n yargs.showHelp();\n\n console.error(`\\n${message}`);\n process.exit(1);\n }\n })\n .parseAsync(argv);\n },\n };\n}\n\nasync function loadApplication(path: string, options: Parameters<typeof loadAIGNE>[0] = {}) {\n const { cacheDir, dir } = prepareDirs(path);\n\n if (cacheDir) {\n await new Listr(\n [\n {\n title: \"Download package\",\n task: () => downloadPackage(path, cacheDir),\n },\n {\n title: \"Extract package\",\n task: () => extractPackage(cacheDir, dir),\n },\n ],\n {\n rendererOptions: {\n collapseSubtasks: false,\n showErrorMessage: false,\n timer: PRESET_TIMER,\n },\n },\n ).run();\n }\n\n // Load env files in the aigne directory\n config({ path: dir, silent: true });\n\n const aigne = await loadAIGNE({ ...options, path: dir });\n\n return { aigne, path: dir };\n}\n\nasync function downloadPackage(url: string, cacheDir: string) {\n await rm(cacheDir, { recursive: true, force: true });\n\n await mkdir(cacheDir, { recursive: true });\n\n await downloadAndExtract(url, cacheDir);\n}\n\nasync function extractPackage(cacheDir: string, dir: string) {\n await mkdir(dir, { recursive: true });\n\n if (await isV1Package(cacheDir)) {\n await toAIGNEPackage(cacheDir, dir);\n } else {\n await cp(cacheDir, dir, { recursive: true, force: true });\n }\n}\n\nfunction prepareDirs(path: string) {\n let dir: string;\n let cacheDir: string | undefined;\n\n if (!path.startsWith(\"http\")) {\n dir = isAbsolute(path) ? path : resolve(process.cwd(), path);\n } else {\n dir = getLocalPackagePathFromUrl(path);\n cacheDir = getLocalPackagePathFromUrl(path, { subdir: \".download\" });\n }\n\n return { cacheDir, dir };\n}\n\nfunction getLocalPackagePathFromUrl(url: string, { subdir }: { subdir?: string } = {}) {\n const root = [homedir(), \".aigne\", subdir].filter(isNonNullable);\n const u = new URL(url);\n return join(...root, u.hostname, u.pathname);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,IAAI,gBAA6B;AAEjC,SAAgB,iBAAiB,EAC/B,kBAGE,EAAE,EAGJ;AACA,QAAO;EAEL,SAAS,CAAC,4BAA4B,KAAK;EAC3C,UAAU;EACV,SAAS,OAAO,YAAU;AACxB,mBAAgBA;AAEhB,UAAOA,QACJ,WAAW,QAAQ;IAClB,MAAM;IACN,UAAU;IACV,SAAS;IACV,CAA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AAiB;EACf,kBAAkB;EAClB,kBAAkB;EAClB,OAAO;EACR,EACF,CACF,CAAC,KAAK;AAIT,QAAO;EAAE,MAAM;EAAK,QAAQ;EAAM,CAAC;AAInC,QAAO;EAAE,OAFK,MAAM,UAAU;GAAE,GAAG;GAAS,MAAM;GAAK,CAAC;EAExC,MAAM;EAAK;;AAG7B,eAAe,gBAAgB,KAAa,UAAkB;AAC5D,OAAM,GAAG,UAAU;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;AAEpD,OAAM,MAAM,UAAU,EAAE,WAAW,MAAM,CAAC;AAE1C,OAAM,mBAAmB,KAAK,SAAS;;AAGzC,eAAe,eAAe,UAAkB,KAAa;AAC3D,OAAM,MAAM,KAAK,EAAE,WAAW,MAAM,CAAC;AAErC,KAAI,MAAM,YAAY,SAAS,CAC7B,OAAM,eAAe,UAAU,IAAI;KAEnC,OAAM,GAAG,UAAU,KAAK;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC;;AAI7D,SAAS,YAAY,QAAc;CACjC,IAAI;CACJ,IAAI;AAEJ,KAAI,CAACA,OAAK,WAAW,OAAO,CAC1B,OAAM,WAAWA,OAAK,GAAGA,SAAO,QAAQ,QAAQ,KAAK,EAAEA,OAAK;MACvD;AACL,QAAM,2BAA2BA,OAAK;AACtC,aAAW,2BAA2BA,QAAM,EAAE,QAAQ,aAAa,CAAC;;AAGtE,QAAO;EAAE;EAAU;EAAK;;AAG1B,SAAS,2BAA2B,KAAa,EAAE,WAAgC,EAAE,EAAE;CACrF,MAAM,OAAO;EAAC,SAAS;EAAE;EAAU;EAAO,CAAC,OAAO,cAAc;CAChE,MAAM,IAAI,IAAI,IAAI,IAAI;AACtB,QAAO,KAAK,GAAG,MAAM,EAAE,UAAU,EAAE,SAAS"}
@@ -1,5 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_utils_output = require('../utils/output.cjs');
2
3
  const require_utils_load_aigne = require('../utils/load-aigne.cjs');
4
+ const require_utils_view = require('../utils/view.cjs');
3
5
  const require_utils_serve_mcp = require('../utils/serve-mcp.cjs');
4
6
  let node_path = require("node:path");
5
7
  let _aigne_core_utils_type_utils = require("@aigne/core/utils/type-utils");
@@ -36,6 +38,19 @@ function createServeMCPCommand({ aigneFilePath } = {}) {
36
38
  }).option("aigne-hub-url", {
37
39
  describe: "Custom AIGNE Hub service URL. Used to fetch remote agent definitions or models. ",
38
40
  type: "string"
41
+ }).option("json", {
42
+ type: "boolean",
43
+ describe: "Output in JSON format",
44
+ default: false
45
+ }).option("view", {
46
+ type: "string",
47
+ describe: "Output view type (human, json, llm, default)",
48
+ choices: [
49
+ "default",
50
+ "json",
51
+ "llm",
52
+ "human"
53
+ ]
39
54
  });
40
55
  },
41
56
  handler: async (options) => {
@@ -44,25 +59,55 @@ function createServeMCPCommand({ aigneFilePath } = {}) {
44
59
  path: (0, node_path.isAbsolute)(path) ? path : (0, node_path.resolve)(process.cwd(), path),
45
60
  modelOptions: { aigneHubUrl: options.aigneHubUrl }
46
61
  });
62
+ const view = require_utils_view.detectView({
63
+ view: options.view,
64
+ json: options.json
65
+ }, {}, require_utils_view.createViewContext());
47
66
  await serveMCPServerFromDir({
48
67
  ...options,
49
- aigne
68
+ aigne,
69
+ view
50
70
  });
51
71
  }
52
72
  };
53
73
  }
54
74
  async function serveMCPServerFromDir(options) {
55
75
  const port = options.port || DEFAULT_PORT();
76
+ const view = options.view ?? "human";
56
77
  await require_utils_serve_mcp.serveMCPServer({
57
78
  aigne: options.aigne,
58
79
  host: options.host,
59
80
  port,
60
81
  pathname: options.pathname
61
82
  });
62
- console.log(`MCP server is running on http://${options.host}:${port}${options.pathname}`);
83
+ const url = `http://${options.host}:${port}${options.pathname}`;
84
+ const serverInfo = {
85
+ status: "running",
86
+ url,
87
+ host: options.host,
88
+ port,
89
+ pathname: options.pathname
90
+ };
91
+ switch (view) {
92
+ case "json":
93
+ console.log(require_utils_output.formatJSON(serverInfo));
94
+ break;
95
+ case "llm":
96
+ case "default":
97
+ console.log(require_utils_output.formatLLMDSL(serverInfo, [
98
+ "status",
99
+ "url",
100
+ "host",
101
+ "port",
102
+ "pathname"
103
+ ]));
104
+ break;
105
+ default:
106
+ console.log(`MCP server is running on ${url}`);
107
+ break;
108
+ }
63
109
  if (!process.env.CI && process.env.NODE_ENV !== "test") await new Promise(() => {});
64
110
  }
65
111
 
66
112
  //#endregion
67
- exports.createServeMCPCommand = createServeMCPCommand;
68
- exports.serveMCPServerFromDir = serveMCPServerFromDir;
113
+ exports.createServeMCPCommand = createServeMCPCommand;
@@ -1,4 +1,6 @@
1
+ import { formatJSON, formatLLMDSL } from "../utils/output.mjs";
1
2
  import { loadAIGNE } from "../utils/load-aigne.mjs";
3
+ import { createViewContext, detectView } from "../utils/view.mjs";
2
4
  import { serveMCPServer } from "../utils/serve-mcp.mjs";
3
5
  import { isAbsolute, resolve } from "node:path";
4
6
  import { tryOrThrow } from "@aigne/core/utils/type-utils";
@@ -35,6 +37,19 @@ function createServeMCPCommand({ aigneFilePath } = {}) {
35
37
  }).option("aigne-hub-url", {
36
38
  describe: "Custom AIGNE Hub service URL. Used to fetch remote agent definitions or models. ",
37
39
  type: "string"
40
+ }).option("json", {
41
+ type: "boolean",
42
+ describe: "Output in JSON format",
43
+ default: false
44
+ }).option("view", {
45
+ type: "string",
46
+ describe: "Output view type (human, json, llm, default)",
47
+ choices: [
48
+ "default",
49
+ "json",
50
+ "llm",
51
+ "human"
52
+ ]
38
53
  });
39
54
  },
40
55
  handler: async (options) => {
@@ -43,25 +58,56 @@ function createServeMCPCommand({ aigneFilePath } = {}) {
43
58
  path: isAbsolute(path$1) ? path$1 : resolve(process.cwd(), path$1),
44
59
  modelOptions: { aigneHubUrl: options.aigneHubUrl }
45
60
  });
61
+ const view = detectView({
62
+ view: options.view,
63
+ json: options.json
64
+ }, {}, createViewContext());
46
65
  await serveMCPServerFromDir({
47
66
  ...options,
48
- aigne
67
+ aigne,
68
+ view
49
69
  });
50
70
  }
51
71
  };
52
72
  }
53
73
  async function serveMCPServerFromDir(options) {
54
74
  const port = options.port || DEFAULT_PORT();
75
+ const view = options.view ?? "human";
55
76
  await serveMCPServer({
56
77
  aigne: options.aigne,
57
78
  host: options.host,
58
79
  port,
59
80
  pathname: options.pathname
60
81
  });
61
- console.log(`MCP server is running on http://${options.host}:${port}${options.pathname}`);
82
+ const url = `http://${options.host}:${port}${options.pathname}`;
83
+ const serverInfo = {
84
+ status: "running",
85
+ url,
86
+ host: options.host,
87
+ port,
88
+ pathname: options.pathname
89
+ };
90
+ switch (view) {
91
+ case "json":
92
+ console.log(formatJSON(serverInfo));
93
+ break;
94
+ case "llm":
95
+ case "default":
96
+ console.log(formatLLMDSL(serverInfo, [
97
+ "status",
98
+ "url",
99
+ "host",
100
+ "port",
101
+ "pathname"
102
+ ]));
103
+ break;
104
+ default:
105
+ console.log(`MCP server is running on ${url}`);
106
+ break;
107
+ }
62
108
  if (!process.env.CI && process.env.NODE_ENV !== "test") await new Promise(() => {});
63
109
  }
64
110
 
65
111
  //#endregion
66
- export { createServeMCPCommand, serveMCPServerFromDir };
112
+ export { createServeMCPCommand };
67
113
  //# sourceMappingURL=serve-mcp.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve-mcp.mjs","names":["path"],"sources":["../../src/commands/serve-mcp.ts"],"sourcesContent":["import { isAbsolute, resolve } from \"node:path\";\nimport type { AIGNE } from \"@aigne/core\";\nimport { tryOrThrow } from \"@aigne/core/utils/type-utils\";\nimport type { CommandModule } from \"yargs\";\nimport { loadAIGNE } from \"../utils/load-aigne.js\";\nimport { serveMCPServer } from \"../utils/serve-mcp.js\";\n\ninterface ServeMCPOptions {\n path: string;\n host: string;\n port?: number;\n pathname: string;\n aigneHubUrl?: string;\n}\n\nexport const DEFAULT_PORT = () =>\n tryOrThrow(\n () => {\n const { PORT } = process.env;\n if (!PORT) return 3000;\n const port = Number.parseInt(PORT, 10);\n if (!port || !Number.isInteger(port)) throw new Error(`Invalid PORT: ${PORT}`);\n return port;\n },\n (error) => new Error(`parse PORT error ${error.message}`),\n );\n\nexport function createServeMCPCommand({\n aigneFilePath,\n}: {\n aigneFilePath?: string;\n} = {}): CommandModule<unknown, ServeMCPOptions> {\n return {\n command: \"serve-mcp\",\n describe: \"Serve the agents in the specified directory as a MCP server (streamable http)\",\n builder: (yargs) => {\n return yargs\n .option(\"path\", {\n describe: \"Path to the agents directory or URL to aigne project\",\n type: \"string\",\n default: \".\",\n alias: [\"url\"],\n })\n .option(\"host\", {\n describe: \"Host to run the MCP server on, use 0.0.0.0 to publicly expose the server\",\n type: \"string\",\n default: \"localhost\",\n })\n .option(\"port\", {\n describe: \"Port to run the MCP server on\",\n type: \"number\",\n })\n .option(\"pathname\", {\n describe: \"Pathname to the service\",\n type: \"string\",\n default: \"/mcp\",\n })\n .option(\"aigne-hub-url\", {\n describe:\n \"Custom AIGNE Hub service URL. Used to fetch remote agent definitions or models. \",\n type: \"string\",\n });\n },\n handler: async (options) => {\n const path = aigneFilePath || options.path;\n const absolutePath = isAbsolute(path) ? path : resolve(process.cwd(), path);\n\n const aigne = await loadAIGNE({\n path: absolutePath,\n modelOptions: { aigneHubUrl: options.aigneHubUrl },\n });\n\n await serveMCPServerFromDir({ ...options, aigne });\n },\n };\n}\n\nexport async function serveMCPServerFromDir(options: {\n aigne: AIGNE;\n host: string;\n port?: number;\n pathname: string;\n}) {\n const port = options.port || DEFAULT_PORT();\n\n await serveMCPServer({\n aigne: options.aigne,\n host: options.host,\n port,\n pathname: options.pathname,\n });\n\n console.log(`MCP server is running on http://${options.host}:${port}${options.pathname}`);\n\n if (!process.env.CI && process.env.NODE_ENV !== \"test\") await new Promise(() => {}); // Keep the server running\n}\n"],"mappings":";;;;;;AAeA,MAAa,qBACX,iBACQ;CACJ,MAAM,EAAE,SAAS,QAAQ;AACzB,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,OAAO,OAAO,SAAS,MAAM,GAAG;AACtC,KAAI,CAAC,QAAQ,CAAC,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node:path\";\nimport type { AIGNE } from \"@aigne/core\";\nimport { tryOrThrow } from \"@aigne/core/utils/type-utils\";\nimport type { CommandModule } from \"yargs\";\nimport { loadAIGNE } from \"../utils/load-aigne.js\";\nimport { formatJSON, formatLLMDSL } from \"../utils/output.js\";\nimport { serveMCPServer } from \"../utils/serve-mcp.js\";\nimport { createViewContext, detectView, type ViewType } from \"../utils/view.js\";\n\ninterface ServeMCPOptions {\n path: string;\n host: string;\n port?: number;\n pathname: string;\n aigneHubUrl?: string;\n json?: boolean;\n view?: ViewType;\n}\n\nexport const DEFAULT_PORT = () =>\n tryOrThrow(\n () => {\n const { PORT } = process.env;\n if (!PORT) return 3000;\n const port = Number.parseInt(PORT, 10);\n if (!port || !Number.isInteger(port)) throw new Error(`Invalid PORT: ${PORT}`);\n return port;\n },\n (error) => new Error(`parse PORT error ${error.message}`),\n );\n\nexport function createServeMCPCommand({\n aigneFilePath,\n}: {\n aigneFilePath?: string;\n} = {}): CommandModule<unknown, ServeMCPOptions> {\n return {\n command: \"serve-mcp\",\n describe: \"Serve the agents in the specified directory as a MCP server (streamable http)\",\n builder: (yargs) => {\n return yargs\n .option(\"path\", {\n describe: \"Path to the agents directory or URL to aigne project\",\n type: \"string\",\n default: \".\",\n alias: [\"url\"],\n })\n .option(\"host\", {\n describe: \"Host to run the MCP server on, use 0.0.0.0 to publicly expose the server\",\n type: \"string\",\n default: \"localhost\",\n })\n .option(\"port\", {\n describe: \"Port to run the MCP server on\",\n type: \"number\",\n })\n .option(\"pathname\", {\n describe: \"Pathname to the service\",\n type: \"string\",\n default: \"/mcp\",\n })\n .option(\"aigne-hub-url\", {\n describe:\n \"Custom AIGNE Hub service URL. Used to fetch remote agent definitions or models. \",\n type: \"string\",\n })\n .option(\"json\", {\n type: \"boolean\",\n describe: \"Output in JSON format\",\n default: false,\n })\n .option(\"view\", {\n type: \"string\",\n describe: \"Output view type (human, json, llm, default)\",\n choices: [\"default\", \"json\", \"llm\", \"human\"] as const,\n });\n },\n handler: async (options) => {\n const path = aigneFilePath || options.path;\n const absolutePath = isAbsolute(path) ? path : resolve(process.cwd(), path);\n\n const aigne = await loadAIGNE({\n path: absolutePath,\n modelOptions: { aigneHubUrl: options.aigneHubUrl },\n });\n\n // Detect view based on options and context\n const view = detectView(\n { view: options.view as ViewType, json: options.json },\n {},\n createViewContext(),\n );\n\n await serveMCPServerFromDir({ ...options, aigne, view });\n },\n };\n}\n\nexport async function serveMCPServerFromDir(options: {\n aigne: AIGNE;\n host: string;\n port?: number;\n pathname: string;\n view?: ViewType;\n}) {\n const port = options.port || DEFAULT_PORT();\n const view = options.view ?? \"human\";\n\n await serveMCPServer({\n aigne: options.aigne,\n host: options.host,\n port,\n pathname: options.pathname,\n });\n\n const url = `http://${options.host}:${port}${options.pathname}`;\n const serverInfo = {\n status: \"running\",\n url,\n host: options.host,\n port,\n pathname: options.pathname,\n };\n\n switch (view) {\n case \"json\":\n console.log(formatJSON(serverInfo));\n break;\n case \"llm\":\n case \"default\":\n console.log(formatLLMDSL(serverInfo, [\"status\", \"url\", \"host\", \"port\", \"pathname\"]));\n break;\n default:\n console.log(`MCP server is running on ${url}`);\n break;\n }\n\n if (!process.env.CI && process.env.NODE_ENV !== \"test\") await new Promise(() => {}); // Keep the server running\n}\n"],"mappings":";;;;;;;;AAmBA,MAAa,qBACX,iBACQ;CACJ,MAAM,EAAE,SAAS,QAAQ;AACzB,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,OAAO,OAAO,SAAS,MAAM,GAAG;AACtC,KAAI,CAAC,QAAQ,CAAC,OAAO,UAAU,KAAK,CAAE,OAAM,IAAI,MAAM,iBAAiB,OAAO;AAC9E,QAAO;IAER,0BAAU,IAAI,MAAM,oBAAoB,MAAM,UAAU,CAC1D;AAEH,SAAgB,sBAAsB,EACpC,kBAGE,EAAE,EAA2C;AAC/C,QAAO;EACL,SAAS;EACT,UAAU;EACV,UAAU,UAAU;AAClB,UAAO,MACJ,OAAO,QAAQ;IACd,UAAU;IACV,M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