tyc-cli 0.2.3 → 0.2.4
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/dist/catalog.json +12 -6
- package/dist/commands/layers.js +78 -6
- package/dist/index.js +21 -5
- package/dist/registry.js +10 -0
- package/package.json +1 -1
package/dist/catalog.json
CHANGED
|
@@ -675,7 +675,8 @@
|
|
|
675
675
|
"required": true,
|
|
676
676
|
"description": "企业名称 或 统一社会信用代码"
|
|
677
677
|
}
|
|
678
|
-
]
|
|
678
|
+
],
|
|
679
|
+
"priority": true
|
|
679
680
|
},
|
|
680
681
|
{
|
|
681
682
|
"name": "get_stock_executives",
|
|
@@ -964,7 +965,8 @@
|
|
|
964
965
|
"required": true,
|
|
965
966
|
"description": "人员姓名"
|
|
966
967
|
}
|
|
967
|
-
]
|
|
968
|
+
],
|
|
969
|
+
"priority": true
|
|
968
970
|
},
|
|
969
971
|
{
|
|
970
972
|
"name": "get_personnel_controlled_companies",
|
|
@@ -1446,7 +1448,8 @@
|
|
|
1446
1448
|
"required": true,
|
|
1447
1449
|
"description": "企业名称 或 统一社会信用代码"
|
|
1448
1450
|
}
|
|
1449
|
-
]
|
|
1451
|
+
],
|
|
1452
|
+
"priority": true
|
|
1450
1453
|
},
|
|
1451
1454
|
{
|
|
1452
1455
|
"name": "get_historical_shareholders",
|
|
@@ -1675,7 +1678,8 @@
|
|
|
1675
1678
|
"required": true,
|
|
1676
1679
|
"description": "企业名称 或 统一社会信用代码"
|
|
1677
1680
|
}
|
|
1678
|
-
]
|
|
1681
|
+
],
|
|
1682
|
+
"priority": true
|
|
1679
1683
|
},
|
|
1680
1684
|
{
|
|
1681
1685
|
"name": "search_patents",
|
|
@@ -1759,7 +1763,8 @@
|
|
|
1759
1763
|
"required": true,
|
|
1760
1764
|
"description": "企业名称 或 统一社会信用代码"
|
|
1761
1765
|
}
|
|
1762
|
-
]
|
|
1766
|
+
],
|
|
1767
|
+
"priority": true
|
|
1763
1768
|
},
|
|
1764
1769
|
{
|
|
1765
1770
|
"name": "get_bonds",
|
|
@@ -2558,7 +2563,8 @@
|
|
|
2558
2563
|
"required": true,
|
|
2559
2564
|
"description": "企业名称 或 统一社会信用代码"
|
|
2560
2565
|
}
|
|
2561
|
-
]
|
|
2566
|
+
],
|
|
2567
|
+
"priority": true
|
|
2562
2568
|
},
|
|
2563
2569
|
{
|
|
2564
2570
|
"name": "get_judicial_documents",
|
package/dist/commands/layers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCategories, getCategoryName, getLayerCount, getToolsByLayer, getTotalCount, } from "../registry.js";
|
|
1
|
+
import { getCategories, getCategoryName, getLayerCount, getPriorityTools, getToolsByLayer, getTotalCount, } from "../registry.js";
|
|
2
2
|
const LAYER_SPECS = [
|
|
3
3
|
{
|
|
4
4
|
layer: "L0",
|
|
@@ -54,11 +54,17 @@ function registerLayers(program) {
|
|
|
54
54
|
contract: s.contract,
|
|
55
55
|
})),
|
|
56
56
|
categories: getCategories(),
|
|
57
|
+
l2_priority: getPriorityTools().map((t) => ({
|
|
58
|
+
facet: t.group,
|
|
59
|
+
tool: t.name,
|
|
60
|
+
cli: `tyc ${t.group} ${t.cliMethod}`,
|
|
61
|
+
description: t.description,
|
|
62
|
+
})),
|
|
57
63
|
recommended_call_order: [
|
|
58
64
|
`0. Anchor at L0 — feed the user's raw company name into the ${getLayerCount("L0")} L0 tool (search_companies); lock onto a USCC + official name`,
|
|
59
65
|
`1. Ascend to L1 — pick ONE of the ${getLayerCount("L1")} overview tools with the anchored USCC`,
|
|
60
66
|
"2. Read _summary + drill_down hints from the response",
|
|
61
|
-
`3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools)`,
|
|
67
|
+
`3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools); when unsure which L2, default to the facet's L2 优先 (★, see l2_priority)`,
|
|
62
68
|
`4. Reach L3 for id-based detail, search_*, or vertical SKILL tools (${getLayerCount("L3")} tools)`,
|
|
63
69
|
],
|
|
64
70
|
};
|
|
@@ -91,6 +97,9 @@ function registerLayerCmd(program, spec) {
|
|
|
91
97
|
count: tools.length,
|
|
92
98
|
trigger: spec.trigger,
|
|
93
99
|
contract: spec.contract,
|
|
100
|
+
priority_count: layer === "L2"
|
|
101
|
+
? tools.filter((t) => t.priority).length
|
|
102
|
+
: undefined,
|
|
94
103
|
tools: tools.map((t) => ({
|
|
95
104
|
name: t.name,
|
|
96
105
|
group: t.group,
|
|
@@ -98,6 +107,7 @@ function registerLayerCmd(program, spec) {
|
|
|
98
107
|
cli: `tyc ${t.group} ${t.cliMethod}`,
|
|
99
108
|
description: t.description,
|
|
100
109
|
params: t.params ?? [],
|
|
110
|
+
...(t.priority ? { priority: true } : {}),
|
|
101
111
|
})),
|
|
102
112
|
};
|
|
103
113
|
console.log(JSON.stringify(payload, null, 2));
|
|
@@ -129,13 +139,22 @@ function renderLayersText() {
|
|
|
129
139
|
lines.push(` Trigger: ${s.trigger}`);
|
|
130
140
|
lines.push(` Contract: ${s.contract}`);
|
|
131
141
|
lines.push(` List: tyc ${s.layer} list [--md|--json]`);
|
|
142
|
+
if (s.layer === "L2") {
|
|
143
|
+
const prio = getPriorityTools();
|
|
144
|
+
lines.push("");
|
|
145
|
+
lines.push(` L2 优先(★ "L2★ 队副",每 facet 1 个,共 ${prio.length} 个):Agent 拿到 L1 _summary`);
|
|
146
|
+
lines.push(" 若不确定走哪个 L2,默认推这 6 个之一:");
|
|
147
|
+
for (const t of prio) {
|
|
148
|
+
lines.push(` ★ ${pad(t.group, 22)} ${pad(t.name, 36)} (tyc ${t.group} ${t.cliMethod})`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
132
151
|
lines.push("");
|
|
133
152
|
}
|
|
134
153
|
lines.push("Recommended call order for agents:");
|
|
135
154
|
lines.push(` 0. Anchor at L0 — feed the user's raw company name into the ${getLayerCount("L0")} L0 tool (search_companies)`);
|
|
136
155
|
lines.push(` 1. Ascend to L1 — one of the ${getLayerCount("L1")} overview tools, with the anchored USCC`);
|
|
137
156
|
lines.push(" 2. Read _summary + drill_down hints in the response");
|
|
138
|
-
lines.push(` 3. Drill to L2 for a specific dimension (${getLayerCount("L2")} tools)`);
|
|
157
|
+
lines.push(` 3. Drill to L2 for a specific dimension (${getLayerCount("L2")} tools); unsure which L2 → default to that facet's L2★ 优先 (see L2 block above)`);
|
|
139
158
|
lines.push(` 4. Reach L3 for id-based detail / search_* / vertical SKILL (${getLayerCount("L3")} tools)`);
|
|
140
159
|
return lines.join("\n");
|
|
141
160
|
}
|
|
@@ -153,12 +172,24 @@ function renderLayersMarkdown() {
|
|
|
153
172
|
lines.push(`| **${s.layer}** ${s.title} | ${getLayerCount(s.layer)} | ${escapeCell(s.summary)} | ${escapeCell(s.trigger)} |`);
|
|
154
173
|
}
|
|
155
174
|
lines.push("");
|
|
175
|
+
// L2 优先("L2★ 队副")映射表
|
|
176
|
+
const prio = getPriorityTools();
|
|
177
|
+
lines.push(`**L2 优先 ★ — \`L2★ 队副\`(${prio.length} 个,每 facet 1 个)**`);
|
|
178
|
+
lines.push("");
|
|
179
|
+
lines.push("> Agent 拿到 L1 `_summary` 后若不确定走哪个 L2,默认推对应 facet 的 L2 优先工具。");
|
|
180
|
+
lines.push("");
|
|
181
|
+
lines.push("| facet | L2★ 优先工具 | CLI |");
|
|
182
|
+
lines.push("|---|---|---|");
|
|
183
|
+
for (const t of prio) {
|
|
184
|
+
lines.push(`| ${t.group} | \`${t.name}\` | \`tyc ${t.group} ${t.cliMethod}\` |`);
|
|
185
|
+
}
|
|
186
|
+
lines.push("");
|
|
156
187
|
lines.push("**Recommended call order for agents**");
|
|
157
188
|
lines.push("");
|
|
158
189
|
lines.push(`0. Anchor at L0 — feed the user's raw company name into the ${getLayerCount("L0")} L0 tool (\`search_companies\`); lock onto a USCC + official name.`);
|
|
159
190
|
lines.push(`1. Ascend to L1 — pick ONE of the ${getLayerCount("L1")} overview tools with the anchored USCC.`);
|
|
160
191
|
lines.push("2. Read `_summary` + `drill_down` hints in the response.");
|
|
161
|
-
lines.push(`3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools).`);
|
|
192
|
+
lines.push(`3. Drill to L2 for a specific dimension (items + totals; ${getLayerCount("L2")} tools). Unsure which L2 → default to that facet's L2★ 优先 (table above).`);
|
|
162
193
|
lines.push(`4. Reach L3 for id-based detail, \`search_*\`, or vertical SKILL tools (${getLayerCount("L3")} tools).`);
|
|
163
194
|
lines.push("");
|
|
164
195
|
lines.push("**Discover each layer**");
|
|
@@ -175,6 +206,24 @@ function renderLayerListText(spec, tools) {
|
|
|
175
206
|
lines.push(`${spec.layer} · ${spec.title} (${n} tool${n === 1 ? "" : "s"})`);
|
|
176
207
|
lines.push(`Trigger: ${spec.trigger}`);
|
|
177
208
|
lines.push("");
|
|
209
|
+
// L2 优先置顶(只在 L2 list 渲染)
|
|
210
|
+
if (spec.layer === "L2") {
|
|
211
|
+
const prio = tools.filter((t) => t.priority);
|
|
212
|
+
if (prio.length > 0) {
|
|
213
|
+
lines.push(`★ L2 优先("L2★ 队副",${prio.length} 个,每 facet 1 个)`);
|
|
214
|
+
lines.push(" Agent 拿到 L1 _summary 不确定走哪个 L2 时,默认推这 6 个之一。");
|
|
215
|
+
const groupsOrder = getCategories().map((c) => c.group);
|
|
216
|
+
const orderIdx = new Map();
|
|
217
|
+
groupsOrder.forEach((g, i) => orderIdx.set(g, i));
|
|
218
|
+
const sortedPrio = [...prio].sort((a, b) => (orderIdx.get(a.group) ?? 999) - (orderIdx.get(b.group) ?? 999));
|
|
219
|
+
for (const t of sortedPrio) {
|
|
220
|
+
const cli = `tyc ${t.group} ${t.cliMethod}`;
|
|
221
|
+
lines.push(` ★ ${pad(t.group, 22)} ${pad(t.name, 36)} ${cli}`);
|
|
222
|
+
lines.push(` ${oneLine(t.description)}`);
|
|
223
|
+
}
|
|
224
|
+
lines.push("");
|
|
225
|
+
}
|
|
226
|
+
}
|
|
178
227
|
// 按 group 分组打印(按 categories 中声明顺序)
|
|
179
228
|
const groupsOrder = getCategories().map((c) => c.group);
|
|
180
229
|
const grouped = new Map();
|
|
@@ -191,7 +240,8 @@ function renderLayerListText(spec, tools) {
|
|
|
191
240
|
lines.push(`── ${g} (${zh}, ${arr.length}) ──`);
|
|
192
241
|
for (const t of arr) {
|
|
193
242
|
const cli = `tyc ${t.group} ${t.cliMethod}`;
|
|
194
|
-
|
|
243
|
+
const star = t.priority ? "★ " : " ";
|
|
244
|
+
lines.push(` ${star}${pad(t.name, 46)} ${cli}`);
|
|
195
245
|
lines.push(` ${oneLine(t.description)}`);
|
|
196
246
|
}
|
|
197
247
|
lines.push("");
|
|
@@ -207,6 +257,27 @@ function renderLayerListMarkdown(spec, tools) {
|
|
|
207
257
|
lines.push(`> **${n} tool${n === 1 ? "" : "s"}** · ${spec.summary} `);
|
|
208
258
|
lines.push(`> Trigger: ${spec.trigger}`);
|
|
209
259
|
lines.push("");
|
|
260
|
+
// L2 优先置顶(只在 L2 list 渲染)
|
|
261
|
+
if (spec.layer === "L2") {
|
|
262
|
+
const prio = tools.filter((t) => t.priority);
|
|
263
|
+
if (prio.length > 0) {
|
|
264
|
+
const groupsOrder = getCategories().map((c) => c.group);
|
|
265
|
+
const orderIdx = new Map();
|
|
266
|
+
groupsOrder.forEach((g, i) => orderIdx.set(g, i));
|
|
267
|
+
const sortedPrio = [...prio].sort((a, b) => (orderIdx.get(a.group) ?? 999) - (orderIdx.get(b.group) ?? 999));
|
|
268
|
+
lines.push(`## ★ L2 优先(\`L2★ 队副\`,${prio.length} 个)`);
|
|
269
|
+
lines.push("");
|
|
270
|
+
lines.push("> 每 facet 1 个;Agent 拿到 L1 `_summary` 不确定走哪个 L2 时,默认推这 6 个之一。");
|
|
271
|
+
lines.push("");
|
|
272
|
+
lines.push("| ★ | facet | Tool | CLI | Description |");
|
|
273
|
+
lines.push("|---|---|---|---|---|");
|
|
274
|
+
for (const t of sortedPrio) {
|
|
275
|
+
const cli = `\`tyc ${t.group} ${t.cliMethod}\``;
|
|
276
|
+
lines.push(`| ★ | ${t.group} | \`${t.name}\` | ${cli} | ${escapeCell(oneLine(t.description))} |`);
|
|
277
|
+
}
|
|
278
|
+
lines.push("");
|
|
279
|
+
}
|
|
280
|
+
}
|
|
210
281
|
const groupsOrder = getCategories().map((c) => c.group);
|
|
211
282
|
const grouped = new Map();
|
|
212
283
|
for (const t of tools) {
|
|
@@ -225,7 +296,8 @@ function renderLayerListMarkdown(spec, tools) {
|
|
|
225
296
|
lines.push("|---|---|---|");
|
|
226
297
|
for (const t of arr) {
|
|
227
298
|
const cli = `\`tyc ${t.group} ${t.cliMethod}\``;
|
|
228
|
-
|
|
299
|
+
const name = t.priority ? `★ \`${t.name}\`` : `\`${t.name}\``;
|
|
300
|
+
lines.push(`| ${name} | ${cli} | ${escapeCell(oneLine(t.description))} |`);
|
|
229
301
|
}
|
|
230
302
|
lines.push("");
|
|
231
303
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Command } from "commander";
|
|
|
3
3
|
import { registerInitCommand } from "./commands/init.js";
|
|
4
4
|
import { registerCategoryCommands } from "./commands/category.js";
|
|
5
5
|
import { registerLayerCommands } from "./commands/layers.js";
|
|
6
|
-
import { getCategories, getLayerCount, getTotalCount, } from "./registry.js";
|
|
6
|
+
import { getCategories, getLayerCount, getPriorityTools, getTotalCount, } from "./registry.js";
|
|
7
7
|
// 顶层 help:把"最懂 AI 的 CLI"落在 4 层架构 + 调用顺序 + 可发现性上。
|
|
8
8
|
// Agent 看 tyc --help 时应立刻读懂"先 L0 锚定企业,再 L1 概览,再 L2 下钻,最后 L3 详情"这条主线。
|
|
9
9
|
const helpText = `
|
|
@@ -16,7 +16,7 @@ ARCHITECTURE — Layered Tool Discovery for LLM Agents
|
|
|
16
16
|
|
|
17
17
|
┌─ L0 Resolve ${pad(getLayerCount("L0"), 3)} tool entity resolution · 简称/曾用名/模糊名 → 精确企业
|
|
18
18
|
├─ L1 Overview ${pad(getLayerCount("L1"), 3)} tools one captain per facet · returns _summary + drill_down
|
|
19
|
-
├─ L2 Drill-down ${pad(getLayerCount("L2"), 3)} tools one-hop into a specific data dimension
|
|
19
|
+
├─ L2 Drill-down ${pad(getLayerCount("L2"), 3)} tools one-hop into a specific data dimension (★ = L2 优先, see below)
|
|
20
20
|
└─ L3 Specialized ${pad(getLayerCount("L3"), 3)} tools id-based detail · search_* · vertical SKILLs
|
|
21
21
|
|
|
22
22
|
Recommended call order:
|
|
@@ -28,6 +28,7 @@ ARCHITECTURE — Layered Tool Discovery for LLM Agents
|
|
|
28
28
|
anchored USCC. Read the response's _summary + drill_down.
|
|
29
29
|
2. Descend to L2. Follow hints to a specific dimension
|
|
30
30
|
(shareholders / litigation / patents / annual reports …).
|
|
31
|
+
If unsure which L2, default to that facet's L2★ 优先 (below).
|
|
31
32
|
3. Land on L3. When L2 returns a list item with an \`id\`, a \`search_*\`
|
|
32
33
|
need arises, or a vertical SKILL is activated.
|
|
33
34
|
|
|
@@ -36,15 +37,23 @@ ARCHITECTURE — Layered Tool Discovery for LLM Agents
|
|
|
36
37
|
in hand) wastes downstream calls on the wrong entity.
|
|
37
38
|
Default LLM surface = L0 + L1 = ${getLayerCount("L0") + getLayerCount("L1")} tools (≤ 15-tool exposure limit).
|
|
38
39
|
|
|
40
|
+
L2 优先 ★ — \`L2★ 队副\`(${getPriorityTools().length} 个,每 facet 1 个)
|
|
41
|
+
|
|
42
|
+
Agent 拿到 L1 _summary 后若不确定走哪个 L2,对应 facet 的"L2 优先"是默认下钻:
|
|
43
|
+
|
|
44
|
+
${renderPriorityLines()}
|
|
45
|
+
|
|
46
|
+
Detail: tyc layers / tyc L2 list (★ marks priority rows)
|
|
47
|
+
|
|
39
48
|
DISCOVER BY LAYER
|
|
40
49
|
|
|
41
|
-
tyc layers one-screen architecture map
|
|
50
|
+
tyc layers one-screen architecture map (含 L2 优先映射)
|
|
42
51
|
tyc L0 list list the ${getLayerCount("L0")} L0 tool (entity-resolve layer)
|
|
43
52
|
tyc L1 list list all ${getLayerCount("L1")} L1 tools (overview, grouped)
|
|
44
|
-
tyc L2 list list all ${getLayerCount("L2")} L2 tools (drill-down
|
|
53
|
+
tyc L2 list list all ${getLayerCount("L2")} L2 tools (drill-down; ★ priority pinned to top)
|
|
45
54
|
tyc L3 list list all ${getLayerCount("L3")} L3 tools (specialized, grouped)
|
|
46
55
|
tyc L0 list --md Markdown tables (agent on-screen)
|
|
47
|
-
tyc L0 list --json machine-readable JSON (id · cli · params · description)
|
|
56
|
+
tyc L0 list --json machine-readable JSON (id · cli · params · description · priority)
|
|
48
57
|
|
|
49
58
|
DISCOVER BY CATEGORY (orthogonal to layers, 6 groups)
|
|
50
59
|
|
|
@@ -78,6 +87,13 @@ function renderCategoryLines() {
|
|
|
78
87
|
}
|
|
79
88
|
return lines.join("\n");
|
|
80
89
|
}
|
|
90
|
+
function renderPriorityLines() {
|
|
91
|
+
const lines = [];
|
|
92
|
+
for (const t of getPriorityTools()) {
|
|
93
|
+
lines.push(` ★ ${t.group.padEnd(22)} ${t.name.padEnd(36)} (tyc ${t.group} ${t.cliMethod})`);
|
|
94
|
+
}
|
|
95
|
+
return lines.join("\n");
|
|
96
|
+
}
|
|
81
97
|
const program = new Command()
|
|
82
98
|
.name("tyc")
|
|
83
99
|
.description(`Tianyan AI CLI — ${getTotalCount()} commercial-data tools · L0=${getLayerCount("L0")} L1=${getLayerCount("L1")} L2=${getLayerCount("L2")} L3=${getLayerCount("L3")} · the AI-native gateway (pair with the TA MCP Server)`)
|
package/dist/registry.js
CHANGED
|
@@ -62,3 +62,13 @@ export function getLayerCount(layer) {
|
|
|
62
62
|
export function getCategoryName(group) {
|
|
63
63
|
return getCategories().find((c) => c.group === group)?.name_zh ?? group;
|
|
64
64
|
}
|
|
65
|
+
// 6 个 L2 优先工具("L2★ 队副"):每 facet 1 个,Agent 在 L1 _summary 之后
|
|
66
|
+
// 若不确定该往哪个 L2 钻,默认推这 6 个之一。order 与 categories 声明顺序一致。
|
|
67
|
+
export function getPriorityTools() {
|
|
68
|
+
const groupsOrder = getCategories().map((c) => c.group);
|
|
69
|
+
const orderIdx = new Map();
|
|
70
|
+
groupsOrder.forEach((g, i) => orderIdx.set(g, i));
|
|
71
|
+
return load()
|
|
72
|
+
.tools.filter((t) => t.priority === true)
|
|
73
|
+
.sort((a, b) => (orderIdx.get(a.group) ?? 999) - (orderIdx.get(b.group) ?? 999));
|
|
74
|
+
}
|