agentworkshop 0.7.62 → 0.7.64

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.
Files changed (31) hide show
  1. package/.AgentWorkShop/prompts/host-tools.json +2488 -2526
  2. package/.output/.AgentWorkShop/prompts/host-tools.json +2488 -2526
  3. package/.output/nitro.json +1 -1
  4. package/.output/public/_nuxt/builds/latest.json +1 -1
  5. package/.output/public/_nuxt/builds/meta/1809e625-ff1d-4fd5-9ad2-28cea81f06ab.json +1 -0
  6. package/.output/server/chunks/_/nitro.mjs +924 -1022
  7. package/.output/server/chunks/_/nitro.mjs.map +1 -1
  8. package/.output/server/package.json +1 -1
  9. package/README-zh.md +946 -945
  10. package/README.md +970 -969
  11. package/config.yml +180 -180
  12. package/docs/cli.en.md +447 -447
  13. package/docs/cli.md +412 -412
  14. package/docs/full-test-plan.md +1 -1
  15. package/docs/plugins.en.md +1 -1
  16. package/docs/plugins.md +1 -1
  17. package/docs/sdk.en.md +1 -1
  18. package/docs/sdk.md +1 -1
  19. package/package.json +181 -181
  20. package/scripts/e2e-plc-plugin-closedloop.mjs +1 -1
  21. package/server/plugins-builtin/diag-bridge/host/diagnosis.mjs +13 -3
  22. package/server/plugins-builtin/diag-bridge/host/intents.mjs +62 -0
  23. package/server/plugins-builtin/diag-bridge/host/plugin.mjs +28 -14
  24. package/server/plugins-builtin/diag-bridge/host/sweep.mjs +26 -18
  25. package/server/services/workshop/agents/host-tool-bridge/dispatch.ts +241 -243
  26. package/server/services/workshop/agents/host-tool-bridge/tools/industrial.ts +96 -98
  27. package/server/services/workshop/agents/industrial/dcw-tools.ts +210 -255
  28. package/server/services/workshop/agents/industrial/index.ts +32 -32
  29. package/server/services/workshop/agents/industrial/param-tools.ts +0 -40
  30. package/server/services/workshop/prompts/loader.ts +15 -2
  31. package/.output/public/_nuxt/builds/meta/603a62a6-71d7-4d9c-bb1d-e8264a58798e.json +0 -1
@@ -1,98 +1,96 @@
1
- /**
2
- * 工业工具族(my_industrial_nodes / aml_* / dcw_* / param_* / daq_* / ops_log / recipe_* / line_context / analysis_*)。
3
- *
4
- * 原 dispatchHostTool 首个 switch 的 26 个转发分支按行搬运到本模块:每个分支都只是
5
- * 「按 agentId 查绑定与节点后转交 industrial 模块的同名函数」,因此把闭包捕获的
6
- * (identity.agentId, args) 收敛为显式参数,并整理成「工具名 → 处理器」一张表。
7
- * 工具名集合与处理器表同源(INDUSTRIAL_TOOL_NAMES 由表键导出),不会出现有名字无处理器的分支。
8
- *
9
- * 该族**不依赖 workspace**,由 dispatch 在 workspace 门控之前分流(保持原分发顺序)。
10
- */
11
- import type { HostToolResult } from '../types'
12
- import { toolLineStart, toolLineStop, toolLineStatus, toolAmlDatasetBuild, toolAmlDatasetStats, toolAmlJobCancel, toolAmlJobLogs, toolAmlJobStatus, toolAmlJobSubmit, toolAmlLeaderboard, toolAmlModelFind, toolAmlModelPromote, toolAmlModelReference, toolAmlNodeCatalog, toolAmlTrainingPlanCreate, toolAmlTrainingPlanList, toolAmlTrainingPlanTrain, toolDaqExport, toolDaqFrames, toolDaqQuery, toolDcwControl, toolDcwJudge, toolDcwJournal, toolDcwRead, toolDcwRollback, toolLineContext, toolMesCatalog, toolMesDatasetRead, toolMesDatasets, toolMesFetch, toolMyIndustrialNodes, toolOpsLog, toolParamControl, toolParamRead, toolRecipeApply, toolRecipeLog, toolRecipeRollback, toolRecipeTrial, toolRecipeUpdate, toolRecipeVersions, toolOptimizationExplore, toolTwinProviderCatalog, toolTwinSceneDiscover, toolTwinSceneCompile, toolTwinSceneFreeze, toolTwinSceneRead, toolTwinPhysicsSpecDraft, toolTwinPhysicsSpecValidate, toolTwinPhysicsSpecCompile, toolTwinSnapshotCreate, toolTwinTrialRun, toolMpcOptimize, toolTwinGateEvaluate, toolTwinBayesOptimize, toolTwinCalibrationRequest, toolAnalysisSave, toolAnalysisQuery } from '../../industrial'
13
-
14
- import { toolExpCollect } from '../../industrial/exp-tools'
15
- import { toolRecipePropose } from '../../industrial/recipe-propose-tools'
16
- import { toolAmlActivity } from '../../industrial/aml-activity'
17
-
18
- type IndustrialToolHandler = (agentId: string, args: Record<string, unknown>, channelId?: string) => Promise<HostToolResult>
19
-
20
- /** 工具名 → 转发处理器(顺序与原 dispatch 首个 switch 的分支顺序一致) */
21
- const INDUSTRIAL_HANDLERS = new Map<string, IndustrialToolHandler>([
22
- ['my_industrial_nodes', agentId => toolMyIndustrialNodes(agentId)],
23
- ['aml_node_catalog', agentId => toolAmlNodeCatalog(agentId)],
24
- ['aml_dataset_build', (agentId, args) => toolAmlDatasetBuild(agentId, args as Parameters<typeof toolAmlDatasetBuild>[1])],
25
- ['aml_dataset_stats', (agentId, args) => toolAmlDatasetStats(agentId, args as Parameters<typeof toolAmlDatasetStats>[1])],
26
- ['aml_job_submit', (agentId, args) => toolAmlJobSubmit(agentId, args as Parameters<typeof toolAmlJobSubmit>[1])],
27
- ['aml_job_status', (agentId, args) => toolAmlJobStatus(agentId, args as Parameters<typeof toolAmlJobStatus>[1])],
28
- ['aml_job_logs', (agentId, args) => toolAmlJobLogs(agentId, args as Parameters<typeof toolAmlJobLogs>[1])],
29
- ['aml_job_cancel', (agentId, args) => toolAmlJobCancel(agentId, args as Parameters<typeof toolAmlJobCancel>[1])],
30
- ['aml_leaderboard', (agentId, args) => toolAmlLeaderboard(agentId, args as Parameters<typeof toolAmlLeaderboard>[1])],
31
- ['aml_model_find', (agentId, args) => toolAmlModelFind(agentId, args as Parameters<typeof toolAmlModelFind>[1])],
32
- ['aml_model_promote', (agentId, args) => toolAmlModelPromote(agentId, args as Parameters<typeof toolAmlModelPromote>[1])],
33
- ['aml_model_reference', (agentId, args) => toolAmlModelReference(agentId, args as Parameters<typeof toolAmlModelReference>[1])],
34
- ['aml_training_plan_list', (agentId, args) => toolAmlTrainingPlanList(agentId, args)],
35
- ['aml_training_plan_create', (agentId, args) => toolAmlTrainingPlanCreate(agentId, args as Parameters<typeof toolAmlTrainingPlanCreate>[1])],
36
- ['aml_training_plan_train', (agentId, args) => toolAmlTrainingPlanTrain(agentId, args as Parameters<typeof toolAmlTrainingPlanTrain>[1])],
37
- ['twin_provider_catalog', (agentId, args) => toolTwinProviderCatalog(agentId, args)],
38
- ['twin_scene_discover', (agentId, args) => toolTwinSceneDiscover(agentId, args)],
39
- ['twin_scene_compile', (agentId, args) => toolTwinSceneCompile(agentId, args)],
40
- ['twin_scene_freeze', (agentId, args) => toolTwinSceneFreeze(agentId, args)],
41
- ['twin_physics_spec_draft', (agentId, args) => toolTwinPhysicsSpecDraft(agentId, args)],
42
- ['twin_physics_spec_validate', (agentId, args) => toolTwinPhysicsSpecValidate(agentId, args)],
43
- ['twin_physics_spec_compile', (agentId, args) => toolTwinPhysicsSpecCompile(agentId, args)],
44
- ['twin_scene_read', (agentId, args) => toolTwinSceneRead(agentId, args)],
45
- ['twin_snapshot_create', (agentId, args) => toolTwinSnapshotCreate(agentId, args)],
46
- ['twin_trial_run', (agentId, args) => toolTwinTrialRun(agentId, args)],
47
- ['mpc_optimize', (agentId, args) => toolMpcOptimize(agentId, args)],
48
- ['twin_gate_evaluate', (agentId, args) => toolTwinGateEvaluate(agentId, args)],
49
- ['twin_calibration_request', (agentId, args) => toolTwinCalibrationRequest(agentId, args)],
50
- ['optimization_explore', (agentId, args, channelId) => toolOptimizationExplore(agentId, args as Parameters<typeof toolOptimizationExplore>[1], channelId)],
51
- ['twin_bayes_optimize', (agentId, args) => toolTwinBayesOptimize(agentId, args)],
52
- ['dcw_control', (agentId, args, channelId) => toolDcwControl(agentId, args as { node_id?: string, value?: number | string, hypothesis?: string, task_id?: string }, channelId)],
53
- ['dcw_read', (agentId, args) => toolDcwRead(agentId, args as { node_id?: string })],
54
- ['param_control', (agentId, args, channelId) => toolParamControl(agentId, args as { param?: string, value?: number | string, hypothesis?: string, task_id?: string, line_id?: string }, channelId)],
55
- ['param_read', (agentId, args) => toolParamRead(agentId, args as { param?: string, line_id?: string })],
56
- ['daq_query', (agentId, args) => toolDaqQuery(agentId, args as Parameters<typeof toolDaqQuery>[1])],
57
- ['daq_export', (agentId, args) => toolDaqExport(agentId, args as Parameters<typeof toolDaqExport>[1])],
58
- ['daq_frames', (agentId, args) => toolDaqFrames(agentId, args as Parameters<typeof toolDaqFrames>[1])],
59
- ['dcw_judge', (agentId, args) => toolDcwJudge(agentId, args as { record_id?: string, verdict?: string, reason?: string })],
60
- ['dcw_rollback', (agentId, args) => toolDcwRollback(agentId, args as { record_id?: string, node_id?: string, to?: string })],
61
- ['dcw_journal', (agentId, args) => toolDcwJournal(agentId, args as { node_id?: string, recipe_id?: string, limit?: number | string })],
62
- ['ops_log', (agentId, args) => toolOpsLog(agentId, args as Parameters<typeof toolOpsLog>[1])],
63
- ['recipe_log', (agentId, args) => toolRecipeLog(agentId, args as Parameters<typeof toolRecipeLog>[1])],
64
- ['line_context', (agentId, args) => toolLineContext(agentId, args as { line_id?: string })],
65
- ['recipe_versions', (agentId, args) => toolRecipeVersions(agentId, args as { recipe_id?: string, limit?: number | string })],
66
- ['recipe_update', (agentId, args) => toolRecipeUpdate(agentId, args as Parameters<typeof toolRecipeUpdate>[1])],
67
- ['recipe_rollback', (agentId, args) => toolRecipeRollback(agentId, args as Parameters<typeof toolRecipeRollback>[1])],
68
- ['recipe_trial', (agentId, args) => toolRecipeTrial(agentId, args as Parameters<typeof toolRecipeTrial>[1])],
69
- ['recipe_apply', (agentId, args) => toolRecipeApply(agentId, args as Parameters<typeof toolRecipeApply>[1])],
70
- ['mes_catalog', (agentId, args) => toolMesCatalog(agentId, args as Parameters<typeof toolMesCatalog>[1])],
71
- ['mes_fetch', (agentId, args) => toolMesFetch(agentId, args as Parameters<typeof toolMesFetch>[1])],
72
- ['mes_dataset_read', (agentId, args) => toolMesDatasetRead(agentId, args as Parameters<typeof toolMesDatasetRead>[1])],
73
- ['mes_datasets', (agentId, args) => toolMesDatasets(agentId, args as Parameters<typeof toolMesDatasets>[1])],
74
- ['exp_collect', (agentId, args) => toolExpCollect(agentId, args as { line_id?: string, lineId?: string })],
75
- // 产线 Co-Pilot P2(诊断工程师下发面):整包方案审批 + AML 活动硬闸自查
76
- ['recipe_propose', (agentId, args) => toolRecipePropose(agentId, args as Parameters<typeof toolRecipePropose>[1])],
77
- ['line_start', (agentId, args, channelId) => toolLineStart(agentId, args as Parameters<typeof toolLineStart>[1], channelId)],
78
- ['line_stop', (agentId, args, channelId) => toolLineStop(agentId, args as Parameters<typeof toolLineStop>[1], channelId)],
79
- ['line_status', (agentId, args, channelId) => toolLineStatus(agentId, args as Parameters<typeof toolLineStatus>[1], channelId)],
80
- ['aml_activity', (agentId, args) => toolAmlActivity(agentId, args as { line_id?: string })],
81
- // 数据分析系统:分析结果留痕台账(save 可写台账(非产线写);query 查历史留痕)
82
- ['analysis_save', (agentId, args, channelId) => toolAnalysisSave(agentId, args as Parameters<typeof toolAnalysisSave>[1], channelId)],
83
- ['analysis_query', (agentId, args) => toolAnalysisQuery(agentId, args as Parameters<typeof toolAnalysisQuery>[1])],
84
- ])
85
-
86
- /** 工业工具名集合(与 INDUSTRIAL_HANDLERS 同源;dispatch 据此在 workspace 门控前分流) */
87
- export const INDUSTRIAL_TOOL_NAMES: ReadonlySet<string> = new Set(INDUSTRIAL_HANDLERS.keys())
88
-
89
- /**
90
- * 工业工具族分发:按工具名转交 industrial 模块(调用参数与该族原分支逐字一致)。
91
- * 调用方先经 INDUSTRIAL_TOOL_NAMES 判断,故「未登记的工具名」不可达 —— 仍然显式拒绝,
92
- * 避免静默返回与未知工具混淆。
93
- */
94
- export function dispatchIndustrialTool(agentId: string, toolName: string, args: Record<string, unknown>, channelId?: string): Promise<HostToolResult> {
95
- const handler = INDUSTRIAL_HANDLERS.get(toolName)
96
- if (!handler) return Promise.reject(new Error(`未知工业工具: ${toolName}`))
97
- return handler(agentId, args, channelId)
98
- }
1
+ /**
2
+ * 工业工具族(my_industrial_nodes / aml_* / dcw_* / param_* / daq_* / ops_log / recipe_* / line_context / analysis_*)。
3
+ *
4
+ * 原 dispatchHostTool 首个 switch 的 26 个转发分支按行搬运到本模块:每个分支都只是
5
+ * 「按 agentId 查绑定与节点后转交 industrial 模块的同名函数」,因此把闭包捕获的
6
+ * (identity.agentId, args) 收敛为显式参数,并整理成「工具名 → 处理器」一张表。
7
+ * 工具名集合与处理器表同源(INDUSTRIAL_TOOL_NAMES 由表键导出),不会出现有名字无处理器的分支。
8
+ *
9
+ * 该族**不依赖 workspace**,由 dispatch 在 workspace 门控之前分流(保持原分发顺序)。
10
+ */
11
+ import type { HostToolResult } from '../types'
12
+ import { toolLineStart, toolLineStop, toolLineStatus, toolAmlDatasetBuild, toolAmlDatasetStats, toolAmlJobCancel, toolAmlJobLogs, toolAmlJobStatus, toolAmlJobSubmit, toolAmlLeaderboard, toolAmlModelFind, toolAmlModelPromote, toolAmlModelReference, toolAmlNodeCatalog, toolAmlTrainingPlanCreate, toolAmlTrainingPlanList, toolAmlTrainingPlanTrain, toolDaqExport, toolDaqFrames, toolDaqQuery, toolDcwControl, toolDcwJudge, toolDcwJournal, toolDcwRollback, toolLineContext, toolMesCatalog, toolMesDatasetRead, toolMesDatasets, toolMesFetch, toolMyIndustrialNodes, toolOpsLog, toolParamControl, toolRecipeApply, toolRecipeLog, toolRecipeRollback, toolRecipeTrial, toolRecipeUpdate, toolRecipeVersions, toolOptimizationExplore, toolTwinProviderCatalog, toolTwinSceneDiscover, toolTwinSceneCompile, toolTwinSceneFreeze, toolTwinSceneRead, toolTwinPhysicsSpecDraft, toolTwinPhysicsSpecValidate, toolTwinPhysicsSpecCompile, toolTwinSnapshotCreate, toolTwinTrialRun, toolMpcOptimize, toolTwinGateEvaluate, toolTwinBayesOptimize, toolTwinCalibrationRequest, toolAnalysisSave, toolAnalysisQuery } from '../../industrial'
13
+
14
+ import { toolExpCollect } from '../../industrial/exp-tools'
15
+ import { toolRecipePropose } from '../../industrial/recipe-propose-tools'
16
+ import { toolAmlActivity } from '../../industrial/aml-activity'
17
+
18
+ type IndustrialToolHandler = (agentId: string, args: Record<string, unknown>, channelId?: string) => Promise<HostToolResult>
19
+
20
+ /** 工具名 → 转发处理器(顺序与原 dispatch 首个 switch 的分支顺序一致) */
21
+ const INDUSTRIAL_HANDLERS = new Map<string, IndustrialToolHandler>([
22
+ ['my_industrial_nodes', agentId => toolMyIndustrialNodes(agentId)],
23
+ ['aml_node_catalog', agentId => toolAmlNodeCatalog(agentId)],
24
+ ['aml_dataset_build', (agentId, args) => toolAmlDatasetBuild(agentId, args as Parameters<typeof toolAmlDatasetBuild>[1])],
25
+ ['aml_dataset_stats', (agentId, args) => toolAmlDatasetStats(agentId, args as Parameters<typeof toolAmlDatasetStats>[1])],
26
+ ['aml_job_submit', (agentId, args) => toolAmlJobSubmit(agentId, args as Parameters<typeof toolAmlJobSubmit>[1])],
27
+ ['aml_job_status', (agentId, args) => toolAmlJobStatus(agentId, args as Parameters<typeof toolAmlJobStatus>[1])],
28
+ ['aml_job_logs', (agentId, args) => toolAmlJobLogs(agentId, args as Parameters<typeof toolAmlJobLogs>[1])],
29
+ ['aml_job_cancel', (agentId, args) => toolAmlJobCancel(agentId, args as Parameters<typeof toolAmlJobCancel>[1])],
30
+ ['aml_leaderboard', (agentId, args) => toolAmlLeaderboard(agentId, args as Parameters<typeof toolAmlLeaderboard>[1])],
31
+ ['aml_model_find', (agentId, args) => toolAmlModelFind(agentId, args as Parameters<typeof toolAmlModelFind>[1])],
32
+ ['aml_model_promote', (agentId, args) => toolAmlModelPromote(agentId, args as Parameters<typeof toolAmlModelPromote>[1])],
33
+ ['aml_model_reference', (agentId, args) => toolAmlModelReference(agentId, args as Parameters<typeof toolAmlModelReference>[1])],
34
+ ['aml_training_plan_list', (agentId, args) => toolAmlTrainingPlanList(agentId, args)],
35
+ ['aml_training_plan_create', (agentId, args) => toolAmlTrainingPlanCreate(agentId, args as Parameters<typeof toolAmlTrainingPlanCreate>[1])],
36
+ ['aml_training_plan_train', (agentId, args) => toolAmlTrainingPlanTrain(agentId, args as Parameters<typeof toolAmlTrainingPlanTrain>[1])],
37
+ ['twin_provider_catalog', (agentId, args) => toolTwinProviderCatalog(agentId, args)],
38
+ ['twin_scene_discover', (agentId, args) => toolTwinSceneDiscover(agentId, args)],
39
+ ['twin_scene_compile', (agentId, args) => toolTwinSceneCompile(agentId, args)],
40
+ ['twin_scene_freeze', (agentId, args) => toolTwinSceneFreeze(agentId, args)],
41
+ ['twin_physics_spec_draft', (agentId, args) => toolTwinPhysicsSpecDraft(agentId, args)],
42
+ ['twin_physics_spec_validate', (agentId, args) => toolTwinPhysicsSpecValidate(agentId, args)],
43
+ ['twin_physics_spec_compile', (agentId, args) => toolTwinPhysicsSpecCompile(agentId, args)],
44
+ ['twin_scene_read', (agentId, args) => toolTwinSceneRead(agentId, args)],
45
+ ['twin_snapshot_create', (agentId, args) => toolTwinSnapshotCreate(agentId, args)],
46
+ ['twin_trial_run', (agentId, args) => toolTwinTrialRun(agentId, args)],
47
+ ['mpc_optimize', (agentId, args) => toolMpcOptimize(agentId, args)],
48
+ ['twin_gate_evaluate', (agentId, args) => toolTwinGateEvaluate(agentId, args)],
49
+ ['twin_calibration_request', (agentId, args) => toolTwinCalibrationRequest(agentId, args)],
50
+ ['optimization_explore', (agentId, args, channelId) => toolOptimizationExplore(agentId, args as Parameters<typeof toolOptimizationExplore>[1], channelId)],
51
+ ['twin_bayes_optimize', (agentId, args) => toolTwinBayesOptimize(agentId, args)],
52
+ ['dcw_control', (agentId, args, channelId) => toolDcwControl(agentId, args as { node_id?: string, value?: number | string, hypothesis?: string, task_id?: string }, channelId)],
53
+ ['param_control', (agentId, args, channelId) => toolParamControl(agentId, args as { param?: string, value?: number | string, hypothesis?: string, task_id?: string, line_id?: string }, channelId)],
54
+ ['daq_query', (agentId, args) => toolDaqQuery(agentId, args as Parameters<typeof toolDaqQuery>[1])],
55
+ ['daq_export', (agentId, args) => toolDaqExport(agentId, args as Parameters<typeof toolDaqExport>[1])],
56
+ ['daq_frames', (agentId, args) => toolDaqFrames(agentId, args as Parameters<typeof toolDaqFrames>[1])],
57
+ ['dcw_judge', (agentId, args) => toolDcwJudge(agentId, args as { record_id?: string, verdict?: string, reason?: string })],
58
+ ['dcw_rollback', (agentId, args) => toolDcwRollback(agentId, args as { record_id?: string, node_id?: string, to?: string })],
59
+ ['dcw_journal', (agentId, args) => toolDcwJournal(agentId, args as { node_id?: string, recipe_id?: string, limit?: number | string })],
60
+ ['ops_log', (agentId, args) => toolOpsLog(agentId, args as Parameters<typeof toolOpsLog>[1])],
61
+ ['recipe_log', (agentId, args) => toolRecipeLog(agentId, args as Parameters<typeof toolRecipeLog>[1])],
62
+ ['line_context', (agentId, args) => toolLineContext(agentId, args as { line_id?: string })],
63
+ ['recipe_versions', (agentId, args) => toolRecipeVersions(agentId, args as { recipe_id?: string, limit?: number | string })],
64
+ ['recipe_update', (agentId, args) => toolRecipeUpdate(agentId, args as Parameters<typeof toolRecipeUpdate>[1])],
65
+ ['recipe_rollback', (agentId, args) => toolRecipeRollback(agentId, args as Parameters<typeof toolRecipeRollback>[1])],
66
+ ['recipe_trial', (agentId, args) => toolRecipeTrial(agentId, args as Parameters<typeof toolRecipeTrial>[1])],
67
+ ['recipe_apply', (agentId, args) => toolRecipeApply(agentId, args as Parameters<typeof toolRecipeApply>[1])],
68
+ ['mes_catalog', (agentId, args) => toolMesCatalog(agentId, args as Parameters<typeof toolMesCatalog>[1])],
69
+ ['mes_fetch', (agentId, args) => toolMesFetch(agentId, args as Parameters<typeof toolMesFetch>[1])],
70
+ ['mes_dataset_read', (agentId, args) => toolMesDatasetRead(agentId, args as Parameters<typeof toolMesDatasetRead>[1])],
71
+ ['mes_datasets', (agentId, args) => toolMesDatasets(agentId, args as Parameters<typeof toolMesDatasets>[1])],
72
+ ['exp_collect', (agentId, args) => toolExpCollect(agentId, args as { line_id?: string, lineId?: string })],
73
+ // 产线 Co-Pilot P2(诊断工程师下发面):整包方案审批 + AML 活动硬闸自查
74
+ ['recipe_propose', (agentId, args) => toolRecipePropose(agentId, args as Parameters<typeof toolRecipePropose>[1])],
75
+ ['line_start', (agentId, args, channelId) => toolLineStart(agentId, args as Parameters<typeof toolLineStart>[1], channelId)],
76
+ ['line_stop', (agentId, args, channelId) => toolLineStop(agentId, args as Parameters<typeof toolLineStop>[1], channelId)],
77
+ ['line_status', (agentId, args, channelId) => toolLineStatus(agentId, args as Parameters<typeof toolLineStatus>[1], channelId)],
78
+ ['aml_activity', (agentId, args) => toolAmlActivity(agentId, args as { line_id?: string })],
79
+ // 数据分析系统:分析结果留痕台账(save 可写台账(非产线写);query 查历史留痕)
80
+ ['analysis_save', (agentId, args, channelId) => toolAnalysisSave(agentId, args as Parameters<typeof toolAnalysisSave>[1], channelId)],
81
+ ['analysis_query', (agentId, args) => toolAnalysisQuery(agentId, args as Parameters<typeof toolAnalysisQuery>[1])],
82
+ ])
83
+
84
+ /** 工业工具名集合(与 INDUSTRIAL_HANDLERS 同源;dispatch 据此在 workspace 门控前分流) */
85
+ export const INDUSTRIAL_TOOL_NAMES: ReadonlySet<string> = new Set(INDUSTRIAL_HANDLERS.keys())
86
+
87
+ /**
88
+ * 工业工具族分发:按工具名转交 industrial 模块(调用参数与该族原分支逐字一致)。
89
+ * 调用方先经 INDUSTRIAL_TOOL_NAMES 判断,故「未登记的工具名」不可达 —— 仍然显式拒绝,
90
+ * 避免静默返回与未知工具混淆。
91
+ */
92
+ export function dispatchIndustrialTool(agentId: string, toolName: string, args: Record<string, unknown>, channelId?: string): Promise<HostToolResult> {
93
+ const handler = INDUSTRIAL_HANDLERS.get(toolName)
94
+ if (!handler) return Promise.reject(new Error(`未知工业工具: ${toolName}`))
95
+ return handler(agentId, args, channelId)
96
+ }