@jnrs/lingshu-smart 3.1.16 → 3.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/AGENTS.md +5 -5
- package/dist/components/debug/WsProxy/MappingGrid.vue.d.ts +3 -0
- package/dist/components/debug/WsProxy/proxy.d.ts +22 -2
- package/dist/components/index.js +6487 -6579
- package/dist/components/preview/index.vue.d.ts +1404 -702
- package/dist/controller/AppController.d.ts +1 -1
- package/dist/lingshu-smart/cases.json +154 -1
- package/dist/playground/ViewPageDemo.vue.d.ts +2808 -1404
- package/dist/stores/index.js +1 -1
- package/dist/stores/useAppStore.d.ts +4212 -2106
- package/dist/stores/useDataStore.d.ts +4218 -2106
- package/dist/types/base.types.d.ts +4 -1
- package/dist/types/models/config.types.d.ts +3 -3
- package/dist/{useAppStore-ear8sr0q.js → useAppStore-BNICxg4C.js} +1526 -1465
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -386,7 +386,7 @@ onMounted(() => {
|
|
|
386
386
|
|
|
387
387
|
| 属性 | 类型 | 必填 | 说明 |
|
|
388
388
|
| ----------- | -------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
389
|
-
| `id` | `string` | ✓ | 业务设备 ID,对应图层 `rawData.
|
|
389
|
+
| `id` | `string` | ✓ | 业务设备 ID,对应图层 `rawData.businessId` |
|
|
390
390
|
| `className` | `EnumModel` | ✓ | 设备类型枚举,用于 businessMap 匹配 |
|
|
391
391
|
| `raw_data` | `IRowData` | ✓ | 原始业务数据,建议传入完整 payload |
|
|
392
392
|
| `resource` | `IResourceOperating` | — | 工位槽资源增删(多设备共用) |
|
|
@@ -526,7 +526,7 @@ type ILayerOperating =
|
|
|
526
526
|
| 属性 | 类型 | 说明 |
|
|
527
527
|
| ------- | -------- | --------------------------- |
|
|
528
528
|
| `x` | `number` | 拖链延伸位置(像素) |
|
|
529
|
-
| `botId` | `string` | 关联移动设备的 `rawData.
|
|
529
|
+
| `botId` | `string` | 关联移动设备的 `rawData.businessId` |
|
|
530
530
|
|
|
531
531
|
#### IResourceStoreOperating
|
|
532
532
|
|
|
@@ -639,7 +639,7 @@ type ILayerOperating =
|
|
|
639
639
|
## 📝 注意事项
|
|
640
640
|
|
|
641
641
|
1. **编辑器 vs 预览:** 编辑模式配置 `EditorActions`;预览模式配置 `PreviewActions`,并通过 `feedSocketMessage` 下发标准信封协议消息(`envelope + payload`)驱动画布。画布内置 `SocketDispatcher` 自动分发,业务侧无需自行解析 `payload.type`。
|
|
642
|
-
2. **设备 ID 匹配:** 协议消息中 `device_id` 必须与方案图层 `rawData.
|
|
642
|
+
2. **设备 ID 匹配:** 协议消息中 `device_id` 必须与方案图层 `rawData.businessId` 一致,否则回执 `404` 且不驱动(在前端层面该值即为编辑器组件中业务数据配置中「设备业务标识」的值,需根据后端预先提供的设备 id 在编辑器中进行配置);设备业务标识已由旧版 `rawData.id` 迁移至 `rawData.businessId`(旧字段不再作为业务标识读取),宿主若直接读取业务标识需同步适配
|
|
643
643
|
3. **坐标系:** 协议 `position.x/y/z` 为比例值 \[0,1],画布按场景自动换算为像素;`j1 / j2 / fork_xy / fork_z` 为角度/比例原值直接透传
|
|
644
644
|
4. **资源消息:** `resource_command` 不再映射到独立图层,资源为独立实体,由画布对象资源池按 `resource_id` 管理,操作工位的纯位置槽
|
|
645
645
|
5. **扩展工位(合并编号):** 托盘图层配置 `extendHostId`(宿主设备业务 ID)后,托盘工位并入宿主设备的合并编号空间——资源寻址宿主越界时按「宿主工位总数 + 前序扩展托盘工位总数」顺延落到扩展托盘(404/409 以实际承接工位判定);点击扩展托盘工位时 `onTap` 的 `layer` 为宿主设备、`data.index` 为合并编号(附 `extensionOf` / `localIndex` 溯源字段)。详见 socket-operating-api.md 3.6
|
|
@@ -662,8 +662,8 @@ type ILayerOperating =
|
|
|
662
662
|
| `composables/useDebugEasterEgg.ts` | 调试触发检测:500ms 内 10 次点击打开面板 |
|
|
663
663
|
| `components/debug/GlobalSetting.vue` | 全局设置对话框 UI(原 DebugPanel,含语言/日志等级/FPS/阴影/动画等开关) |
|
|
664
664
|
| `components/debug/ScriptRunner/` | Socket 脚本模拟器:脚本步骤编排、断点调试,生成标准信封协议消息(`envelope + payload`,含 device_init / device_command / resource_command / alarm_push / scene_reset 等模板);设备下拉支持自定义/全部复位(resetAll)/资源操作,「添加」支持单点 / 持续运行 / **自定义脚本**(`__raw__`:编辑「消息数据(JSON)」,运行时原样透出、不包装 envelope 不做加工)三种步骤,产物经 `feedSocketMessage`/`feedMessage` 驱动画布;脚本**按方案分组**存储(`ScriptCaseData[]`:caseId / caseName / steps / looping,与 `wsProxyConfig` 对称,经 `currentCase` prop 确定归属);支持**一键烧录**(二次确认后写入 `public/lingshu-smart/mockSocket.json`,开发服务器接口 `POST /lingshu-smart/__burn-mock-socket`,宿主无需改动)与**导入/导出** JSON 文件;弹窗打开时按「文件优先 + 未烧录改动确认」懒加载当前方案(见 `scriptFile.ts`) |
|
|
665
|
-
| `components/debug/WsProxy/` | WebSocket 代理器:声明式字段映射将后端 socket 结构桥接为标准信封协议消息(`envelope + payload`,snake_case)并经 `feedSocketMessage` 驱动画布,标准信封消息直接透传;顶部单选「信封模式 / 注册表模式」+ 连接面板「Websocket 数据来源」下拉(内置 / 外接,组合出 builtin / external / registry / registry-external 四种数据源);注册表模式**仅按「消息类型值」分发**——「设备状态配置」为每台画布设备独立配置消息类型值(`RegistryDeviceBinding.typeValue`,消息类型字段值相等即归属该设备)与设备主键字段名(`idField`,缺省回退全局 `registryIdField`),提取主键查注册表匹配具体设备后驱动;同一消息类型值对应多台设备时按「设备类型标识」(枚举值+number ↔ 注册表 `deviceType`/`number`,`registryDevices`)精确区分,无法区分则 warn
|
|
666
|
-
| `controller/SocketDispatcher.ts` | Socket 协议分发器:解析 `envelope + payload`,识别心跳、按 `envelope.id` 去重、按类型分发(device_init / device_command / resource_command / alarm_push / runtime_status_push / scene_reset),对象资源池管理资源生命周期,处理完毕回执 `command_ack`(0/400/404/409/500,非 0 回执同步输出 warn 日志);设备定位按「业务标识(`rawData.
|
|
665
|
+
| `components/debug/WsProxy/` | WebSocket 代理器:声明式字段映射将后端 socket 结构桥接为标准信封协议消息(`envelope + payload`,snake_case)并经 `feedSocketMessage` 驱动画布,标准信封消息直接透传;顶部单选「信封模式 / 注册表模式」+ 连接面板「Websocket 数据来源」下拉(内置 / 外接,组合出 builtin / external / registry / registry-external 四种数据源);注册表模式**仅按「消息类型值」分发**——「设备状态配置」为每台画布设备独立配置消息类型值(`RegistryDeviceBinding.typeValue`,消息类型字段值相等即归属该设备)与设备主键字段名(`idField`,缺省回退全局 `registryIdField`),提取主键查注册表匹配具体设备后驱动;同一消息类型值对应多台设备时按「设备类型标识」(枚举值+number ↔ 注册表 `deviceType`/`number`,`registryDevices`)精确区分,无法区分则 warn 后丢弃;失效绑定(`layerId` 已不在当前方案画布中)在配置加载 / 绑定变化时自动剔除,且不参与候选分发;下发 `device_id` 优先级为「设备类型标识(枚举值_number,须与业务标识一致)→ 业务标识(`rawData.businessId`)→ 画布图层 id」,画布侧同步按「业务索引 → 图层 id」两条索引定位;注册表拉取/绑定变化时自动把注册表设备记录写入对应画布图层的 `rawData.device`(点击设备可直接读取);资源操作按资源类型拆分为工件 / 刀具 / 辅料三条规则(`Resource_workpiece` / `Resource_tool` / `Resource_auxiliary`,`resource_type` 由规则固定注入;注册表配置界面仅展示 transfer / batch_remove 两组),按各资源组「消息类型值」(`resourceFields.typeValues`)分发,`to/from.device_id`(注册表主键)经注册表+绑定自动翻译为画布标识并注入 `device_type`;「消息配置」(payloadKey / sourceTypeField)两种流水线均生效;设备注册表请求地址跟随「请求模式」(默认 `/api/device/devices`,复用统一 `/api` 代理前缀;代理请求拼当前页面 origin,开发走 Vite proxy / 生产走 Nginx proxy;直连原样请求);支持连接/断开/重连(指数退避)、心跳 ping/pong、日志、配置导出/导入/**持久化保存**(「导入&导出&持久化」下拉,烧录全部方案配置进 `public/lingshu-smart/wsProxyConfig.json`,开发服务器接口 `POST /lingshu-smart/__burn-ws-proxy-config`)、场景像素换算(percentToPixel 百分比/ runtimeToPixel 运行时坐标)、拼接运算表达式(`{value}` 当前源值、`{字段路径}` 业务参数占位,如 `{remainProcessTime}/{totalProcessTime}`;除零等非有限结果静默置 0)、standalone 独立标签页模式 / remote 远程接收模式(BroadcastChannel 跨标签页流转数据);操作规则含 single/resource/resetAll(ResetAll 接收源类型值 `scene_reset` 后生成全部复位) |
|
|
666
|
+
| `controller/SocketDispatcher.ts` | Socket 协议分发器:解析 `envelope + payload`,识别心跳、按 `envelope.id` 去重、按类型分发(device_init / device_command / resource_command / alarm_push / runtime_status_push / scene_reset),对象资源池管理资源生命周期,处理完毕回执 `command_ack`(0/400/404/409/500,非 0 回执同步输出 warn 日志);设备定位按「业务标识(`rawData.businessId`)→ 画布图层 id」依次匹配;`transfer` 在资源池未登记该资源且未携带来源位置(`from.device_id` 为空)时直接在目标工位放置资源(等价 add,不回 404);资源实体 `raw_data` 携带资源身份与所在位置(点击资源可读取) |
|
|
667
667
|
| `controller/AppController.ts` | 画布控制器:提供 `toggleShadows` / `toggleAnimations` / `setFps` / `resetAllModels` / `setAlarmHighlight` / `resolveDeviceModels`(业务标识 → 画布图层 id 回退定位)/ `setDeviceRegistrySnapshot`(设备注册表快照写入模型 `rawData.device`,供点击设备读取)等方法 |
|
|
668
668
|
|
|
669
669
|
### 日志系统
|
|
@@ -16,6 +16,8 @@ type __VLS_Props = {
|
|
|
16
16
|
targetText?: boolean;
|
|
17
17
|
/** 必填的画布字段名列表(命中时在该单元格右上角标记红色 *) */
|
|
18
18
|
requiredTargets?: string[];
|
|
19
|
+
/** 需要隐藏的映射行(按 target 精确匹配;固定由规则注入的字段使用,隐藏后索引仍对应原数组) */
|
|
20
|
+
hiddenTargets?: string[];
|
|
19
21
|
};
|
|
20
22
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
23
|
add: () => any;
|
|
@@ -41,5 +43,6 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
41
43
|
showAction: boolean;
|
|
42
44
|
targetText: boolean;
|
|
43
45
|
requiredTargets: string[];
|
|
46
|
+
hiddenTargets: string[];
|
|
44
47
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
45
48
|
export default _default;
|
|
@@ -42,7 +42,7 @@ export interface FieldMapper {
|
|
|
42
42
|
dictName?: string;
|
|
43
43
|
/** 输出目标类型(transform 为 'objDict' 时生效):'string' 默认 / 'number' 转数字 / 'boolean' 布尔标准化;未命中映射保持原值 */
|
|
44
44
|
transformTargetType?: 'string' | 'number' | 'boolean';
|
|
45
|
-
/** 条件判断列表(transform 为 'condition' 时生效,按顺序匹配首个为 true 的条件,赋其 value 给画布字段;无匹配时回退 defaultValue
|
|
45
|
+
/** 条件判断列表(transform 为 'condition' 时生效,按顺序匹配首个为 true 的条件,赋其 value 给画布字段;无匹配时回退 defaultValue,未配置默认值时布尔字段输出 false、其余类型不写该字段) */
|
|
46
46
|
conditions?: ConditionRule[];
|
|
47
47
|
/** 运算处理类型(transform 为 'operation' 时生效):'negate' 数字取反 / 'not' 布尔取反 / 'toBoolean' 转布尔值 / 'concat' 拼接运算 */
|
|
48
48
|
operateFn?: 'negate' | 'not' | 'toBoolean' | 'concat';
|
|
@@ -104,6 +104,9 @@ export interface ProxyRule {
|
|
|
104
104
|
resourceMappings?: ResourceFieldMap;
|
|
105
105
|
/** Resource 规则专属源字段配置(operate: 'resource' 时生效) */
|
|
106
106
|
resourceFields?: ResourceFieldConfig;
|
|
107
|
+
/** 资源类型固定值(operate: 'resource' 时生效):按资源类型拆分的资源规则在此固定 resource_type,
|
|
108
|
+
* 生成 resource_command 时强制注入且 UI 不可修改;缺省表示旧版通用资源规则(resource_type 由映射产出) */
|
|
109
|
+
resourceType?: 'workpiece' | 'tool' | 'auxiliary';
|
|
107
110
|
/** 手动新增标记:「+ 新增」手动添加的规则不随方案设备类型自动移除 */
|
|
108
111
|
custom?: boolean;
|
|
109
112
|
}
|
|
@@ -249,7 +252,7 @@ export interface RegistryCanvasDevice {
|
|
|
249
252
|
name: string;
|
|
250
253
|
/** 铭牌文本(未配置为空串) */
|
|
251
254
|
nameplate: string;
|
|
252
|
-
/** 画布设备业务标识(rawData.
|
|
255
|
+
/** 画布设备业务标识(rawData.businessId,回退图层 id) */
|
|
253
256
|
bizId: string;
|
|
254
257
|
}
|
|
255
258
|
/** 注册表模式设备绑定:画布设备 ↔ 注册表「设备类型枚举值 + 设备number」手动绑定。
|
|
@@ -311,6 +314,13 @@ export declare const DEFAULT_RESOURCE_BATCH_ADD_MAPPERS: FieldMapper[];
|
|
|
311
314
|
/** 批量离场字段默认映射(target 为 batch_remove 协议 payload 路径,见 socket-operating-api-backend.md 8.5:
|
|
312
315
|
* resource_ids 必填(资源 ID 列表)、resource_type 可选(匹配资源类型,不填就是所有类型) */
|
|
313
316
|
export declare const DEFAULT_RESOURCE_BATCH_REMOVE_MAPPERS: FieldMapper[];
|
|
317
|
+
/** 资源类型固定值(按资源类型拆分的资源规则使用) */
|
|
318
|
+
export type ResourceTypeValue = 'workpiece' | 'tool' | 'auxiliary';
|
|
319
|
+
/** 资源类型固定值及显示名(默认规则生成 / UI 展示共用) */
|
|
320
|
+
export declare const RESOURCE_TYPE_OPTIONS: Array<{
|
|
321
|
+
value: ResourceTypeValue;
|
|
322
|
+
label: string;
|
|
323
|
+
}>;
|
|
314
324
|
/** 默认代理配置(含全部已知设备类型) */
|
|
315
325
|
export declare function createDefaultConfig(): WsProxyConfig;
|
|
316
326
|
/** 返回某设备类型的默认代理规则;未知类型返回 null(供「画布模型类」按 currentCase 缺型兜底) */
|
|
@@ -327,6 +337,16 @@ export declare function createDefaultConfigForCase(caseId: string, deviceClassNa
|
|
|
327
337
|
* 不做结构合法性校验(校验走 validateConfig)。
|
|
328
338
|
*/
|
|
329
339
|
export declare function migrateConfig(cfg: WsProxyConfig): WsProxyConfig;
|
|
340
|
+
/**
|
|
341
|
+
* 注册表模式配置规范化(仅 dataSource 为 registry / registry-external 时调用,信封模式配置保持原样):
|
|
342
|
+
* 1. 资源规则只保留 transfer / remove / batch_remove:注册表流水线按「消息类型值」分发,
|
|
343
|
+
* add / batch_add 不参与解析,资源项数组源路径(batchAddItems)一并移除;
|
|
344
|
+
* 2. 移除 to.device_type / from.device_type 映射:注册表模式下 device_type 由「注册表设备 + 设备类型标识绑定」
|
|
345
|
+
* 解析后按画布设备类名注入(snake_case);映射产出的注册表数字枚举会抢占该注入,被协议回执 400 未知设备类型;
|
|
346
|
+
* 3. 移除 ResetAll 规则:该规则按 sourceType 匹配,注册表模式的消息类型字段为业务类型值,规则不会被命中。
|
|
347
|
+
* 返回新对象,不修改入参。
|
|
348
|
+
*/
|
|
349
|
+
export declare function normalizeRegistryConfig<T extends WsProxyConfig>(cfg: T): T;
|
|
330
350
|
export declare function validateConfig(raw: unknown): WsProxyConfig | null;
|
|
331
351
|
/** 校验代理器配置数组是否合法 */
|
|
332
352
|
export declare function validateCaseConfigArray(raw: unknown): WsProxyCaseConfig[] | null;
|