@aigne/cli 1.59.1-beta → 1.74.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/bunwrapper.cjs +22 -0
- package/dist/bunwrapper.d.cts +1 -0
- package/dist/bunwrapper.d.mts +1 -0
- package/dist/bunwrapper.mjs +23 -0
- package/dist/bunwrapper.mjs.map +1 -0
- package/dist/cli.cjs +42 -0
- package/dist/cli.d.cts +9 -0
- package/dist/cli.d.cts.map +1 -0
- package/dist/cli.d.mts +10 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +41 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/commands/aigne.cjs +23 -0
- package/dist/commands/aigne.mjs +22 -0
- package/dist/commands/aigne.mjs.map +1 -0
- package/dist/commands/app/agent.cjs +117 -0
- package/dist/commands/app/agent.mjs +113 -0
- package/dist/commands/app/agent.mjs.map +1 -0
- package/dist/commands/app/app.cjs +92 -0
- package/dist/commands/app/app.mjs +90 -0
- package/dist/commands/app/app.mjs.map +1 -0
- package/dist/commands/app/cli.cjs +6 -0
- package/dist/commands/app/cli.d.cts +1 -0
- package/dist/commands/app/cli.d.mts +1 -0
- package/dist/commands/app/cli.mjs +8 -0
- package/dist/commands/app/cli.mjs.map +1 -0
- package/dist/commands/app/upgrade.cjs +243 -0
- package/dist/commands/app/upgrade.mjs +240 -0
- package/dist/commands/app/upgrade.mjs.map +1 -0
- package/dist/commands/app.cjs +53 -0
- package/dist/commands/app.mjs +53 -0
- package/dist/commands/app.mjs.map +1 -0
- package/dist/commands/create.cjs +66 -0
- package/dist/commands/create.mjs +65 -0
- package/dist/commands/create.mjs.map +1 -0
- package/dist/commands/deploy.cjs +237 -0
- package/dist/commands/deploy.mjs +237 -0
- package/dist/commands/deploy.mjs.map +1 -0
- package/dist/commands/eval.cjs +88 -0
- package/dist/commands/eval.mjs +88 -0
- package/dist/commands/eval.mjs.map +1 -0
- package/dist/commands/hub.cjs +297 -0
- package/dist/commands/hub.mjs +294 -0
- package/dist/commands/hub.mjs.map +1 -0
- package/dist/commands/observe.cjs +49 -0
- package/dist/commands/observe.mjs +46 -0
- package/dist/commands/observe.mjs.map +1 -0
- package/dist/commands/run-skill.cjs +84 -0
- package/dist/commands/run-skill.mjs +81 -0
- package/dist/commands/run-skill.mjs.map +1 -0
- package/dist/commands/run.cjs +172 -0
- package/dist/commands/run.mjs +171 -0
- package/dist/commands/run.mjs.map +1 -0
- package/dist/commands/serve-mcp.cjs +68 -0
- package/dist/commands/serve-mcp.mjs +67 -0
- package/dist/commands/serve-mcp.mjs.map +1 -0
- package/dist/commands/test.cjs +40 -0
- package/dist/commands/test.mjs +39 -0
- package/dist/commands/test.mjs.map +1 -0
- package/dist/constants.cjs +28 -0
- package/dist/constants.d.cts +9 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +9 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +24 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/global.d.cjs +0 -0
- package/dist/global.d.cts +6 -0
- package/dist/global.d.cts.map +1 -0
- package/dist/global.d.mts +6 -0
- package/dist/global.d.mts.map +1 -0
- package/dist/index.cjs +0 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/tracer/terminal.cjs +336 -0
- package/dist/tracer/terminal.mjs +332 -0
- package/dist/tracer/terminal.mjs.map +1 -0
- package/dist/type.cjs +0 -0
- package/dist/type.d.cts +10 -0
- package/dist/type.d.cts.map +1 -0
- package/dist/type.d.mts +10 -0
- package/dist/type.d.mts.map +1 -0
- package/dist/type.mjs +1 -0
- package/dist/ui/utils/terminal-input.cjs +145 -0
- package/dist/ui/utils/terminal-input.mjs +144 -0
- package/dist/ui/utils/terminal-input.mjs.map +1 -0
- package/dist/ui/utils/text-buffer.cjs +865 -0
- package/dist/ui/utils/text-buffer.mjs +865 -0
- package/dist/ui/utils/text-buffer.mjs.map +1 -0
- package/dist/ui/utils/text-utils.cjs +85 -0
- package/dist/ui/utils/text-utils.mjs +78 -0
- package/dist/ui/utils/text-utils.mjs.map +1 -0
- package/dist/utils/agent-v1.cjs +180 -0
- package/dist/utils/agent-v1.d.cts +138 -0
- package/dist/utils/agent-v1.d.cts.map +1 -0
- package/dist/utils/agent-v1.d.mts +138 -0
- package/dist/utils/agent-v1.d.mts.map +1 -0
- package/dist/utils/agent-v1.mjs +179 -0
- package/dist/utils/agent-v1.mjs.map +1 -0
- package/dist/utils/aigne-hub/constants.cjs +22 -0
- package/dist/utils/aigne-hub/constants.mjs +18 -0
- package/dist/utils/aigne-hub/constants.mjs.map +1 -0
- package/dist/utils/aigne-hub/credential.cjs +179 -0
- package/dist/utils/aigne-hub/credential.mjs +175 -0
- package/dist/utils/aigne-hub/credential.mjs.map +1 -0
- package/dist/utils/aigne-hub/crypto.cjs +41 -0
- package/dist/utils/aigne-hub/crypto.mjs +33 -0
- package/dist/utils/aigne-hub/crypto.mjs.map +1 -0
- package/dist/utils/aigne-hub/model.cjs +112 -0
- package/dist/utils/aigne-hub/model.d.cts +19 -0
- package/dist/utils/aigne-hub/model.d.cts.map +1 -0
- package/dist/utils/aigne-hub/model.d.mts +19 -0
- package/dist/utils/aigne-hub/model.d.mts.map +1 -0
- package/dist/utils/aigne-hub/model.mjs +106 -0
- package/dist/utils/aigne-hub/model.mjs.map +1 -0
- package/dist/utils/aigne-hub/store/file.cjs +64 -0
- package/dist/utils/aigne-hub/store/file.mjs +64 -0
- package/dist/utils/aigne-hub/store/file.mjs.map +1 -0
- package/dist/utils/aigne-hub/store/index.cjs +37 -0
- package/dist/utils/aigne-hub/store/index.mjs +37 -0
- package/dist/utils/aigne-hub/store/index.mjs.map +1 -0
- package/dist/utils/aigne-hub/store/keytar.cjs +61 -0
- package/dist/utils/aigne-hub/store/keytar.mjs +61 -0
- package/dist/utils/aigne-hub/store/keytar.mjs.map +1 -0
- package/dist/utils/aigne-hub/store/migrate.cjs +46 -0
- package/dist/utils/aigne-hub/store/migrate.mjs +45 -0
- package/dist/utils/aigne-hub/store/migrate.mjs.map +1 -0
- package/dist/utils/aigne-hub/type.d.cts +18 -0
- package/dist/utils/aigne-hub/type.d.cts.map +1 -0
- package/dist/utils/aigne-hub/type.d.mts +18 -0
- package/dist/utils/aigne-hub/type.d.mts.map +1 -0
- package/dist/utils/aigne-hub-user.cjs +11 -0
- package/dist/utils/aigne-hub-user.d.cts +23 -0
- package/dist/utils/aigne-hub-user.d.cts.map +1 -0
- package/dist/utils/aigne-hub-user.d.mts +23 -0
- package/dist/utils/aigne-hub-user.d.mts.map +1 -0
- package/dist/utils/aigne-hub-user.mjs +11 -0
- package/dist/utils/aigne-hub-user.mjs.map +1 -0
- package/dist/utils/ascii-logo.cjs +30 -0
- package/dist/utils/ascii-logo.d.cts +5 -0
- package/dist/utils/ascii-logo.d.cts.map +1 -0
- package/dist/utils/ascii-logo.d.mts +5 -0
- package/dist/utils/ascii-logo.d.mts.map +1 -0
- package/dist/utils/{ascii-logo.js → ascii-logo.mjs} +13 -3
- package/dist/utils/ascii-logo.mjs.map +1 -0
- package/dist/utils/download.cjs +25 -0
- package/dist/utils/download.d.cts +7 -0
- package/dist/utils/download.d.cts.map +1 -0
- package/dist/utils/download.d.mts +7 -0
- package/dist/utils/download.d.mts.map +1 -0
- package/dist/utils/download.mjs +25 -0
- package/dist/utils/download.mjs.map +1 -0
- package/dist/utils/evaluation/core.cjs +84 -0
- package/dist/utils/evaluation/core.mjs +84 -0
- package/dist/utils/evaluation/core.mjs.map +1 -0
- package/dist/utils/evaluation/dataset.cjs +47 -0
- package/dist/utils/evaluation/dataset.mjs +46 -0
- package/dist/utils/evaluation/dataset.mjs.map +1 -0
- package/dist/utils/evaluation/evaluator.cjs +109 -0
- package/dist/utils/evaluation/{evaluator.js → evaluator.mjs} +48 -45
- package/dist/utils/evaluation/evaluator.mjs.map +1 -0
- package/dist/utils/evaluation/reporter.cjs +225 -0
- package/dist/utils/evaluation/reporter.mjs +220 -0
- package/dist/utils/evaluation/reporter.mjs.map +1 -0
- package/dist/utils/evaluation/runner.cjs +85 -0
- package/dist/utils/evaluation/runner.mjs +85 -0
- package/dist/utils/evaluation/runner.mjs.map +1 -0
- package/dist/utils/get-url-origin.cjs +12 -0
- package/dist/utils/get-url-origin.d.cts +5 -0
- package/dist/utils/get-url-origin.d.cts.map +1 -0
- package/dist/utils/get-url-origin.d.mts +5 -0
- package/dist/utils/get-url-origin.d.mts.map +1 -0
- package/dist/utils/get-url-origin.mjs +12 -0
- package/dist/utils/get-url-origin.mjs.map +1 -0
- package/dist/utils/inquirer/checkbox.cjs +265 -0
- package/dist/utils/inquirer/checkbox.mjs +262 -0
- package/dist/utils/inquirer/checkbox.mjs.map +1 -0
- package/dist/utils/listr.cjs +226 -0
- package/dist/utils/listr.d.cts +71 -0
- package/dist/utils/listr.d.cts.map +1 -0
- package/dist/utils/listr.d.mts +71 -0
- package/dist/utils/listr.d.mts.map +1 -0
- package/dist/utils/listr.mjs +222 -0
- package/dist/utils/listr.mjs.map +1 -0
- package/dist/utils/load-aigne.cjs +77 -0
- package/dist/utils/load-aigne.d.cts +29 -0
- package/dist/utils/load-aigne.d.cts.map +1 -0
- package/dist/utils/load-aigne.d.mts +29 -0
- package/dist/utils/load-aigne.d.mts.map +1 -0
- package/dist/utils/load-aigne.mjs +74 -0
- package/dist/utils/load-aigne.mjs.map +1 -0
- package/dist/utils/run-chat-loop.cjs +90 -0
- package/dist/utils/run-chat-loop.d.cts +20 -0
- package/dist/utils/run-chat-loop.d.cts.map +1 -0
- package/dist/utils/run-chat-loop.d.mts +20 -0
- package/dist/utils/run-chat-loop.d.mts.map +1 -0
- package/dist/utils/run-chat-loop.mjs +89 -0
- package/dist/utils/run-chat-loop.mjs.map +1 -0
- package/dist/utils/run-with-aigne.cjs +131 -0
- package/dist/utils/run-with-aigne.d.cts +46 -0
- package/dist/utils/run-with-aigne.d.cts.map +1 -0
- package/dist/utils/run-with-aigne.d.mts +46 -0
- package/dist/utils/run-with-aigne.d.mts.map +1 -0
- package/dist/utils/run-with-aigne.mjs +126 -0
- package/dist/utils/run-with-aigne.mjs.map +1 -0
- package/dist/utils/serve-mcp.cjs +91 -0
- package/dist/utils/serve-mcp.d.cts +20 -0
- package/dist/utils/serve-mcp.d.cts.map +1 -0
- package/dist/utils/serve-mcp.d.mts +20 -0
- package/dist/utils/serve-mcp.d.mts.map +1 -0
- package/dist/utils/serve-mcp.mjs +89 -0
- package/dist/utils/serve-mcp.mjs.map +1 -0
- package/dist/utils/spinner.cjs +19 -0
- package/dist/utils/spinner.d.cts +5 -0
- package/dist/utils/spinner.d.cts.map +1 -0
- package/dist/utils/spinner.d.mts +5 -0
- package/dist/utils/spinner.d.mts.map +1 -0
- package/dist/utils/spinner.mjs +19 -0
- package/dist/utils/spinner.mjs.map +1 -0
- package/dist/utils/string-utils.cjs +11 -0
- package/dist/utils/string-utils.d.cts +5 -0
- package/dist/utils/string-utils.d.cts.map +1 -0
- package/dist/utils/string-utils.d.mts +5 -0
- package/dist/utils/string-utils.d.mts.map +1 -0
- package/dist/utils/string-utils.mjs +10 -0
- package/dist/utils/string-utils.mjs.map +1 -0
- package/dist/utils/time.cjs +14 -0
- package/dist/utils/time.d.cts +5 -0
- package/dist/utils/time.d.cts.map +1 -0
- package/dist/utils/time.d.mts +5 -0
- package/dist/utils/time.d.mts.map +1 -0
- package/dist/utils/time.mjs +14 -0
- package/dist/utils/time.mjs.map +1 -0
- package/dist/utils/url.cjs +8 -0
- package/dist/utils/url.d.cts +5 -0
- package/dist/utils/url.d.cts.map +1 -0
- package/dist/utils/url.d.mts +5 -0
- package/dist/utils/url.d.mts.map +1 -0
- package/dist/utils/url.mjs +8 -0
- package/dist/utils/url.mjs.map +1 -0
- package/dist/utils/yargs.cjs +191 -0
- package/dist/utils/yargs.d.cts +96 -0
- package/dist/utils/yargs.d.cts.map +1 -0
- package/dist/utils/yargs.d.mts +96 -0
- package/dist/utils/yargs.d.mts.map +1 -0
- package/dist/utils/yargs.mjs +186 -0
- package/dist/utils/yargs.mjs.map +1 -0
- package/package.json +122 -45
- package/CHANGELOG.md +0 -4994
- package/dist/bunwrapper.d.ts +0 -2
- package/dist/bunwrapper.js +0 -18
- package/dist/cli.d.ts +0 -7
- package/dist/cli.js +0 -42
- package/dist/commands/aigne.d.ts +0 -4
- package/dist/commands/aigne.js +0 -35
- package/dist/commands/app/agent.d.ts +0 -26
- package/dist/commands/app/agent.js +0 -111
- package/dist/commands/app/app.d.ts +0 -7
- package/dist/commands/app/app.js +0 -92
- package/dist/commands/app/cli.d.ts +0 -1
- package/dist/commands/app/cli.js +0 -2
- package/dist/commands/app/upgrade.d.ts +0 -54
- package/dist/commands/app/upgrade.js +0 -236
- package/dist/commands/app.d.ts +0 -4
- package/dist/commands/app.js +0 -54
- package/dist/commands/create.d.ts +0 -6
- package/dist/commands/create.js +0 -74
- package/dist/commands/deploy.d.ts +0 -11
- package/dist/commands/deploy.js +0 -255
- package/dist/commands/eval.d.ts +0 -11
- package/dist/commands/eval.js +0 -110
- package/dist/commands/hub.d.ts +0 -3
- package/dist/commands/hub.js +0 -323
- package/dist/commands/observe.d.ts +0 -7
- package/dist/commands/observe.js +0 -41
- package/dist/commands/run-skill.d.ts +0 -6
- package/dist/commands/run-skill.js +0 -102
- package/dist/commands/run.d.ts +0 -9
- package/dist/commands/run.js +0 -187
- package/dist/commands/serve-mcp.d.ts +0 -20
- package/dist/commands/serve-mcp.js +0 -67
- package/dist/commands/test.d.ts +0 -9
- package/dist/commands/test.js +0 -33
- package/dist/constants.d.ts +0 -7
- package/dist/constants.js +0 -21
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/tracer/terminal.d.ts +0 -62
- package/dist/tracer/terminal.js +0 -404
- package/dist/type.d.ts +0 -5
- package/dist/type.js +0 -1
- package/dist/ui/utils/terminal-input.d.ts +0 -19
- package/dist/ui/utils/terminal-input.js +0 -123
- package/dist/ui/utils/text-buffer.d.ts +0 -87
- package/dist/ui/utils/text-buffer.js +0 -1059
- package/dist/ui/utils/text-utils.d.ts +0 -37
- package/dist/ui/utils/text-utils.js +0 -185
- package/dist/utils/agent-v1.d.ts +0 -134
- package/dist/utils/agent-v1.js +0 -213
- package/dist/utils/aigne-hub/constants.d.ts +0 -6
- package/dist/utils/aigne-hub/constants.js +0 -12
- package/dist/utils/aigne-hub/credential.d.ts +0 -20
- package/dist/utils/aigne-hub/credential.js +0 -182
- package/dist/utils/aigne-hub/crypto.d.ts +0 -4
- package/dist/utils/aigne-hub/crypto.js +0 -30
- package/dist/utils/aigne-hub/model.d.ts +0 -13
- package/dist/utils/aigne-hub/model.js +0 -122
- package/dist/utils/aigne-hub/store/file.d.ts +0 -15
- package/dist/utils/aigne-hub/store/file.js +0 -69
- package/dist/utils/aigne-hub/store/index.d.ts +0 -5
- package/dist/utils/aigne-hub/store/index.js +0 -43
- package/dist/utils/aigne-hub/store/keytar.d.ts +0 -15
- package/dist/utils/aigne-hub/store/keytar.js +0 -67
- package/dist/utils/aigne-hub/store/migrate.d.ts +0 -2
- package/dist/utils/aigne-hub/store/migrate.js +0 -57
- package/dist/utils/aigne-hub/type.d.ts +0 -38
- package/dist/utils/aigne-hub/type.js +0 -1
- package/dist/utils/aigne-hub-user.d.ts +0 -16
- package/dist/utils/aigne-hub-user.js +0 -10
- package/dist/utils/ascii-logo.d.ts +0 -1
- package/dist/utils/download.d.ts +0 -3
- package/dist/utils/download.js +0 -19
- package/dist/utils/evaluation/core.d.ts +0 -8
- package/dist/utils/evaluation/core.js +0 -83
- package/dist/utils/evaluation/dataset.d.ts +0 -15
- package/dist/utils/evaluation/dataset.js +0 -61
- package/dist/utils/evaluation/evaluator.d.ts +0 -9
- package/dist/utils/evaluation/reporter.d.ts +0 -28
- package/dist/utils/evaluation/reporter.js +0 -221
- package/dist/utils/evaluation/runner.d.ts +0 -16
- package/dist/utils/evaluation/runner.js +0 -129
- package/dist/utils/evaluation/type.d.ts +0 -69
- package/dist/utils/evaluation/type.js +0 -1
- package/dist/utils/get-url-origin.d.ts +0 -1
- package/dist/utils/get-url-origin.js +0 -8
- package/dist/utils/inquirer/checkbox.d.ts +0 -55
- package/dist/utils/inquirer/checkbox.js +0 -319
- package/dist/utils/listr.d.ts +0 -64
- package/dist/utils/listr.js +0 -265
- package/dist/utils/load-aigne.d.ts +0 -18
- package/dist/utils/load-aigne.js +0 -80
- package/dist/utils/run-chat-loop.d.ts +0 -15
- package/dist/utils/run-chat-loop.js +0 -87
- package/dist/utils/run-with-aigne.d.ts +0 -27
- package/dist/utils/run-with-aigne.js +0 -157
- package/dist/utils/serve-mcp.d.ts +0 -9
- package/dist/utils/serve-mcp.js +0 -93
- package/dist/utils/spinner.d.ts +0 -1
- package/dist/utils/spinner.js +0 -14
- package/dist/utils/string-utils.d.ts +0 -1
- package/dist/utils/string-utils.js +0 -4
- package/dist/utils/time.d.ts +0 -1
- package/dist/utils/time.js +0 -12
- package/dist/utils/url.d.ts +0 -1
- package/dist/utils/url.js +0 -3
- package/dist/utils/yargs.d.ts +0 -94
- package/dist/utils/yargs.js +0 -210
package/README.md
CHANGED
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<picture>
|
|
5
|
-
<source srcset="https://raw.githubusercontent.com/
|
|
6
|
-
<source srcset="https://raw.githubusercontent.com/
|
|
7
|
-
<img src="https://raw.githubusercontent.com/
|
|
5
|
+
<source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/packages/cli/logo-dark.svg" media="(prefers-color-scheme: dark)">
|
|
6
|
+
<source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/packages/cli/logo.svg" media="(prefers-color-scheme: light)">
|
|
7
|
+
<img src="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/packages/cli/logo.svg" alt="AIGNE Logo" width="400" />
|
|
8
8
|
</picture>
|
|
9
9
|
|
|
10
10
|
<center>Your command center for agent development</center>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
|
-
[](https://star-history.com/#ArcBlock/aigne-framework)
|
|
14
|
+
[](https://github.com/ArcBlock/aigne-framework/issues)
|
|
15
|
+
[](https://codecov.io/gh/ArcBlock/aigne-framework)
|
|
16
16
|
[](https://www.npmjs.com/package/@aigne/cli)
|
|
17
|
-
[](https://github.com/
|
|
17
|
+
[](https://github.com/ArcBlock/aigne-framework/blob/main/LICENSE)
|
|
18
18
|
|
|
19
|
-
Command-line tool for [AIGNE Framework](https://github.com/
|
|
19
|
+
Command-line tool for [AIGNE Framework](https://github.com/ArcBlock/aigne-framework), providing convenient development and management capabilities.
|
|
20
20
|
|
|
21
21
|
## Introduction
|
|
22
22
|
|
|
23
|
-
`@aigne/cli` is the official command-line tool for [AIGNE Framework](https://github.com/
|
|
23
|
+
`@aigne/cli` is the official command-line tool for [AIGNE Framework](https://github.com/ArcBlock/aigne-framework), designed to simplify the development, testing, and deployment processes for AIGNE applications. It provides a series of useful commands to help developers quickly create projects, run agents, test code, and deploy applications.
|
|
24
24
|
|
|
25
25
|
<picture>
|
|
26
|
-
<source srcset="https://raw.githubusercontent.com/
|
|
27
|
-
<source srcset="https://raw.githubusercontent.com/
|
|
28
|
-
<img src="https://raw.githubusercontent.com/
|
|
26
|
+
<source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/assets/aigne-cli-dark.png" media="(prefers-color-scheme: dark)">
|
|
27
|
+
<source srcset="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/assets/aigne-cli.png" media="(prefers-color-scheme: light)">
|
|
28
|
+
<img src="https://raw.githubusercontent.com/ArcBlock/aigne-framework/main/aigne-cli.png" alt="AIGNE Arch" />
|
|
29
29
|
</picture>
|
|
30
30
|
|
|
31
31
|
## Features
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
let node_child_process = require("node:child_process");
|
|
4
|
+
let node_process = require("node:process");
|
|
5
|
+
|
|
6
|
+
//#region src/bunwrapper.ts
|
|
7
|
+
if (!getBunVersion()) (0, node_child_process.spawnSync)("npx", [
|
|
8
|
+
"-y",
|
|
9
|
+
"bun",
|
|
10
|
+
...node_process.argv.slice(2)
|
|
11
|
+
], { stdio: "inherit" });
|
|
12
|
+
else (0, node_child_process.spawnSync)("bun", node_process.argv.slice(2), { stdio: "inherit" });
|
|
13
|
+
function getBunVersion() {
|
|
14
|
+
try {
|
|
15
|
+
const { stdout } = (0, node_child_process.spawnSync)("bun", ["--version"], { stdio: "pipe" });
|
|
16
|
+
return stdout.toString().trim() || void 0;
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { argv } from "node:process";
|
|
4
|
+
|
|
5
|
+
//#region src/bunwrapper.ts
|
|
6
|
+
if (!getBunVersion()) spawnSync("npx", [
|
|
7
|
+
"-y",
|
|
8
|
+
"bun",
|
|
9
|
+
...argv.slice(2)
|
|
10
|
+
], { stdio: "inherit" });
|
|
11
|
+
else spawnSync("bun", argv.slice(2), { stdio: "inherit" });
|
|
12
|
+
function getBunVersion() {
|
|
13
|
+
try {
|
|
14
|
+
const { stdout } = spawnSync("bun", ["--version"], { stdio: "pipe" });
|
|
15
|
+
return stdout.toString().trim() || void 0;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { };
|
|
23
|
+
//# sourceMappingURL=bunwrapper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bunwrapper.mjs","names":[],"sources":["../src/bunwrapper.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { spawnSync } from \"node:child_process\";\nimport { argv } from \"node:process\";\n\nif (!getBunVersion()) {\n spawnSync(\"npx\", [\"-y\", \"bun\", ...argv.slice(2)], { stdio: \"inherit\" });\n} else {\n spawnSync(\"bun\", argv.slice(2), { stdio: \"inherit\" });\n}\n\nfunction getBunVersion() {\n try {\n const { stdout } = spawnSync(\"bun\", [\"--version\"], { stdio: \"pipe\" });\n return stdout.toString().trim() || undefined;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;AAKA,IAAI,CAAC,eAAe,CAClB,WAAU,OAAO;CAAC;CAAM;CAAO,GAAG,KAAK,MAAM,EAAE;CAAC,EAAE,EAAE,OAAO,WAAW,CAAC;IAEvE,WAAU,OAAO,KAAK,MAAM,EAAE,EAAE,EAAE,OAAO,WAAW,CAAC;AAGvD,SAAS,gBAAgB;AACvB,KAAI;EACF,MAAM,EAAE,WAAW,UAAU,OAAO,CAAC,YAAY,EAAE,EAAE,OAAO,QAAQ,CAAC;AACrE,SAAO,OAAO,UAAU,CAAC,MAAM,IAAI;SAC7B;AACN,SAAO"}
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_utils_string_utils = require('./utils/string-utils.cjs');
|
|
4
|
+
const require_aigne = require('./commands/aigne.cjs');
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
|
+
let _aigne_core_utils_logger = require("@aigne/core/utils/logger");
|
|
7
|
+
let chalk = require("chalk");
|
|
8
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
9
|
+
let dotenv_flow = require("dotenv-flow");
|
|
10
|
+
|
|
11
|
+
//#region src/cli.ts
|
|
12
|
+
(0, dotenv_flow.config)({ silent: true });
|
|
13
|
+
function getAIGNEFilePath() {
|
|
14
|
+
let file = process.argv[2];
|
|
15
|
+
if (file) {
|
|
16
|
+
if (!(0, node_fs.existsSync)(file)) return;
|
|
17
|
+
file = (0, node_fs.realpathSync)(file);
|
|
18
|
+
if ((0, node_fs.statSync)(file).isFile()) return file;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const aigneFilePath = getAIGNEFilePath();
|
|
22
|
+
const argv = process.argv.slice(aigneFilePath ? 3 : 2);
|
|
23
|
+
var cli_default = require_aigne.createAIGNECommand({
|
|
24
|
+
argv,
|
|
25
|
+
aigneFilePath
|
|
26
|
+
}).fail((message, error, yargs) => {
|
|
27
|
+
if (!error) {
|
|
28
|
+
yargs.showHelp();
|
|
29
|
+
console.error(`\n${message}`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}).parseAsync(argv).catch((error) => {
|
|
33
|
+
if (error.name !== "ExitPromptError") {
|
|
34
|
+
console.log("");
|
|
35
|
+
if (_aigne_core_utils_logger.logger.enabled(_aigne_core_utils_logger.LogLevel.ERROR)) console.error(chalk.default.red(error.stack));
|
|
36
|
+
else console.error(`${chalk.default.red("Error:")} ${require_utils_string_utils.highlightUrl(error.message)}`);
|
|
37
|
+
}
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
module.exports = cli_default;
|
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.cts","names":[],"sources":["../src/cli.ts"],"mappings":""}
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.mts","names":[],"sources":["../src/cli.ts"],"mappings":""}
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { highlightUrl } from "./utils/string-utils.mjs";
|
|
3
|
+
import { createAIGNECommand } from "./commands/aigne.mjs";
|
|
4
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
5
|
+
import { LogLevel, logger } from "@aigne/core/utils/logger";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import { config } from "dotenv-flow";
|
|
8
|
+
|
|
9
|
+
//#region src/cli.ts
|
|
10
|
+
config({ silent: true });
|
|
11
|
+
function getAIGNEFilePath() {
|
|
12
|
+
let file = process.argv[2];
|
|
13
|
+
if (file) {
|
|
14
|
+
if (!existsSync(file)) return;
|
|
15
|
+
file = realpathSync(file);
|
|
16
|
+
if (statSync(file).isFile()) return file;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const aigneFilePath = getAIGNEFilePath();
|
|
20
|
+
const argv = process.argv.slice(aigneFilePath ? 3 : 2);
|
|
21
|
+
var cli_default = createAIGNECommand({
|
|
22
|
+
argv,
|
|
23
|
+
aigneFilePath
|
|
24
|
+
}).fail((message, error, yargs) => {
|
|
25
|
+
if (!error) {
|
|
26
|
+
yargs.showHelp();
|
|
27
|
+
console.error(`\n${message}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
}).parseAsync(argv).catch((error) => {
|
|
31
|
+
if (error.name !== "ExitPromptError") {
|
|
32
|
+
console.log("");
|
|
33
|
+
if (logger.enabled(LogLevel.ERROR)) console.error(chalk.red(error.stack));
|
|
34
|
+
else console.error(`${chalk.red("Error:")} ${highlightUrl(error.message)}`);
|
|
35
|
+
}
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { cli_default as default };
|
|
41
|
+
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, realpathSync, statSync } from \"node:fs\";\nimport { LogLevel, logger } from \"@aigne/core/utils/logger\";\nimport chalk from \"chalk\";\nimport { config } from \"dotenv-flow\";\nimport { createAIGNECommand } from \"./commands/aigne.js\";\nimport { highlightUrl } from \"./utils/string-utils.js\";\n\nconfig({ silent: true });\n\nfunction getAIGNEFilePath() {\n let file = process.argv[2];\n if (file) {\n if (!existsSync(file)) return;\n file = realpathSync(file);\n if (statSync(file).isFile()) return file;\n }\n}\n\nconst aigneFilePath = getAIGNEFilePath();\n\nconst argv = process.argv.slice(aigneFilePath ? 3 : 2);\n\nexport default createAIGNECommand({ argv, aigneFilePath })\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 .catch((error: Error) => {\n if (error.name !== \"ExitPromptError\") {\n console.log(\"\"); // Add an empty line for better readability\n\n if (logger.enabled(LogLevel.ERROR)) {\n console.error(chalk.red(error.stack));\n } else {\n console.error(`${chalk.red(\"Error:\")} ${highlightUrl(error.message)}`);\n }\n }\n process.exit(1);\n });\n"],"mappings":";;;;;;;;;AASA,OAAO,EAAE,QAAQ,MAAM,CAAC;AAExB,SAAS,mBAAmB;CAC1B,IAAI,OAAO,QAAQ,KAAK;AACxB,KAAI,MAAM;AACR,MAAI,CAAC,WAAW,KAAK,CAAE;AACvB,SAAO,aAAa,KAAK;AACzB,MAAI,SAAS,KAAK,CAAC,QAAQ,CAAE,QAAO;;;AAIxC,MAAM,gBAAgB,kBAAkB;AAExC,MAAM,OAAO,QAAQ,KAAK,MAAM,gBAAgB,IAAI,EAAE;AAEtD,kBAAe,mBAAmB;CAAE;CAAM;CAAe,CAAC,CACvD,MAAM,SAAS,OAAO,UAAU;AAE/B,KAAI,CAAC,OAAO;AACV,QAAM,UAAU;AAEhB,UAAQ,MAAM,KAAK,UAAU;AAC7B,UAAQ,KAAK,EAAE;;EAEjB,CACD,WAAW,KAAK,CAChB,OAAO,UAAiB;AACvB,KAAI,MAAM,SAAS,mBAAmB;AACpC,UAAQ,IAAI,GAAG;AAEf,MAAI,OAAO,QAAQ,SAAS,MAAM,CAChC,SAAQ,MAAM,MAAM,IAAI,MAAM,MAAM,CAAC;MAErC,SAAQ,MAAM,GAAG,MAAM,IAAI,SAAS,CAAC,GAAG,aAAa,MAAM,QAAQ,GAAG;;AAG1E,SAAQ,KAAK,EAAE;EACf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_constants = require('../constants.cjs');
|
|
3
|
+
const require_utils_ascii_logo = require('../utils/ascii-logo.cjs');
|
|
4
|
+
const require_app = require('./app.cjs');
|
|
5
|
+
const require_create = require('./create.cjs');
|
|
6
|
+
const require_deploy = require('./deploy.cjs');
|
|
7
|
+
const require_eval = require('./eval.cjs');
|
|
8
|
+
const require_hub = require('./hub.cjs');
|
|
9
|
+
const require_observe = require('./observe.cjs');
|
|
10
|
+
const require_serve_mcp = require('./serve-mcp.cjs');
|
|
11
|
+
const require_run = require('./run.cjs');
|
|
12
|
+
const require_run_skill = require('./run-skill.cjs');
|
|
13
|
+
const require_test = require('./test.cjs');
|
|
14
|
+
let yargs = require("yargs");
|
|
15
|
+
yargs = require_rolldown_runtime.__toESM(yargs);
|
|
16
|
+
|
|
17
|
+
//#region src/commands/aigne.ts
|
|
18
|
+
function createAIGNECommand(options) {
|
|
19
|
+
return (0, yargs.default)().scriptName("aigne").usage(`${require_utils_ascii_logo.asciiLogo}\n$0 <command> [options]`).version(require_constants.AIGNE_CLI_VERSION).command(require_run.createRunCommand(options)).command(require_run_skill.createRunSkillCommand()).command(require_eval.createEvalCommand(options)).command(require_test.createTestCommand(options)).command(require_create.createCreateCommand()).command(require_serve_mcp.createServeMCPCommand(options)).command(require_observe.createObservabilityCommand()).command(require_app.createAppCommands(options)).command(require_hub.createHubCommand()).command(require_deploy.createDeployCommands()).demandCommand().version(false).alias("help", "h").wrap(null).strict();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.createAIGNECommand = createAIGNECommand;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AIGNE_CLI_VERSION } from "../constants.mjs";
|
|
2
|
+
import { asciiLogo } from "../utils/ascii-logo.mjs";
|
|
3
|
+
import { createAppCommands } from "./app.mjs";
|
|
4
|
+
import { createCreateCommand } from "./create.mjs";
|
|
5
|
+
import { createDeployCommands } from "./deploy.mjs";
|
|
6
|
+
import { createEvalCommand } from "./eval.mjs";
|
|
7
|
+
import { createHubCommand } from "./hub.mjs";
|
|
8
|
+
import { createObservabilityCommand } from "./observe.mjs";
|
|
9
|
+
import { createServeMCPCommand } from "./serve-mcp.mjs";
|
|
10
|
+
import { createRunCommand } from "./run.mjs";
|
|
11
|
+
import { createRunSkillCommand } from "./run-skill.mjs";
|
|
12
|
+
import { createTestCommand } from "./test.mjs";
|
|
13
|
+
import yargs from "yargs";
|
|
14
|
+
|
|
15
|
+
//#region src/commands/aigne.ts
|
|
16
|
+
function createAIGNECommand(options) {
|
|
17
|
+
return yargs().scriptName("aigne").usage(`${asciiLogo}\n$0 <command> [options]`).version(AIGNE_CLI_VERSION).command(createRunCommand(options)).command(createRunSkillCommand()).command(createEvalCommand(options)).command(createTestCommand(options)).command(createCreateCommand()).command(createServeMCPCommand(options)).command(createObservabilityCommand()).command(createAppCommands(options)).command(createHubCommand()).command(createDeployCommands()).demandCommand().version(false).alias("help", "h").wrap(null).strict();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { createAIGNECommand };
|
|
22
|
+
//# sourceMappingURL=aigne.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aigne.mjs","names":[],"sources":["../../src/commands/aigne.ts"],"sourcesContent":["import yargs from \"yargs\";\nimport { AIGNE_CLI_VERSION } from \"../constants.js\";\nimport { asciiLogo } from \"../utils/ascii-logo.js\";\nimport { createAppCommands } from \"./app.js\";\nimport { createCreateCommand } from \"./create.js\";\nimport { createDeployCommands } from \"./deploy.js\";\nimport { createEvalCommand } from \"./eval.js\";\nimport { createHubCommand } from \"./hub.js\";\nimport { createObservabilityCommand } from \"./observe.js\";\nimport { createRunCommand } from \"./run.js\";\nimport { createRunSkillCommand } from \"./run-skill.js\";\nimport { createServeMCPCommand } from \"./serve-mcp.js\";\nimport { createTestCommand } from \"./test.js\";\n\nexport function createAIGNECommand(options?: { argv?: string[]; aigneFilePath?: string }) {\n return (\n yargs()\n .scriptName(\"aigne\")\n .usage(`${asciiLogo}\\n$0 <command> [options]`)\n .version(AIGNE_CLI_VERSION)\n // default command: when user runs `aigne` without subcommand, behave like `aigne run`\n .command(createRunCommand(options))\n .command(createRunSkillCommand())\n .command(createEvalCommand(options))\n .command(createTestCommand(options))\n .command(createCreateCommand())\n .command(createServeMCPCommand(options))\n .command(createObservabilityCommand())\n .command(createAppCommands(options))\n .command(createHubCommand())\n .command(createDeployCommands())\n .demandCommand()\n .version(false)\n .alias(\"help\", \"h\")\n .wrap(null)\n .strict()\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,mBAAmB,SAAuD;AACxF,QACE,OAAO,CACJ,WAAW,QAAQ,CACnB,MAAM,GAAG,UAAU,0BAA0B,CAC7C,QAAQ,kBAAkB,CAE1B,QAAQ,iBAAiB,QAAQ,CAAC,CAClC,QAAQ,uBAAuB,CAAC,CAChC,QAAQ,kBAAkB,QAAQ,CAAC,CACnC,QAAQ,kBAAkB,QAAQ,CAAC,CACnC,QAAQ,qBAAqB,CAAC,CAC9B,QAAQ,sBAAsB,QAAQ,CAAC,CACvC,QAAQ,4BAA4B,CAAC,CACrC,QAAQ,kBAAkB,QAAQ,CAAC,CACnC,QAAQ,kBAAkB,CAAC,CAC3B,QAAQ,sBAAsB,CAAC,CAC/B,eAAe,CACf,QAAQ,MAAM,CACd,MAAM,QAAQ,IAAI,CAClB,KAAK,KAAK,CACV,QAAQ"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_constants = require('../../constants.cjs');
|
|
3
|
+
const require_utils_yargs = require('../../utils/yargs.cjs');
|
|
4
|
+
const require_utils_run_with_aigne = require('../../utils/run-with-aigne.cjs');
|
|
5
|
+
const require_serve_mcp = require('../serve-mcp.cjs');
|
|
6
|
+
let _aigne_core_utils_logger = require("@aigne/core/utils/logger");
|
|
7
|
+
let node_assert = require("node:assert");
|
|
8
|
+
node_assert = require_rolldown_runtime.__toESM(node_assert);
|
|
9
|
+
let _aigne_uuid = require("@aigne/uuid");
|
|
10
|
+
|
|
11
|
+
//#region src/commands/app/agent.ts
|
|
12
|
+
const serveMcpCommandModule = ({ aigne, name }) => ({
|
|
13
|
+
command: "serve-mcp",
|
|
14
|
+
describe: `Serve ${name} a MCP server (streamable http)`,
|
|
15
|
+
builder: (yargs) => {
|
|
16
|
+
return yargs.option("host", {
|
|
17
|
+
describe: "Host to run the MCP server on, use 0.0.0.0 to publicly expose the server",
|
|
18
|
+
type: "string",
|
|
19
|
+
default: "localhost"
|
|
20
|
+
}).option("port", {
|
|
21
|
+
describe: "Port to run the MCP server on",
|
|
22
|
+
type: "number"
|
|
23
|
+
}).option("pathname", {
|
|
24
|
+
describe: "Pathname to the service",
|
|
25
|
+
type: "string",
|
|
26
|
+
default: "/mcp"
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
handler: async (options) => {
|
|
30
|
+
await require_serve_mcp.serveMCPServerFromDir({
|
|
31
|
+
...options,
|
|
32
|
+
aigne
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const agentCommandModule = ({ aigne, agent, interactive }) => {
|
|
37
|
+
return {
|
|
38
|
+
command: agent.name,
|
|
39
|
+
aliases: agent.alias || [],
|
|
40
|
+
describe: agent.description || "",
|
|
41
|
+
builder: async (yargs) => {
|
|
42
|
+
return require_utils_yargs.withAgentInputSchema(yargs, {
|
|
43
|
+
inputSchema: agent.inputSchema,
|
|
44
|
+
optionalInputs: interactive && "inputKey" in agent && typeof agent.inputKey === "string" ? [agent.inputKey] : []
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
handler: async (options) => {
|
|
48
|
+
if (options.logLevel) _aigne_core_utils_logger.logger.level = options.logLevel;
|
|
49
|
+
await invokeAgent({
|
|
50
|
+
aigne,
|
|
51
|
+
agent,
|
|
52
|
+
input: {
|
|
53
|
+
...options,
|
|
54
|
+
interactive: interactive ?? options.interactive
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const cliAgentCommandModule = ({ aigne, cliAgent }) => {
|
|
61
|
+
const { agent, agents } = cliAgent;
|
|
62
|
+
const name = cliAgent.name || agent?.name;
|
|
63
|
+
(0, node_assert.default)(name, "CLI agent must have a name");
|
|
64
|
+
return {
|
|
65
|
+
command: name,
|
|
66
|
+
aliases: cliAgent.alias || agent?.alias || [],
|
|
67
|
+
describe: cliAgent.description || agent?.description || "",
|
|
68
|
+
builder: async (yargs) => {
|
|
69
|
+
if (agent) require_utils_yargs.withAgentInputSchema(yargs, { inputSchema: agent.inputSchema });
|
|
70
|
+
if (agents?.length) for (const cmd of agents) yargs.command(cliAgentCommandModule({
|
|
71
|
+
aigne,
|
|
72
|
+
cliAgent: cmd
|
|
73
|
+
}));
|
|
74
|
+
if (!agent) yargs.demandCommand();
|
|
75
|
+
return yargs;
|
|
76
|
+
},
|
|
77
|
+
handler: async (options) => {
|
|
78
|
+
if (!agent) throw new Error("CLI agent is not defined");
|
|
79
|
+
if (options.logLevel) _aigne_core_utils_logger.logger.level = options.logLevel;
|
|
80
|
+
await invokeAgent({
|
|
81
|
+
aigne,
|
|
82
|
+
agent,
|
|
83
|
+
input: options
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
async function invokeAgent(options) {
|
|
89
|
+
const { agent, aigne } = options;
|
|
90
|
+
try {
|
|
91
|
+
const input = await require_utils_yargs.parseAgentInput(options.input, agent);
|
|
92
|
+
const sessionId = options.input.sessionId || (0, _aigne_uuid.v7)();
|
|
93
|
+
const userId = require_constants.DEFAULT_USER_ID;
|
|
94
|
+
if (aigne.cli.init) await require_utils_run_with_aigne.runAgentWithAIGNE(aigne, aigne.cli.init, {
|
|
95
|
+
...options.input,
|
|
96
|
+
input,
|
|
97
|
+
interactive: false,
|
|
98
|
+
sessionId,
|
|
99
|
+
userId
|
|
100
|
+
});
|
|
101
|
+
await require_utils_run_with_aigne.runAgentWithAIGNE(aigne, agent, {
|
|
102
|
+
...options.input,
|
|
103
|
+
input,
|
|
104
|
+
interactive: options.input.interactive,
|
|
105
|
+
sessionId,
|
|
106
|
+
userId
|
|
107
|
+
});
|
|
108
|
+
} finally {
|
|
109
|
+
await aigne.shutdown();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
exports.agentCommandModule = agentCommandModule;
|
|
115
|
+
exports.cliAgentCommandModule = cliAgentCommandModule;
|
|
116
|
+
exports.invokeAgent = invokeAgent;
|
|
117
|
+
exports.serveMcpCommandModule = serveMcpCommandModule;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { DEFAULT_USER_ID } from "../../constants.mjs";
|
|
2
|
+
import { parseAgentInput, withAgentInputSchema } from "../../utils/yargs.mjs";
|
|
3
|
+
import { runAgentWithAIGNE } from "../../utils/run-with-aigne.mjs";
|
|
4
|
+
import { serveMCPServerFromDir } from "../serve-mcp.mjs";
|
|
5
|
+
import { logger } from "@aigne/core/utils/logger";
|
|
6
|
+
import assert from "node:assert";
|
|
7
|
+
import { v7 } from "@aigne/uuid";
|
|
8
|
+
|
|
9
|
+
//#region src/commands/app/agent.ts
|
|
10
|
+
const serveMcpCommandModule = ({ aigne, name }) => ({
|
|
11
|
+
command: "serve-mcp",
|
|
12
|
+
describe: `Serve ${name} a MCP server (streamable http)`,
|
|
13
|
+
builder: (yargs) => {
|
|
14
|
+
return yargs.option("host", {
|
|
15
|
+
describe: "Host to run the MCP server on, use 0.0.0.0 to publicly expose the server",
|
|
16
|
+
type: "string",
|
|
17
|
+
default: "localhost"
|
|
18
|
+
}).option("port", {
|
|
19
|
+
describe: "Port to run the MCP server on",
|
|
20
|
+
type: "number"
|
|
21
|
+
}).option("pathname", {
|
|
22
|
+
describe: "Pathname to the service",
|
|
23
|
+
type: "string",
|
|
24
|
+
default: "/mcp"
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
handler: async (options) => {
|
|
28
|
+
await serveMCPServerFromDir({
|
|
29
|
+
...options,
|
|
30
|
+
aigne
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const agentCommandModule = ({ aigne, agent, interactive }) => {
|
|
35
|
+
return {
|
|
36
|
+
command: agent.name,
|
|
37
|
+
aliases: agent.alias || [],
|
|
38
|
+
describe: agent.description || "",
|
|
39
|
+
builder: async (yargs) => {
|
|
40
|
+
return withAgentInputSchema(yargs, {
|
|
41
|
+
inputSchema: agent.inputSchema,
|
|
42
|
+
optionalInputs: interactive && "inputKey" in agent && typeof agent.inputKey === "string" ? [agent.inputKey] : []
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
handler: async (options) => {
|
|
46
|
+
if (options.logLevel) logger.level = options.logLevel;
|
|
47
|
+
await invokeAgent({
|
|
48
|
+
aigne,
|
|
49
|
+
agent,
|
|
50
|
+
input: {
|
|
51
|
+
...options,
|
|
52
|
+
interactive: interactive ?? options.interactive
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const cliAgentCommandModule = ({ aigne, cliAgent }) => {
|
|
59
|
+
const { agent, agents } = cliAgent;
|
|
60
|
+
const name = cliAgent.name || agent?.name;
|
|
61
|
+
assert(name, "CLI agent must have a name");
|
|
62
|
+
return {
|
|
63
|
+
command: name,
|
|
64
|
+
aliases: cliAgent.alias || agent?.alias || [],
|
|
65
|
+
describe: cliAgent.description || agent?.description || "",
|
|
66
|
+
builder: async (yargs) => {
|
|
67
|
+
if (agent) withAgentInputSchema(yargs, { inputSchema: agent.inputSchema });
|
|
68
|
+
if (agents?.length) for (const cmd of agents) yargs.command(cliAgentCommandModule({
|
|
69
|
+
aigne,
|
|
70
|
+
cliAgent: cmd
|
|
71
|
+
}));
|
|
72
|
+
if (!agent) yargs.demandCommand();
|
|
73
|
+
return yargs;
|
|
74
|
+
},
|
|
75
|
+
handler: async (options) => {
|
|
76
|
+
if (!agent) throw new Error("CLI agent is not defined");
|
|
77
|
+
if (options.logLevel) logger.level = options.logLevel;
|
|
78
|
+
await invokeAgent({
|
|
79
|
+
aigne,
|
|
80
|
+
agent,
|
|
81
|
+
input: options
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
async function invokeAgent(options) {
|
|
87
|
+
const { agent, aigne } = options;
|
|
88
|
+
try {
|
|
89
|
+
const input = await parseAgentInput(options.input, agent);
|
|
90
|
+
const sessionId = options.input.sessionId || v7();
|
|
91
|
+
const userId = DEFAULT_USER_ID;
|
|
92
|
+
if (aigne.cli.init) await runAgentWithAIGNE(aigne, aigne.cli.init, {
|
|
93
|
+
...options.input,
|
|
94
|
+
input,
|
|
95
|
+
interactive: false,
|
|
96
|
+
sessionId,
|
|
97
|
+
userId
|
|
98
|
+
});
|
|
99
|
+
await runAgentWithAIGNE(aigne, agent, {
|
|
100
|
+
...options.input,
|
|
101
|
+
input,
|
|
102
|
+
interactive: options.input.interactive,
|
|
103
|
+
sessionId,
|
|
104
|
+
userId
|
|
105
|
+
});
|
|
106
|
+
} finally {
|
|
107
|
+
await aigne.shutdown();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
export { agentCommandModule, cliAgentCommandModule, invokeAgent, serveMcpCommandModule };
|
|
113
|
+
//# sourceMappingURL=agent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.mjs","names":[],"sources":["../../../src/commands/app/agent.ts"],"sourcesContent":["import assert from \"node:assert\";\nimport { DEFAULT_USER_ID } from \"@aigne/cli/constants.js\";\nimport type { Agent, AIGNE, Message } from \"@aigne/core\";\nimport type { CLIAgent } from \"@aigne/core/utils/agent-utils\";\nimport { logger } from \"@aigne/core/utils/logger\";\nimport { v7 } from \"@aigne/uuid\";\nimport type { CommandModule } from \"yargs\";\nimport { runAgentWithAIGNE } from \"../../utils/run-with-aigne.js\";\nimport {\n type AgentRunCommonOptions,\n parseAgentInput,\n withAgentInputSchema,\n} from \"../../utils/yargs.js\";\nimport { serveMCPServerFromDir } from \"../serve-mcp.js\";\n\nexport const serveMcpCommandModule = ({\n aigne,\n name,\n}: {\n aigne: AIGNE;\n name: string;\n}): CommandModule<unknown, { host: string; port?: number; pathname: string }> => ({\n command: \"serve-mcp\",\n describe: `Serve ${name} a MCP server (streamable http)`,\n builder: (yargs) => {\n return yargs\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 },\n handler: async (options) => {\n await serveMCPServerFromDir({\n ...options,\n aigne,\n });\n },\n});\n\nexport const agentCommandModule = ({\n aigne,\n agent,\n interactive,\n}: {\n aigne: AIGNE;\n agent: Agent;\n interactive?: boolean;\n}): CommandModule<unknown, AgentRunCommonOptions> => {\n return {\n command: agent.name,\n aliases: agent.alias || [],\n describe: agent.description || \"\",\n builder: async (yargs) => {\n return withAgentInputSchema(yargs, {\n inputSchema: agent.inputSchema,\n optionalInputs:\n interactive && \"inputKey\" in agent && typeof agent.inputKey === \"string\"\n ? [agent.inputKey]\n : [],\n });\n },\n handler: async (options) => {\n if (options.logLevel) logger.level = options.logLevel;\n\n await invokeAgent({\n aigne,\n agent,\n input: { ...options, interactive: interactive ?? options.interactive },\n });\n },\n };\n};\n\nexport const cliAgentCommandModule = ({\n aigne,\n cliAgent,\n}: {\n aigne: AIGNE;\n cliAgent: CLIAgent<Agent>;\n}): CommandModule<unknown, AgentRunCommonOptions> => {\n const { agent, agents } = cliAgent;\n\n const name = cliAgent.name || agent?.name;\n assert(name, \"CLI agent must have a name\");\n\n return {\n command: name,\n aliases: cliAgent.alias || agent?.alias || [],\n describe: cliAgent.description || agent?.description || \"\",\n builder: async (yargs) => {\n if (agent) {\n withAgentInputSchema(yargs, { inputSchema: agent.inputSchema });\n }\n if (agents?.length) {\n for (const cmd of agents) {\n yargs.command(\n cliAgentCommandModule({\n aigne,\n cliAgent: cmd,\n }),\n );\n }\n }\n\n if (!agent) yargs.demandCommand();\n\n return yargs;\n },\n handler: async (options) => {\n if (!agent) throw new Error(\"CLI agent is not defined\");\n\n if (options.logLevel) logger.level = options.logLevel;\n\n await invokeAgent({\n aigne,\n agent,\n input: options,\n });\n },\n };\n};\n\nexport async function invokeAgent(options: {\n aigne: AIGNE;\n agent: Agent;\n input: Message & AgentRunCommonOptions;\n}) {\n const { agent, aigne } = options;\n\n try {\n const input = await parseAgentInput(options.input, agent);\n\n const sessionId = options.input.sessionId || v7();\n const userId = DEFAULT_USER_ID;\n\n if (aigne.cli.init) {\n await runAgentWithAIGNE(aigne, aigne.cli.init, {\n ...options.input,\n input,\n interactive: false,\n sessionId,\n userId,\n });\n }\n\n await runAgentWithAIGNE(aigne, agent, {\n ...options.input,\n input,\n interactive: options.input.interactive,\n sessionId,\n userId,\n });\n } finally {\n await aigne.shutdown();\n }\n}\n"],"mappings":";;;;;;;;;AAeA,MAAa,yBAAyB,EACpC,OACA,YAIgF;CAChF,SAAS;CACT,UAAU,SAAS,KAAK;CACxB,UAAU,UAAU;AAClB,SAAO,MACJ,OAAO,QAAQ;GACd,UAAU;GACV,MAAM;GACN,SAAS;GACV,CAAC,CACD,OAAO,QAAQ;GACd,UAAU;GACV,MAAM;GACP,CAAC,CACD,OAAO,YAAY;GAClB,UAAU;GACV,MAAM;GACN,SAAS;GACV,CAAC;;CAEN,SAAS,OAAO,YAAY;AAC1B,QAAM,sBAAsB;GAC1B,GAAG;GACH;GACD,CAAC;;CAEL;AAED,MAAa,sBAAsB,EACjC,OACA,OACA,kBAKmD;AACnD,QAAO;EACL,SAAS,MAAM;EACf,SAAS,MAAM,SAAS,EAAE;EAC1B,UAAU,MAAM,eAAe;EAC/B,SAAS,OAAO,UAAU;AACxB,UAAO,qBAAqB,OAAO;IACjC,aAAa,MAAM;IACnB,gBACE,eAAe,cAAc,SAAS,OAAO,MAAM,aAAa,WAC5D,CAAC,MAAM,SAAS,GAChB,EAAE;IACT,CAAC;;EAEJ,SAAS,OAAO,YAAY;AAC1B,OAAI,QAAQ,SAAU,QAAO,QAAQ,QAAQ;AAE7C,SAAM,YAAY;IAChB;IACA;IACA,OAAO;KAAE,GAAG;KAAS,aAAa,eAAe,QAAQ;KAAa;IACvE,CAAC;;EAEL;;AAGH,MAAa,yBAAyB,EACpC,OACA,eAImD;CACnD,MAAM,EAAE,OAAO,WAAW;CAE1B,MAAM,OAAO,SAAS,QAAQ,OAAO;AACrC,QAAO,MAAM,6BAA6B;AAE1C,QAAO;EACL,SAAS;EACT,SAAS,SAAS,SAAS,OAAO,SAAS,EAAE;EAC7C,UAAU,SAAS,eAAe,OAAO,eAAe;EACxD,SAAS,OAAO,UAAU;AACxB,OAAI,MACF,sBAAqB,OAAO,EAAE,aAAa,MAAM,aAAa,CAAC;AAEjE,OAAI,QAAQ,OACV,MAAK,MAAM,OAAO,OAChB,OAAM,QACJ,sBAAsB;IACpB;IACA,UAAU;IACX,CAAC,CACH;AAIL,OAAI,CAAC,MAAO,OAAM,eAAe;AAEjC,UAAO;;EAET,SAAS,OAAO,YAAY;AAC1B,OAAI,CAAC,MAAO,OAAM,IAAI,MAAM,2BAA2B;AAEvD,OAAI,QAAQ,SAAU,QAAO,QAAQ,QAAQ;AAE7C,SAAM,YAAY;IAChB;IACA;IACA,OAAO;IACR,CAAC;;EAEL;;AAGH,eAAsB,YAAY,SAI/B;CACD,MAAM,EAAE,OAAO,UAAU;AAEzB,KAAI;EACF,MAAM,QAAQ,MAAM,gBAAgB,QAAQ,OAAO,MAAM;EAEzD,MAAM,YAAY,QAAQ,MAAM,aAAa,IAAI;EACjD,MAAM,SAAS;AAEf,MAAI,MAAM,IAAI,KACZ,OAAM,kBAAkB,OAAO,MAAM,IAAI,MAAM;GAC7C,GAAG,QAAQ;GACX;GACA,aAAa;GACb;GACA;GACD,CAAC;AAGJ,QAAM,kBAAkB,OAAO,OAAO;GACpC,GAAG,QAAQ;GACX;GACA,aAAa,QAAQ,MAAM;GAC3B;GACA;GACD,CAAC;WACM;AACR,QAAM,MAAM,UAAU"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_constants = require('../../constants.cjs');
|
|
3
|
+
const require_upgrade = require('./upgrade.cjs');
|
|
4
|
+
const require_utils_yargs = require('../../utils/yargs.cjs');
|
|
5
|
+
const require_utils_string_utils = require('../../utils/string-utils.cjs');
|
|
6
|
+
const require_agent = require('./agent.cjs');
|
|
7
|
+
let _aigne_core_utils_logger = require("@aigne/core/utils/logger");
|
|
8
|
+
let chalk = require("chalk");
|
|
9
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
10
|
+
let yargs = require("yargs");
|
|
11
|
+
yargs = require_rolldown_runtime.__toESM(yargs);
|
|
12
|
+
let node_path = require("node:path");
|
|
13
|
+
let _aigne_core_utils_type_utils = require("@aigne/core/utils/type-utils");
|
|
14
|
+
let node_os = require("node:os");
|
|
15
|
+
let yargs_helpers = require("yargs/helpers");
|
|
16
|
+
|
|
17
|
+
//#region src/commands/app/app.ts
|
|
18
|
+
async function runAppCLI({ appName = process.env.AIGNE_APP_NAME, appPackageName = process.env.AIGNE_APP_PACKAGE_NAME, appDescription = process.env.AIGNE_APP_DESCRIPTION, appUseBetaVersion = process.env.AIGNE_APP_USE_BETA_APPS === "1" ? true : void 0, ...options } = {}) {
|
|
19
|
+
const [scriptName, ...argv] = options.argv || (0, yargs_helpers.hideBin)(process.argv);
|
|
20
|
+
if (!appName || !appPackageName) throw new Error("AIGNE_APP_NAME or AIGNE_APP_PACKAGE_NAME is not defined");
|
|
21
|
+
try {
|
|
22
|
+
const options$1 = require_utils_yargs.withRunAgentCommonOptions((0, yargs.default)(argv).help(false).version(false).strict(false)).parseSync();
|
|
23
|
+
_aigne_core_utils_logger.logger.level = options$1.logLevel;
|
|
24
|
+
const dir = (0, node_path.join)((0, node_os.homedir)(), ".aigne", "registry.npmjs.org", appPackageName);
|
|
25
|
+
const y = (0, yargs.default)().scriptName(`aigne ${scriptName}`).usage(`aigne ${scriptName}\n\n${appDescription || ""}`).command(require_upgrade.upgradeCommandModule({
|
|
26
|
+
packageName: appPackageName,
|
|
27
|
+
dir
|
|
28
|
+
}));
|
|
29
|
+
if (!isUpgradeCommand(argv)) {
|
|
30
|
+
const { aigne, version } = await require_upgrade.loadApplication({
|
|
31
|
+
packageName: appPackageName,
|
|
32
|
+
beta: appUseBetaVersion,
|
|
33
|
+
dir,
|
|
34
|
+
install: true,
|
|
35
|
+
modelOptions: (0, _aigne_core_utils_type_utils.pick)(options$1, require_constants.CHAT_MODEL_OPTIONS),
|
|
36
|
+
imageModelOptions: { model: options$1.imageModel },
|
|
37
|
+
skipModelLoading: (options$1.help || options$1.h || options$1.version || options$1.v) === true
|
|
38
|
+
});
|
|
39
|
+
if (aigne.cli?.chat) y.command({
|
|
40
|
+
...require_agent.agentCommandModule({
|
|
41
|
+
aigne,
|
|
42
|
+
agent: aigne.cli.chat,
|
|
43
|
+
interactive: true
|
|
44
|
+
}),
|
|
45
|
+
command: "$0"
|
|
46
|
+
});
|
|
47
|
+
for (const cliAgent of aigne.cli?.agents ?? []) y.command(require_agent.cliAgentCommandModule({
|
|
48
|
+
aigne,
|
|
49
|
+
cliAgent
|
|
50
|
+
}));
|
|
51
|
+
y.option("model", {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Model to use for the application, example: openai:gpt-4.1 or google:gemini-2.5-flash"
|
|
54
|
+
}).command(require_agent.serveMcpCommandModule({
|
|
55
|
+
aigne,
|
|
56
|
+
name: appName
|
|
57
|
+
}));
|
|
58
|
+
y.version(`${appName} v${version}`);
|
|
59
|
+
}
|
|
60
|
+
await y.alias("v", "version").alias("h", "help").demandCommand().fail((message, error, yargs$2) => {
|
|
61
|
+
if (!error) {
|
|
62
|
+
yargs$2.showHelp();
|
|
63
|
+
console.error(`\n${message}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}).parseAsync(argv);
|
|
67
|
+
process.exit(0);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (error instanceof require_upgrade.NeedReinstallError || error instanceof require_upgrade.NeedReinstallBetaError) {
|
|
70
|
+
_aigne_core_utils_logger.logger.warn(error.message);
|
|
71
|
+
process.exit(error instanceof require_upgrade.NeedReinstallBetaError ? require_upgrade.NeedReinstallBetaError.code : require_upgrade.NeedReinstallError.code);
|
|
72
|
+
}
|
|
73
|
+
if (error.name !== "ExitPromptError") {
|
|
74
|
+
console.log("");
|
|
75
|
+
if (_aigne_core_utils_logger.logger.enabled(_aigne_core_utils_logger.LogLevel.ERROR)) console.error(chalk.default.red(error.stack));
|
|
76
|
+
else console.error(`${chalk.default.red("Error:")} ${require_utils_string_utils.highlightUrl(error.message)}`);
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function isUpgradeCommand(argv) {
|
|
82
|
+
const skipGlobalOptions = [
|
|
83
|
+
"-v",
|
|
84
|
+
"--version",
|
|
85
|
+
"-h",
|
|
86
|
+
"--help"
|
|
87
|
+
];
|
|
88
|
+
return argv[0] === "upgrade" && !argv.some((arg) => skipGlobalOptions.includes(arg));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
92
|
+
exports.runAppCLI = runAppCLI;
|