@aigne/cli 1.60.0-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 -5019
- 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 -122
- 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
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the maximum width of a multi-line ASCII art string.
|
|
3
|
-
* @param asciiArt The ASCII art string.
|
|
4
|
-
* @returns The length of the longest line in the ASCII art.
|
|
5
|
-
*/
|
|
6
|
-
export declare const getAsciiArtWidth: (asciiArt: string) => number;
|
|
7
|
-
export declare function toCodePoints(str: string): string[];
|
|
8
|
-
export declare function cpLen(str: string): number;
|
|
9
|
-
export declare function cpSlice(str: string, start: number, end?: number): string;
|
|
10
|
-
/**
|
|
11
|
-
* Strip characters that can break terminal rendering.
|
|
12
|
-
*
|
|
13
|
-
* Uses Node.js built-in stripVTControlCharacters to handle VT sequences,
|
|
14
|
-
* then filters remaining control characters that can disrupt display.
|
|
15
|
-
*
|
|
16
|
-
* Characters stripped:
|
|
17
|
-
* - ANSI escape sequences (via strip-ansi)
|
|
18
|
-
* - VT control sequences (via Node.js util.stripVTControlCharacters)
|
|
19
|
-
* - C0 control chars (0x00-0x1F) except CR/LF which are handled elsewhere
|
|
20
|
-
* - C1 control chars (0x80-0x9F) that can cause display issues
|
|
21
|
-
*
|
|
22
|
-
* Characters preserved:
|
|
23
|
-
* - All printable Unicode including emojis
|
|
24
|
-
* - DEL (0x7F) - handled functionally by applyOperations, not a display issue
|
|
25
|
-
* - CR/LF (0x0D/0x0A) - needed for line breaks
|
|
26
|
-
*/
|
|
27
|
-
export declare function stripUnsafeCharacters(str: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* Cached version of stringWidth function for better performance
|
|
30
|
-
* Follows Ink's approach with unlimited cache (no eviction)
|
|
31
|
-
*/
|
|
32
|
-
export declare const getCachedStringWidth: (str: string) => number;
|
|
33
|
-
/**
|
|
34
|
-
* Clear the string width cache
|
|
35
|
-
*/
|
|
36
|
-
export declare const clearStringWidthCache: () => void;
|
|
37
|
-
export declare function escapeAnsiCtrlCodes<T>(obj: T): T;
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
// biome-ignore-all lint/style/noNonNullAssertion: code is from gemini-cli
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2025 Google LLC
|
|
5
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { stripVTControlCharacters } from "node:util";
|
|
8
|
-
import ansiRegex from "ansi-regex";
|
|
9
|
-
import stringWidth from "string-width";
|
|
10
|
-
import stripAnsi from "strip-ansi";
|
|
11
|
-
/**
|
|
12
|
-
* Calculates the maximum width of a multi-line ASCII art string.
|
|
13
|
-
* @param asciiArt The ASCII art string.
|
|
14
|
-
* @returns The length of the longest line in the ASCII art.
|
|
15
|
-
*/
|
|
16
|
-
export const getAsciiArtWidth = (asciiArt) => {
|
|
17
|
-
if (!asciiArt) {
|
|
18
|
-
return 0;
|
|
19
|
-
}
|
|
20
|
-
const lines = asciiArt.split("\n");
|
|
21
|
-
return Math.max(...lines.map((line) => line.length));
|
|
22
|
-
};
|
|
23
|
-
/*
|
|
24
|
-
* -------------------------------------------------------------------------
|
|
25
|
-
* Unicode‑aware helpers (work at the code‑point level rather than UTF‑16
|
|
26
|
-
* code units so that surrogate‑pair emoji count as one "column".)
|
|
27
|
-
* ---------------------------------------------------------------------- */
|
|
28
|
-
// Cache for code points to reduce GC pressure
|
|
29
|
-
const codePointsCache = new Map();
|
|
30
|
-
const MAX_STRING_LENGTH_TO_CACHE = 1000;
|
|
31
|
-
export function toCodePoints(str) {
|
|
32
|
-
// ASCII fast path - check if all chars are ASCII (0-127)
|
|
33
|
-
let isAscii = true;
|
|
34
|
-
for (let i = 0; i < str.length; i++) {
|
|
35
|
-
if (str.charCodeAt(i) > 127) {
|
|
36
|
-
isAscii = false;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (isAscii) {
|
|
41
|
-
return str.split("");
|
|
42
|
-
}
|
|
43
|
-
// Cache short strings
|
|
44
|
-
if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
|
|
45
|
-
const cached = codePointsCache.get(str);
|
|
46
|
-
if (cached) {
|
|
47
|
-
return cached;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const result = Array.from(str);
|
|
51
|
-
// Cache result (unlimited like Ink)
|
|
52
|
-
if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
|
|
53
|
-
codePointsCache.set(str, result);
|
|
54
|
-
}
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
export function cpLen(str) {
|
|
58
|
-
return toCodePoints(str).length;
|
|
59
|
-
}
|
|
60
|
-
export function cpSlice(str, start, end) {
|
|
61
|
-
// Slice by code‑point indices and re‑join.
|
|
62
|
-
const arr = toCodePoints(str).slice(start, end);
|
|
63
|
-
return arr.join("");
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Strip characters that can break terminal rendering.
|
|
67
|
-
*
|
|
68
|
-
* Uses Node.js built-in stripVTControlCharacters to handle VT sequences,
|
|
69
|
-
* then filters remaining control characters that can disrupt display.
|
|
70
|
-
*
|
|
71
|
-
* Characters stripped:
|
|
72
|
-
* - ANSI escape sequences (via strip-ansi)
|
|
73
|
-
* - VT control sequences (via Node.js util.stripVTControlCharacters)
|
|
74
|
-
* - C0 control chars (0x00-0x1F) except CR/LF which are handled elsewhere
|
|
75
|
-
* - C1 control chars (0x80-0x9F) that can cause display issues
|
|
76
|
-
*
|
|
77
|
-
* Characters preserved:
|
|
78
|
-
* - All printable Unicode including emojis
|
|
79
|
-
* - DEL (0x7F) - handled functionally by applyOperations, not a display issue
|
|
80
|
-
* - CR/LF (0x0D/0x0A) - needed for line breaks
|
|
81
|
-
*/
|
|
82
|
-
export function stripUnsafeCharacters(str) {
|
|
83
|
-
const strippedAnsi = stripAnsi(str);
|
|
84
|
-
const strippedVT = stripVTControlCharacters(strippedAnsi);
|
|
85
|
-
return toCodePoints(strippedVT)
|
|
86
|
-
.filter((char) => {
|
|
87
|
-
const code = char.codePointAt(0);
|
|
88
|
-
if (code === undefined)
|
|
89
|
-
return false;
|
|
90
|
-
// Preserve CR/LF for line handling
|
|
91
|
-
if (code === 0x0a || code === 0x0d)
|
|
92
|
-
return true;
|
|
93
|
-
// Remove C0 control chars (except CR/LF) that can break display
|
|
94
|
-
// Examples: BELL(0x07) makes noise, BS(0x08) moves cursor, VT(0x0B), FF(0x0C)
|
|
95
|
-
if (code >= 0x00 && code <= 0x1f)
|
|
96
|
-
return false;
|
|
97
|
-
// Remove C1 control chars (0x80-0x9f) - legacy 8-bit control codes
|
|
98
|
-
if (code >= 0x80 && code <= 0x9f)
|
|
99
|
-
return false;
|
|
100
|
-
// Preserve DEL (0x7f) - it's handled functionally by applyOperations as backspace
|
|
101
|
-
// and doesn't cause rendering issues when displayed
|
|
102
|
-
// Preserve all other characters including Unicode/emojis
|
|
103
|
-
return true;
|
|
104
|
-
})
|
|
105
|
-
.join("");
|
|
106
|
-
}
|
|
107
|
-
// String width caching for performance optimization
|
|
108
|
-
const stringWidthCache = new Map();
|
|
109
|
-
/**
|
|
110
|
-
* Cached version of stringWidth function for better performance
|
|
111
|
-
* Follows Ink's approach with unlimited cache (no eviction)
|
|
112
|
-
*/
|
|
113
|
-
export const getCachedStringWidth = (str) => {
|
|
114
|
-
// ASCII printable chars have width 1
|
|
115
|
-
if (/^[\x20-\x7E]*$/.test(str)) {
|
|
116
|
-
return str.length;
|
|
117
|
-
}
|
|
118
|
-
if (stringWidthCache.has(str)) {
|
|
119
|
-
return stringWidthCache.get(str);
|
|
120
|
-
}
|
|
121
|
-
const width = stringWidth(str);
|
|
122
|
-
stringWidthCache.set(str, width);
|
|
123
|
-
return width;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Clear the string width cache
|
|
127
|
-
*/
|
|
128
|
-
export const clearStringWidthCache = () => {
|
|
129
|
-
stringWidthCache.clear();
|
|
130
|
-
};
|
|
131
|
-
const regex = ansiRegex();
|
|
132
|
-
/* Recursively traverses a JSON-like structure (objects, arrays, primitives)
|
|
133
|
-
* and escapes all ANSI control characters found in any string values.
|
|
134
|
-
*
|
|
135
|
-
* This function is designed to be robust, handling deeply nested objects and
|
|
136
|
-
* arrays. It applies a regex-based replacement to all string values to
|
|
137
|
-
* safely escape control characters.
|
|
138
|
-
*
|
|
139
|
-
* To optimize performance, this function uses a "copy-on-write" strategy.
|
|
140
|
-
* It avoids allocating new objects or arrays if no nested string values
|
|
141
|
-
* required escaping, returning the original object reference in such cases.
|
|
142
|
-
*
|
|
143
|
-
* @param obj The JSON-like value (object, array, string, etc.) to traverse.
|
|
144
|
-
* @returns A new value with all nested string fields escaped, or the
|
|
145
|
-
* original `obj` reference if no changes were necessary.
|
|
146
|
-
*/
|
|
147
|
-
export function escapeAnsiCtrlCodes(obj) {
|
|
148
|
-
if (typeof obj === "string") {
|
|
149
|
-
if (obj.search(regex) === -1) {
|
|
150
|
-
return obj; // No changes return original string
|
|
151
|
-
}
|
|
152
|
-
regex.lastIndex = 0; // needed for global regex
|
|
153
|
-
return obj.replace(regex, (match) => JSON.stringify(match).slice(1, -1));
|
|
154
|
-
}
|
|
155
|
-
if (obj === null || typeof obj !== "object") {
|
|
156
|
-
return obj;
|
|
157
|
-
}
|
|
158
|
-
if (Array.isArray(obj)) {
|
|
159
|
-
let newArr = null;
|
|
160
|
-
for (let i = 0; i < obj.length; i++) {
|
|
161
|
-
const value = obj[i];
|
|
162
|
-
const escapedValue = escapeAnsiCtrlCodes(value);
|
|
163
|
-
if (escapedValue !== value) {
|
|
164
|
-
if (newArr === null) {
|
|
165
|
-
newArr = [...obj];
|
|
166
|
-
}
|
|
167
|
-
newArr[i] = escapedValue;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return (newArr !== null ? newArr : obj);
|
|
171
|
-
}
|
|
172
|
-
let newObj = null;
|
|
173
|
-
const keys = Object.keys(obj);
|
|
174
|
-
for (const key of keys) {
|
|
175
|
-
const value = obj[key];
|
|
176
|
-
const escapedValue = escapeAnsiCtrlCodes(value);
|
|
177
|
-
if (escapedValue !== value) {
|
|
178
|
-
if (newObj === null) {
|
|
179
|
-
newObj = { ...obj };
|
|
180
|
-
}
|
|
181
|
-
newObj[key] = escapedValue;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return newObj !== null ? newObj : obj;
|
|
185
|
-
}
|
package/dist/utils/agent-v1.d.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
export declare function isV1Package(src: string): Promise<boolean>;
|
|
2
|
-
export declare function toAIGNEPackage(src: string, dst: string): Promise<void>;
|
|
3
|
-
export type Parameter = {
|
|
4
|
-
id: string;
|
|
5
|
-
key?: string;
|
|
6
|
-
hidden?: boolean;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
} & ({
|
|
10
|
-
type?: "string" | "number" | "boolean" | "language";
|
|
11
|
-
} | {
|
|
12
|
-
type?: "select";
|
|
13
|
-
options?: {
|
|
14
|
-
id: string;
|
|
15
|
-
label?: string;
|
|
16
|
-
value?: string;
|
|
17
|
-
}[];
|
|
18
|
-
});
|
|
19
|
-
export interface VariableTypeBase {
|
|
20
|
-
id: string;
|
|
21
|
-
name?: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
required?: boolean;
|
|
24
|
-
hidden?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export type OutputVariable = VariableTypeBase & ({
|
|
27
|
-
type?: undefined;
|
|
28
|
-
} | {
|
|
29
|
-
type: "string";
|
|
30
|
-
defaultValue?: string;
|
|
31
|
-
} | {
|
|
32
|
-
type: "number";
|
|
33
|
-
defaultValue?: number;
|
|
34
|
-
} | {
|
|
35
|
-
type: "boolean";
|
|
36
|
-
defaultValue?: boolean;
|
|
37
|
-
} | {
|
|
38
|
-
type: "object";
|
|
39
|
-
properties?: OutputVariable[];
|
|
40
|
-
} | {
|
|
41
|
-
type: "array";
|
|
42
|
-
element?: OutputVariable;
|
|
43
|
-
});
|
|
44
|
-
export type AgentV1 = {
|
|
45
|
-
id: string;
|
|
46
|
-
name?: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
parameters?: Parameter[];
|
|
49
|
-
outputVariables?: OutputVariable[];
|
|
50
|
-
} & ({
|
|
51
|
-
type: "prompt";
|
|
52
|
-
prompts?: Prompt[];
|
|
53
|
-
temperature?: number;
|
|
54
|
-
topP?: number;
|
|
55
|
-
presencePenalty?: number;
|
|
56
|
-
frequencyPenalty?: number;
|
|
57
|
-
maxTokens?: number;
|
|
58
|
-
model?: string;
|
|
59
|
-
} | {
|
|
60
|
-
type: "router";
|
|
61
|
-
defaultToolId?: string;
|
|
62
|
-
prompt?: string;
|
|
63
|
-
decisionType?: "ai";
|
|
64
|
-
routes?: Tool[];
|
|
65
|
-
temperature?: number;
|
|
66
|
-
topP?: number;
|
|
67
|
-
presencePenalty?: number;
|
|
68
|
-
frequencyPenalty?: number;
|
|
69
|
-
maxTokens?: number;
|
|
70
|
-
model?: string;
|
|
71
|
-
} | {
|
|
72
|
-
type: "image";
|
|
73
|
-
prompt?: string;
|
|
74
|
-
model?: string;
|
|
75
|
-
n?: number;
|
|
76
|
-
quality?: string;
|
|
77
|
-
style?: string;
|
|
78
|
-
size?: string;
|
|
79
|
-
modelSettings?: {
|
|
80
|
-
[key: string]: unknown;
|
|
81
|
-
};
|
|
82
|
-
} | {
|
|
83
|
-
type: "api";
|
|
84
|
-
requestParameters?: {
|
|
85
|
-
id: string;
|
|
86
|
-
key?: string;
|
|
87
|
-
value?: string;
|
|
88
|
-
}[];
|
|
89
|
-
requestMethod?: string;
|
|
90
|
-
requestUrl?: string;
|
|
91
|
-
requestHeaders: {
|
|
92
|
-
id: string;
|
|
93
|
-
key?: string;
|
|
94
|
-
value?: string;
|
|
95
|
-
}[];
|
|
96
|
-
} | {
|
|
97
|
-
type: "function";
|
|
98
|
-
code?: string;
|
|
99
|
-
} | {
|
|
100
|
-
type: "callAgent";
|
|
101
|
-
agents?: Tool[];
|
|
102
|
-
});
|
|
103
|
-
export interface ProjectDefinitionV1 {
|
|
104
|
-
project: {
|
|
105
|
-
name?: string;
|
|
106
|
-
description?: string;
|
|
107
|
-
};
|
|
108
|
-
agents: AgentV1[];
|
|
109
|
-
}
|
|
110
|
-
export type Prompt = {
|
|
111
|
-
type: "message";
|
|
112
|
-
data: PromptMessage;
|
|
113
|
-
visibility?: "hidden";
|
|
114
|
-
} | {
|
|
115
|
-
type: "executeBlock";
|
|
116
|
-
visibility?: "hidden";
|
|
117
|
-
};
|
|
118
|
-
export type PromptMessage = {
|
|
119
|
-
id: string;
|
|
120
|
-
role: Role;
|
|
121
|
-
content?: string;
|
|
122
|
-
name?: string;
|
|
123
|
-
};
|
|
124
|
-
export type Role = "system" | "user" | "assistant";
|
|
125
|
-
export type Tool = {
|
|
126
|
-
blockletDid?: string;
|
|
127
|
-
projectId?: string;
|
|
128
|
-
id: string;
|
|
129
|
-
from?: "assistant" | "blockletAPI" | "knowledge";
|
|
130
|
-
parameters?: {
|
|
131
|
-
[key: string]: unknown;
|
|
132
|
-
};
|
|
133
|
-
functionName?: string;
|
|
134
|
-
};
|
package/dist/utils/agent-v1.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { glob } from "glob";
|
|
4
|
-
import { parse, stringify } from "yaml";
|
|
5
|
-
export async function isV1Package(src) {
|
|
6
|
-
return stat(join(src, "project.yaml"))
|
|
7
|
-
.then((res) => res.isFile())
|
|
8
|
-
.catch((error) => {
|
|
9
|
-
if (error.code === "ENOENT")
|
|
10
|
-
return false;
|
|
11
|
-
throw error;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
export async function toAIGNEPackage(src, dst) {
|
|
15
|
-
const definition = await loadAgentV1Package(src);
|
|
16
|
-
const aigne = {
|
|
17
|
-
chat_model: {
|
|
18
|
-
name: "gpt-4o-mini", // TODO: get from config
|
|
19
|
-
},
|
|
20
|
-
agents: [],
|
|
21
|
-
cli: {
|
|
22
|
-
agents: [],
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
for (const agent of definition.agents) {
|
|
26
|
-
const { content } = await assistantToAIGNEV2(agent, definition);
|
|
27
|
-
const filename = getAgentFilename(agent);
|
|
28
|
-
await writeFile(join(dst, filename), content);
|
|
29
|
-
aigne.agents.push(filename);
|
|
30
|
-
aigne.cli.agents.push(filename);
|
|
31
|
-
}
|
|
32
|
-
await writeFile(join(dst, "aigne.yaml"), stringify(aigne));
|
|
33
|
-
}
|
|
34
|
-
async function loadAgentV1Package(path) {
|
|
35
|
-
const agentFilePaths = await glob("prompts/**/*.yaml", {
|
|
36
|
-
cwd: path,
|
|
37
|
-
});
|
|
38
|
-
const project = parse(await readFile(join(path, "project.yaml"), "utf8"));
|
|
39
|
-
const definition = {
|
|
40
|
-
project,
|
|
41
|
-
agents: [],
|
|
42
|
-
};
|
|
43
|
-
for (const filename of agentFilePaths) {
|
|
44
|
-
const agent = parse(await readFile(join(path, filename), "utf8"));
|
|
45
|
-
definition.agents.push(agent);
|
|
46
|
-
}
|
|
47
|
-
return definition;
|
|
48
|
-
}
|
|
49
|
-
function assistantToAIGNEV2(agent, project) {
|
|
50
|
-
const converter = AGENT_MAP[agent.type];
|
|
51
|
-
if (!converter)
|
|
52
|
-
throw new Error(`Unsupported agent type: ${agent.type}`);
|
|
53
|
-
return converter(agent, project);
|
|
54
|
-
}
|
|
55
|
-
const AGENT_MAP = {
|
|
56
|
-
prompt: (agent) => {
|
|
57
|
-
if (agent.type !== "prompt")
|
|
58
|
-
throw new Error(`Expected agent type 'prompt', but got '${agent.type}'`);
|
|
59
|
-
const obj = {
|
|
60
|
-
name: agent.name || agent.id,
|
|
61
|
-
description: agent.description,
|
|
62
|
-
input_schema: convertInputSchema(agent),
|
|
63
|
-
output_schema: convertOutputSchema(agent),
|
|
64
|
-
instructions: agent.prompts
|
|
65
|
-
?.filter((i) => i.visibility !== "hidden" && i.type === "message")
|
|
66
|
-
.map((i) => i.data.content) // TODO: should support multiple messages with different roles
|
|
67
|
-
.join("\n"),
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
content: stringify(obj),
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
function: async (agent) => {
|
|
74
|
-
if (agent.type !== "function")
|
|
75
|
-
throw new Error(`Expected agent type 'function', but got '${agent.type}'`);
|
|
76
|
-
const inputNames = agent.parameters?.map((i) => i.key).filter(Boolean) ?? [];
|
|
77
|
-
return {
|
|
78
|
-
content: await formatCode(`\
|
|
79
|
-
export default async function agent({${inputNames.join(", ")}}) {
|
|
80
|
-
${agent.code}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
agent.agent_name = ${JSON.stringify(agent.name || agent.id)};
|
|
84
|
-
|
|
85
|
-
agent.description = ${agent.description ? JSON.stringify(agent.description) : "undefined"};
|
|
86
|
-
|
|
87
|
-
agent.input_schema = ${JSON.stringify(convertInputSchema(agent))};
|
|
88
|
-
|
|
89
|
-
agent.output_schema = ${JSON.stringify(convertOutputSchema(agent))};
|
|
90
|
-
`),
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
router: (agent, project) => {
|
|
94
|
-
if (agent.type !== "router")
|
|
95
|
-
throw new Error(`Expected agent type 'router', but got '${agent.type}'`);
|
|
96
|
-
return {
|
|
97
|
-
content: stringify({
|
|
98
|
-
name: agent.name || agent.id,
|
|
99
|
-
description: agent.description,
|
|
100
|
-
instructions: agent.prompt,
|
|
101
|
-
input_schema: convertInputSchema(agent),
|
|
102
|
-
output_schema: convertOutputSchema(agent),
|
|
103
|
-
skills: agent.routes?.map((i) => {
|
|
104
|
-
const tool = project.agents.find((j) => j.id === i.id);
|
|
105
|
-
if (!tool)
|
|
106
|
-
throw new Error(`Tool ${i.id} not found in project definition`);
|
|
107
|
-
return getAgentFilename(tool);
|
|
108
|
-
}),
|
|
109
|
-
tool_choice: "router",
|
|
110
|
-
}),
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
function getAgentFilename(agent) {
|
|
115
|
-
switch (agent.type) {
|
|
116
|
-
case "prompt":
|
|
117
|
-
case "router":
|
|
118
|
-
return `${agent.name || agent.id}.yaml`;
|
|
119
|
-
case "function":
|
|
120
|
-
return `${agent.name || agent.id}.js`;
|
|
121
|
-
default:
|
|
122
|
-
throw new Error(`Unsupported agent type: ${agent.type}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async function formatCode(code) {
|
|
126
|
-
const [prettier, typescriptPlugin, estreePlugin] = await Promise.all([
|
|
127
|
-
import("prettier"),
|
|
128
|
-
import("prettier/plugins/typescript"),
|
|
129
|
-
import("prettier/plugins/estree"),
|
|
130
|
-
]);
|
|
131
|
-
return prettier.format(code, {
|
|
132
|
-
parser: "typescript",
|
|
133
|
-
plugins: [typescriptPlugin, estreePlugin.default],
|
|
134
|
-
printWidth: 120,
|
|
135
|
-
useTabs: false,
|
|
136
|
-
tabWidth: 2,
|
|
137
|
-
trailingComma: "es5",
|
|
138
|
-
bracketSameLine: true,
|
|
139
|
-
semi: true,
|
|
140
|
-
singleQuote: true,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
function convertInputSchema(agent) {
|
|
144
|
-
const parameters = (agent.parameters ?? []).filter((i) => !!i.key && !i.hidden);
|
|
145
|
-
const properties = parameters.map((i) => [i.key, parameterToJsonSchema(i)]);
|
|
146
|
-
return {
|
|
147
|
-
type: "object",
|
|
148
|
-
properties: Object.fromEntries(properties),
|
|
149
|
-
required: parameters.filter((i) => i.required).map((i) => i.key),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function parameterToJsonSchema(parameter) {
|
|
153
|
-
switch (parameter.type) {
|
|
154
|
-
case undefined:
|
|
155
|
-
case "string":
|
|
156
|
-
case "language":
|
|
157
|
-
return {
|
|
158
|
-
type: "string",
|
|
159
|
-
description: parameter.placeholder,
|
|
160
|
-
};
|
|
161
|
-
case "select":
|
|
162
|
-
return {
|
|
163
|
-
type: "string",
|
|
164
|
-
enum: parameter.options?.map((i) => i.value),
|
|
165
|
-
description: parameter.placeholder,
|
|
166
|
-
};
|
|
167
|
-
case "number":
|
|
168
|
-
case "boolean":
|
|
169
|
-
return {
|
|
170
|
-
type: parameter.type,
|
|
171
|
-
description: parameter.placeholder,
|
|
172
|
-
};
|
|
173
|
-
default:
|
|
174
|
-
throw new Error(`Unsupported parameter type: ${parameter.type}`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function convertOutputSchema(agent) {
|
|
178
|
-
const outputs = agent.outputVariables?.filter((i) => !!i.name && !i.hidden) ?? [];
|
|
179
|
-
const properties = outputs
|
|
180
|
-
.map((i) => [i.name, variableTypeToJsonSchema(i)])
|
|
181
|
-
.filter((i) => !!i[1]);
|
|
182
|
-
return {
|
|
183
|
-
type: "object",
|
|
184
|
-
properties: Object.fromEntries(properties),
|
|
185
|
-
required: outputs.filter((i) => i.required).map((i) => i.name),
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function variableTypeToJsonSchema(output) {
|
|
189
|
-
if (output.type === "object") {
|
|
190
|
-
if (!output.properties)
|
|
191
|
-
return undefined;
|
|
192
|
-
return {
|
|
193
|
-
type: "object",
|
|
194
|
-
properties: Object.fromEntries(output.properties
|
|
195
|
-
.filter((i) => !!i.name)
|
|
196
|
-
.map((i) => [i.name, variableTypeToJsonSchema(i)])
|
|
197
|
-
.filter((i) => !!i[1])),
|
|
198
|
-
required: output.properties.filter((i) => i.required && i.name).map((i) => i.name),
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
if (output.type === "array") {
|
|
202
|
-
if (!output.element)
|
|
203
|
-
return undefined;
|
|
204
|
-
return {
|
|
205
|
-
type: "array",
|
|
206
|
-
items: variableTypeToJsonSchema(output.element),
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
return {
|
|
210
|
-
type: output.type || "string",
|
|
211
|
-
description: output.description,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const WELLKNOWN_SERVICE_PATH_PREFIX = "/.well-known/service";
|
|
2
|
-
export declare const ACCESS_KEY_SESSION_API = "/api/access-key/session";
|
|
3
|
-
export declare const AIGNE_HUB_PROVIDER = "aignehub";
|
|
4
|
-
export declare const DEFAULT_AIGNE_HUB_PROVIDER_MODEL = "aignehub:openai/gpt-5-mini";
|
|
5
|
-
export declare const isTest: string | boolean;
|
|
6
|
-
export declare const AIGNE_ENV_FILE: string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
const ACCESS_KEY_PREFIX = "/api/access-key";
|
|
4
|
-
export const WELLKNOWN_SERVICE_PATH_PREFIX = "/.well-known/service";
|
|
5
|
-
export const ACCESS_KEY_SESSION_API = `${ACCESS_KEY_PREFIX}/session`;
|
|
6
|
-
const DEFAULT_AIGNE_HUB_MODEL = "openai/gpt-5-mini";
|
|
7
|
-
export const AIGNE_HUB_PROVIDER = "aignehub";
|
|
8
|
-
export const DEFAULT_AIGNE_HUB_PROVIDER_MODEL = `${AIGNE_HUB_PROVIDER}:${DEFAULT_AIGNE_HUB_MODEL}`;
|
|
9
|
-
export const isTest = process.env.CI || process.env.NODE_ENV === "test";
|
|
10
|
-
const TEST_AIGNE_ENV_FILE = join(homedir(), ".aigne", "test-aigne-hub-connected.yaml");
|
|
11
|
-
const PROD_AIGNE_ENV_FILE = join(homedir(), ".aigne", "aigne-hub-connected.yaml");
|
|
12
|
-
export const AIGNE_ENV_FILE = isTest ? TEST_AIGNE_ENV_FILE : PROD_AIGNE_ENV_FILE;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { CreateConnectOptions, FetchResult, LoadCredentialOptions } from "./type.js";
|
|
2
|
-
export declare const fetchConfigs: ({ connectUrl, sessionId, fetchInterval, fetchTimeout, }: {
|
|
3
|
-
connectUrl: string;
|
|
4
|
-
sessionId: string;
|
|
5
|
-
fetchInterval: number;
|
|
6
|
-
fetchTimeout: number;
|
|
7
|
-
}) => Promise<any>;
|
|
8
|
-
export declare function createConnect({ connectUrl, openPage, fetchInterval, retry, source, connectAction, wrapSpinner, closeOnSuccess, intervalFetchConfig, appName, appLogo, }: CreateConnectOptions): Promise<FetchResult>;
|
|
9
|
-
export declare function connectToAIGNEHub(url: string): Promise<{
|
|
10
|
-
apiKey: string;
|
|
11
|
-
url: string;
|
|
12
|
-
}>;
|
|
13
|
-
export declare const checkConnectionStatus: (host: string) => Promise<{
|
|
14
|
-
apiKey: any;
|
|
15
|
-
url: any;
|
|
16
|
-
}>;
|
|
17
|
-
export declare function loadAIGNEHubCredential(options?: LoadCredentialOptions): Promise<{
|
|
18
|
-
apiKey?: string;
|
|
19
|
-
url?: string;
|
|
20
|
-
} | undefined>;
|