agentworkshop 0.2.1 → 0.2.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.
@@ -1,94 +1,4 @@
1
1
  [
2
- {
3
- "id": "rr-77052bf8",
4
- "recipeId": "rc-8c99f08c",
5
- "recipeName": "线审计配方",
6
- "productId": "pd-f7e92f0d",
7
- "lineId": "ln-4163b163",
8
- "startedAt": "2026-08-29T14:48:03.323Z",
9
- "endedAt": "2026-08-29T14:48:07.042Z",
10
- "results": [
11
- {
12
- "templateRef": "dcw-cw-52d5c9ef",
13
- "nodeId": "dw-5e63b6aa",
14
- "ok": true,
15
- "message": "Mock PLC 写入成功:45 → raw 45,回读一致(标定后物理值 45)",
16
- "value": 45
17
- }
18
- ]
19
- },
20
- {
21
- "id": "rr-1cfa407d",
22
- "recipeId": "rc-2cda129f",
23
- "recipeName": "作业流审计配方",
24
- "productId": "pd-783824dc",
25
- "lineId": "ln-4fbbc6e5",
26
- "startedAt": "2026-08-29T14:48:41.611Z",
27
- "endedAt": "2026-08-29T14:48:47.087Z",
28
- "results": [
29
- {
30
- "templateRef": "dcw-temp-sp",
31
- "nodeId": "dw-c72cc3d8",
32
- "ok": true,
33
- "message": "Mock PLC 写入成功:180 → raw 180,回读一致(标定后物理值 180)",
34
- "value": 180
35
- }
36
- ]
37
- },
38
- {
39
- "id": "rr-3438a315",
40
- "recipeId": "rc-e346d225",
41
- "recipeName": "作业流审计配方",
42
- "productId": "pd-b51d0098",
43
- "lineId": "ln-0b846303",
44
- "startedAt": "2026-08-29T14:49:23.297Z",
45
- "endedAt": "2026-08-29T14:49:28.771Z",
46
- "results": [
47
- {
48
- "templateRef": "dcw-temp-sp",
49
- "nodeId": "dw-bc6b2e04",
50
- "ok": true,
51
- "message": "Mock PLC 写入成功:180 → raw 180,回读一致(标定后物理值 180)",
52
- "value": 180
53
- }
54
- ]
55
- },
56
- {
57
- "id": "rr-89fecc12",
58
- "recipeId": "rc-4e563100",
59
- "recipeName": "控制终审X线配方",
60
- "productId": "pd-999336c2",
61
- "lineId": "ln-b758b74e",
62
- "startedAt": "2026-08-29T14:59:09.163Z",
63
- "endedAt": "2026-08-29T14:59:16.232Z",
64
- "results": [
65
- {
66
- "templateRef": "dcw-temp-sp",
67
- "nodeId": "dw-65e7c7da",
68
- "ok": true,
69
- "message": "Mock PLC 写入成功:180 → raw 180,回读一致(标定后物理值 180)",
70
- "value": 180
71
- }
72
- ]
73
- },
74
- {
75
- "id": "rr-845ec7a7",
76
- "recipeId": "rc-075136a0",
77
- "recipeName": "控制终审Y线配方",
78
- "productId": "pd-6ba2e8da",
79
- "lineId": "ln-6cd8918a",
80
- "startedAt": "2026-08-29T14:59:13.576Z",
81
- "endedAt": "2026-08-29T14:59:18.388Z",
82
- "results": [
83
- {
84
- "templateRef": "dcw-temp-sp",
85
- "nodeId": "dw-01418312",
86
- "ok": true,
87
- "message": "Mock PLC 写入成功:165 → raw 165,回读一致(标定后物理值 165)",
88
- "value": 165
89
- }
90
- ]
91
- },
92
2
  {
93
3
  "id": "rr-aa12ae5e",
94
4
  "recipeId": "rc-246373dd",
@@ -4629,5 +4539,130 @@
4629
4539
  "max": 1
4630
4540
  }
4631
4541
  ]
4542
+ },
4543
+ {
4544
+ "id": "rr-391f84af",
4545
+ "recipeId": "rc-a8d2da01",
4546
+ "recipeName": "配方-mtjjgw4u",
4547
+ "productId": "pd-b2d5d46d",
4548
+ "lineId": "ln-6e75316a",
4549
+ "startedAt": "2026-09-02T03:30:56.209Z",
4550
+ "endedAt": "2026-09-02T03:31:13.401Z",
4551
+ "results": [
4552
+ {
4553
+ "templateRef": "temp-sp",
4554
+ "nodeId": "dw-be292513",
4555
+ "ok": false,
4556
+ "message": "设定值 120℃ 越出工艺安全量程 [150, 200] ℃",
4557
+ "value": 120
4558
+ }
4559
+ ],
4560
+ "paramsSnapshot": [
4561
+ {
4562
+ "nodeId": "dw-be292513",
4563
+ "templateRef": "temp-sp",
4564
+ "value": 120
4565
+ }
4566
+ ]
4567
+ },
4568
+ {
4569
+ "id": "rr-b1e3982b",
4570
+ "recipeId": "rc-3bc18ab7",
4571
+ "recipeName": "配方-mtjjl440",
4572
+ "productId": "pd-2908dea4",
4573
+ "lineId": "ln-e2d8aebc",
4574
+ "startedAt": "2026-09-02T03:34:13.182Z",
4575
+ "endedAt": "2026-09-02T03:34:19.458Z",
4576
+ "results": [
4577
+ {
4578
+ "templateRef": "temp-sp",
4579
+ "nodeId": "dw-488fdd91",
4580
+ "ok": false,
4581
+ "message": "设定值 120℃ 越出工艺安全量程 [150, 200] ℃",
4582
+ "value": 120
4583
+ }
4584
+ ],
4585
+ "paramsSnapshot": [
4586
+ {
4587
+ "nodeId": "dw-488fdd91",
4588
+ "templateRef": "temp-sp",
4589
+ "value": 120
4590
+ }
4591
+ ]
4592
+ },
4593
+ {
4594
+ "id": "rr-f5ae10ae",
4595
+ "recipeId": "rc-114d80a5",
4596
+ "recipeName": "配方-mtjjodq2",
4597
+ "productId": "pd-0629a23a",
4598
+ "lineId": "ln-4849768e",
4599
+ "startedAt": "2026-09-02T03:36:45.583Z",
4600
+ "endedAt": "2026-09-02T03:36:50.665Z",
4601
+ "results": [
4602
+ {
4603
+ "templateRef": "temp-sp",
4604
+ "nodeId": "dw-b98f94d2",
4605
+ "ok": false,
4606
+ "message": "设定值 120℃ 越出工艺安全量程 [150, 200] ℃",
4607
+ "value": 120
4608
+ }
4609
+ ],
4610
+ "paramsSnapshot": [
4611
+ {
4612
+ "nodeId": "dw-b98f94d2",
4613
+ "templateRef": "temp-sp",
4614
+ "value": 120
4615
+ }
4616
+ ]
4617
+ },
4618
+ {
4619
+ "id": "rr-bbba6181",
4620
+ "recipeId": "rc-5e7b8b10",
4621
+ "recipeName": "配方-mtjjs78h",
4622
+ "productId": "pd-83e974b9",
4623
+ "lineId": "ln-e0769d5b",
4624
+ "startedAt": "2026-09-02T03:39:43.842Z",
4625
+ "endedAt": "2026-09-02T03:39:50.185Z",
4626
+ "results": [
4627
+ {
4628
+ "templateRef": "temp-sp",
4629
+ "nodeId": "dw-093215e8",
4630
+ "ok": false,
4631
+ "message": "设定值 120℃ 越出工艺安全量程 [150, 200] ℃",
4632
+ "value": 120
4633
+ }
4634
+ ],
4635
+ "paramsSnapshot": [
4636
+ {
4637
+ "nodeId": "dw-093215e8",
4638
+ "templateRef": "temp-sp",
4639
+ "value": 120
4640
+ }
4641
+ ]
4642
+ },
4643
+ {
4644
+ "id": "rr-8107a4c4",
4645
+ "recipeId": "rc-7c7d2862",
4646
+ "recipeName": "配方-mtjjvde2",
4647
+ "productId": "pd-0a982f6c",
4648
+ "lineId": "ln-8c17f4e7",
4649
+ "startedAt": "2026-09-02T03:42:11.738Z",
4650
+ "endedAt": "2026-09-02T03:42:17.988Z",
4651
+ "results": [
4652
+ {
4653
+ "templateRef": "temp-sp",
4654
+ "nodeId": "dw-4b8064da",
4655
+ "ok": false,
4656
+ "message": "设定值 120℃ 越出工艺安全量程 [150, 200] ℃",
4657
+ "value": 120
4658
+ }
4659
+ ],
4660
+ "paramsSnapshot": [
4661
+ {
4662
+ "nodeId": "dw-4b8064da",
4663
+ "templateRef": "temp-sp",
4664
+ "value": 120
4665
+ }
4666
+ ]
4632
4667
  }
4633
4668
  ]
@@ -1732,5 +1732,110 @@
1732
1732
  "state": "ok",
1733
1733
  "lastError": null,
1734
1734
  "createdAt": "2026-09-01T12:27:14.362Z"
1735
+ },
1736
+ {
1737
+ "id": "dw-be292513",
1738
+ "templateRef": "temp-sp",
1739
+ "name": "温控",
1740
+ "driver": "mock",
1741
+ "enabled": true,
1742
+ "holdIntervalMs": null,
1743
+ "unit": "℃",
1744
+ "decimals": 1,
1745
+ "min": 150,
1746
+ "max": 200,
1747
+ "deviceBindingId": null,
1748
+ "driverConfig": {},
1749
+ "lineId": "ln-6e75316a",
1750
+ "value": null,
1751
+ "lastAckAt": null,
1752
+ "lastWriteAt": null,
1753
+ "state": "idle",
1754
+ "lastError": null,
1755
+ "createdAt": "2026-09-02T03:30:56.130Z"
1756
+ },
1757
+ {
1758
+ "id": "dw-488fdd91",
1759
+ "templateRef": "temp-sp",
1760
+ "name": "温控",
1761
+ "driver": "mock",
1762
+ "enabled": true,
1763
+ "holdIntervalMs": null,
1764
+ "unit": "℃",
1765
+ "decimals": 1,
1766
+ "min": 150,
1767
+ "max": 200,
1768
+ "deviceBindingId": null,
1769
+ "driverConfig": {},
1770
+ "lineId": "ln-e2d8aebc",
1771
+ "value": null,
1772
+ "lastAckAt": null,
1773
+ "lastWriteAt": null,
1774
+ "state": "idle",
1775
+ "lastError": null,
1776
+ "createdAt": "2026-09-02T03:34:13.100Z"
1777
+ },
1778
+ {
1779
+ "id": "dw-b98f94d2",
1780
+ "templateRef": "temp-sp",
1781
+ "name": "温控",
1782
+ "driver": "mock",
1783
+ "enabled": true,
1784
+ "holdIntervalMs": null,
1785
+ "unit": "℃",
1786
+ "decimals": 1,
1787
+ "min": 150,
1788
+ "max": 200,
1789
+ "deviceBindingId": null,
1790
+ "driverConfig": {},
1791
+ "lineId": "ln-4849768e",
1792
+ "value": null,
1793
+ "lastAckAt": null,
1794
+ "lastWriteAt": null,
1795
+ "state": "idle",
1796
+ "lastError": null,
1797
+ "createdAt": "2026-09-02T03:36:45.499Z"
1798
+ },
1799
+ {
1800
+ "id": "dw-093215e8",
1801
+ "templateRef": "temp-sp",
1802
+ "name": "温控",
1803
+ "driver": "mock",
1804
+ "enabled": true,
1805
+ "holdIntervalMs": null,
1806
+ "unit": "℃",
1807
+ "decimals": 1,
1808
+ "min": 150,
1809
+ "max": 200,
1810
+ "deviceBindingId": null,
1811
+ "driverConfig": {},
1812
+ "lineId": "ln-e0769d5b",
1813
+ "value": null,
1814
+ "lastAckAt": null,
1815
+ "lastWriteAt": null,
1816
+ "state": "idle",
1817
+ "lastError": null,
1818
+ "createdAt": "2026-09-02T03:39:43.737Z"
1819
+ },
1820
+ {
1821
+ "id": "dw-4b8064da",
1822
+ "templateRef": "temp-sp",
1823
+ "name": "温控",
1824
+ "driver": "mock",
1825
+ "enabled": true,
1826
+ "holdIntervalMs": null,
1827
+ "unit": "℃",
1828
+ "decimals": 1,
1829
+ "min": 150,
1830
+ "max": 200,
1831
+ "deviceBindingId": null,
1832
+ "driverConfig": {},
1833
+ "lineId": "ln-8c17f4e7",
1834
+ "value": null,
1835
+ "lastAckAt": null,
1836
+ "lastWriteAt": null,
1837
+ "state": "idle",
1838
+ "lastError": null,
1839
+ "createdAt": "2026-09-02T03:42:11.685Z"
1735
1840
  }
1736
1841
  ]
@@ -7,7 +7,7 @@
7
7
  "productId": "pd-3ad54846",
8
8
  "productName": "光学膜 BOPP",
9
9
  "startedAt": "2026-08-31T16:20:13.707Z",
10
- "taggedSamples": 28822
10
+ "taggedSamples": 29498
11
11
  },
12
12
  {
13
13
  "lineId": "ln-c377a6bf",
@@ -17,7 +17,7 @@
17
17
  "productId": "pd-7e69e0ee",
18
18
  "productName": "警告验证产品-k2xh",
19
19
  "startedAt": "2026-09-01T03:23:18.233Z",
20
- "taggedSamples": 11221
20
+ "taggedSamples": 11559
21
21
  },
22
22
  {
23
23
  "lineId": "ln-9224d3d7",
@@ -27,7 +27,7 @@
27
27
  "productId": "pd-910c0fa8",
28
28
  "productName": "新协议产品-9xhn",
29
29
  "startedAt": "2026-09-01T05:59:24.062Z",
30
- "taggedSamples": 14198
30
+ "taggedSamples": 14533
31
31
  },
32
32
  {
33
33
  "lineId": "ln-386c53ed",
@@ -37,7 +37,7 @@
37
37
  "productId": "pd-2d4f9357",
38
38
  "productName": "新协议产品-6ofk",
39
39
  "startedAt": "2026-09-01T06:05:53.063Z",
40
- "taggedSamples": 14488
40
+ "taggedSamples": 14823
41
41
  },
42
42
  {
43
43
  "lineId": "ln-5957f6db",
@@ -47,7 +47,7 @@
47
47
  "productId": "pd-a3ed5047",
48
48
  "productName": "新协议产品-x4hd",
49
49
  "startedAt": "2026-09-01T06:09:02.148Z",
50
- "taggedSamples": 14074
50
+ "taggedSamples": 14409
51
51
  },
52
52
  {
53
53
  "lineId": "ln-9ec42f08",
@@ -57,7 +57,7 @@
57
57
  "productId": "pd-5de729c0",
58
58
  "productName": "新协议产品-teti",
59
59
  "startedAt": "2026-09-01T06:13:44.315Z",
60
- "taggedSamples": 14053
60
+ "taggedSamples": 14388
61
61
  },
62
62
  {
63
63
  "lineId": "ln-69e37924",
@@ -67,7 +67,7 @@
67
67
  "productId": "pd-45eb8d43",
68
68
  "productName": "新协议产品-fg8t",
69
69
  "startedAt": "2026-09-01T06:16:47.469Z",
70
- "taggedSamples": 14086
70
+ "taggedSamples": 14421
71
71
  },
72
72
  {
73
73
  "lineId": "ln-c269e692",
@@ -77,7 +77,7 @@
77
77
  "productId": "pd-b3bd0191",
78
78
  "productName": "新协议产品-w2sp",
79
79
  "startedAt": "2026-09-01T06:56:05.893Z",
80
- "taggedSamples": 14137
80
+ "taggedSamples": 14472
81
81
  },
82
82
  {
83
83
  "lineId": "ln-229d1637",
@@ -87,7 +87,7 @@
87
87
  "productId": "pd-06b896f9",
88
88
  "productName": "新协议产品-lp4h",
89
89
  "startedAt": "2026-09-01T06:57:29.288Z",
90
- "taggedSamples": 14009
90
+ "taggedSamples": 14344
91
91
  },
92
92
  {
93
93
  "lineId": "ln-9546f91f",
@@ -97,7 +97,7 @@
97
97
  "productId": "pd-53e55078",
98
98
  "productName": "新协议产品-jri6",
99
99
  "startedAt": "2026-09-01T07:00:25.059Z",
100
- "taggedSamples": 13432
100
+ "taggedSamples": 13767
101
101
  },
102
102
  {
103
103
  "lineId": "ln-087aad5b",
@@ -107,7 +107,7 @@
107
107
  "productId": "pd-e7e969af",
108
108
  "productName": "新协议产品-4c2d",
109
109
  "startedAt": "2026-09-01T07:09:07.307Z",
110
- "taggedSamples": 12423
110
+ "taggedSamples": 12758
111
111
  },
112
112
  {
113
113
  "lineId": "ln-97d44f8a",
@@ -117,7 +117,7 @@
117
117
  "productId": "pd-28a3ab2c",
118
118
  "productName": "新协议产品-b2ni",
119
119
  "startedAt": "2026-09-01T07:13:44.912Z",
120
- "taggedSamples": 12272
120
+ "taggedSamples": 12607
121
121
  },
122
122
  {
123
123
  "lineId": "ln-a9551770",
@@ -127,7 +127,7 @@
127
127
  "productId": "pd-0c6a64c8",
128
128
  "productName": "新协议产品-uwkf",
129
129
  "startedAt": "2026-09-01T07:15:40.113Z",
130
- "taggedSamples": 11917
130
+ "taggedSamples": 12252
131
131
  },
132
132
  {
133
133
  "lineId": "ln-844ad82f",
@@ -137,7 +137,7 @@
137
137
  "productId": "pd-6932b24f",
138
138
  "productName": "新协议产品-kk6l",
139
139
  "startedAt": "2026-09-01T09:06:55.728Z",
140
- "taggedSamples": 10072
140
+ "taggedSamples": 10407
141
141
  },
142
142
  {
143
143
  "lineId": "ln-af002514",
@@ -147,6 +147,6 @@
147
147
  "productId": "pd-6348a595",
148
148
  "productName": "0.8mm 光学膜",
149
149
  "startedAt": "2026-09-01T14:06:28.766Z",
150
- "taggedSamples": 0
150
+ "taggedSamples": 676
151
151
  }
152
152
  ]
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 插件宿主 nitro 装配点 —— 启动期装载 ~/.AgentWorkShop/plugins 与
3
+ * <repo>/.AgentWorkShop/plugins 下的用户插件;服务关闭时发出 server:close。
4
+ * 装载细节见 server/services/workshop/plugins/host.mjs(错误隔离:单插件失败不拖垮主服务)。
5
+ */
6
+ import { initPluginHost, shutdownPluginHost } from '@/server/services/workshop/plugins/host.mjs'
7
+ import { fileURLToPath } from 'node:url'
8
+ import { dirname, resolve } from 'node:path'
9
+
10
+ // packageRoot = 本包根(nitro 打包后由运行 cwd 提供事实源,此处兜底)
11
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..')
12
+
13
+ export default defineNitroPlugin((nitroApp) => {
14
+ void initPluginHost({ cwd: process.cwd(), packageRoot })
15
+ nitroApp.hooks.hookOnce('close', () => {
16
+ void shutdownPluginHost()
17
+ })
18
+ })
@@ -33,6 +33,7 @@ import { getDaqNodeRepo } from './daq-node.repo'
33
33
  import { getTsdb, tsdbReady } from './storage'
34
34
  import { getDaqQueue } from './bus'
35
35
  import { getDaqHostPorts } from './host-ports'
36
+ import { emitDaqSample } from '@/server/services/workshop/plugins/host.mjs'
36
37
  import { getOps, recordOps } from '../ops/ops'
37
38
  import { notifyAlarm, newAlarmId, startAlarmEscalator } from './alarm-notify'
38
39
  import type { DaqSampleEnvelope } from './bus/queue-port'
@@ -193,13 +194,16 @@ class DaqController {
193
194
  // 配方级数采监控窗口的越限判定已前移到运行时 onSample(与量程告警共用边沿语义,
194
195
  // 越窗即 raise 落库 + 广播);此处 state 已含窗口结论,仅负责管线汇聚。
195
196
  if (allowPublish) {
196
- this.broadcast?.('daq.reading', {
197
+ const reading = {
197
198
  nodeId: node.id,
198
199
  templateRef: node.templateRef,
199
200
  value: node.value ?? env.value,
200
201
  state: node.state,
201
202
  at: env.at,
202
- } satisfies AepDaqReading)
203
+ } satisfies AepDaqReading
204
+ this.broadcast?.('daq.reading', reading)
205
+ // 插件钩子:下发级采样观察(与 WS daq.reading 同点同节拍;宿主未装载时零开销 no-op)
206
+ emitDaqSample(reading)
203
207
  }
204
208
  this.writeBackTelemetry(node)
205
209
 
@@ -22,6 +22,7 @@ import { DcwNodeRuntime } from './dcw-runtime'
22
22
  import { getDcwRecipeRepo, type DcwWriteHistoryEntry } from './dcw-recipe.repo'
23
23
  import { getDcwProductRepo } from './dcw-product.repo'
24
24
  import { getDcwLineRepo } from './dcw-line.repo'
25
+ import { emitDcwWrite } from '@/server/services/workshop/plugins/host.mjs'
25
26
  import { clearActiveLineRun, getActiveLineRun, getAllActiveLineRuns, setActiveLineRun } from './line-run'
26
27
  import { getRecipeRollBackManager } from './recipe-rollback-manager'
27
28
  import { recordOps } from '../ops/ops'
@@ -463,6 +464,8 @@ class DcwController {
463
464
  recipeId: runNow?.recipeId ?? recipeRunId ?? '',
464
465
  detail: { eng, prevValue, ok: outcome.ok, message: outcome.message, taskId: meta?.taskId ?? null },
465
466
  })
467
+ // 插件钩子:写控 ACK 观察(与运维入册同点同去重节流)
468
+ emitDcwWrite({ nodeId: id, name: node.name, eng, prevValue, ok: outcome.ok, source: src, lineId: node.lineId ?? '', at: new Date().toISOString() })
466
469
  }
467
470
  }
468
471
  catch {