@huaqiu/dsh-analytics 0.4.10 → 0.4.13
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/lib/index.mjs +29 -16
- package/package.json +5 -4
- package/src/generated/builtin-tools.ts +33 -0
- package/src/tool-events.ts +24 -30
package/lib/index.mjs
CHANGED
|
@@ -16,36 +16,49 @@ function createAnalyticsHandler(queue) {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
|
-
//#region src/
|
|
20
|
-
const
|
|
21
|
-
"generate_symbol_from_image",
|
|
22
|
-
"generate_footprint_from_image",
|
|
19
|
+
//#region src/generated/builtin-tools.ts
|
|
20
|
+
const BUILTIN_TOOLS = [
|
|
23
21
|
"generate_footprint_from_dimensions",
|
|
22
|
+
"generate_footprint_from_image",
|
|
24
23
|
"generate_schematic_from_description",
|
|
24
|
+
"generate_symbol_from_image",
|
|
25
25
|
"generate_system_module_graph",
|
|
26
|
-
"
|
|
26
|
+
"get_active_page_netlist",
|
|
27
|
+
"get_eda_bom",
|
|
28
|
+
"get_eda_host_capabilities",
|
|
29
|
+
"get_eda_host_info",
|
|
27
30
|
"get_hqsch_part",
|
|
28
31
|
"get_hqsch_part_models",
|
|
29
32
|
"get_hqsch_supply_chain",
|
|
30
|
-
"
|
|
33
|
+
"get_pcb_board",
|
|
34
|
+
"get_pcb_selection",
|
|
31
35
|
"get_project_netlist",
|
|
32
36
|
"get_selection_netlist",
|
|
33
|
-
"get_active_page_netlist",
|
|
34
|
-
"get_eda_host_info",
|
|
35
|
-
"get_pcb_selection",
|
|
36
|
-
"get_pcb_board",
|
|
37
|
-
"get_eda_host_capabilities",
|
|
38
37
|
"kicad_ipc_diagnose",
|
|
39
38
|
"kicad_ipc_verify_live",
|
|
39
|
+
"kicad_pcb_add_footprint_from_template",
|
|
40
|
+
"kicad_pcb_create_copper_zone",
|
|
40
41
|
"kicad_pcb_create_track",
|
|
41
42
|
"kicad_pcb_create_via",
|
|
42
|
-
"kicad_pcb_create_copper_zone",
|
|
43
|
-
"kicad_pcb_add_footprint_from_template",
|
|
44
43
|
"kicad_pcb_move_rotate_footprint",
|
|
45
|
-
"kicad_pcb_update_selected_track_width",
|
|
46
44
|
"kicad_pcb_refill_zones",
|
|
47
|
-
"kicad_pcb_remove_selected_items"
|
|
48
|
-
|
|
45
|
+
"kicad_pcb_remove_selected_items",
|
|
46
|
+
"kicad_pcb_update_selected_track_width",
|
|
47
|
+
"match_bom",
|
|
48
|
+
"pcb_preview",
|
|
49
|
+
"run_erc",
|
|
50
|
+
"search_hqsch_parts"
|
|
51
|
+
];
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/tool-events.ts
|
|
54
|
+
const EXTRA_TRACKED_TOOLS = [];
|
|
55
|
+
const EXCLUDED_TRACKED_TOOLS = ["run_code"];
|
|
56
|
+
function createTrackedToolSet(builtinTools, extraTools, excludedTools) {
|
|
57
|
+
const tracked = /* @__PURE__ */ new Set([...builtinTools, ...extraTools]);
|
|
58
|
+
for (const name of excludedTools) tracked.delete(name);
|
|
59
|
+
return tracked;
|
|
60
|
+
}
|
|
61
|
+
const TRACKED_TOOLS = createTrackedToolSet(BUILTIN_TOOLS, EXTRA_TRACKED_TOOLS, EXCLUDED_TRACKED_TOOLS);
|
|
49
62
|
function isTrackedTool(name) {
|
|
50
63
|
return TRACKED_TOOLS.has(name);
|
|
51
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaqiu/dsh-analytics",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.13",
|
|
4
4
|
"description": "Huaqiu Sensors Analytics integration for DeepSeek Harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.mjs",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"sa-sdk-javascript": "1.16.16",
|
|
38
|
-
"@huaqiu/dsh-
|
|
39
|
-
"@huaqiu/dsh-
|
|
38
|
+
"@huaqiu/dsh-plugin-log": "0.4.13",
|
|
39
|
+
"@huaqiu/dsh-auth": "0.4.13"
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"lib",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"typecheck": "tsc --noEmit",
|
|
51
|
-
"
|
|
51
|
+
"generate:tools": "node ../../scripts/generate-analytics-tools.mjs",
|
|
52
|
+
"build": "pnpm generate:tools && tsdown",
|
|
52
53
|
"test": "vitest run"
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Generated by scripts/generate-analytics-tools.mjs. Do not edit by hand.
|
|
2
|
+
export const BUILTIN_TOOLS = [
|
|
3
|
+
"generate_footprint_from_dimensions",
|
|
4
|
+
"generate_footprint_from_image",
|
|
5
|
+
"generate_schematic_from_description",
|
|
6
|
+
"generate_symbol_from_image",
|
|
7
|
+
"generate_system_module_graph",
|
|
8
|
+
"get_active_page_netlist",
|
|
9
|
+
"get_eda_bom",
|
|
10
|
+
"get_eda_host_capabilities",
|
|
11
|
+
"get_eda_host_info",
|
|
12
|
+
"get_hqsch_part",
|
|
13
|
+
"get_hqsch_part_models",
|
|
14
|
+
"get_hqsch_supply_chain",
|
|
15
|
+
"get_pcb_board",
|
|
16
|
+
"get_pcb_selection",
|
|
17
|
+
"get_project_netlist",
|
|
18
|
+
"get_selection_netlist",
|
|
19
|
+
"kicad_ipc_diagnose",
|
|
20
|
+
"kicad_ipc_verify_live",
|
|
21
|
+
"kicad_pcb_add_footprint_from_template",
|
|
22
|
+
"kicad_pcb_create_copper_zone",
|
|
23
|
+
"kicad_pcb_create_track",
|
|
24
|
+
"kicad_pcb_create_via",
|
|
25
|
+
"kicad_pcb_move_rotate_footprint",
|
|
26
|
+
"kicad_pcb_refill_zones",
|
|
27
|
+
"kicad_pcb_remove_selected_items",
|
|
28
|
+
"kicad_pcb_update_selected_track_width",
|
|
29
|
+
"match_bom",
|
|
30
|
+
"pcb_preview",
|
|
31
|
+
"run_erc",
|
|
32
|
+
"search_hqsch_parts",
|
|
33
|
+
] as const
|
package/src/tool-events.ts
CHANGED
|
@@ -1,38 +1,32 @@
|
|
|
1
|
+
import { BUILTIN_TOOLS } from './generated/builtin-tools.js'
|
|
2
|
+
|
|
1
3
|
export interface AnalyticsEvent {
|
|
2
4
|
event: string
|
|
3
5
|
properties?: Record<string, unknown>
|
|
4
6
|
}
|
|
5
7
|
|
|
6
|
-
//
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'kicad_pcb_create_via',
|
|
29
|
-
'kicad_pcb_create_copper_zone',
|
|
30
|
-
'kicad_pcb_add_footprint_from_template',
|
|
31
|
-
'kicad_pcb_move_rotate_footprint',
|
|
32
|
-
'kicad_pcb_update_selected_track_width',
|
|
33
|
-
'kicad_pcb_refill_zones',
|
|
34
|
-
'kicad_pcb_remove_selected_items',
|
|
35
|
-
])
|
|
8
|
+
// 埋点工具手动白名单
|
|
9
|
+
export const EXTRA_TRACKED_TOOLS: readonly string[] = []
|
|
10
|
+
|
|
11
|
+
// 埋点工具手动黑名单
|
|
12
|
+
const EXCLUDED_TRACKED_TOOLS = ['run_code'] as const
|
|
13
|
+
|
|
14
|
+
// 埋点工具最终白名单:组合配置获取的工具名单+手动白名单-手动黑名单
|
|
15
|
+
export function createTrackedToolSet(
|
|
16
|
+
builtinTools: readonly string[],
|
|
17
|
+
extraTools: readonly string[],
|
|
18
|
+
excludedTools: readonly string[],
|
|
19
|
+
): ReadonlySet<string> {
|
|
20
|
+
const tracked = new Set([...builtinTools, ...extraTools])
|
|
21
|
+
for (const name of excludedTools) tracked.delete(name)
|
|
22
|
+
return tracked
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const TRACKED_TOOLS = createTrackedToolSet(
|
|
26
|
+
BUILTIN_TOOLS,
|
|
27
|
+
EXTRA_TRACKED_TOOLS,
|
|
28
|
+
EXCLUDED_TRACKED_TOOLS,
|
|
29
|
+
)
|
|
36
30
|
|
|
37
31
|
export function isTrackedTool(name: string): boolean {
|
|
38
32
|
return TRACKED_TOOLS.has(name)
|