@jnrs/lingshu-smart 2.2.47 → 3.0.0
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 +281 -348
- package/dist/components/debug/DataLogPanel.vue.d.ts +13 -2
- package/dist/components/debug/PerformanceStats.vue.d.ts +1 -1
- package/dist/components/debug/ScriptRunner/ConfigPanel.vue.d.ts +1 -1
- package/dist/components/debug/ScriptRunner/StepsPanel.vue.d.ts +4 -2
- package/dist/components/debug/ScriptRunner/index.vue.d.ts +11 -0
- package/dist/components/debug/ScriptRunner/script.d.ts +131 -41
- package/dist/components/debug/ScriptRunner/scriptFile.d.ts +92 -0
- package/dist/components/debug/WsProxy/index.vue.d.ts +10 -8
- package/dist/components/debug/WsProxy/proxy.d.ts +114 -53
- package/dist/components/editor/ControlBar/CaseManger.vue.d.ts +18 -2
- package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +2 -2
- package/dist/components/editor/ControlBar/PersistDialog.vue.d.ts +9 -0
- package/dist/components/index.js +8287 -6169
- package/dist/components/preview/index.vue.d.ts +6308 -4098
- package/dist/controller/AppController.d.ts +65 -3
- package/dist/controller/SocketDispatcher.d.ts +59 -0
- package/dist/fullscreen-BA3oea8O.js +53 -0
- package/dist/index-C6Liz-8o.js +1238 -0
- package/dist/index.js +36 -27
- package/dist/lingshu-smart/cases.json +5882 -14843
- package/dist/lingshu-smart/mockSocket.json +263 -0
- package/dist/lingshu-smart/wsProxyConfig.json +327 -725
- package/dist/playground/ViewPageDemo.vue.d.ts +13336 -8894
- package/dist/stores/index.js +1 -1
- package/dist/stores/useAppStore.d.ts +18952 -12321
- package/dist/stores/useDataStore.d.ts +19714 -12469
- package/dist/stores/useDebugStore.d.ts +11 -2
- package/dist/stores/useEditorStore.d.ts +3 -3
- package/dist/types/app.types.d.ts +1 -1
- package/dist/types/components/config.types.d.ts +16 -0
- package/dist/types/components/operating.types.d.ts +22 -13
- package/dist/types/enums.d.ts +22 -2
- package/dist/types/guards.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/config.types.d.ts +23 -5
- package/dist/types/models/operating.types.d.ts +57 -57
- package/dist/types/socket.types.d.ts +275 -0
- package/dist/ui/abstract/ModelAbs.d.ts +37 -2
- package/dist/ui/components/Resource.d.ts +0 -1
- package/dist/ui/components/StationSlot.d.ts +8 -2
- package/dist/ui/components/StationSlotGroup.d.ts +26 -1
- package/dist/ui/models/DoubleJointRobot.d.ts +14 -4
- package/dist/ui/models/MachineTool.d.ts +6 -1
- package/dist/ui/models/MaterialTrack.d.ts +14 -2
- package/dist/ui/models/Pallet.d.ts +20 -5
- package/dist/ui/models/ResourceOperationWindow.d.ts +0 -1
- package/dist/ui/models/ResourceStore.d.ts +7 -5
- package/dist/ui/models/Rgv.d.ts +4 -2
- package/dist/ui/models/ShuttleStation.d.ts +14 -2
- package/dist/ui/models/SingleJointRobot.d.ts +14 -4
- package/dist/ui/utils/resolveStationSlotLayers.d.ts +20 -0
- package/dist/ui/utils/resolveTypeStyle.d.ts +13 -0
- package/dist/useAppStore-DASwAOBy.js +7223 -0
- package/dist/utils/fullscreen.d.ts +9 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/vite.d.ts +15 -0
- package/dist/vite.js +39 -0
- package/package.json +6 -2
- package/dist/components/editor/OptionCard/Equipment/stationSlot/StationSlotGroupBoth.vue.d.ts +0 -2
- package/dist/guards-Bi8oNtaY.js +0 -35
- package/dist/index-Dsgrnpn0.js +0 -1186
- package/dist/useAppStore-CevWqcmT.js +0 -6147
- /package/dist/components/editor/OptionCard/Equipment/{stationSlot/StationSlotGroup.vue.d.ts → models/ResourceStore.vue.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SocketMessage } from '../../types';
|
|
2
2
|
export interface LogEntry {
|
|
3
3
|
datetime: string;
|
|
4
4
|
type: string;
|
|
@@ -11,7 +11,8 @@ export interface WsProxyLogEntry {
|
|
|
11
11
|
direction: LogDirection;
|
|
12
12
|
data: any;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/** 运行日志条目:WsProxy 代理生成的标准信封协议消息(envelope + payload) */
|
|
15
|
+
export type RunLogEntry = SocketMessage<Record<string, unknown>>;
|
|
15
16
|
type __VLS_Props = {
|
|
16
17
|
logs: any[];
|
|
17
18
|
maxLogCount: number;
|
|
@@ -24,6 +25,12 @@ type __VLS_Props = {
|
|
|
24
25
|
textFn?: (row: any) => string;
|
|
25
26
|
/** 是否展示方向/类型列(WsProxy 消息日志专用) */
|
|
26
27
|
showDirectionType?: boolean;
|
|
28
|
+
/** 运行日志专用:envelope.id → command_ack 结果映射。消费端回执关联,
|
|
29
|
+
* 用于展示"跳过 N 项类型不匹配"等消费端语义(代理器本身无资源池状态) */
|
|
30
|
+
ackMap?: Map<string, {
|
|
31
|
+
code: number;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
27
34
|
};
|
|
28
35
|
declare function __VLS_template(): {
|
|
29
36
|
attrs: Partial<{}>;
|
|
@@ -49,6 +56,10 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
49
56
|
dataLabel: string;
|
|
50
57
|
textFn: (row: any) => string;
|
|
51
58
|
showDirectionType: boolean;
|
|
59
|
+
ackMap: Map<string, {
|
|
60
|
+
code: number;
|
|
61
|
+
message: string;
|
|
62
|
+
}>;
|
|
52
63
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
53
64
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
54
65
|
export default _default;
|
|
@@ -34,9 +34,9 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
34
34
|
right: string;
|
|
35
35
|
top: string;
|
|
36
36
|
bottom: string;
|
|
37
|
+
position: "static" | "fixed" | "absolute";
|
|
37
38
|
layout: Layout;
|
|
38
39
|
collapsible: boolean;
|
|
39
40
|
showHeader: boolean;
|
|
40
|
-
position: "static" | "fixed" | "absolute";
|
|
41
41
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
42
42
|
export default _default;
|
|
@@ -34,5 +34,5 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
34
34
|
"onUpdate:customData"?: ((value: string) => any) | undefined;
|
|
35
35
|
"onMove-up"?: ((uid: string) => any) | undefined;
|
|
36
36
|
"onMove-down"?: ((uid: string) => any) | undefined;
|
|
37
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
37
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
export default _default;
|
|
@@ -21,9 +21,11 @@ type __VLS_Props = {
|
|
|
21
21
|
isIndeterminate: boolean;
|
|
22
22
|
scriptTemplates: ScriptTemplate[];
|
|
23
23
|
deviceOptions: DeviceOption[];
|
|
24
|
+
/** 各步骤缺失的必填字段映射(uid → 字段 key 列表):为有问题的步骤在 info 底部加红色虚线标记 */
|
|
25
|
+
stepErrors: Record<string, string[]>;
|
|
24
26
|
};
|
|
25
27
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
26
|
-
add: () => any;
|
|
28
|
+
add: (kind: "single" | "continuous") => any;
|
|
27
29
|
select: (uid: string) => any;
|
|
28
30
|
stop: () => any;
|
|
29
31
|
"update:allChecked": (value: boolean) => any;
|
|
@@ -35,7 +37,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
35
37
|
"step-next": () => any;
|
|
36
38
|
"load-template": (name: string) => any;
|
|
37
39
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
38
|
-
onAdd?: (() => any) | undefined;
|
|
40
|
+
onAdd?: ((kind: "single" | "continuous") => any) | undefined;
|
|
39
41
|
onSelect?: ((uid: string) => any) | undefined;
|
|
40
42
|
onStop?: (() => any) | undefined;
|
|
41
43
|
"onUpdate:allChecked"?: ((value: boolean) => any) | undefined;
|
|
@@ -2,15 +2,26 @@ import { ILayer } from '../../../types';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
/** 当前方案的设备图层列表 */
|
|
4
4
|
layers?: ILayer[];
|
|
5
|
+
/** 当前方案(脚本按方案分组持久化 / 烧录,需据此确定归属;未传时回退 store 中的激活方案) */
|
|
6
|
+
currentCase?: {
|
|
7
|
+
id?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
} | null;
|
|
5
10
|
};
|
|
6
11
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
7
12
|
open: () => void;
|
|
8
13
|
isRunning: import('vue').Ref<boolean, boolean>;
|
|
14
|
+
/** 快捷执行:运行脚本(供外部右键等快捷入口调用,等效点击弹窗内「运行」按钮) */
|
|
15
|
+
run: () => void;
|
|
9
16
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
17
|
message: (message: any) => any;
|
|
11
18
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
19
|
onMessage?: ((message: any) => any) | undefined;
|
|
13
20
|
}>, {
|
|
14
21
|
layers: ILayer[];
|
|
22
|
+
currentCase: {
|
|
23
|
+
id?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
} | null;
|
|
15
26
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
27
|
export default _default;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @File : script.ts
|
|
3
3
|
* @Desc. : 脚本模拟器的设备字段配置与预设模板
|
|
4
|
+
* 严格对齐《socket-operating-api.md》(v3.5):
|
|
5
|
+
* - 每个步骤生成「信封 + 数据体」标准消息(envelope + payload)
|
|
6
|
+
* - envelope.type 固定值分发,msgType 记录该步骤的信封类型(缺省按模式推导)
|
|
7
|
+
* - 业务数据字段 key 即 payload 点路径(如 light.color / position.x),
|
|
8
|
+
* 生成消息时由 buildDevicePayload 展开为嵌套结构
|
|
4
9
|
*/
|
|
10
|
+
/** 画布模型 className → socket 协议 device_type(snake_case,见 socket-operating-api.md 6.0) */
|
|
11
|
+
export declare const toDeviceType: (className: string) => string;
|
|
5
12
|
/** 字段配置 */
|
|
6
13
|
export interface ScriptFieldConfig {
|
|
7
14
|
key: string;
|
|
8
15
|
label: string;
|
|
9
16
|
/**
|
|
10
|
-
* 字段类型。
|
|
11
|
-
*
|
|
17
|
+
* 字段类型。key 为 payload 点路径(如 light.color / position.x),生成/预览时展开为嵌套对象。
|
|
18
|
+
* json:对象/数组类型业务字段(如 layer_visible、marking_sites),以 JSON 文本字符串形式编辑与存储,
|
|
19
|
+
* 生成消息/预览时经 buildDevicePayload 解析为对象/数组。
|
|
12
20
|
* device:设备下拉选择(持续运行步骤的「驱动设备」字段)
|
|
13
21
|
*/
|
|
14
22
|
type: 'input' | 'select' | 'switch' | 'number' | 'color' | 'json' | 'device';
|
|
@@ -16,7 +24,11 @@ export interface ScriptFieldConfig {
|
|
|
16
24
|
label: string;
|
|
17
25
|
value: string | number;
|
|
18
26
|
}[];
|
|
27
|
+
/** 是否必填:label 加红色 * 标记(无合理默认值、缺省会导致消息无效的字段) */
|
|
28
|
+
required?: boolean;
|
|
19
29
|
default?: any;
|
|
30
|
+
/** 输入提示占位文本(json 等类型可按字段语义定制,如数组/对象示例) */
|
|
31
|
+
placeholder?: string;
|
|
20
32
|
step?: number;
|
|
21
33
|
min?: number;
|
|
22
34
|
max?: number;
|
|
@@ -28,25 +40,32 @@ export interface ScriptStep {
|
|
|
28
40
|
deviceId: string;
|
|
29
41
|
delay: number;
|
|
30
42
|
enabled: boolean;
|
|
43
|
+
/** 业务数据(payload),key 为点路径;生成消息时展开为嵌套结构 */
|
|
31
44
|
params: Record<string, any>;
|
|
32
45
|
/**
|
|
33
46
|
* 用户显式配置过的字段 key 列表:
|
|
34
|
-
* 生成消息时仅发送这些字段,避免设备字段默认值(如 x
|
|
47
|
+
* 生成消息时仅发送这些字段,避免设备字段默认值(如 position.x=0)把模型瞬间移回原点,
|
|
35
48
|
* 与「持续运行」等高频位置驱动冲突造成抖动。undefined 表示兼容旧数据(全部发送)
|
|
36
49
|
*/
|
|
37
50
|
configuredKeys?: string[];
|
|
38
|
-
/**
|
|
39
|
-
code: number;
|
|
40
|
-
/** 返回消息说明(可选 code 自动带入后可修改) */
|
|
41
|
-
msg: string;
|
|
42
|
-
/** 消息体字段名:'data' 或 'payload' */
|
|
43
|
-
payloadKey: 'data' | 'payload';
|
|
44
|
-
/** 顶层 type 值(可自由配置,默认 'update') */
|
|
51
|
+
/** 信封类型(envelope.type 固定值,见 socket-operating-api.md 2.2);缺失时按模式推导 */
|
|
45
52
|
msgType: string;
|
|
46
|
-
/** 自定义业务数据 JSON
|
|
53
|
+
/** 自定义业务数据 JSON 文本(设备/资源选择「自定义」时启用,作为完整消息体或 payload) */
|
|
47
54
|
customData?: string;
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 单个方案的脚本数据(与 WsProxy 的 `WsProxyCaseConfig` 对称,按方案分组持久化/烧录)。
|
|
58
|
+
* 脚本的设备下拉来自所属方案的图层,故脚本天然绑定方案,不做跨方案共享。
|
|
59
|
+
*/
|
|
60
|
+
export interface ScriptCaseData {
|
|
61
|
+
/** 绑定的方案 id(currentCase.id);空串表示未绑定方案(宿主未提供方案上下文时的兜底) */
|
|
62
|
+
caseId: string;
|
|
63
|
+
/** 方案名称(currentCase.title),用于文件可读性与列表展示;可缺省,缺省时回退 id */
|
|
64
|
+
caseName?: string;
|
|
65
|
+
/** 脚本步骤列表 */
|
|
66
|
+
steps: ScriptStep[];
|
|
67
|
+
/** 「循环脚本」开关(按方案保存,属该方案的运行配置) */
|
|
68
|
+
looping: boolean;
|
|
50
69
|
}
|
|
51
70
|
/** 脚本模板 */
|
|
52
71
|
export interface ScriptTemplate {
|
|
@@ -61,63 +80,134 @@ export declare const deviceTypeOptions: {
|
|
|
61
80
|
}[];
|
|
62
81
|
/** 设备/资源下拉「自定义」选项的标识值(选中后编辑自定义业务数据 JSON) */
|
|
63
82
|
export declare const CUSTOM_DEVICE_TYPE = "__custom__";
|
|
64
|
-
/**
|
|
83
|
+
/** 设备/资源下拉「全部复位」选项的标识值(选中后消息为 scene_reset,画布全部复位) */
|
|
65
84
|
export declare const RESET_ALL_TYPE = "__resetAll__";
|
|
66
|
-
/**
|
|
67
|
-
export declare const RESET_ALL_MSG_TYPE = "
|
|
85
|
+
/** 「全部复位」的信封类型(envelope.type:scene_reset) */
|
|
86
|
+
export declare const RESET_ALL_MSG_TYPE = "scene_reset";
|
|
68
87
|
/** 设备/资源下拉「持续运行」选项的标识值(选中后按设定频率持续发送设备高频消息,模拟生产环境持续运行) */
|
|
69
88
|
export declare const CONTINUOUS_TYPE = "__continuous__";
|
|
70
|
-
/**
|
|
89
|
+
/** 资源类型选项(resource_type:workpiece / tool / auxiliary) */
|
|
71
90
|
export declare const resourceTypeOptions: {
|
|
72
91
|
label: string;
|
|
73
92
|
value: string;
|
|
74
93
|
}[];
|
|
75
|
-
/**
|
|
94
|
+
/** 机器人夹具选项(current_fixture:三类资源 + none 空夹具,见 socket-operating-api.md 6.7) */
|
|
95
|
+
export declare const fixtureOptions: {
|
|
96
|
+
label: string;
|
|
97
|
+
value: string;
|
|
98
|
+
}[];
|
|
99
|
+
/** 通用状态字典:状态值/文本/颜色三要素(供状态灯颜色快速选择) */
|
|
76
100
|
export interface CommonStatusOption {
|
|
77
101
|
label: string;
|
|
78
102
|
value: number;
|
|
79
103
|
displayColor: string;
|
|
80
104
|
}
|
|
81
105
|
export declare const commonDict: CommonStatusOption[];
|
|
82
|
-
/**
|
|
83
|
-
export declare const
|
|
84
|
-
/** 返回码字典:code / 说明,供「返回码」下拉与 msg 自动带入使用 */
|
|
85
|
-
export interface CodeOption {
|
|
106
|
+
/** 资源操作类型选项(resource_command 的 payload.operation),对应 socket-operating-api.md 第 8 章 */
|
|
107
|
+
export declare const resourceOperationOptions: {
|
|
86
108
|
label: string;
|
|
87
|
-
value:
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
export declare const
|
|
96
|
-
/**
|
|
97
|
-
export declare
|
|
98
|
-
/**
|
|
99
|
-
|
|
109
|
+
value: string;
|
|
110
|
+
}[];
|
|
111
|
+
/** 各资源操作下展示的字段(按 key 排列):切换操作类型时面板据此显隐字段(见 resourceOperationFields 对应注释) */
|
|
112
|
+
export declare const resourceOperationFields: Record<string, string[]>;
|
|
113
|
+
/** 各资源操作必填字段(界面据此动态标记红色 *):与 resourceOperationFields 联用。
|
|
114
|
+
* 严格对齐文档:ResourceLocation 中仅 device_id 必填,layer / device_station 均为可选(见 socket-operating-api-backend.md 3.2),
|
|
115
|
+
* 故 add/transfer 仅标记 to_id(目标 device_id)为必填,to_type / to_device_station / to_device_layer 一律可选;
|
|
116
|
+
* transfer 的 from 整体可选;remove 的 resource_type 可选。 */
|
|
117
|
+
export declare const resourceOperationRequired: Record<string, string[]>;
|
|
118
|
+
/** 校验资源步骤缺失的必填字段(按当前 operation 对齐文档)。返回缺失字段 key 列表;非资源步骤 / 无缺失返回空数组 */
|
|
119
|
+
export declare function missingResourceFields(step: Pick<ScriptStep, 'deviceType' | 'params' | 'msgType'>): string[];
|
|
120
|
+
/** 消息信封类型预置选项(envelope.type,见 socket-operating-api.md 2.2)。
|
|
121
|
+
* 下拉框:左侧显示 type 值,右侧显示对应操作中文名;resource_command 置于首位。
|
|
122
|
+
* 末尾「自定义」为信封级自定义(编辑 envelope + payload 完整 JSON)。 */
|
|
123
|
+
export declare const CUSTOM_MSG_TYPE = "__custom__";
|
|
124
|
+
export declare const msgTypeOptions: {
|
|
125
|
+
value: string;
|
|
126
|
+
label: string;
|
|
127
|
+
}[];
|
|
128
|
+
/** 按设备/模式推导默认信封类型(envelope.type) */
|
|
129
|
+
export declare function defaultEnvelopeType(deviceType: string): string;
|
|
130
|
+
/**
|
|
131
|
+
* 解析步骤实际生效的信封类型(envelope.type):
|
|
132
|
+
* - 已显式设置且非旧协议遗留值('update')时采用 msgType
|
|
133
|
+
* - 否则按设备/模式推导(defaultEnvelopeType)
|
|
134
|
+
*/
|
|
135
|
+
export declare const resolveEnvelopeType: (step: {
|
|
136
|
+
deviceType: string;
|
|
137
|
+
msgType: string;
|
|
138
|
+
}) => string;
|
|
139
|
+
/**
|
|
140
|
+
* 业务区形态:由信封类型(envelope.type)联动决定「设备选择 / 业务参数」需要显示的内容。
|
|
141
|
+
* - device → 目标设备选择 + 设备业务参数(device_command)
|
|
142
|
+
* - resource → 资源操作参数(to/from 设备,无目标设备)(resource_command)
|
|
143
|
+
* - custom → 无结构化表单,编辑自定义 JSON【alarm_push / runtime_status_push / device_init / 自定义步骤】
|
|
144
|
+
* - none → 无业务参数,仅提示【scene_reset / 全部复位】
|
|
145
|
+
* - continuous → 持续运行驱动参数(模拟器步骤物种,与协议信封类型正交)
|
|
146
|
+
*/
|
|
147
|
+
export type PayloadMode = 'device' | 'resource' | 'custom' | 'none' | 'continuous';
|
|
148
|
+
/** 由信封类型(envelope.type)推导业务区形态;模拟器特殊步骤物种(自定义/持续/复位)优先按 deviceType 判断 */
|
|
149
|
+
export declare function payloadModeOf(step: {
|
|
150
|
+
deviceType: string;
|
|
151
|
+
msgType: string;
|
|
152
|
+
}): PayloadMode;
|
|
153
|
+
/** 解析自定义业务数据 JSON 文本:目标 JSON 对象;解析失败时返回包含错误提示的对象 */
|
|
154
|
+
export declare function parseCustomData(text: string | undefined): Record<string, any>;
|
|
155
|
+
/** 无结构化表单的信封类型(选择后编辑完整 envelope + payload JSON) */
|
|
156
|
+
export declare const CUSTOM_PAYLOAD_MSG_TYPES: string[];
|
|
157
|
+
/** 组装某信封类型的默认「envelope + payload」完整 JSON 文本:选择该信封类型时自动带入编辑(envelope 仅含 type,id/timestamp 发送时再生成) */
|
|
158
|
+
export declare function defaultEnvelopePayloadJson(type: string): string;
|
|
100
159
|
/** 可作为资源容器的设备类型 */
|
|
101
160
|
export declare const containerDeviceOptions: {
|
|
102
161
|
label: string;
|
|
103
162
|
value: string;
|
|
104
163
|
}[];
|
|
105
|
-
/**
|
|
164
|
+
/** 各设备类型的字段配置(key 即 payload 点路径,与 socket 协议 payload 结构一致,见 socket-operating-api.md 第 6 章) */
|
|
106
165
|
export declare const deviceFieldConfigs: Record<string, ScriptFieldConfig[]>;
|
|
166
|
+
/**
|
|
167
|
+
* 根据设备类型与(点路径)params 构建嵌套 payload。
|
|
168
|
+
* - 仅保留显式配置的字段(configuredKeys),避免默认 0 值复位设备
|
|
169
|
+
* - json 类型字段(layer_visible / marking_sites / layer_light_colors 等)由文本字符串解析为对象
|
|
170
|
+
* - 点路径(如 light.color / position.x)展开为嵌套对象
|
|
171
|
+
* - 兼容旧协议扁平键(x/lightColor/percent 等)映射为嵌套键,见 LEGACY_KEY_MAP
|
|
172
|
+
*/
|
|
173
|
+
export declare function buildDevicePayload(deviceType: string, params: Record<string, any>, configuredKeys?: string[]): Record<string, any>;
|
|
174
|
+
/**
|
|
175
|
+
* 由脚本步骤生成完整协议消息(envelope + payload),严格对齐 socket-operating-api.md。
|
|
176
|
+
* payload 形态与 envelope.type 联动(与面板 payloadModeOf 一致):
|
|
177
|
+
* - device_command → 设备嵌套 payload(点路径 params 经 buildDevicePayload 展开)
|
|
178
|
+
* - resource_command → 资源操作 payload(add / transfer / remove)
|
|
179
|
+
* - device_init / alarm_push / runtime_status_push → 无结构化表单,取自定义 JSON 作为 payload/完整消息
|
|
180
|
+
* - scene_reset(含全部复位)→ 空 payload
|
|
181
|
+
* - 自定义步骤 → 完整消息体原样透出(含 envelope 时保留其 type,重生成 id/timestamp 避免被分发器按 id 去重丢弃)
|
|
182
|
+
*/
|
|
183
|
+
export declare function buildMessage(step: ScriptStep): {
|
|
184
|
+
envelope: Record<string, any>;
|
|
185
|
+
payload: any;
|
|
186
|
+
};
|
|
107
187
|
/**
|
|
108
188
|
* 模板说明:
|
|
109
189
|
* - 每个步骤的 deviceId 留空,由 loadTemplate 根据当前方案自动回填
|
|
110
190
|
* - 单设备模板总时长 ≤ 3 秒
|
|
111
191
|
* - 完整生产流程展示资源跨设备搬运全流程
|
|
112
|
-
* -
|
|
113
|
-
* - x
|
|
192
|
+
* - 状态灯颜色:待机 #999999 / 运行 #66DC7A / 报警 #E83B30(见 commonDict)
|
|
193
|
+
* - 位置字段使用点路径 position.x,每步增量 ≤ 0.03,整体移动幅度小(轻微移动)
|
|
114
194
|
*/
|
|
115
195
|
export declare const scriptTemplates: ScriptTemplate[];
|
|
116
196
|
/** 获取设备类型中文标签 */
|
|
117
197
|
export declare function getDeviceLabel(deviceType: string): string;
|
|
198
|
+
/**
|
|
199
|
+
* 步骤显示名(缺必填等提示用):
|
|
200
|
+
* - 绑定了目标设备:`设备名 (device_id)`
|
|
201
|
+
* - 旧形态特殊物种(Resource / __custom__ / __resetAll__ 等):按 deviceType 取设备 label
|
|
202
|
+
* - 新形态步骤(deviceType 为空,物种由信封类型决定,如 resource_command 资源操作):回退信封类型 label,
|
|
203
|
+
* 避免出现「步骤「」」空名提示
|
|
204
|
+
*/
|
|
205
|
+
export declare function stepLabel(step: {
|
|
206
|
+
deviceType: string;
|
|
207
|
+
deviceId: string;
|
|
208
|
+
msgType: string;
|
|
209
|
+
}): string;
|
|
118
210
|
/** 深拷贝字段默认值:对象/数组类型默认值不可跨步骤共享引用 */
|
|
119
211
|
export declare function cloneDefault(value: any): any;
|
|
120
|
-
/**
|
|
121
|
-
export declare function parseJsonFieldValues(deviceType: string, payload: Record<string, any>): void;
|
|
122
|
-
/** 为指定设备类型创建默认参数 */
|
|
212
|
+
/** 为指定设备类型创建默认参数(key 为点路径,与 deviceFieldConfigs 一致) */
|
|
123
213
|
export declare function createDefaultParams(deviceType: string): Record<string, any>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ScriptStep, ScriptCaseData } from './script';
|
|
2
|
+
/** 脚本文件路径(业务工程 public 目录下,与 cases.json 平级) */
|
|
3
|
+
export declare const MOCK_SOCKET_FILE_URL = "public/lingshu-smart/mockSocket.json";
|
|
4
|
+
/** 脚本烧录接口(开发服务器中间件,由 src/vite.ts 的 lingshuBurnCasesPlugin 提供) */
|
|
5
|
+
export declare const BURN_SCRIPTS_ENDPOINT = "/lingshu-smart/__burn-mock-socket";
|
|
6
|
+
/** 从文件加载脚本的结果 */
|
|
7
|
+
export type ScriptFileResult = {
|
|
8
|
+
status: 'ok';
|
|
9
|
+
configs: ScriptCaseData[];
|
|
10
|
+
repaired: number;
|
|
11
|
+
} | {
|
|
12
|
+
status: 'missing';
|
|
13
|
+
reason: string;
|
|
14
|
+
} | {
|
|
15
|
+
status: 'invalid';
|
|
16
|
+
reason: string;
|
|
17
|
+
} | {
|
|
18
|
+
status: 'unknown';
|
|
19
|
+
reason: string;
|
|
20
|
+
};
|
|
21
|
+
/** 烧录结果 */
|
|
22
|
+
export type BurnScriptsResult = {
|
|
23
|
+
ok: true;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
reason: string;
|
|
27
|
+
};
|
|
28
|
+
/** 解析脚本数据的结果 */
|
|
29
|
+
export type ParseScriptsResult = {
|
|
30
|
+
ok: true;
|
|
31
|
+
configs: ScriptCaseData[];
|
|
32
|
+
repaired: number;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
reason: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* 校验单个脚本步骤的形状。
|
|
39
|
+
* 宽松策略(避免旧数据 / 手写 JSON 被误拒):仅 `deviceType` 强制为字符串,
|
|
40
|
+
* 其余字段缺省时容忍(由 normalizeScriptSteps 补默认值),存在时才校验类型。
|
|
41
|
+
* `msgType` 不做值域白名单(兼容历史 `'update'` 与空串推导)。
|
|
42
|
+
*/
|
|
43
|
+
export declare function isScriptStep(value: unknown): value is ScriptStep;
|
|
44
|
+
/** 校验脚本步骤数组形状 */
|
|
45
|
+
export declare function isScriptStepArray(value: unknown): value is ScriptStep[];
|
|
46
|
+
/**
|
|
47
|
+
* 规范化脚本步骤:补全缺省字段,并为缺失 / 重复的 uid 重新生成(保留首个出现者)。
|
|
48
|
+
* 不拒绝任何已通过 isScriptStepArray 的数据,仅做修复。
|
|
49
|
+
* @returns steps 规范化后的新数组(不改动入参);repaired uid 被补全或重建的条数
|
|
50
|
+
*/
|
|
51
|
+
export declare function normalizeScriptSteps(steps: ScriptStep[]): {
|
|
52
|
+
steps: ScriptStep[];
|
|
53
|
+
repaired: number;
|
|
54
|
+
};
|
|
55
|
+
/** 校验单个方案的脚本数据(steps 逐项校验) */
|
|
56
|
+
export declare function isScriptCaseData(value: unknown): value is ScriptCaseData;
|
|
57
|
+
/** 校验脚本配置数组形状 */
|
|
58
|
+
export declare function isScriptCaseDataArray(value: unknown): value is ScriptCaseData[];
|
|
59
|
+
/**
|
|
60
|
+
* 规范化脚本配置数组:补全各方案缺省字段(steps 内的 uid 一并修复)
|
|
61
|
+
* @returns configs 规范化后的新数组;repaired uid 被补全或重建的条数
|
|
62
|
+
*/
|
|
63
|
+
export declare function normalizeScriptCases(configs: ScriptCaseData[]): {
|
|
64
|
+
configs: ScriptCaseData[];
|
|
65
|
+
repaired: number;
|
|
66
|
+
};
|
|
67
|
+
/** 解析脚本数据(对象形态直接判非法,仅接受按方案分组的数组) */
|
|
68
|
+
export declare function parseScriptCasesData(data: unknown): ParseScriptsResult;
|
|
69
|
+
/** 解析脚本文本(导入用):JSON 解析失败或结构非法时返回失败原因 */
|
|
70
|
+
export declare function parseScriptCasesJson(text: string): ParseScriptsResult;
|
|
71
|
+
/**
|
|
72
|
+
* 从业务工程 public 目录加载脚本文件(默认 public/lingshu-smart/mockSocket.json)。
|
|
73
|
+
* 先取 text 再解析:开发服务器对 public 下缺失路径会 fallback 返回 index.html(HTTP 200),
|
|
74
|
+
* 直接 res.json() 会抛 `Unexpected token '<'`,此处统一按「文件不存在」处理。
|
|
75
|
+
*/
|
|
76
|
+
export declare function loadScriptCasesFromFile(fileUrl?: string): Promise<ScriptFileResult>;
|
|
77
|
+
/**
|
|
78
|
+
* 烧录脚本到 public/lingshu-smart/mockSocket.json(开发服务器写盘,需宿主已注册 lingshuBurnCasesPlugin)
|
|
79
|
+
* @param configs 全部方案的脚本数据(完整文件覆盖语义,与 cases.json 烧录一致)
|
|
80
|
+
*/
|
|
81
|
+
export declare function burnScriptCases(configs: ScriptCaseData[]): Promise<BurnScriptsResult>;
|
|
82
|
+
/** 导出脚本为本地 JSON 文件(文件名默认 mockSocket_<时间戳>.json) */
|
|
83
|
+
export declare function exportScriptCases(configs: ScriptCaseData[], fileName?: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* 单个方案的脚本内容 hash(仅 steps + looping,不含 caseId / caseName,
|
|
86
|
+
* 避免方案重命名被误判为「有未烧录改动」;必须先深拷贝,响应式 Proxy 直接 hash 会异常)
|
|
87
|
+
*/
|
|
88
|
+
export declare function hashScriptCase(data: Pick<ScriptCaseData, 'steps' | 'looping'>): string;
|
|
89
|
+
/** 读取指定方案的「已同步基线」hash(无基线时返回空串) */
|
|
90
|
+
export declare function readBaselineHash(caseId: string): string;
|
|
91
|
+
/** 写入指定方案的「已同步基线」hash(文件加载 / 烧录 / 导入成功后调用;用户手动编辑不更新) */
|
|
92
|
+
export declare function writeBaselineHash(caseId: string, hash: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IScene, SocketMessage } from '../../../types';
|
|
2
2
|
import { WsProxyConfig, ProxyRule, DictFn } from './proxy';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
/** 是否自动应用注入的消息(父组件调用 expose 的 feedMessage 时) */
|
|
@@ -8,13 +8,13 @@ type __VLS_Props = {
|
|
|
8
8
|
/** 场景信息:用于字段映射中 percentToPixel 换算(如 currentCase.scene)
|
|
9
9
|
* 兼容旧用法:new 用法下由 currentCase.scene 派生,仅当 currentCase 缺失时回退此 prop */
|
|
10
10
|
scene?: IScene | null;
|
|
11
|
-
/** 当前方案
|
|
12
|
-
* 兼容旧用法:new 用法下由 currentCase.
|
|
11
|
+
/** 当前方案 id:按方案自动匹配代理配置,未匹配则新建并绑定
|
|
12
|
+
* 兼容旧用法:new 用法下由 currentCase.id 派生,仅当 currentCase 缺失时回退此 prop */
|
|
13
13
|
currentCaseId?: string;
|
|
14
|
-
/** 当前方案(含
|
|
14
|
+
/** 当前方案(含 id/scene/title/layers):作为唯一权威来源,
|
|
15
15
|
* 内部派生 caseId 与 scene,并据此动态生成「画布模型类」列表 */
|
|
16
16
|
currentCase?: {
|
|
17
|
-
|
|
17
|
+
id?: string;
|
|
18
18
|
title?: string;
|
|
19
19
|
scene?: IScene | null;
|
|
20
20
|
layers?: Array<{
|
|
@@ -37,18 +37,20 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
37
37
|
isConnected: import('vue').Ref<boolean, boolean>;
|
|
38
38
|
rules: import('vue').ComputedRef<ProxyRule[]>;
|
|
39
39
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
40
|
-
operating: (data: ILayerOperating) => any;
|
|
41
40
|
raw: (data: unknown) => any;
|
|
41
|
+
"socket-message": (message: SocketMessage<Record<string, unknown>>) => any;
|
|
42
|
+
"runtime-status": (data: Record<string, unknown>) => any;
|
|
42
43
|
"status-change": (connected: boolean) => any;
|
|
43
44
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
44
|
-
onOperating?: ((data: ILayerOperating) => any) | undefined;
|
|
45
45
|
onRaw?: ((data: unknown) => any) | undefined;
|
|
46
|
+
"onSocket-message"?: ((message: SocketMessage<Record<string, unknown>>) => any) | undefined;
|
|
47
|
+
"onRuntime-status"?: ((data: Record<string, unknown>) => any) | undefined;
|
|
46
48
|
"onStatus-change"?: ((connected: boolean) => any) | undefined;
|
|
47
49
|
}>, {
|
|
48
50
|
config: WsProxyConfig;
|
|
49
51
|
scene: IScene | null;
|
|
50
52
|
currentCase: {
|
|
51
|
-
|
|
53
|
+
id?: string;
|
|
52
54
|
title?: string;
|
|
53
55
|
scene?: IScene | null;
|
|
54
56
|
layers?: Array<{
|