@helixlife-ai/xiantao 0.1.16 → 0.1.17
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
CHANGED
|
@@ -75,6 +75,7 @@ For agent workflows, do not use `xt tool run`. Treat `xt tool run` as the human-
|
|
|
75
75
|
- `xt tool resolve`
|
|
76
76
|
- `xt tool menu`
|
|
77
77
|
- `xt tool menus`
|
|
78
|
+
- `xt tool menus-raw`
|
|
78
79
|
- `xt tool fetch-all`
|
|
79
80
|
|
|
80
81
|
## Notes
|
|
@@ -83,7 +84,7 @@ For the common Xiantao tool product, `tool search`, `tool inspect`, `tool run`,
|
|
|
83
84
|
|
|
84
85
|
The CLI also loads a project-root `.env` file on startup. You can set `XIANTAO_BASE_URL=https://agent.helixlife.cn` there to switch the API base URL without prefixing each command manually.
|
|
85
86
|
|
|
86
|
-
`xt tool search <keyword>` searches remote tool menus by tool id, title, path, and route. `xt tool inspect <tool_id>` prints resolved metadata together with the dynamic `args_main` schema used by the tool. `xt tool run <tool_id>` runs a Xiantao bioinformatics tool in the human-first path. `xt tool exec <tool_id>` is the agent-safe submit command and also supports `--download <path>` when a local artifact is needed. `xt tool resolve <tool_id>` remains available as the low-level UUID and route lookup. `--demo` reuses the demo file metadata returned by `tool fetch-all`; otherwise `tool run` uploads the local file first and therefore also needs token auth. Run `xt login` first to authorize the stored token. When a tool exposes multiple downloadable results, `--download <path>` uses the output file extension to select the matching artifact.
|
|
87
|
+
`xt tool search <keyword>` searches remote tool menus by tool id, title, path, and route. `xt tool inspect <tool_id>` prints resolved metadata together with the dynamic `args_main` schema used by the tool. `xt tool run <tool_id>` runs a Xiantao bioinformatics tool in the human-first path. `xt tool exec <tool_id>` is the agent-safe submit command and also supports `--download <path>` when a local artifact is needed. `xt tool resolve <tool_id>` remains available as the low-level UUID and route lookup. `xt tool menus` returns a concise catalog with each tool title, `module_id`, `path`, and `route`, which is useful when `tool search` finds nothing helpful or when you want to shortlist tools for recommendation. `--demo` reuses the demo file metadata returned by `tool fetch-all`; otherwise `tool run` uploads the local file first and therefore also needs token auth. Run `xt login` first to authorize the stored token. When a tool exposes multiple downloadable results, `--download <path>` uses the output file extension to select the matching artifact.
|
|
87
88
|
|
|
88
89
|
`xt tool run <tool_id> ... --interactive` prompts for dynamic `args_main` values before the final submit, prints reusable `--set` flags, and supports `<` for the previous item plus `/skip` for the current section.
|
|
89
90
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { XtzCommand } from '../../base-command.js';
|
|
3
|
+
import { getAuthContext } from '../../lib/auth.js';
|
|
4
|
+
import { globalFlags } from '../../lib/flags.js';
|
|
5
|
+
import { resolveXiantaoToolProductUuid } from '../../lib/storage.js';
|
|
6
|
+
import { fetchToolMenus } from '../../lib/xiantao.js';
|
|
7
|
+
export default class PlotMenusRaw extends XtzCommand {
|
|
8
|
+
static description = 'Fetch all raw Xiantao menu metadata for a tool product';
|
|
9
|
+
static flags = {
|
|
10
|
+
...globalFlags,
|
|
11
|
+
token: Flags.string({
|
|
12
|
+
description: 'Bearer token for agent.helixlife.cn xiantao APIs; falls back to the stored agent token',
|
|
13
|
+
}),
|
|
14
|
+
toolProductUuid: Flags.string({
|
|
15
|
+
description: 'tool_product_uuid used in the menu filter payload; defaults to the main Xiantao product UUID',
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
this.warnIfLegacyPlotCommand();
|
|
20
|
+
const { flags } = await this.parse(PlotMenusRaw);
|
|
21
|
+
const agent = await this.getProfile(flags.profile);
|
|
22
|
+
const auth = await getAuthContext(agent, flags.token);
|
|
23
|
+
const toolProductUuid = await resolveXiantaoToolProductUuid(flags.toolProductUuid);
|
|
24
|
+
const menus = await fetchToolMenus(auth, toolProductUuid);
|
|
25
|
+
this.print(flags, {
|
|
26
|
+
agent,
|
|
27
|
+
menus,
|
|
28
|
+
tool_product_uuid: toolProductUuid,
|
|
29
|
+
}, JSON.stringify(menus, null, 2), { profile: agent });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -3,9 +3,9 @@ import { XtzCommand } from '../../base-command.js';
|
|
|
3
3
|
import { getAuthContext } from '../../lib/auth.js';
|
|
4
4
|
import { globalFlags } from '../../lib/flags.js';
|
|
5
5
|
import { resolveXiantaoToolProductUuid } from '../../lib/storage.js';
|
|
6
|
-
import { fetchToolMenus } from '../../lib/xiantao.js';
|
|
6
|
+
import { fetchToolMenus, listToolMenuSummaries } from '../../lib/xiantao.js';
|
|
7
7
|
export default class PlotMenus extends XtzCommand {
|
|
8
|
-
static description = '
|
|
8
|
+
static description = 'List Xiantao tools with title, tool id, path, and route for a product';
|
|
9
9
|
static flags = {
|
|
10
10
|
...globalFlags,
|
|
11
11
|
token: Flags.string({
|
|
@@ -21,11 +21,27 @@ export default class PlotMenus extends XtzCommand {
|
|
|
21
21
|
const agent = await this.getProfile(flags.profile);
|
|
22
22
|
const auth = await getAuthContext(agent, flags.token);
|
|
23
23
|
const toolProductUuid = await resolveXiantaoToolProductUuid(flags.toolProductUuid);
|
|
24
|
-
const menus = await fetchToolMenus(auth, toolProductUuid);
|
|
24
|
+
const menus = listToolMenuSummaries(await fetchToolMenus(auth, toolProductUuid));
|
|
25
25
|
this.print(flags, {
|
|
26
26
|
agent,
|
|
27
27
|
menus,
|
|
28
28
|
tool_product_uuid: toolProductUuid,
|
|
29
|
-
},
|
|
29
|
+
}, this.formatMenusText(menus), { profile: agent });
|
|
30
|
+
}
|
|
31
|
+
formatMenusText(menus) {
|
|
32
|
+
if (menus.length === 0) {
|
|
33
|
+
return '未找到可用工具';
|
|
34
|
+
}
|
|
35
|
+
const lines = [`共 ${menus.length} 个工具`];
|
|
36
|
+
for (const menu of menus) {
|
|
37
|
+
lines.push('');
|
|
38
|
+
lines.push(`${menu.title}`);
|
|
39
|
+
lines.push(` ${menu.module_id}`);
|
|
40
|
+
if (menu.path) {
|
|
41
|
+
lines.push(` ${menu.path}`);
|
|
42
|
+
}
|
|
43
|
+
lines.push(` ${menu.route}`);
|
|
44
|
+
}
|
|
45
|
+
return lines.join('\n');
|
|
30
46
|
}
|
|
31
47
|
}
|
package/dist/lib/xiantao.js
CHANGED
|
@@ -48,6 +48,14 @@ export async function resolveToolMenuByCode(auth, toolProductUuid, code) {
|
|
|
48
48
|
export function listResolvedToolMenus(menus) {
|
|
49
49
|
return collectToolMenuMatches(menus);
|
|
50
50
|
}
|
|
51
|
+
export function listToolMenuSummaries(menus) {
|
|
52
|
+
return listResolvedToolMenus(menus).map((menu) => ({
|
|
53
|
+
module_id: menu.code,
|
|
54
|
+
path: menu.path,
|
|
55
|
+
route: menu.route,
|
|
56
|
+
title: menu.title,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
51
59
|
export function searchResolvedToolMenus(menus, keyword) {
|
|
52
60
|
const normalizedKeyword = keyword.trim().toLowerCase();
|
|
53
61
|
return listResolvedToolMenus(menus)
|
package/dist/xtz-help.js
CHANGED
|
@@ -73,7 +73,8 @@ export default class XtzHelp extends Help {
|
|
|
73
73
|
['xt history --help', 'Show the history command set'],
|
|
74
74
|
['xt tool resolve', 'Resolve a tool id to UUID and route'],
|
|
75
75
|
['xt tool menu', 'Fetch one raw tool menu by UUID'],
|
|
76
|
-
['xt tool menus', '
|
|
76
|
+
['xt tool menus', 'List tool titles and ids for a product'],
|
|
77
|
+
['xt tool menus-raw', 'Fetch all raw tool menus for a product'],
|
|
77
78
|
['xt tool fetch-all', 'Fetch raw dynamic args for a tool'],
|
|
78
79
|
['xt tool prepare', 'Resolve upload-dependent dynamic schema for agent workflows'],
|
|
79
80
|
['xt auth ...', 'Legacy auth topic kept for compatibility'],
|