shennian 0.2.89 → 0.2.90

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 (118) hide show
  1. package/dist/assets/wechat-channel/macos/manifest.json +13 -4
  2. package/dist/assets/wechat-channel/macos/shennian-wechat-channel-helper +0 -0
  3. package/dist/bin/shennian.js +1 -1
  4. package/dist/publish-build-manifest.json +548 -0
  5. package/dist/scripts/wechat-rpa-confirmation.mjs +5 -97
  6. package/dist/src/agent-env.js +4 -105
  7. package/dist/src/agents/adapter.js +1 -19
  8. package/dist/src/agents/claude.js +8 -305
  9. package/dist/src/agents/codex-control.js +2 -188
  10. package/dist/src/agents/codex-utils.js +7 -200
  11. package/dist/src/agents/codex.js +15 -916
  12. package/dist/src/agents/command-spec.js +2 -413
  13. package/dist/src/agents/config-status.js +1 -226
  14. package/dist/src/agents/cursor.js +1 -249
  15. package/dist/src/agents/custom.js +4 -271
  16. package/dist/src/agents/detect.js +1 -56
  17. package/dist/src/agents/external-channel-instructions.js +10 -94
  18. package/dist/src/agents/gemini.js +1 -173
  19. package/dist/src/agents/manager.js +13 -157
  20. package/dist/src/agents/model-registry/cache.js +1 -37
  21. package/dist/src/agents/model-registry/discovery.js +2 -187
  22. package/dist/src/agents/model-registry/parsers.js +4 -447
  23. package/dist/src/agents/model-registry/runner.js +1 -30
  24. package/dist/src/agents/model-registry/service.js +1 -78
  25. package/dist/src/agents/model-registry/types.js +1 -8
  26. package/dist/src/agents/model-registry.js +1 -18
  27. package/dist/src/agents/openclaw.js +2 -275
  28. package/dist/src/agents/opencode.js +1 -231
  29. package/dist/src/agents/pi-context.js +12 -217
  30. package/dist/src/agents/pi.js +14 -723
  31. package/dist/src/agents/platform-instructions.js +9 -54
  32. package/dist/src/channels/base.js +1 -3
  33. package/dist/src/channels/registry.js +1 -30
  34. package/dist/src/channels/reply-split.js +10 -89
  35. package/dist/src/channels/runtime.js +5 -564
  36. package/dist/src/channels/secret-registry.js +1 -46
  37. package/dist/src/channels/websocket.js +8 -378
  38. package/dist/src/channels/wechat-channel/anchor.js +1 -65
  39. package/dist/src/channels/wechat-channel/client.js +1 -96
  40. package/dist/src/channels/wechat-channel/cooldown.js +1 -38
  41. package/dist/src/channels/wechat-channel/fingerprint.js +1 -71
  42. package/dist/src/channels/wechat-channel/helper-assets.d.ts +10 -1
  43. package/dist/src/channels/wechat-channel/helper-assets.js +1 -68
  44. package/dist/src/channels/wechat-channel/helper-client.js +3 -149
  45. package/dist/src/channels/wechat-channel/helper-protocol.d.ts +1 -1
  46. package/dist/src/channels/wechat-channel/helper-protocol.js +1 -115
  47. package/dist/src/channels/wechat-channel/index.d.ts +1 -0
  48. package/dist/src/channels/wechat-channel/index.js +1 -19
  49. package/dist/src/channels/wechat-channel/ledger.js +1 -54
  50. package/dist/src/channels/wechat-channel/media-resolver.js +1 -181
  51. package/dist/src/channels/wechat-channel/message-key.js +1 -105
  52. package/dist/src/channels/wechat-channel/observer.js +1 -118
  53. package/dist/src/channels/wechat-channel/outbound-ledger.d.ts +3 -0
  54. package/dist/src/channels/wechat-channel/outbound-ledger.js +2 -112
  55. package/dist/src/channels/wechat-channel/outbound-sender.d.ts +26 -0
  56. package/dist/src/channels/wechat-channel/outbound-sender.js +1 -0
  57. package/dist/src/channels/wechat-channel/preflight.js +1 -48
  58. package/dist/src/channels/wechat-channel/runner.js +1 -84
  59. package/dist/src/channels/wechat-channel/runtime.js +1 -66
  60. package/dist/src/channels/wechat-channel/scheduler.d.ts +5 -0
  61. package/dist/src/channels/wechat-channel/scheduler.js +1 -152
  62. package/dist/src/channels/wechat-rpa/macos-flow.js +1 -96
  63. package/dist/src/channels/wechat-rpa/macos.js +6 -48
  64. package/dist/src/channels/wechat-rpa/normalizer.js +7 -127
  65. package/dist/src/channels/wechat-rpa.js +6 -1028
  66. package/dist/src/channels/wecom.js +4 -357
  67. package/dist/src/commands/agent.js +6 -131
  68. package/dist/src/commands/daemon-windows.js +8 -48
  69. package/dist/src/commands/daemon.js +19 -1013
  70. package/dist/src/commands/external-attachments.js +1 -51
  71. package/dist/src/commands/external.js +1 -137
  72. package/dist/src/commands/manager.js +2 -391
  73. package/dist/src/commands/pair-qr.js +1 -6
  74. package/dist/src/commands/pair.js +9 -287
  75. package/dist/src/commands/tools.js +1 -34
  76. package/dist/src/commands/upgrade.js +1 -198
  77. package/dist/src/config/index.js +1 -35
  78. package/dist/src/daemon-log.js +6 -58
  79. package/dist/src/env-path.js +1 -64
  80. package/dist/src/fs/boundary.js +1 -126
  81. package/dist/src/fs/handler.js +1 -130
  82. package/dist/src/fs/security.js +1 -32
  83. package/dist/src/fs/text-decoder.js +1 -110
  84. package/dist/src/index.js +2 -404
  85. package/dist/src/log-reporter.js +1 -16
  86. package/dist/src/manager/prompt.js +29 -34
  87. package/dist/src/manager/registry.js +2 -269
  88. package/dist/src/manager/runtime.js +19 -1007
  89. package/dist/src/native-fusion/config.js +1 -5
  90. package/dist/src/native-fusion/opencode-parser.js +3 -123
  91. package/dist/src/native-fusion/parser-common.js +8 -264
  92. package/dist/src/native-fusion/parsers.js +8 -729
  93. package/dist/src/native-fusion/service.js +2 -225
  94. package/dist/src/native-fusion/state.js +1 -22
  95. package/dist/src/native-fusion/types.js +1 -1
  96. package/dist/src/region.js +1 -88
  97. package/dist/src/relay/client.js +1 -343
  98. package/dist/src/session/archive-zip.js +1 -220
  99. package/dist/src/session/handlers/agent-config.js +1 -150
  100. package/dist/src/session/handlers/agents.js +1 -55
  101. package/dist/src/session/handlers/chat.js +2 -751
  102. package/dist/src/session/handlers/control.js +1 -55
  103. package/dist/src/session/handlers/fs.js +1 -783
  104. package/dist/src/session/handlers/session-refresh.js +1 -47
  105. package/dist/src/session/handlers/skills.js +1 -121
  106. package/dist/src/session/handlers/title.js +1 -60
  107. package/dist/src/session/handlers/tool-detail.js +1 -218
  108. package/dist/src/session/manager.js +1 -319
  109. package/dist/src/session/projection.js +1 -54
  110. package/dist/src/session/queue.js +4 -317
  111. package/dist/src/session/remote-attachments.js +1 -72
  112. package/dist/src/session/store.js +3 -109
  113. package/dist/src/session/types.js +1 -4
  114. package/dist/src/skills/registry.js +15 -148
  115. package/dist/src/skills/setup.js +1 -101
  116. package/dist/src/tools/markdown-to-pdf.js +10 -346
  117. package/dist/src/upgrade/engine.js +3 -347
  118. package/package.json +3 -2
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "helperVersion": "0.1.0",
3
+ "helperVersion": "0.1.1",
4
4
  "protocolVersion": 1,
5
5
  "platforms": {
6
6
  "darwin": {
7
7
  "executable": "shennian-wechat-channel-helper",
8
- "sha256": "02b8569879cf116d9838474a7f2300f12e3bd252d41369647df2d450936e851d",
9
- "signed": false,
10
- "notarized": false
8
+ "sha256": "0f8d00837896ce6fe802aa1da879502d0e786a62acd55fc9ba9e74ebc81a6627",
9
+ "signed": true,
10
+ "notarized": true,
11
+ "signing": {
12
+ "authority": "Developer ID Application: Wave Leap (Chengdu) Technology Co., Ltd (MCU3455YJJ)",
13
+ "teamIdentifier": "MCU3455YJJ",
14
+ "hardenedRuntime": true
15
+ },
16
+ "notarization": {
17
+ "status": "accepted",
18
+ "id": "26178582-e61a-4ffb-97f6-61968ec77891"
19
+ }
11
20
  }
12
21
  }
13
22
  }
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import '../src/index.js';
2
+ import"../src/index.js";
@@ -0,0 +1,548 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "jsMinified": true,
4
+ "minifier": "esbuild",
5
+ "fileCount": 108,
6
+ "files": [
7
+ {
8
+ "file": "bin/shennian.js",
9
+ "beforeBytes": 46,
10
+ "afterBytes": 45
11
+ },
12
+ {
13
+ "file": "scripts/wechat-rpa-confirmation.mjs",
14
+ "beforeBytes": 4305,
15
+ "afterBytes": 2107
16
+ },
17
+ {
18
+ "file": "src/agent-env.js",
19
+ "beforeBytes": 3799,
20
+ "afterBytes": 2099
21
+ },
22
+ {
23
+ "file": "src/agents/adapter.js",
24
+ "beforeBytes": 552,
25
+ "afterBytes": 322
26
+ },
27
+ {
28
+ "file": "src/agents/claude.js",
29
+ "beforeBytes": 11638,
30
+ "afterBytes": 6020
31
+ },
32
+ {
33
+ "file": "src/agents/codex-control.js",
34
+ "beforeBytes": 6674,
35
+ "afterBytes": 3673
36
+ },
37
+ {
38
+ "file": "src/agents/codex-utils.js",
39
+ "beforeBytes": 7479,
40
+ "afterBytes": 4851
41
+ },
42
+ {
43
+ "file": "src/agents/codex.js",
44
+ "beforeBytes": 36278,
45
+ "afterBytes": 18665
46
+ },
47
+ {
48
+ "file": "src/agents/command-spec.js",
49
+ "beforeBytes": 14571,
50
+ "afterBytes": 6536
51
+ },
52
+ {
53
+ "file": "src/agents/config-status.js",
54
+ "beforeBytes": 7583,
55
+ "afterBytes": 3900
56
+ },
57
+ {
58
+ "file": "src/agents/cursor.js",
59
+ "beforeBytes": 8582,
60
+ "afterBytes": 3829
61
+ },
62
+ {
63
+ "file": "src/agents/custom.js",
64
+ "beforeBytes": 10037,
65
+ "afterBytes": 5064
66
+ },
67
+ {
68
+ "file": "src/agents/detect.js",
69
+ "beforeBytes": 1892,
70
+ "afterBytes": 958
71
+ },
72
+ {
73
+ "file": "src/agents/external-channel-instructions.js",
74
+ "beforeBytes": 7720,
75
+ "afterBytes": 10536
76
+ },
77
+ {
78
+ "file": "src/agents/gemini.js",
79
+ "beforeBytes": 5657,
80
+ "afterBytes": 2848
81
+ },
82
+ {
83
+ "file": "src/agents/manager.js",
84
+ "beforeBytes": 6489,
85
+ "afterBytes": 3499
86
+ },
87
+ {
88
+ "file": "src/agents/model-registry/cache.js",
89
+ "beforeBytes": 1216,
90
+ "afterBytes": 548
91
+ },
92
+ {
93
+ "file": "src/agents/model-registry/discovery.js",
94
+ "beforeBytes": 6948,
95
+ "afterBytes": 3270
96
+ },
97
+ {
98
+ "file": "src/agents/model-registry/parsers.js",
99
+ "beforeBytes": 16473,
100
+ "afterBytes": 8011
101
+ },
102
+ {
103
+ "file": "src/agents/model-registry/runner.js",
104
+ "beforeBytes": 1110,
105
+ "afterBytes": 553
106
+ },
107
+ {
108
+ "file": "src/agents/model-registry/service.js",
109
+ "beforeBytes": 2610,
110
+ "afterBytes": 1086
111
+ },
112
+ {
113
+ "file": "src/agents/model-registry/types.js",
114
+ "beforeBytes": 384,
115
+ "afterBytes": 235
116
+ },
117
+ {
118
+ "file": "src/agents/model-registry.js",
119
+ "beforeBytes": 918,
120
+ "afterBytes": 829
121
+ },
122
+ {
123
+ "file": "src/agents/openclaw.js",
124
+ "beforeBytes": 10365,
125
+ "afterBytes": 4588
126
+ },
127
+ {
128
+ "file": "src/agents/opencode.js",
129
+ "beforeBytes": 7660,
130
+ "afterBytes": 4001
131
+ },
132
+ {
133
+ "file": "src/agents/pi-context.js",
134
+ "beforeBytes": 8077,
135
+ "afterBytes": 4817
136
+ },
137
+ {
138
+ "file": "src/agents/pi.js",
139
+ "beforeBytes": 30742,
140
+ "afterBytes": 14501
141
+ },
142
+ {
143
+ "file": "src/agents/platform-instructions.js",
144
+ "beforeBytes": 2735,
145
+ "afterBytes": 1589
146
+ },
147
+ {
148
+ "file": "src/channels/base.js",
149
+ "beforeBytes": 98,
150
+ "afterBytes": 1
151
+ },
152
+ {
153
+ "file": "src/channels/registry.js",
154
+ "beforeBytes": 1092,
155
+ "afterBytes": 575
156
+ },
157
+ {
158
+ "file": "src/channels/reply-split.js",
159
+ "beforeBytes": 3130,
160
+ "afterBytes": 1237
161
+ },
162
+ {
163
+ "file": "src/channels/runtime.js",
164
+ "beforeBytes": 26885,
165
+ "afterBytes": 14640
166
+ },
167
+ {
168
+ "file": "src/channels/secret-registry.js",
169
+ "beforeBytes": 1339,
170
+ "afterBytes": 621
171
+ },
172
+ {
173
+ "file": "src/channels/websocket.js",
174
+ "beforeBytes": 15795,
175
+ "afterBytes": 8055
176
+ },
177
+ {
178
+ "file": "src/channels/wechat-channel/anchor.js",
179
+ "beforeBytes": 2412,
180
+ "afterBytes": 1090
181
+ },
182
+ {
183
+ "file": "src/channels/wechat-channel/client.js",
184
+ "beforeBytes": 4282,
185
+ "afterBytes": 2358
186
+ },
187
+ {
188
+ "file": "src/channels/wechat-channel/cooldown.js",
189
+ "beforeBytes": 1694,
190
+ "afterBytes": 958
191
+ },
192
+ {
193
+ "file": "src/channels/wechat-channel/fingerprint.js",
194
+ "beforeBytes": 3143,
195
+ "afterBytes": 1506
196
+ },
197
+ {
198
+ "file": "src/channels/wechat-channel/helper-assets.js",
199
+ "beforeBytes": 2538,
200
+ "afterBytes": 1363
201
+ },
202
+ {
203
+ "file": "src/channels/wechat-channel/helper-client.js",
204
+ "beforeBytes": 5676,
205
+ "afterBytes": 3132
206
+ },
207
+ {
208
+ "file": "src/channels/wechat-channel/helper-protocol.js",
209
+ "beforeBytes": 4826,
210
+ "afterBytes": 2375
211
+ },
212
+ {
213
+ "file": "src/channels/wechat-channel/index.js",
214
+ "beforeBytes": 736,
215
+ "afterBytes": 496
216
+ },
217
+ {
218
+ "file": "src/channels/wechat-channel/ledger.js",
219
+ "beforeBytes": 2568,
220
+ "afterBytes": 1533
221
+ },
222
+ {
223
+ "file": "src/channels/wechat-channel/media-resolver.js",
224
+ "beforeBytes": 7347,
225
+ "afterBytes": 3705
226
+ },
227
+ {
228
+ "file": "src/channels/wechat-channel/message-key.js",
229
+ "beforeBytes": 4391,
230
+ "afterBytes": 2079
231
+ },
232
+ {
233
+ "file": "src/channels/wechat-channel/observer.js",
234
+ "beforeBytes": 5412,
235
+ "afterBytes": 3162
236
+ },
237
+ {
238
+ "file": "src/channels/wechat-channel/outbound-ledger.js",
239
+ "beforeBytes": 5740,
240
+ "afterBytes": 3182
241
+ },
242
+ {
243
+ "file": "src/channels/wechat-channel/outbound-sender.js",
244
+ "beforeBytes": 4406,
245
+ "afterBytes": 2468
246
+ },
247
+ {
248
+ "file": "src/channels/wechat-channel/preflight.js",
249
+ "beforeBytes": 3246,
250
+ "afterBytes": 2566
251
+ },
252
+ {
253
+ "file": "src/channels/wechat-channel/runner.js",
254
+ "beforeBytes": 4474,
255
+ "afterBytes": 2399
256
+ },
257
+ {
258
+ "file": "src/channels/wechat-channel/runtime.js",
259
+ "beforeBytes": 2968,
260
+ "afterBytes": 1416
261
+ },
262
+ {
263
+ "file": "src/channels/wechat-channel/scheduler.js",
264
+ "beforeBytes": 8958,
265
+ "afterBytes": 4427
266
+ },
267
+ {
268
+ "file": "src/channels/wechat-rpa/macos-flow.js",
269
+ "beforeBytes": 3590,
270
+ "afterBytes": 1951
271
+ },
272
+ {
273
+ "file": "src/channels/wechat-rpa/macos.js",
274
+ "beforeBytes": 2243,
275
+ "afterBytes": 1537
276
+ },
277
+ {
278
+ "file": "src/channels/wechat-rpa/normalizer.js",
279
+ "beforeBytes": 4913,
280
+ "afterBytes": 2465
281
+ },
282
+ {
283
+ "file": "src/channels/wechat-rpa.js",
284
+ "beforeBytes": 44213,
285
+ "afterBytes": 23118
286
+ },
287
+ {
288
+ "file": "src/channels/wecom.js",
289
+ "beforeBytes": 13799,
290
+ "afterBytes": 6763
291
+ },
292
+ {
293
+ "file": "src/commands/agent.js",
294
+ "beforeBytes": 6216,
295
+ "afterBytes": 3443
296
+ },
297
+ {
298
+ "file": "src/commands/daemon-windows.js",
299
+ "beforeBytes": 3464,
300
+ "afterBytes": 2819
301
+ },
302
+ {
303
+ "file": "src/commands/daemon.js",
304
+ "beforeBytes": 36491,
305
+ "afterBytes": 17235
306
+ },
307
+ {
308
+ "file": "src/commands/external-attachments.js",
309
+ "beforeBytes": 1915,
310
+ "afterBytes": 1193
311
+ },
312
+ {
313
+ "file": "src/commands/external.js",
314
+ "beforeBytes": 6503,
315
+ "afterBytes": 4455
316
+ },
317
+ {
318
+ "file": "src/commands/manager.js",
319
+ "beforeBytes": 17386,
320
+ "afterBytes": 11639
321
+ },
322
+ {
323
+ "file": "src/commands/pair-qr.js",
324
+ "beforeBytes": 225,
325
+ "afterBytes": 112
326
+ },
327
+ {
328
+ "file": "src/commands/pair.js",
329
+ "beforeBytes": 11239,
330
+ "afterBytes": 6441
331
+ },
332
+ {
333
+ "file": "src/commands/tools.js",
334
+ "beforeBytes": 1572,
335
+ "afterBytes": 1010
336
+ },
337
+ {
338
+ "file": "src/commands/upgrade.js",
339
+ "beforeBytes": 8537,
340
+ "afterBytes": 4347
341
+ },
342
+ {
343
+ "file": "src/config/index.js",
344
+ "beforeBytes": 1140,
345
+ "afterBytes": 732
346
+ },
347
+ {
348
+ "file": "src/daemon-log.js",
349
+ "beforeBytes": 2147,
350
+ "afterBytes": 1024
351
+ },
352
+ {
353
+ "file": "src/env-path.js",
354
+ "beforeBytes": 2795,
355
+ "afterBytes": 1377
356
+ },
357
+ {
358
+ "file": "src/fs/boundary.js",
359
+ "beforeBytes": 4949,
360
+ "afterBytes": 2118
361
+ },
362
+ {
363
+ "file": "src/fs/handler.js",
364
+ "beforeBytes": 4690,
365
+ "afterBytes": 2320
366
+ },
367
+ {
368
+ "file": "src/fs/security.js",
369
+ "beforeBytes": 1003,
370
+ "afterBytes": 455
371
+ },
372
+ {
373
+ "file": "src/fs/text-decoder.js",
374
+ "beforeBytes": 4660,
375
+ "afterBytes": 1844
376
+ },
377
+ {
378
+ "file": "src/index.js",
379
+ "beforeBytes": 16616,
380
+ "afterBytes": 8320
381
+ },
382
+ {
383
+ "file": "src/log-reporter.js",
384
+ "beforeBytes": 479,
385
+ "afterBytes": 214
386
+ },
387
+ {
388
+ "file": "src/manager/prompt.js",
389
+ "beforeBytes": 4329,
390
+ "afterBytes": 7069
391
+ },
392
+ {
393
+ "file": "src/manager/registry.js",
394
+ "beforeBytes": 11704,
395
+ "afterBytes": 5761
396
+ },
397
+ {
398
+ "file": "src/manager/runtime.js",
399
+ "beforeBytes": 46059,
400
+ "afterBytes": 23855
401
+ },
402
+ {
403
+ "file": "src/native-fusion/config.js",
404
+ "beforeBytes": 225,
405
+ "afterBytes": 109
406
+ },
407
+ {
408
+ "file": "src/native-fusion/opencode-parser.js",
409
+ "beforeBytes": 4849,
410
+ "afterBytes": 2575
411
+ },
412
+ {
413
+ "file": "src/native-fusion/parser-common.js",
414
+ "beforeBytes": 9254,
415
+ "afterBytes": 4189
416
+ },
417
+ {
418
+ "file": "src/native-fusion/parsers.js",
419
+ "beforeBytes": 30394,
420
+ "afterBytes": 13019
421
+ },
422
+ {
423
+ "file": "src/native-fusion/service.js",
424
+ "beforeBytes": 8516,
425
+ "afterBytes": 3942
426
+ },
427
+ {
428
+ "file": "src/native-fusion/state.js",
429
+ "beforeBytes": 808,
430
+ "afterBytes": 467
431
+ },
432
+ {
433
+ "file": "src/native-fusion/types.js",
434
+ "beforeBytes": 11,
435
+ "afterBytes": 1
436
+ },
437
+ {
438
+ "file": "src/region.js",
439
+ "beforeBytes": 3114,
440
+ "afterBytes": 1441
441
+ },
442
+ {
443
+ "file": "src/relay/client.js",
444
+ "beforeBytes": 11795,
445
+ "afterBytes": 5823
446
+ },
447
+ {
448
+ "file": "src/session/archive-zip.js",
449
+ "beforeBytes": 8037,
450
+ "afterBytes": 3438
451
+ },
452
+ {
453
+ "file": "src/session/handlers/agent-config.js",
454
+ "beforeBytes": 5630,
455
+ "afterBytes": 2823
456
+ },
457
+ {
458
+ "file": "src/session/handlers/agents.js",
459
+ "beforeBytes": 1853,
460
+ "afterBytes": 966
461
+ },
462
+ {
463
+ "file": "src/session/handlers/chat.js",
464
+ "beforeBytes": 31162,
465
+ "afterBytes": 14142
466
+ },
467
+ {
468
+ "file": "src/session/handlers/control.js",
469
+ "beforeBytes": 2206,
470
+ "afterBytes": 1257
471
+ },
472
+ {
473
+ "file": "src/session/handlers/fs.js",
474
+ "beforeBytes": 29092,
475
+ "afterBytes": 13200
476
+ },
477
+ {
478
+ "file": "src/session/handlers/session-refresh.js",
479
+ "beforeBytes": 1455,
480
+ "afterBytes": 730
481
+ },
482
+ {
483
+ "file": "src/session/handlers/skills.js",
484
+ "beforeBytes": 4584,
485
+ "afterBytes": 2473
486
+ },
487
+ {
488
+ "file": "src/session/handlers/title.js",
489
+ "beforeBytes": 2225,
490
+ "afterBytes": 1113
491
+ },
492
+ {
493
+ "file": "src/session/handlers/tool-detail.js",
494
+ "beforeBytes": 8659,
495
+ "afterBytes": 4063
496
+ },
497
+ {
498
+ "file": "src/session/manager.js",
499
+ "beforeBytes": 13797,
500
+ "afterBytes": 6882
501
+ },
502
+ {
503
+ "file": "src/session/projection.js",
504
+ "beforeBytes": 1991,
505
+ "afterBytes": 966
506
+ },
507
+ {
508
+ "file": "src/session/queue.js",
509
+ "beforeBytes": 11770,
510
+ "afterBytes": 5816
511
+ },
512
+ {
513
+ "file": "src/session/remote-attachments.js",
514
+ "beforeBytes": 2999,
515
+ "afterBytes": 1492
516
+ },
517
+ {
518
+ "file": "src/session/store.js",
519
+ "beforeBytes": 3925,
520
+ "afterBytes": 1918
521
+ },
522
+ {
523
+ "file": "src/session/types.js",
524
+ "beforeBytes": 159,
525
+ "afterBytes": 1
526
+ },
527
+ {
528
+ "file": "src/skills/registry.js",
529
+ "beforeBytes": 6393,
530
+ "afterBytes": 3730
531
+ },
532
+ {
533
+ "file": "src/skills/setup.js",
534
+ "beforeBytes": 3894,
535
+ "afterBytes": 2048
536
+ },
537
+ {
538
+ "file": "src/tools/markdown-to-pdf.js",
539
+ "beforeBytes": 15004,
540
+ "afterBytes": 8684
541
+ },
542
+ {
543
+ "file": "src/upgrade/engine.js",
544
+ "beforeBytes": 13403,
545
+ "afterBytes": 5673
546
+ }
547
+ ]
548
+ }
@@ -1,97 +1,5 @@
1
- import crypto from 'node:crypto'
2
- import path from 'node:path'
3
-
4
- export function containsAttachmentName(messages, filePath) {
5
- const base = normalizeReplyText(path.basename(filePath))
6
- const stem = normalizeReplyText(path.basename(filePath, path.extname(filePath)))
7
- const haystack = normalizeReplyText(messages.map((message) => message.text).join(''))
8
- return Boolean(base && haystack.includes(base)) || Boolean(stem.length >= 4 && haystack.includes(stem))
9
- }
10
-
11
- export function containsSentAttachment(postSendMessages, observations, filePath, beforeMessages, beforeObservations) {
12
- if (containsAttachmentName(postSendMessages, filePath)) return true
13
- if (containsAttachmentNameInObservations(observations, filePath)) return true
14
- const beforeIds = new Set(beforeMessages.map((message) => message.id))
15
- const fresh = postSendMessages.filter((message) => !beforeIds.has(message.id))
16
- const ext = path.extname(filePath).toLowerCase()
17
- const expectedType = attachmentTypeFromExt(ext)
18
- if (expectedType !== 'file' && fresh.some((message) => message.attachments?.some((attachment) => attachment.type === expectedType))) return true
19
- if (containsNewAttachmentPreviewLabel(observations, beforeObservations, expectedType)) return true
20
- if (expectedType === 'image' && fresh.some((message) => /图片|照片|image/i.test(message.text))) return true
21
- if (expectedType === 'video' && fresh.some((message) => /视频|video/i.test(message.text) || isVideoDurationLabel(message.text))) return true
22
- return false
23
- }
24
-
25
- export function containsReplyText(messages, text) {
26
- return containsNormalizedReplyText(messages.map((message) => message.text).join(''), text)
27
- }
28
-
29
- export function containsReplyTextInObservations(observations, text) {
30
- return containsNormalizedReplyText(observations.map((item) => item.text).join(''), text)
31
- }
32
-
33
- export function containsAttachmentNameInObservations(observations, filePath) {
34
- const base = normalizeReplyText(path.basename(filePath))
35
- const stem = normalizeReplyText(path.basename(filePath, path.extname(filePath)))
36
- const haystack = normalizeReplyText(observations.map((item) => item.text).join(''))
37
- return Boolean(base && haystack.includes(base)) || Boolean(stem.length >= 4 && haystack.includes(stem))
38
- }
39
-
40
- export function normalizeReplyText(text) {
41
- return String(text)
42
- .replace(/[^\p{L}\p{N}]/gu, '')
43
- .toLowerCase()
44
- }
45
-
46
- export function postSendInitialDelayMs(attachmentPath) {
47
- if (!attachmentPath) return 2_000
48
- const type = attachmentTypeFromExt(path.extname(attachmentPath).toLowerCase())
49
- if (type === 'image') return 8_000
50
- if (type === 'video') return 15_000
51
- return 2_000
52
- }
53
-
54
- export function isVideoDurationLabel(text) {
55
- return /^(?:\d{1,2}:)?\d{1,2}:\d{2}$/.test(String(text || '').trim())
56
- }
57
-
58
- function containsNewAttachmentPreviewLabel(observations, beforeObservations, expectedType) {
59
- const beforeIds = new Set(beforeObservations.filter((item) => isAttachmentPreviewLabel(item, expectedType)).map(observationId))
60
- return observations
61
- .filter((item) => isAttachmentPreviewLabel(item, expectedType))
62
- .some((item) => !beforeIds.has(observationId(item)))
63
- }
64
-
65
- function containsNormalizedReplyText(haystackText, text) {
66
- const haystack = normalizeReplyText(haystackText)
67
- const needle = normalizeReplyText(text)
68
- if (!needle) return false
69
- if (haystack.includes(needle)) return true
70
- const head = needle.slice(0, Math.min(16, needle.length))
71
- const tail = needle.slice(Math.max(0, needle.length - 12))
72
- return head.length >= 8 && tail.length >= 8 && haystack.includes(head) && haystack.includes(tail)
73
- }
74
-
75
- function isAttachmentPreviewLabel(item, expectedType) {
76
- if (expectedType === 'image') {
77
- return /\[?图片\]?|照片|image/i.test(item.text)
78
- }
79
- if (expectedType === 'video') {
80
- return /\[?视频\]?|video/i.test(item.text) || isVideoDurationLabel(item.text)
81
- }
82
- return false
83
- }
84
-
85
- function observationId(item) {
86
- return stableId(`${item.text}\n${item.x}\n${item.y}\n${item.width}\n${item.height}`)
87
- }
88
-
89
- function attachmentTypeFromExt(ext) {
90
- if (['.png', '.jpg', '.jpeg', '.gif', '.webp', '.heic'].includes(ext)) return 'image'
91
- if (['.mp4', '.mov', '.avi', '.mkv'].includes(ext)) return 'video'
92
- return 'file'
93
- }
94
-
95
- function stableId(value) {
96
- return crypto.createHash('sha256').update(value).digest('hex').slice(0, 24)
97
- }
1
+ import b from"node:crypto";import s from"node:path";function v(e,t){const n=u(s.basename(t)),r=u(s.basename(t,s.extname(t))),o=u(e.map(a=>a.text).join(""));return!!(n&&o.includes(n))||!!(r.length>=4&&o.includes(r))}function $(e,t,n,r,o){if(v(e,n)||y(t,n))return!0;const a=new Set(r.map(i=>i.id)),m=e.filter(i=>!a.has(i.id)),h=s.extname(n).toLowerCase(),c=x(h);return!!(c!=="file"&&m.some(i=>i.attachments?.some(g=>g.type===c))||w(t,o,c)||c==="image"&&m.some(i=>/图片|照片|image/i.test(i.text))||c==="video"&&m.some(i=>/视频|video/i.test(i.text)||l(i.text)))}function A(e,t){return f(e.map(n=>n.text).join(""),t)}function N(e,t){return f(e.map(n=>n.text).join(""),t)}function y(e,t){const n=u(s.basename(t)),r=u(s.basename(t,s.extname(t))),o=u(e.map(a=>a.text).join(""));return!!(n&&o.includes(n))||!!(r.length>=4&&o.includes(r))}function u(e){return String(e).replace(/[^\p{L}\p{N}]/gu,"").toLowerCase()}function S(e){if(!e)return 2e3;const t=x(s.extname(e).toLowerCase());return t==="image"?8e3:t==="video"?15e3:2e3}function l(e){return/^(?:\d{1,2}:)?\d{1,2}:\d{2}$/.test(String(e||"").trim())}function w(e,t,n){const r=new Set(t.filter(o=>p(o,n)).map(d));return e.filter(o=>p(o,n)).some(o=>!r.has(d(o)))}function f(e,t){const n=u(e),r=u(t);if(!r)return!1;if(n.includes(r))return!0;const o=r.slice(0,Math.min(16,r.length)),a=r.slice(Math.max(0,r.length-12));return o.length>=8&&a.length>=8&&n.includes(o)&&n.includes(a)}function p(e,t){return t==="image"?/\[?图片\]?|照片|image/i.test(e.text):t==="video"?/\[?视频\]?|video/i.test(e.text)||l(e.text):!1}function d(e){return I(`${e.text}
2
+ ${e.x}
3
+ ${e.y}
4
+ ${e.width}
5
+ ${e.height}`)}function x(e){return[".png",".jpg",".jpeg",".gif",".webp",".heic"].includes(e)?"image":[".mp4",".mov",".avi",".mkv"].includes(e)?"video":"file"}function I(e){return b.createHash("sha256").update(e).digest("hex").slice(0,24)}export{v as containsAttachmentName,y as containsAttachmentNameInObservations,A as containsReplyText,N as containsReplyTextInObservations,$ as containsSentAttachment,l as isVideoDurationLabel,u as normalizeReplyText,S as postSendInitialDelayMs};