@yorha2b-lab/autodev 7.2.0 → 7.3.2

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.
@@ -77,19 +77,19 @@
77
77
  ],
78
78
  "operation": [
79
79
  {
80
- "uri": "BUNKER_API_ANCHOR_view",
80
+ "uri": "BUNKER_API_ANCHOR_viewProfession",
81
81
  "label": "查看",
82
- "action": "view"
82
+ "action": "viewProfession"
83
83
  },
84
84
  {
85
- "uri": "BUNKER_API_ANCHOR_edit",
85
+ "uri": "BUNKER_API_ANCHOR_editProfession",
86
86
  "label": "编辑",
87
- "action": "edit"
87
+ "action": "editProfession"
88
88
  },
89
89
  {
90
- "uri": "BUNKER_API_ANCHOR_delete",
90
+ "uri": "BUNKER_API_ANCHOR_deleteProfession",
91
91
  "label": "删除",
92
- "action": "delete"
92
+ "action": "deleteProfession"
93
93
  }
94
94
  ],
95
95
  "pagination": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorha2b-lab/autodev",
3
- "version": "7.2.0",
3
+ "version": "7.3.2",
4
4
  "description": "基于 AI 视觉与语义协议的前端 (React+Antd) 代码构筑与旧系统重构引擎",
5
5
  "bin": {
6
6
  "bunker": "bin/bunker.js"
@@ -9,6 +9,7 @@ module.exports = {
9
9
 
10
10
  const recruiter = require('../headquarters/recruiter')
11
11
  const logistics = recruiter(path.join(__dirname, '../logistics'))
12
+ const constitution = recruiter(path.join(__dirname, '../constitution'))
12
13
  const headquarters = recruiter(path.join(__dirname, '../headquarters'))
13
14
 
14
15
  const yorha = logistics.presenter.yorha()
@@ -25,6 +26,7 @@ module.exports = {
25
26
  template,
26
27
  logistics,
27
28
  headquarters,
29
+ constitution,
28
30
  units: recruiter(path.join(__dirname, '../units')),
29
31
  briefings: recruiter(path.join(__dirname, `../workshop/${template}/briefings`)),
30
32
  }
@@ -0,0 +1,13 @@
1
+ module.exports = units => `
2
+ # Mission Classification
3
+ 分析输入图片,判断它适合以下哪一种unit执行:
4
+ 可选units: ${units.map(unit => `
5
+ Unit: ${unit.meta.name}
6
+ Mission:${unit.meta.mission}
7
+ Description: ${unit.meta.description}
8
+ Capabilities: ${unit.meta.capabilities.join(', ')}
9
+ `).join('\n')}
10
+
11
+ ## Result
12
+ return capabilities
13
+ `.trim()
@@ -1,11 +1,11 @@
1
- module.exports = ({ yorha, dialog, logistics, briefings }) => {
1
+ module.exports = ({ yorha, dialog, logistics, constitution }) => {
2
2
 
3
3
  const sharp = require('sharp')
4
4
 
5
5
  const { sleep } = logistics.presenter
6
- const { mock, council, similarity, reconciler } = briefings
7
6
  const { textModel, visionModel } = logistics.supporter.getConfig()
8
- const { UI_DESIGNER, API_DESIGNER, MOCK_DESIGNER } = briefings.system
7
+ const { council, similarity, reconciler, simulation } = constitution
8
+ const { UI_DESIGNER, API_DESIGNER, MOCK_DESIGNER } = constitution.system
9
9
 
10
10
  const openAI = require('./client')()
11
11
  const askAI = require('./protocol')({ yorha, sleep, dialog, openAI })
@@ -16,7 +16,7 @@ module.exports = ({ yorha, dialog, logistics, briefings }) => {
16
16
  model: textModel,
17
17
  messages: [
18
18
  { role: 'system', content: MOCK_DESIGNER },
19
- { role: 'user', content: mock({ columns, fileName }) }
19
+ { role: 'user', content: simulation({ columns, fileName }) }
20
20
  ]
21
21
  })
22
22
  },
@@ -13,31 +13,24 @@ module.exports = bunker => {
13
13
  const acp = bunker.get()
14
14
  const units = Object.values(acp.units)
15
15
  const dispatcher = acp.headquarters.dispatcher(acp, 2)
16
- const prompt = `
17
- # Mission Classification
18
- 分析输入图片,判断它适合以下哪一种unit执行:
19
- 可选units: ${units.map(unit => `
20
- Unit: ${unit.meta.name}
21
- Mission:${unit.meta.mission}
22
- Description: ${unit.meta.description}
23
- Capabilities: ${unit.meta.capabilities.join(', ')}
24
- `).join('\n')}
25
-
26
- ## Result
27
- return capabilities
28
- `.trim()
29
16
 
30
17
  dispatcher.onIdle(() => acp.yorha.commander.report(acp.dialog.bunker.systemStandby, 'gray'))
31
18
 
32
19
  return {
33
20
  receive: async mission => {
34
- const spinner = acp.yorha.commander.start(acp.dialog.bunker.detectedEnemy)
21
+ let unit
22
+ let spinner
35
23
  try {
36
- const result = await acp.llm.recognizePage({ filePath: mission.input, prompt })
37
- acp.yorha.commander.success(spinner, acp.dialog.bunker.confirmEnemy)
38
- const unit = units.map(unit => ({ unit, score: unit.meta.capabilities.filter(cap => result.capabilities.includes(cap)).length }))
39
- .filter(item => item.score > 0)
40
- .sort((a, b) => b.score - a.score)[0]?.unit
24
+ if (acp.logistics.supporter.getConfig().useDemo) {
25
+ unit = units.find(unit => unit.meta.name === 'striker')
26
+ } else {
27
+ spinner = acp.yorha.commander.start(acp.dialog.bunker.detectedEnemy)
28
+ const result = await acp.llm.recognizePage({ filePath: mission.input, prompt: acp.constitution.commander(units) })
29
+ acp.yorha.commander.success(spinner, acp.dialog.bunker.confirmEnemy)
30
+ unit = units.map(unit => ({ unit, score: unit.meta.capabilities.filter(cap => result.capabilities.includes(cap)).length }))
31
+ .filter(item => item.score > 0)
32
+ .sort((a, b) => b.score - a.score)[0]?.unit
33
+ }
41
34
  if (!unit) {
42
35
  acp.yorha.commander.fail(spinner, acp.dialog.bunker.missionFailed)
43
36
  return
@@ -4,22 +4,22 @@ module.exports = bunker => {
4
4
  const chokidar = require('chokidar')
5
5
  const commander = require('../headquarters/commander')(bunker)
6
6
 
7
- const settingWatcher = chokidar.watch('./bunker/config.js', { persistent: true, ignoreInitial: true })
7
+ const settingObserver = chokidar.watch('./bunker/config.js', { persistent: true, ignoreInitial: true })
8
8
 
9
- const missionWatcher = chokidar.watch('./bunker/mission/', {
9
+ const missionObserver = chokidar.watch('./bunker/mission/', {
10
10
  persistent: true,
11
11
  ignoreInitial: true,
12
12
  ignored: /(^|[\/\\])\../,
13
13
  awaitWriteFinish: { stabilityThreshold: 500, pollInterval: 100 },
14
14
  })
15
15
 
16
- missionWatcher.on('add', filePath => {
16
+ missionObserver.on('add', filePath => {
17
17
  if (['.png', '.jpg', '.jpeg', '.webp'].includes(path.extname(filePath))) {
18
18
  commander.receive({ input: filePath })
19
19
  }
20
20
  })
21
21
 
22
- settingWatcher.on('change', file => {
22
+ settingObserver.on('change', file => {
23
23
  if (file.endsWith('config.js')) {
24
24
  bunker.reboot()
25
25
  }
@@ -2,7 +2,9 @@ module.exports = `
2
2
  # Task: Full-Page UI Analysis & Structural Assembly
3
3
  执行全页面视觉特征提取,并按照物理布局顺序输出标准的构筑协议。
4
4
 
5
- **模块名: 页面主体名称[英文]**
5
+ ##模块名
6
+ - **来源**: 页面标题/表格列信息
7
+ - **目标**: 提取页面主体名称[英文]作为模块名
6
8
 
7
9
  ## 核心命名协议 (Naming Convention)
8
10
  - **驼峰命名**: 所有变量及函数名必须遵循 camelCase。
@@ -33,7 +35,7 @@ module.exports = `
33
35
  ## 表格主体 (table)
34
36
  - **基础格式(columns)**: [{ title: '文本', dataIndex: 'englishName' }]。
35
37
  - **配置项**: [pagination, expandable, rowSelection] 均为布尔值。
36
- - **行操作 (operation)**: [{ label: '操作名', action: '操作动词[模块名单数形式]', uri: 'BUNKER_API_ANCHOR_操作动词[模块名单数形式]'}]
38
+ - **行操作 (operation)**: [{ label: '操作名', action: '操作动词+[模块名单数]', uri: 'BUNKER_API_ANCHOR_动词+[模块名单数]'}]
37
39
  - **类型定义 (type)**:
38
40
  - enum: 枚举列
39
41
  - money: 金额列
@@ -45,7 +47,7 @@ module.exports = `
45
47
  - badge: 徽标列(文本前有颜色小圆点)
46
48
 
47
49
  ## 全局功能按钮 (functionButton)
48
- - **基础格式**: [{ btn: '按钮', action: '操作动词[模块名复数形式]', uri: 'BUNKER_API_ANCHOR_动词[模块名复数形式]'}]。
50
+ - **基础格式**: [{ btn: '按钮', action: '操作动词+[模块名复数]', uri: 'BUNKER_API_ANCHOR_动词+[模块名复数]'}]。
49
51
  - **导出数据**: action 设为 'export[模块名]'。
50
52
  - **逻辑锁定**: 只要页面中出现了非查询、非重置的独立操作按钮,必须识别并存入 [functionButton] 数组。
51
53
  - **构筑联动**: 若 [functionButton] 数组不为空,则在下文的 [RenderTree] 中必须包含 "FunctionButtons"。
@@ -50,6 +50,10 @@ export const useTableQuery = ({ api, cols = [], initialParams = {}, formatRespon
50
50
  apiRef.current = api
51
51
  }, [api])
52
52
 
53
+ useEffect(() => {
54
+ formatResponseRef.current = formatResponse
55
+ }, [formatResponse])
56
+
53
57
  /**
54
58
  * @function getColumnSchema
55
59
  * @description [指纹识别协议] 对列配置执行“结构化脱水”。
@@ -104,7 +108,7 @@ export const useTableQuery = ({ api, cols = [], initialParams = {}, formatRespon
104
108
  setLoading(false)
105
109
  }
106
110
  }
107
- }, [search, isLocalPaging, dataSource.length])
111
+ }, [search, isLocalPaging])
108
112
 
109
113
  useEffect(() => {
110
114
  fetchData()