@capyclaw/browser-suite 0.2.36 → 0.2.38
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/composition.lock.json +5 -5
- package/contract/browser-contract.json +45 -19
- package/dsh-suite.json +6 -6
- package/node_modules/@capyclaw/asset-service/src/index.mjs +92 -6
- package/node_modules/@capyclaw/browser-skill-api/contract/browser-contract.json +45 -19
- package/node_modules/@capyclaw/browser-skill-api/skills/browser-api/references/tool-contract.md +1 -1
- package/node_modules/@capyclaw/browser-skill-browser/contract/browser-contract.json +45 -19
- package/node_modules/@capyclaw/browser-skill-ops/contract/browser-contract.json +45 -19
- package/node_modules/@capyclaw/browser-workbench/contract/browser-contract.json +45 -19
- package/node_modules/@capyclaw/browser-workbench/package.json +2 -2
- package/node_modules/@capyclaw/browser-workbench/server/contract.mjs +1 -1
- package/node_modules/@capyclaw/browser-workbench/server/embedded-host.mjs +10 -1
- package/node_modules/@capyclaw/browser-workbench/server/session-engines.mjs +39 -0
- package/node_modules/@capyclaw/browser-workbench/server/shared/SHARED_MANIFEST.json +1 -1
- package/node_modules/@capyclaw/browser-workbench/server/workbench-framework.mjs +34 -0
- package/node_modules/@capyclaw/document-workbench/src/session/context.mjs +17 -5
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +8 -1
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +5 -2
- package/node_modules/@capyclaw/foundation/abi/version.mjs +63 -5
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +11 -10
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +8 -1
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +29 -2
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +31 -3
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +12 -2
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +3 -82
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +13 -6
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +31 -15
- package/node_modules/@capyclaw/service-broker/lib/control.mjs +23 -7
- package/node_modules/@capyclaw/service-broker/lib/engine.mjs +60 -6
- package/node_modules/@capyclaw/service-broker/lib/manifest.mjs +15 -2
- package/node_modules/@capyclaw/service-broker/lib/recovery.mjs +0 -50
- package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +17 -5
- package/node_modules/@capyclaw/service-host/src/index.mjs +9 -1
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +2 -2
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +23 -4
- package/node_modules/@capyclaw/tool-host/package.json +1 -1
- package/node_modules/@capyclaw/tool-host/src/admit-images.mjs +80 -0
- package/node_modules/@capyclaw/tool-host/src/caller-session.mjs +25 -0
- package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +28 -4
- package/node_modules/@capyclaw/tool-host/src/index.mjs +76 -19
- package/node_modules/@capyclaw/tool-host/src/mode-gate.mjs +204 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"contractVersion": "1.3.0",
|
|
3
|
-
"packageVersion": "0.1.
|
|
3
|
+
"packageVersion": "0.1.20",
|
|
4
4
|
"toolCount": 18,
|
|
5
5
|
"tools": [
|
|
6
6
|
{
|
|
@@ -632,6 +632,7 @@
|
|
|
632
632
|
"features": [
|
|
633
633
|
"browser.contract"
|
|
634
634
|
],
|
|
635
|
+
"domain": "",
|
|
635
636
|
"tools": [
|
|
636
637
|
{
|
|
637
638
|
"name": "browser_capabilities",
|
|
@@ -651,7 +652,8 @@
|
|
|
651
652
|
"additionalProperties": false
|
|
652
653
|
},
|
|
653
654
|
"kind": "read",
|
|
654
|
-
"since": "1.0.0"
|
|
655
|
+
"since": "1.0.0",
|
|
656
|
+
"domain": ""
|
|
655
657
|
}
|
|
656
658
|
]
|
|
657
659
|
},
|
|
@@ -670,6 +672,7 @@
|
|
|
670
672
|
"features": [
|
|
671
673
|
"browser.navigation"
|
|
672
674
|
],
|
|
675
|
+
"domain": "",
|
|
673
676
|
"tools": [
|
|
674
677
|
{
|
|
675
678
|
"name": "browser_navigate",
|
|
@@ -694,7 +697,8 @@
|
|
|
694
697
|
"additionalProperties": false
|
|
695
698
|
},
|
|
696
699
|
"kind": "write",
|
|
697
|
-
"since": "1.0.0"
|
|
700
|
+
"since": "1.0.0",
|
|
701
|
+
"domain": ""
|
|
698
702
|
}
|
|
699
703
|
]
|
|
700
704
|
},
|
|
@@ -713,6 +717,7 @@
|
|
|
713
717
|
"features": [
|
|
714
718
|
"browser.snapshot"
|
|
715
719
|
],
|
|
720
|
+
"domain": "",
|
|
716
721
|
"tools": [
|
|
717
722
|
{
|
|
718
723
|
"name": "browser_snapshot",
|
|
@@ -729,7 +734,8 @@
|
|
|
729
734
|
"additionalProperties": false
|
|
730
735
|
},
|
|
731
736
|
"kind": "read",
|
|
732
|
-
"since": "1.0.0"
|
|
737
|
+
"since": "1.0.0",
|
|
738
|
+
"domain": ""
|
|
733
739
|
}
|
|
734
740
|
]
|
|
735
741
|
},
|
|
@@ -748,6 +754,7 @@
|
|
|
748
754
|
"features": [
|
|
749
755
|
"browser.interaction"
|
|
750
756
|
],
|
|
757
|
+
"domain": "",
|
|
751
758
|
"tools": [
|
|
752
759
|
{
|
|
753
760
|
"name": "browser_click",
|
|
@@ -779,7 +786,8 @@
|
|
|
779
786
|
"additionalProperties": false
|
|
780
787
|
},
|
|
781
788
|
"kind": "write",
|
|
782
|
-
"since": "1.0.0"
|
|
789
|
+
"since": "1.0.0",
|
|
790
|
+
"domain": ""
|
|
783
791
|
},
|
|
784
792
|
{
|
|
785
793
|
"name": "browser_drag",
|
|
@@ -838,7 +846,8 @@
|
|
|
838
846
|
"additionalProperties": false
|
|
839
847
|
},
|
|
840
848
|
"kind": "write",
|
|
841
|
-
"since": "1.2.0"
|
|
849
|
+
"since": "1.2.0",
|
|
850
|
+
"domain": ""
|
|
842
851
|
},
|
|
843
852
|
{
|
|
844
853
|
"name": "browser_fill",
|
|
@@ -873,7 +882,8 @@
|
|
|
873
882
|
"additionalProperties": false
|
|
874
883
|
},
|
|
875
884
|
"kind": "write",
|
|
876
|
-
"since": "1.0.0"
|
|
885
|
+
"since": "1.0.0",
|
|
886
|
+
"domain": ""
|
|
877
887
|
},
|
|
878
888
|
{
|
|
879
889
|
"name": "browser_press",
|
|
@@ -903,7 +913,8 @@
|
|
|
903
913
|
"additionalProperties": false
|
|
904
914
|
},
|
|
905
915
|
"kind": "write",
|
|
906
|
-
"since": "1.0.0"
|
|
916
|
+
"since": "1.0.0",
|
|
917
|
+
"domain": ""
|
|
907
918
|
},
|
|
908
919
|
{
|
|
909
920
|
"name": "browser_select",
|
|
@@ -934,7 +945,8 @@
|
|
|
934
945
|
"additionalProperties": false
|
|
935
946
|
},
|
|
936
947
|
"kind": "write",
|
|
937
|
-
"since": "1.0.0"
|
|
948
|
+
"since": "1.0.0",
|
|
949
|
+
"domain": ""
|
|
938
950
|
},
|
|
939
951
|
{
|
|
940
952
|
"name": "browser_upload",
|
|
@@ -973,7 +985,8 @@
|
|
|
973
985
|
"additionalProperties": false
|
|
974
986
|
},
|
|
975
987
|
"kind": "write",
|
|
976
|
-
"since": "1.3.0"
|
|
988
|
+
"since": "1.3.0",
|
|
989
|
+
"domain": ""
|
|
977
990
|
},
|
|
978
991
|
{
|
|
979
992
|
"name": "browser_scroll",
|
|
@@ -1002,7 +1015,8 @@
|
|
|
1002
1015
|
"additionalProperties": false
|
|
1003
1016
|
},
|
|
1004
1017
|
"kind": "write",
|
|
1005
|
-
"since": "1.0.0"
|
|
1018
|
+
"since": "1.0.0",
|
|
1019
|
+
"domain": ""
|
|
1006
1020
|
},
|
|
1007
1021
|
{
|
|
1008
1022
|
"name": "browser_act",
|
|
@@ -1116,7 +1130,8 @@
|
|
|
1116
1130
|
"additionalProperties": false
|
|
1117
1131
|
},
|
|
1118
1132
|
"kind": "write",
|
|
1119
|
-
"since": "1.1.0"
|
|
1133
|
+
"since": "1.1.0",
|
|
1134
|
+
"domain": ""
|
|
1120
1135
|
}
|
|
1121
1136
|
]
|
|
1122
1137
|
},
|
|
@@ -1135,6 +1150,7 @@
|
|
|
1135
1150
|
"features": [
|
|
1136
1151
|
"browser.tabs"
|
|
1137
1152
|
],
|
|
1153
|
+
"domain": "",
|
|
1138
1154
|
"tools": [
|
|
1139
1155
|
{
|
|
1140
1156
|
"name": "browser_tabs",
|
|
@@ -1166,7 +1182,8 @@
|
|
|
1166
1182
|
"additionalProperties": false
|
|
1167
1183
|
},
|
|
1168
1184
|
"kind": "control",
|
|
1169
|
-
"since": "1.0.0"
|
|
1185
|
+
"since": "1.0.0",
|
|
1186
|
+
"domain": ""
|
|
1170
1187
|
}
|
|
1171
1188
|
]
|
|
1172
1189
|
},
|
|
@@ -1186,6 +1203,7 @@
|
|
|
1186
1203
|
"features": [
|
|
1187
1204
|
"browser.screenshot"
|
|
1188
1205
|
],
|
|
1206
|
+
"domain": "",
|
|
1189
1207
|
"tools": [
|
|
1190
1208
|
{
|
|
1191
1209
|
"name": "browser_screenshot",
|
|
@@ -1206,7 +1224,8 @@
|
|
|
1206
1224
|
"additionalProperties": false
|
|
1207
1225
|
},
|
|
1208
1226
|
"kind": "read",
|
|
1209
|
-
"since": "1.0.0"
|
|
1227
|
+
"since": "1.0.0",
|
|
1228
|
+
"domain": ""
|
|
1210
1229
|
}
|
|
1211
1230
|
]
|
|
1212
1231
|
},
|
|
@@ -1225,6 +1244,7 @@
|
|
|
1225
1244
|
"features": [
|
|
1226
1245
|
"browser.session"
|
|
1227
1246
|
],
|
|
1247
|
+
"domain": "",
|
|
1228
1248
|
"tools": [
|
|
1229
1249
|
{
|
|
1230
1250
|
"name": "browser_status",
|
|
@@ -1235,7 +1255,8 @@
|
|
|
1235
1255
|
"additionalProperties": false
|
|
1236
1256
|
},
|
|
1237
1257
|
"kind": "read",
|
|
1238
|
-
"since": "1.0.0"
|
|
1258
|
+
"since": "1.0.0",
|
|
1259
|
+
"domain": ""
|
|
1239
1260
|
},
|
|
1240
1261
|
{
|
|
1241
1262
|
"name": "browser_wait",
|
|
@@ -1261,7 +1282,8 @@
|
|
|
1261
1282
|
"additionalProperties": false
|
|
1262
1283
|
},
|
|
1263
1284
|
"kind": "control",
|
|
1264
|
-
"since": "1.0.0"
|
|
1285
|
+
"since": "1.0.0",
|
|
1286
|
+
"domain": ""
|
|
1265
1287
|
},
|
|
1266
1288
|
{
|
|
1267
1289
|
"name": "browser_history",
|
|
@@ -1287,7 +1309,8 @@
|
|
|
1287
1309
|
"additionalProperties": false
|
|
1288
1310
|
},
|
|
1289
1311
|
"kind": "control",
|
|
1290
|
-
"since": "1.0.0"
|
|
1312
|
+
"since": "1.0.0",
|
|
1313
|
+
"domain": ""
|
|
1291
1314
|
},
|
|
1292
1315
|
{
|
|
1293
1316
|
"name": "browser_close",
|
|
@@ -1298,7 +1321,8 @@
|
|
|
1298
1321
|
"additionalProperties": false
|
|
1299
1322
|
},
|
|
1300
1323
|
"kind": "control",
|
|
1301
|
-
"since": "1.0.0"
|
|
1324
|
+
"since": "1.0.0",
|
|
1325
|
+
"domain": ""
|
|
1302
1326
|
}
|
|
1303
1327
|
]
|
|
1304
1328
|
},
|
|
@@ -1317,6 +1341,7 @@
|
|
|
1317
1341
|
"features": [
|
|
1318
1342
|
"browser.evaluate"
|
|
1319
1343
|
],
|
|
1344
|
+
"domain": "",
|
|
1320
1345
|
"tools": [
|
|
1321
1346
|
{
|
|
1322
1347
|
"name": "browser_evaluate",
|
|
@@ -1341,7 +1366,8 @@
|
|
|
1341
1366
|
"additionalProperties": false
|
|
1342
1367
|
},
|
|
1343
1368
|
"kind": "write",
|
|
1344
|
-
"since": "1.0.0"
|
|
1369
|
+
"since": "1.0.0",
|
|
1370
|
+
"domain": ""
|
|
1345
1371
|
}
|
|
1346
1372
|
]
|
|
1347
1373
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"contractVersion": "1.3.0",
|
|
3
|
-
"packageVersion": "0.1.
|
|
3
|
+
"packageVersion": "0.1.20",
|
|
4
4
|
"toolCount": 18,
|
|
5
5
|
"tools": [
|
|
6
6
|
{
|
|
@@ -632,6 +632,7 @@
|
|
|
632
632
|
"features": [
|
|
633
633
|
"browser.contract"
|
|
634
634
|
],
|
|
635
|
+
"domain": "",
|
|
635
636
|
"tools": [
|
|
636
637
|
{
|
|
637
638
|
"name": "browser_capabilities",
|
|
@@ -651,7 +652,8 @@
|
|
|
651
652
|
"additionalProperties": false
|
|
652
653
|
},
|
|
653
654
|
"kind": "read",
|
|
654
|
-
"since": "1.0.0"
|
|
655
|
+
"since": "1.0.0",
|
|
656
|
+
"domain": ""
|
|
655
657
|
}
|
|
656
658
|
]
|
|
657
659
|
},
|
|
@@ -670,6 +672,7 @@
|
|
|
670
672
|
"features": [
|
|
671
673
|
"browser.navigation"
|
|
672
674
|
],
|
|
675
|
+
"domain": "",
|
|
673
676
|
"tools": [
|
|
674
677
|
{
|
|
675
678
|
"name": "browser_navigate",
|
|
@@ -694,7 +697,8 @@
|
|
|
694
697
|
"additionalProperties": false
|
|
695
698
|
},
|
|
696
699
|
"kind": "write",
|
|
697
|
-
"since": "1.0.0"
|
|
700
|
+
"since": "1.0.0",
|
|
701
|
+
"domain": ""
|
|
698
702
|
}
|
|
699
703
|
]
|
|
700
704
|
},
|
|
@@ -713,6 +717,7 @@
|
|
|
713
717
|
"features": [
|
|
714
718
|
"browser.snapshot"
|
|
715
719
|
],
|
|
720
|
+
"domain": "",
|
|
716
721
|
"tools": [
|
|
717
722
|
{
|
|
718
723
|
"name": "browser_snapshot",
|
|
@@ -729,7 +734,8 @@
|
|
|
729
734
|
"additionalProperties": false
|
|
730
735
|
},
|
|
731
736
|
"kind": "read",
|
|
732
|
-
"since": "1.0.0"
|
|
737
|
+
"since": "1.0.0",
|
|
738
|
+
"domain": ""
|
|
733
739
|
}
|
|
734
740
|
]
|
|
735
741
|
},
|
|
@@ -748,6 +754,7 @@
|
|
|
748
754
|
"features": [
|
|
749
755
|
"browser.interaction"
|
|
750
756
|
],
|
|
757
|
+
"domain": "",
|
|
751
758
|
"tools": [
|
|
752
759
|
{
|
|
753
760
|
"name": "browser_click",
|
|
@@ -779,7 +786,8 @@
|
|
|
779
786
|
"additionalProperties": false
|
|
780
787
|
},
|
|
781
788
|
"kind": "write",
|
|
782
|
-
"since": "1.0.0"
|
|
789
|
+
"since": "1.0.0",
|
|
790
|
+
"domain": ""
|
|
783
791
|
},
|
|
784
792
|
{
|
|
785
793
|
"name": "browser_drag",
|
|
@@ -838,7 +846,8 @@
|
|
|
838
846
|
"additionalProperties": false
|
|
839
847
|
},
|
|
840
848
|
"kind": "write",
|
|
841
|
-
"since": "1.2.0"
|
|
849
|
+
"since": "1.2.0",
|
|
850
|
+
"domain": ""
|
|
842
851
|
},
|
|
843
852
|
{
|
|
844
853
|
"name": "browser_fill",
|
|
@@ -873,7 +882,8 @@
|
|
|
873
882
|
"additionalProperties": false
|
|
874
883
|
},
|
|
875
884
|
"kind": "write",
|
|
876
|
-
"since": "1.0.0"
|
|
885
|
+
"since": "1.0.0",
|
|
886
|
+
"domain": ""
|
|
877
887
|
},
|
|
878
888
|
{
|
|
879
889
|
"name": "browser_press",
|
|
@@ -903,7 +913,8 @@
|
|
|
903
913
|
"additionalProperties": false
|
|
904
914
|
},
|
|
905
915
|
"kind": "write",
|
|
906
|
-
"since": "1.0.0"
|
|
916
|
+
"since": "1.0.0",
|
|
917
|
+
"domain": ""
|
|
907
918
|
},
|
|
908
919
|
{
|
|
909
920
|
"name": "browser_select",
|
|
@@ -934,7 +945,8 @@
|
|
|
934
945
|
"additionalProperties": false
|
|
935
946
|
},
|
|
936
947
|
"kind": "write",
|
|
937
|
-
"since": "1.0.0"
|
|
948
|
+
"since": "1.0.0",
|
|
949
|
+
"domain": ""
|
|
938
950
|
},
|
|
939
951
|
{
|
|
940
952
|
"name": "browser_upload",
|
|
@@ -973,7 +985,8 @@
|
|
|
973
985
|
"additionalProperties": false
|
|
974
986
|
},
|
|
975
987
|
"kind": "write",
|
|
976
|
-
"since": "1.3.0"
|
|
988
|
+
"since": "1.3.0",
|
|
989
|
+
"domain": ""
|
|
977
990
|
},
|
|
978
991
|
{
|
|
979
992
|
"name": "browser_scroll",
|
|
@@ -1002,7 +1015,8 @@
|
|
|
1002
1015
|
"additionalProperties": false
|
|
1003
1016
|
},
|
|
1004
1017
|
"kind": "write",
|
|
1005
|
-
"since": "1.0.0"
|
|
1018
|
+
"since": "1.0.0",
|
|
1019
|
+
"domain": ""
|
|
1006
1020
|
},
|
|
1007
1021
|
{
|
|
1008
1022
|
"name": "browser_act",
|
|
@@ -1116,7 +1130,8 @@
|
|
|
1116
1130
|
"additionalProperties": false
|
|
1117
1131
|
},
|
|
1118
1132
|
"kind": "write",
|
|
1119
|
-
"since": "1.1.0"
|
|
1133
|
+
"since": "1.1.0",
|
|
1134
|
+
"domain": ""
|
|
1120
1135
|
}
|
|
1121
1136
|
]
|
|
1122
1137
|
},
|
|
@@ -1135,6 +1150,7 @@
|
|
|
1135
1150
|
"features": [
|
|
1136
1151
|
"browser.tabs"
|
|
1137
1152
|
],
|
|
1153
|
+
"domain": "",
|
|
1138
1154
|
"tools": [
|
|
1139
1155
|
{
|
|
1140
1156
|
"name": "browser_tabs",
|
|
@@ -1166,7 +1182,8 @@
|
|
|
1166
1182
|
"additionalProperties": false
|
|
1167
1183
|
},
|
|
1168
1184
|
"kind": "control",
|
|
1169
|
-
"since": "1.0.0"
|
|
1185
|
+
"since": "1.0.0",
|
|
1186
|
+
"domain": ""
|
|
1170
1187
|
}
|
|
1171
1188
|
]
|
|
1172
1189
|
},
|
|
@@ -1186,6 +1203,7 @@
|
|
|
1186
1203
|
"features": [
|
|
1187
1204
|
"browser.screenshot"
|
|
1188
1205
|
],
|
|
1206
|
+
"domain": "",
|
|
1189
1207
|
"tools": [
|
|
1190
1208
|
{
|
|
1191
1209
|
"name": "browser_screenshot",
|
|
@@ -1206,7 +1224,8 @@
|
|
|
1206
1224
|
"additionalProperties": false
|
|
1207
1225
|
},
|
|
1208
1226
|
"kind": "read",
|
|
1209
|
-
"since": "1.0.0"
|
|
1227
|
+
"since": "1.0.0",
|
|
1228
|
+
"domain": ""
|
|
1210
1229
|
}
|
|
1211
1230
|
]
|
|
1212
1231
|
},
|
|
@@ -1225,6 +1244,7 @@
|
|
|
1225
1244
|
"features": [
|
|
1226
1245
|
"browser.session"
|
|
1227
1246
|
],
|
|
1247
|
+
"domain": "",
|
|
1228
1248
|
"tools": [
|
|
1229
1249
|
{
|
|
1230
1250
|
"name": "browser_status",
|
|
@@ -1235,7 +1255,8 @@
|
|
|
1235
1255
|
"additionalProperties": false
|
|
1236
1256
|
},
|
|
1237
1257
|
"kind": "read",
|
|
1238
|
-
"since": "1.0.0"
|
|
1258
|
+
"since": "1.0.0",
|
|
1259
|
+
"domain": ""
|
|
1239
1260
|
},
|
|
1240
1261
|
{
|
|
1241
1262
|
"name": "browser_wait",
|
|
@@ -1261,7 +1282,8 @@
|
|
|
1261
1282
|
"additionalProperties": false
|
|
1262
1283
|
},
|
|
1263
1284
|
"kind": "control",
|
|
1264
|
-
"since": "1.0.0"
|
|
1285
|
+
"since": "1.0.0",
|
|
1286
|
+
"domain": ""
|
|
1265
1287
|
},
|
|
1266
1288
|
{
|
|
1267
1289
|
"name": "browser_history",
|
|
@@ -1287,7 +1309,8 @@
|
|
|
1287
1309
|
"additionalProperties": false
|
|
1288
1310
|
},
|
|
1289
1311
|
"kind": "control",
|
|
1290
|
-
"since": "1.0.0"
|
|
1312
|
+
"since": "1.0.0",
|
|
1313
|
+
"domain": ""
|
|
1291
1314
|
},
|
|
1292
1315
|
{
|
|
1293
1316
|
"name": "browser_close",
|
|
@@ -1298,7 +1321,8 @@
|
|
|
1298
1321
|
"additionalProperties": false
|
|
1299
1322
|
},
|
|
1300
1323
|
"kind": "control",
|
|
1301
|
-
"since": "1.0.0"
|
|
1324
|
+
"since": "1.0.0",
|
|
1325
|
+
"domain": ""
|
|
1302
1326
|
}
|
|
1303
1327
|
]
|
|
1304
1328
|
},
|
|
@@ -1317,6 +1341,7 @@
|
|
|
1317
1341
|
"features": [
|
|
1318
1342
|
"browser.evaluate"
|
|
1319
1343
|
],
|
|
1344
|
+
"domain": "",
|
|
1320
1345
|
"tools": [
|
|
1321
1346
|
{
|
|
1322
1347
|
"name": "browser_evaluate",
|
|
@@ -1341,7 +1366,8 @@
|
|
|
1341
1366
|
"additionalProperties": false
|
|
1342
1367
|
},
|
|
1343
1368
|
"kind": "write",
|
|
1344
|
-
"since": "1.0.0"
|
|
1369
|
+
"since": "1.0.0",
|
|
1370
|
+
"domain": ""
|
|
1345
1371
|
}
|
|
1346
1372
|
]
|
|
1347
1373
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capyclaw/browser-workbench",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "浏览器操控工作台运行时:18 个 browser_* MCP 工具(导航/快照/点击/填写/按键/下拉/上传/滚动/批量连做/拖拽/标签页/截图)+ Playwright 引擎(有头可见、登录态持久化)+ 可视化工作台。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./plugin.mjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@capyclaw/foundation": "^0.1.9",
|
|
52
52
|
"@capyclaw/plugin-kit": "^0.2.6",
|
|
53
53
|
"@capyclaw/service-host": "^0.1.5",
|
|
54
|
-
"@capyclaw/tool-host": "^0.
|
|
54
|
+
"@capyclaw/tool-host": "^0.3.0",
|
|
55
55
|
"playwright": "^1.64.0"
|
|
56
56
|
},
|
|
57
57
|
"author": {
|
|
@@ -10,7 +10,7 @@ import { createCapabilityReport } from './shared/tool-host.mjs'
|
|
|
10
10
|
export const CONTRACT_VERSION = '1.3.0'
|
|
11
11
|
|
|
12
12
|
/** 工作台包版本。 */
|
|
13
|
-
export const PACKAGE_VERSION = '0.1.
|
|
13
|
+
export const PACKAGE_VERSION = '0.1.20'
|
|
14
14
|
|
|
15
15
|
/** 生成模型可读的能力报告。 */
|
|
16
16
|
export function capabilityReport(args, workbenchUrl = '', runtime = {}) {
|
|
@@ -128,6 +128,14 @@ async function activate(ctx, config) {
|
|
|
128
128
|
const registry = relay.tools
|
|
129
129
|
const tools = safeGet(ctx, 'tools')
|
|
130
130
|
const toolState = { registered: [], errors: [], hasTools: !!(tools && typeof tools.register === 'function') }
|
|
131
|
+
/* 会话模式锁(框架级强制):把本套件工具声明为 browser 领域,注册时逐个挂 when
|
|
132
|
+
* 可见性条件,并装全局 guard 兜底。锁定其他领域的会话里,本套件工具从工具面消失
|
|
133
|
+
* 且被硬拒。toolHost/modeGate 缺席(老宿主)时优雅降级为不屏蔽。 */
|
|
134
|
+
const modeGate = toolHost && toolHost.modeGate
|
|
135
|
+
if (modeGate && registry && Array.isArray(registry.TOOLS)) {
|
|
136
|
+
modeGate.declareTools('browser', registry.TOOLS.map((t) => t.name), 'browser')
|
|
137
|
+
if (toolState.hasTools) modeGate.install(tools)
|
|
138
|
+
}
|
|
131
139
|
const OUTPUT_SCHEMA = { type: 'object', additionalProperties: true }
|
|
132
140
|
|
|
133
141
|
function toolText(value) {
|
|
@@ -146,6 +154,7 @@ async function activate(ctx, config) {
|
|
|
146
154
|
if (registry && Array.isArray(registry.TOOLS) && toolState.hasTools) {
|
|
147
155
|
for (const tool of registry.TOOLS) {
|
|
148
156
|
try {
|
|
157
|
+
const when = modeGate && modeGate.whenFor(tool.name)
|
|
149
158
|
const dispose = tools.register({
|
|
150
159
|
name: tool.name,
|
|
151
160
|
description: tool.description,
|
|
@@ -157,7 +166,7 @@ async function activate(ctx, config) {
|
|
|
157
166
|
/* 第二个参数是 DSH 的 exec(含 exec.agent.session.id):工具靠它知道是哪个
|
|
158
167
|
* 会话在调用,多会话工作台才能把读写落到调用者自己那份文档上。 */
|
|
159
168
|
execute: async (args, exec) => registry.TOOL_IMPL[tool.name](args || {}, exec),
|
|
160
|
-
})
|
|
169
|
+
}, when ? { when } : {})
|
|
161
170
|
if (typeof dispose === 'function') disposers.push(dispose)
|
|
162
171
|
toolState.registered.push(tool.name)
|
|
163
172
|
} catch (error) {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* 缓存的是 Promise<engine>:并发首请求共享同一次创建,不会重复拉起。
|
|
18
18
|
*/
|
|
19
19
|
import path from 'node:path'
|
|
20
|
+
import fs from 'node:fs'
|
|
20
21
|
import { currentSession } from '@capyclaw/document-workbench/session-context'
|
|
21
22
|
|
|
22
23
|
const DEFAULT_SESSION = 'default'
|
|
@@ -140,6 +141,41 @@ export function createSessionEngines({ hostDir, config, createEngine }) {
|
|
|
140
141
|
reapTimer.unref?.()
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
/* ---- 磁盘回收:会话 profile 目录 TTL 清理 ----
|
|
145
|
+
* 进程回收(reap)只挂起浏览器,<hostDir>/sessions/<sid>/ 的 profile 目录从不删,
|
|
146
|
+
* 跨宿主重启越积越多(实测约 40 个陈旧目录)。这里按 mtime TTL 清理「不在本进程
|
|
147
|
+
* 缓存里」的陈旧会话目录——本进程用过的会话常驻 cache,受保护不会被误删;
|
|
148
|
+
* default / login-vault 是共享登录态,永不删。启动即扫一次清历史,之后慢周期巡检。 */
|
|
149
|
+
const sessionDirTtlMs = Number.isFinite(cfg.sessionDirTtlMs) ? cfg.sessionDirTtlMs : 7 * 24 * 3600 * 1000
|
|
150
|
+
const PROTECTED_DIRS = new Set([DEFAULT_SESSION, 'login-vault'])
|
|
151
|
+
async function cleanupSessionDirs() {
|
|
152
|
+
if (sessionDirTtlMs <= 0) return { removed: 0 }
|
|
153
|
+
const sessionsRoot = path.join(hostDir, 'sessions')
|
|
154
|
+
let names
|
|
155
|
+
try { names = fs.readdirSync(sessionsRoot) } catch { return { removed: 0 } }
|
|
156
|
+
const now = Date.now()
|
|
157
|
+
let removed = 0
|
|
158
|
+
for (const name of names) {
|
|
159
|
+
if (PROTECTED_DIRS.has(name) || cache.has(name) || !SID_RE.test(name)) continue
|
|
160
|
+
const full = path.join(sessionsRoot, name)
|
|
161
|
+
try {
|
|
162
|
+
const st = fs.statSync(full)
|
|
163
|
+
if (!st.isDirectory()) continue
|
|
164
|
+
if (now - st.mtimeMs > sessionDirTtlMs) {
|
|
165
|
+
fs.rmSync(full, { recursive: true, force: true })
|
|
166
|
+
removed += 1
|
|
167
|
+
}
|
|
168
|
+
} catch { /* 忽略单个目录失败 */ }
|
|
169
|
+
}
|
|
170
|
+
return { removed }
|
|
171
|
+
}
|
|
172
|
+
let dirCleanupTimer = null
|
|
173
|
+
if (sessionDirTtlMs > 0) {
|
|
174
|
+
cleanupSessionDirs().catch(() => {})
|
|
175
|
+
dirCleanupTimer = setInterval(() => { cleanupSessionDirs().catch(() => {}) }, 3600000)
|
|
176
|
+
dirCleanupTimer.unref?.()
|
|
177
|
+
}
|
|
178
|
+
|
|
143
179
|
/** 停服前挂起所有已创建的引擎(保留标签日志供下次恢复),避免僵尸浏览器进程。
|
|
144
180
|
* 停服竞态:框架先调 beforeStop 再关 HTTP,await 期间仍可能有请求进来重建引擎。
|
|
145
181
|
* 用 drain 循环把「await 期间新创建的」也扫掉(最多 5 轮,防持续流量下无限循环);
|
|
@@ -150,6 +186,7 @@ export function createSessionEngines({ hostDir, config, createEngine }) {
|
|
|
150
186
|
closingPromise = (async () => {
|
|
151
187
|
try {
|
|
152
188
|
if (reapTimer) { clearInterval(reapTimer); reapTimer = null }
|
|
189
|
+
if (dirCleanupTimer) { clearInterval(dirCleanupTimer); dirCleanupTimer = null }
|
|
153
190
|
for (let pass = 0; pass < 5; pass += 1) {
|
|
154
191
|
const pending = [...cache.values()]
|
|
155
192
|
cache.clear()
|
|
@@ -180,5 +217,7 @@ export function createSessionEngines({ hostDir, config, createEngine }) {
|
|
|
180
217
|
sessions: () => [...cache.keys()],
|
|
181
218
|
/* 手动触发一次回收巡检(测试用;生产由定时器驱动)。 */
|
|
182
219
|
reapNow: () => reap(),
|
|
220
|
+
/* 手动触发一次会话目录磁盘清理(测试用;生产启动+慢周期驱动)。 */
|
|
221
|
+
cleanupSessionDirsNow: () => cleanupSessionDirs(),
|
|
183
222
|
}
|
|
184
223
|
}
|
|
@@ -111,7 +111,13 @@ export function createWorkbench(spec) {
|
|
|
111
111
|
* 已创建的资源——否则引擎/仓库泄漏在仍存活的进程里(reused 分支的 stop 是
|
|
112
112
|
* no-op,不会有人替它清理)。外部传入的 assetStore 不归本框架关。 */
|
|
113
113
|
let app
|
|
114
|
+
/* 资产仓库周期 GC:默认只清孤儿临时文件(安全——内容寻址资产被稿件引用,
|
|
115
|
+
* 按龄/LRU 淘汰会毁掉旧稿渲染,必须经 tuning 显式 opt-in)。定时器 unref,
|
|
116
|
+
* 不拖住进程退出;所有关闭路径都要清掉它。 */
|
|
117
|
+
let assetGcTimer = null
|
|
118
|
+
const stopAssetGc = () => { if (assetGcTimer) { clearInterval(assetGcTimer); assetGcTimer = null } }
|
|
114
119
|
const closeCreatedResources = async (why) => {
|
|
120
|
+
stopAssetGc()
|
|
115
121
|
try { if (spec.beforeStop) await spec.beforeStop(ctx) } catch (error) { console.error(`[${spec.id}] ${why}:beforeStop 失败`, error?.message || error) }
|
|
116
122
|
try { if (!givenAssetStore) await assetStore?.close?.() } catch (error) { console.error(`[${spec.id}] ${why}:assetStore 关闭失败`, error?.message || error) }
|
|
117
123
|
try { await store?.close?.() } catch (error) { console.error(`[${spec.id}] ${why}:store 关闭失败`, error?.message || error) }
|
|
@@ -213,6 +219,32 @@ export function createWorkbench(spec) {
|
|
|
213
219
|
}
|
|
214
220
|
}
|
|
215
221
|
|
|
222
|
+
/* 只有真正提供服务的形态才起周期 GC(reused 形态已回收资源,不起定时器)。
|
|
223
|
+
* tuning.assetGcIntervalMs<=0 可整体关闭;maxAgeMs/maxBytes 缺省 0=不按龄/量淘汰。 */
|
|
224
|
+
if (assetStore && typeof assetStore.gc === 'function') {
|
|
225
|
+
const gcIntervalMs = Number(tuning.assetGcIntervalMs ?? 3600000)
|
|
226
|
+
if (gcIntervalMs > 0) {
|
|
227
|
+
const gcOptions = {
|
|
228
|
+
maxAgeMs: Number(tuning.assetGcMaxAgeMs) || 0,
|
|
229
|
+
maxBytes: Number(tuning.assetGcMaxBytes) || 0,
|
|
230
|
+
}
|
|
231
|
+
const runGc = async () => {
|
|
232
|
+
try {
|
|
233
|
+
const result = await assetStore.gc(gcOptions)
|
|
234
|
+
if (result?.removed || result?.orphanTmpRemoved) {
|
|
235
|
+
console.log(`[${spec.id}] 资产 GC:清理 ${result.removed || 0} 项、孤儿临时文件 ${result.orphanTmpRemoved || 0} 个,释放 ${result.freedBytes || 0} 字节`)
|
|
236
|
+
}
|
|
237
|
+
} catch (error) {
|
|
238
|
+
console.error(`[${spec.id}] 资产 GC 失败(下轮再试):`, error?.message || error)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
assetGcTimer = setInterval(runGc, gcIntervalMs)
|
|
242
|
+
assetGcTimer.unref?.()
|
|
243
|
+
/* 启动即跑一轮:清掉上次进程崩溃留下的孤儿 tmp,不必等第一个周期。 */
|
|
244
|
+
runGc()
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
216
248
|
try {
|
|
217
249
|
/* 业务钩子:设置 URL 环境变量、崩溃恢复等(必须在工具装载之前)。 */
|
|
218
250
|
if (spec.onListening) await spec.onListening(ctx, info, url)
|
|
@@ -255,12 +287,14 @@ export function createWorkbench(spec) {
|
|
|
255
287
|
tools: ctx.toolsRegistry || null,
|
|
256
288
|
...(spec.resultExtras ? spec.resultExtras(ctx) : {}),
|
|
257
289
|
stop: async () => {
|
|
290
|
+
stopAssetGc()
|
|
258
291
|
if (!ctx.embedded) removeDiscovery(hostDir)
|
|
259
292
|
if (spec.beforeStop) await spec.beforeStop(ctx)
|
|
260
293
|
await info.stop()
|
|
261
294
|
},
|
|
262
295
|
}
|
|
263
296
|
} catch (error) {
|
|
297
|
+
stopAssetGc()
|
|
264
298
|
try { if (!ctx.embedded) removeDiscovery(hostDir) } catch { /* 忽略 */ }
|
|
265
299
|
try { if (spec.beforeStop) await spec.beforeStop(ctx) } catch { /* 忽略 */ }
|
|
266
300
|
try { await info.stop() } catch { /* 忽略 */ }
|