odant-work 1.0.40 → 1.0.41
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/#system/package-manifest.json +25 -25
- package/$server/$folder/$file/$task/class.js +3 -0
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +33 -1
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +65 -1
- package/$server/$folder/lib/consultant/consultant.js +9 -0
- package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js +27 -7
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +2 -2
- package/package.json +1 -1
- package/sources/data/progress.md +6 -0
- package/sources/modules/agent/loop.js +39 -4
- package/sources/modules/agent/permissions.js +271 -111
- package/sources/modules/agent/session.js +89 -2
- package/sources/modules/agent/system.js +10 -3
- package/sources/modules/agent/tools/chrome.js +25 -4
- package/sources/modules/agent/tools/desktop.js +184 -170
- package/sources/modules/agent/tools/dev/checks.js +160 -160
- package/sources/modules/agent/tools/dev/git.js +276 -276
- package/sources/modules/agent/tools/net.js +45 -45
- package/sources/modules/agent/tools/os-proc.js +179 -169
- package/sources/modules/agent/tools/services.js +280 -275
- package/sources/modules/trainer/index.js +1 -0
- package/sources/modules/trainer/local-engine.js +321 -55
- package/sources/modules/trainer/worker/local_infer_worker.py +34 -12
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"createdAt": 1794916599757,
|
|
5
|
-
"updatedAt":
|
|
5
|
+
"updatedAt": 1794928249512,
|
|
6
6
|
"files": {
|
|
7
7
|
"run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
|
|
8
|
-
"package.json": "
|
|
9
|
-
"package-lock.json": "
|
|
8
|
+
"package.json": "7e0a770e32c87fdfa3213694b380bb3bc458b497a90556d57038b794ec034784",
|
|
9
|
+
"package-lock.json": "1ca73ad7e453d902d18b754d7110a782ad321284af39b6010c41f84f6ae8f8e5",
|
|
10
10
|
"sources/client/class.js": "c3fb8f143fc83aaa2df1ddeddd412d2d4dfe88656578095babe2df34fb3b3922",
|
|
11
11
|
"sources/client/field.js": "ffdd50fa8b6ec515cc42da5fca96658ff2b20e274601a1f926e0031372467a19",
|
|
12
12
|
"sources/client/file.js": "667101d75fa30840370d5be232e518aaac7c1fd52ca05a12da560eef6c0848b0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"sources/data/objects.js": "23f51d5b00cd766fe27879b874738bc9bd9056bd6e27285fb7a52926c0dbc6a8",
|
|
27
27
|
"sources/data/posting.js": "6595bb9ec632539ae7629504db327d25a491e61c1cdc598bb43d08ea0d45548d",
|
|
28
28
|
"sources/data/print.js": "704f0f2fc80c6466a4196e4650d763150cf9b592eab14ea67ece85d51100107c",
|
|
29
|
-
"sources/data/progress.md": "
|
|
29
|
+
"sources/data/progress.md": "d7e89a4313cbc4b16bf10b5800e6f292e0bba39390395a0e03817f26308636fc",
|
|
30
30
|
"sources/data/readme.md": "593fa2ae07aa91bc26d7542275da6953a9cd419240a9a49e00cb62fb9d5d8e36",
|
|
31
31
|
"sources/data/reports.js": "0330f404860fe2589a7d46a2f0fe690ca23249bd841a062a26718742d4fd11d6",
|
|
32
32
|
"sources/data/schema.js": "1c994f9adb76c156dc86601dd6b1046376b66549b041e1a58aa1727b5476bdbe",
|
|
@@ -67,39 +67,39 @@
|
|
|
67
67
|
"sources/modules/agent/hooks.js": "b74e9d8f4b491b6d16d979891de69941955e50852289f55589c82997405c9048",
|
|
68
68
|
"sources/modules/agent/index.js": "eeb1f34f9ca36e13749389ea544f23e385891d355f6050206bff3f6bd106ceeb",
|
|
69
69
|
"sources/modules/agent/log.js": "03ae1979e2b00459178deda49847c30ed75937fc4f3eea9b778ca6c0f8c4ded0",
|
|
70
|
-
"sources/modules/agent/loop.js": "
|
|
70
|
+
"sources/modules/agent/loop.js": "efff4ddb13b77468c662a966fa4d6e3c8acf060d30d94f4b0132bcc9d30fba12",
|
|
71
71
|
"sources/modules/agent/mcp-pool.js": "aa4e75e2fcfe07883f9b721b33cee642fbbe11b8f416f8cd6a81f9c1ab39edde",
|
|
72
|
-
"sources/modules/agent/permissions.js": "
|
|
72
|
+
"sources/modules/agent/permissions.js": "b3a3b73feea646eb765a4c0b71f8c63ecb36c0d616cf237a9fb040fb19590fbc",
|
|
73
73
|
"sources/modules/agent/plugins.js": "9aed13c2d7bbf66dcd165f23b3969874561aea470dc16dac1435d183696cfda5",
|
|
74
74
|
"sources/modules/agent/readme.md": "c8d461218b8b552be58697f154c5bc4dba9858e6387aff6acfbc794c1286b89d",
|
|
75
75
|
"sources/modules/agent/recovery.js": "7a61dfdb2aef10b5049aee85d579379fdf98af3524f8509428ebc5a613bad92d",
|
|
76
76
|
"sources/modules/agent/resources.js": "2a52a31b2a96e17c713a6e311cbf0fe31a6debf8cd596e8e8067c722e6299eb2",
|
|
77
77
|
"sources/modules/agent/scheduler.js": "26cc6fffb9f570d501dbef5261b274323fe8e8165d1598097ff8f77d32cdd9cf",
|
|
78
|
-
"sources/modules/agent/session.js": "
|
|
79
|
-
"sources/modules/agent/system.js": "
|
|
78
|
+
"sources/modules/agent/session.js": "1f5e9f224e4f1db8fc486861eb9f95478b5010a557db09f9af057d98ba3970d3",
|
|
79
|
+
"sources/modules/agent/system.js": "ec1d0cf29c490b164b4adb0025a138bd12e037276d6286676a085eff2e29ec9b",
|
|
80
80
|
"sources/modules/agent/taint.js": "bf6aee5cc7e8b15ac365525fa74645d4a92da5ce1bdbcdba012e80767b5c7063",
|
|
81
81
|
"sources/modules/agent/tools/branch.js": "1ac9ccafcf292801575e8205ec7b63ab7dd6d53b03ad2a67cc3571092b716bcf",
|
|
82
82
|
"sources/modules/agent/tools/browse.js": "86179a951e82017e17a434b0a4e7678a9211693bf10d614c4c03113d219c0ca4",
|
|
83
83
|
"sources/modules/agent/tools/browser.js": "39db0658cd9bdc1ace994d39ce74c8f601aec576a2a208405bccac58b762c4af",
|
|
84
|
-
"sources/modules/agent/tools/chrome.js": "
|
|
84
|
+
"sources/modules/agent/tools/chrome.js": "ed865bd089bf1ca79bdc2403ac5bc4a26e5b5ac9811ddf841e2d9b9d27ab1aba",
|
|
85
85
|
"sources/modules/agent/tools/computer.js": "2f45ae558ca0a71c14673fb9d598217a7705ef6833e7321ad2e3f5cfc6368e3f",
|
|
86
86
|
"sources/modules/agent/tools/connect.js": "29424fdf9b93d4bf5e81b37e82d5a9d0f76680ea332bf5d4b44580a138cedc5e",
|
|
87
|
-
"sources/modules/agent/tools/desktop.js": "
|
|
88
|
-
"sources/modules/agent/tools/dev/checks.js": "
|
|
89
|
-
"sources/modules/agent/tools/dev/git.js": "
|
|
87
|
+
"sources/modules/agent/tools/desktop.js": "425f21331dcc30325bb692b69d20ebab90e0353fe6325919d062f2b72e3edaa8",
|
|
88
|
+
"sources/modules/agent/tools/dev/checks.js": "1010523c5e9a79c5309507061c39d03d2fa881a0ef0420790df800c86a53dd11",
|
|
89
|
+
"sources/modules/agent/tools/dev/git.js": "0344191dab24553fdaa6414b59a931424542f9a1c0412f9ac071fe3f1f835ec8",
|
|
90
90
|
"sources/modules/agent/tools/dev/lsp.js": "9451a4dae048198bc3ec11d24063ef653e37b5d537606f00ec21c53c9f4a4516",
|
|
91
91
|
"sources/modules/agent/tools/dev/patch.js": "12c4398db554040e424b625ab1dc2aa584685af8973b55ef17d22464a893c60e",
|
|
92
92
|
"sources/modules/agent/tools/dev/search.js": "182a0137f858c97aa4c854c7185ba84a453d1eb9659e3fc831e78b6cc99d675f",
|
|
93
93
|
"sources/modules/agent/tools/docs.js": "3a2d9b07a79371424b9911a755e272b446d8f0940e7312a51a1d9cbf531d9ffa",
|
|
94
94
|
"sources/modules/agent/tools/memory.js": "48df8fa4c323eef62ea541e8c633fca4e2f49bdb7a4f744bbc5a397ebe156779",
|
|
95
95
|
"sources/modules/agent/tools/meta.js": "d3a50b81a1849920fadf114776802a88dd7bf1b8845f64a3d6358ca6a49436c3",
|
|
96
|
-
"sources/modules/agent/tools/net.js": "
|
|
96
|
+
"sources/modules/agent/tools/net.js": "6e2fe4753c5fd0334127d4d286a8b87defbc0f469a6e1b192e30c555675a583f",
|
|
97
97
|
"sources/modules/agent/tools/os-files.js": "7b27de7ca02f35635e6aa61b65c602ec5b9fa0eb656b703907c1ad93ef48f9f8",
|
|
98
|
-
"sources/modules/agent/tools/os-proc.js": "
|
|
98
|
+
"sources/modules/agent/tools/os-proc.js": "2247ac5e3c215325512572d9f7edf17e2a3b13c9f6aa162c1868330d6ef545f7",
|
|
99
99
|
"sources/modules/agent/tools/plugins.js": "1faca1c51259956e4c43c4b18bd4c0b4e573d10c1db9a66cd7f58236c1714ff8",
|
|
100
100
|
"sources/modules/agent/tools/sandbox.js": "bed67cb26f78c6128936902333d408705639441fb0ebe1154139ec1a2924c9da",
|
|
101
101
|
"sources/modules/agent/tools/schedule.js": "a93834b72fcf96f6bfee3d1763119b53dc218db6de0b8c901682bee2001313c8",
|
|
102
|
-
"sources/modules/agent/tools/services.js": "
|
|
102
|
+
"sources/modules/agent/tools/services.js": "e7558df700d6933819754e122e4ba9c68081855d0cc41b1dad27d34d080ce616",
|
|
103
103
|
"sources/modules/agent/tools/work/access.js": "a84468a3f7264a5ce6bd7588422277571f2c77a153bde572e981230661260751",
|
|
104
104
|
"sources/modules/agent/tools/work/classes.js": "fb6ae199f2b7d01613ea55d2447ba1c5fccd473cc377f85e06931f6114c44a03",
|
|
105
105
|
"sources/modules/agent/tools/work/common.js": "b0deead4550694601121d43cd524151c87b464f318a5581b6758018a7665cdf0",
|
|
@@ -178,14 +178,14 @@
|
|
|
178
178
|
"sources/modules/trainer/downloader.js": "d9e96cb07e7bf64386558be8c2265c482af35a513f42954250add6d5fc87bdc4",
|
|
179
179
|
"sources/modules/trainer/halogen.js": "eddc61b4acf5494703d599e4dc5811ce27aa34d60abe24fddadc1755d460c9fe",
|
|
180
180
|
"sources/modules/trainer/huggingface.js": "91878bb2975981e02dd21d2a587d7c345ef65cd2d7032c5769a63c9dba21f982",
|
|
181
|
-
"sources/modules/trainer/index.js": "
|
|
182
|
-
"sources/modules/trainer/local-engine.js": "
|
|
181
|
+
"sources/modules/trainer/index.js": "20809764a1bb4fd9334f741056c44dc8016459c1d362493f9bdab332b9411460",
|
|
182
|
+
"sources/modules/trainer/local-engine.js": "5dbdf6e1a222aa3710d84f16c263095c35b64cd32208d0453981399f710ab037",
|
|
183
183
|
"sources/modules/trainer/paths.js": "86d12a1f3a79127c2284a5e0eaf4f523fbf0f3aa8e13b92d8889ebf4fa5400f4",
|
|
184
184
|
"sources/modules/trainer/providers.js": "56ffd2de03449ecaa13751a7e82c615cf5f84e6f02bb0b34c4432c3d85db28da",
|
|
185
185
|
"sources/modules/trainer/runner.js": "328843672fe0c1bd7e8c35c2e25285c31a9f749e04814e64c32e8cae74086024",
|
|
186
186
|
"sources/modules/trainer/tar-stream.js": "52f1739579a01818b53d04a93fd05a91c49a0716019f309a6fca951ba112794f",
|
|
187
187
|
"sources/modules/trainer/transfer.js": "2c603d538e0f85e1794e2f304081fac136f0ff72f85d8b00c2141c7402b3a1fb",
|
|
188
|
-
"sources/modules/trainer/worker/local_infer_worker.py": "
|
|
188
|
+
"sources/modules/trainer/worker/local_infer_worker.py": "b9e63ff5f45d387c83c80450e47fb360d6cbc4250b5c10fdd7323f632a0c26e7",
|
|
189
189
|
"sources/modules/trainer/worker/unsloth_train.py": "7774d94ffa6f60eed20c57a8dfdc12621d5d9f74d594c605dff32ff70e321e33",
|
|
190
190
|
"sources/modules/user-profile/user-profile.js": "5c8fd002809848b204aee83a44161375e8144bffcc048fde748f4f778162bbef",
|
|
191
191
|
"sources/modules/user-profile/user-token.js": "3797685232684e9e80261a2e63f70cbff4ef1bcc3ded6f755800804e9848d7d9",
|
|
@@ -733,13 +733,13 @@
|
|
|
733
733
|
"$server/$folder/$file/$office/handlers/preview/$handler/preview.js": "6c5d5bbbc20988794b817c6db526a014efcc502ad2e90cc95dbe3c67f5784596",
|
|
734
734
|
"$server/$folder/$file/$office/methods/onlyoffice_callback/$handler/class.js": "a0e07f8683bc33502434c634d37d3397bb5be014912d9b28c1c4bf7fcb5c8bd6",
|
|
735
735
|
"$server/$folder/$file/$office/methods/save/$handler/class.js": "88c7f2c6779ec77cba043558956a9892dd4e1802f12e8554dbd21e1afff03f4a",
|
|
736
|
-
"$server/$folder/$file/$task/class.js": "
|
|
736
|
+
"$server/$folder/$file/$task/class.js": "648dc3ee23d242e8193c351a2f3ca465ea88c87a6b37ca2c78db88ce68f36bc1",
|
|
737
737
|
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js": "67034be6dc54c7116f9f7e4ac83e0bf62de02ca7af7498f3b0e19fee50bf0875",
|
|
738
|
-
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js": "
|
|
738
|
+
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js": "10acaf3e9a5b523a7638627ec900e72db17c6f999b1de98383b821169decb447",
|
|
739
739
|
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/readme.md": "c9ef3c69af48b7f2437c06b45e9fc7d08da1676663514cc963a9860abf89c3d3",
|
|
740
740
|
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/dock.js": "28f4ceebb28a87a5b3c287103a9c06d5728f04afc1b97f599211cb1d242a0a1c",
|
|
741
741
|
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/docs.js": "85dbc8d304b79dd917213b93d837f7882e5453dcdffa0c3f3176a0034da4cf72",
|
|
742
|
-
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js": "
|
|
742
|
+
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js": "826de311b1b243d83cb6e4ee624eff3941bff949074b16c91e7f4fec3786ef6f",
|
|
743
743
|
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/panel.js": "8a158cf43e87a6a70b4e0631a98a48fbd0aa977dd541cfb8308ad6d59ea431c9",
|
|
744
744
|
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/segments.js": "165030064982dc162586f368a8b0531afc297c401debf665def4e73ea6a8e32b",
|
|
745
745
|
"$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/util.js": "db0dca0c9d447034461dd94a408c9efff37999816a7df9acb505ceb4fdb703c0",
|
|
@@ -773,7 +773,7 @@
|
|
|
773
773
|
"$server/$folder/lib/calendar-form/calendar-form.js": "3035cab0a489c891d7dd7ed52ae5c475068b97361a1f7c855d500a0823614d1c",
|
|
774
774
|
"$server/$folder/lib/chat-item/chat-item.js": "6af09b84e5ef31c7e22007ba763bccf874d642afeff359414400ec36d4d5c560",
|
|
775
775
|
"$server/$folder/lib/class-picker/class-picker.js": "b166f0852b38bf91e2576931c62d2d54f27ce259e2e9f8f998e81cb17c6f153b",
|
|
776
|
-
"$server/$folder/lib/consultant/consultant.js": "
|
|
776
|
+
"$server/$folder/lib/consultant/consultant.js": "081f3b83040e0e5f1b4191541f01d571f362c38879420b2a240f9d0fbdb6a3c2",
|
|
777
777
|
"$server/$folder/lib/dialogs/confirm/confirm.js": "dea87a6fc521df05c79aa469bfb060bbb5056105758ef708fd058c6cb2c0d109",
|
|
778
778
|
"$server/$folder/lib/dialogs/input/input.js": "59f57a2514059d76529aa6fd062a6e0ac833f1d8b7a71dda7b8dcc07658df746",
|
|
779
779
|
"$server/$folder/lib/dialogs/popover/popover.js": "f845067f0db0f1851dcea596772aeb45d9916b37dd7de44a753033e5f14ede79",
|
|
@@ -976,13 +976,13 @@
|
|
|
976
976
|
"MODULES/Register/STRUCTS/Паспорт/$struct/class.js": "4a50808e4db7741b0384a775177545d71686a680ccda7ef0ec68bf81f9c988b5",
|
|
977
977
|
"MODELS/$ai/$folder/$class/$ai/class.js": "633d6226576af4ea9731a79fb3d1018a57b50e8e3c4e90464532ae30e39de5de",
|
|
978
978
|
"MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/class.js": "fe5ba834156495c28a34acd4b70a6b6b3bdfccb67ec7bf99e92a292afbb66d19",
|
|
979
|
-
"MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js": "
|
|
979
|
+
"MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js": "11072a2ac8ba6e842316ec03593d64c433bb3b965353bacb9cab08929f23449f",
|
|
980
980
|
"MODELS/$ai/$folder/$class/$ai/methods/chat/$method/class.js": "02fbb40d8ce93fbf568a6a8036c199e2af815be3d63d81f815aeb1da999db717",
|
|
981
981
|
"MODELS/$ai/$folder/$class/$provider/class.js": "069073501b93a95bb9d77e59ce71e53c7a8bcab2564c391b551f68a2453ac486",
|
|
982
982
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/class.js": "8d327820cefd696d351ac4fa7998994039e4d57ef7a9f8ae297209e4dd1b0a9e",
|
|
983
983
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/provider.js": "b9ddf0040a9cd12e0dacd2dd3a61a1f0e62686cc664d02ef446326bc3991f4ce",
|
|
984
984
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/class.js": "06b279a1c053deb37dd7401c84df7f9370309b8dfbd35b368ab1bab4f635cb3f",
|
|
985
|
-
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js": "
|
|
985
|
+
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js": "1ab10009c57d9ef962981d3b8da2a63746e8cb5e56f45234860209f9a45b207b",
|
|
986
986
|
"MODELS/$ai/$folder/$class/$provider/readme.md": "d6ceef2010231ab121510c3d3f35630dd7009a069c7723f6673a0e264799b227",
|
|
987
987
|
"MODELS/$ai/class.js": "54e1bbbde88f8b1f272ff7f5cad87243407591748a44719b7ec90ae2b4962de7",
|
|
988
988
|
"MODELS/$ai/readme.md": "90d70305a2c85312282cf67cc468a0f0b417495cb3d5b3d2ca60c6f44b81cb77",
|
|
@@ -50,6 +50,9 @@ export default {
|
|
|
50
50
|
async approve(params = {}) {
|
|
51
51
|
return (await WORK_AGENT()).approve(this, params);
|
|
52
52
|
},
|
|
53
|
+
async explain_call(params = {}) {
|
|
54
|
+
return (await WORK_AGENT()).explainCall(this, params);
|
|
55
|
+
},
|
|
53
56
|
/** Карточка подключения: данные вводит человек → { auth_url } окна входа или { ok } (токен). Не пишется в ленту. */
|
|
54
57
|
async connect_start(params = {}) {
|
|
55
58
|
return (await WORK_AGENT()).connectStart(this, params);
|
|
@@ -127,6 +127,11 @@ export default {
|
|
|
127
127
|
this._resultsList = undefined;
|
|
128
128
|
this.dockTab = 'context';
|
|
129
129
|
this.resultKey = '';
|
|
130
|
+
this._monitorOpenedFor = '';
|
|
131
|
+
this._cuFor = null;
|
|
132
|
+
this._cu = null;
|
|
133
|
+
this.computerState = 'missing';
|
|
134
|
+
this.computerChecked = false;
|
|
130
135
|
}
|
|
131
136
|
this._bound = n || null;
|
|
132
137
|
if (!n)
|
|
@@ -399,8 +404,11 @@ export default {
|
|
|
399
404
|
const r = await fetch('/~computer/' + encodeURIComponent(this.computerName) + '/status' + this.computerQuery, { credentials: 'same-origin', signal: AbortSignal.timeout(6000) });
|
|
400
405
|
const data = await r.json().catch(() => ({}));
|
|
401
406
|
const state = data.state || 'missing';
|
|
407
|
+
const prevState = this.computerState;
|
|
402
408
|
if (state !== this.computerState)
|
|
403
409
|
this.computerState = state;
|
|
410
|
+
if (state === 'running' && prevState !== 'running')
|
|
411
|
+
this._openMonitorOnce();
|
|
404
412
|
}
|
|
405
413
|
catch {
|
|
406
414
|
if (this.computerState !== 'missing')
|
|
@@ -408,6 +416,14 @@ export default {
|
|
|
408
416
|
}
|
|
409
417
|
this.computerChecked = true;
|
|
410
418
|
},
|
|
419
|
+
_openMonitorOnce() {
|
|
420
|
+
const taskKey = this.$item?.path || this.$item?.id || '_';
|
|
421
|
+
if (this._monitorOpenedFor === taskKey)
|
|
422
|
+
return;
|
|
423
|
+
this._monitorOpenedFor = taskKey;
|
|
424
|
+
this.dockOpen = true;
|
|
425
|
+
this.dockTab = 'monitor';
|
|
426
|
+
},
|
|
411
427
|
_startPcPoll() {
|
|
412
428
|
if (this._pcPoll)
|
|
413
429
|
return;
|
|
@@ -434,6 +450,8 @@ export default {
|
|
|
434
450
|
this._lastDelta = Date.now();
|
|
435
451
|
if (this.status !== 'running')
|
|
436
452
|
this.status = 'running';
|
|
453
|
+
if (/^(?:computer_|sandbox_)/.test(String(d.name || '')) && d.name !== 'computer_destroy')
|
|
454
|
+
this._openMonitorOnce();
|
|
437
455
|
this._stick();
|
|
438
456
|
return;
|
|
439
457
|
}
|
|
@@ -473,12 +491,16 @@ export default {
|
|
|
473
491
|
this.streams = s;
|
|
474
492
|
}
|
|
475
493
|
const before = this._docKeys;
|
|
494
|
+
const prevComputerUsed = Boolean(this._cu?.used);
|
|
476
495
|
this.data = data;
|
|
477
496
|
this.status = data.status || 'idle';
|
|
478
497
|
this._lastDelta = Date.now();
|
|
479
498
|
this._noticeDocs(before);
|
|
480
|
-
if (this.computer.used)
|
|
499
|
+
if (this.computer.used) {
|
|
500
|
+
if (!prevComputerUsed && this.status === 'running')
|
|
501
|
+
this._openMonitorOnce();
|
|
481
502
|
this._checkComputer();
|
|
503
|
+
}
|
|
482
504
|
if (this.starting)
|
|
483
505
|
this.async(() => this.invalidate?.('starting', 'feedItems', 'activity'), Math.max(50, 20100 - (Date.now() - (+data.created || 0))));
|
|
484
506
|
this._stick();
|
|
@@ -616,6 +638,16 @@ export default {
|
|
|
616
638
|
const res = await this.$item?.fetch('approve', {}, JSON.stringify({ call: callId, ...payload }));
|
|
617
639
|
if (res && res.ok === false)
|
|
618
640
|
this.toast(res.error || 'Не удалось отправить ответ');
|
|
641
|
+
else if (this.$item?.path && navigator.serviceWorker?.controller) {
|
|
642
|
+
try {
|
|
643
|
+
navigator.serviceWorker.controller.postMessage({ type: 'work:task-visible', task: this.$item.path });
|
|
644
|
+
}
|
|
645
|
+
catch { /* ignore */ }
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
/** Кратко объяснить действие и последствия ожидающего подтверждения с помощью быстрой модели. */
|
|
649
|
+
async explainCall(callId) {
|
|
650
|
+
return this.$item?.fetch('explain_call', {}, JSON.stringify({ call: callId }));
|
|
619
651
|
},
|
|
620
652
|
async revert(item) {
|
|
621
653
|
if (!item?.id || item.id === 'optimistic')
|
|
@@ -349,6 +349,18 @@ ODA({ is: 'microchat-tool',
|
|
|
349
349
|
.ask .why { @apply --muted; font-size: x-small; }
|
|
350
350
|
.btns { @apply --horizontal; flex-wrap: wrap; gap: 8px; }
|
|
351
351
|
.btns oda-button { border-radius: var(--radius-s); padding: 4px 12px; box-sizing: border-box; }
|
|
352
|
+
.btns .help-btn { padding: 4px 9px; font-weight: 700; min-width: 28px; }
|
|
353
|
+
.auto-tag { padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-color); font-weight: 600; }
|
|
354
|
+
.explain-box {
|
|
355
|
+
padding: 8px 10px;
|
|
356
|
+
border-radius: var(--radius-s);
|
|
357
|
+
background: var(--content-background);
|
|
358
|
+
border: 1px solid var(--subtle-border);
|
|
359
|
+
font-size: 12px;
|
|
360
|
+
line-height: 1.45;
|
|
361
|
+
user-select: text;
|
|
362
|
+
}
|
|
363
|
+
.explain-err { color: var(--error-color); font-size: 12px; }
|
|
352
364
|
.ghost { border: 1px solid var(--subtle-border); background: var(--content-background); }
|
|
353
365
|
.danger { color: var(--error-color); fill: var(--error-color); }
|
|
354
366
|
.opt[selected] { outline: 2px solid var(--accent-color); }
|
|
@@ -375,6 +387,7 @@ ODA({ is: 'microchat-tool',
|
|
|
375
387
|
<span class="label" no-flex>{{meta.label}}</span>
|
|
376
388
|
<span class="target" flex :title="linkPath ? 'Открыть ' + linkPath : target" :link="!!linkPath" @tap.stop="openArtifact">{{target}}</span>
|
|
377
389
|
<span class="aux" no-flex ~if="data?.diff"><span class="plus">+{{data.diff.added}}</span> <span class="minus">−{{data.diff.removed}}</span></span>
|
|
390
|
+
<span class="aux auto-tag" no-flex ~if="data?.autoAllowed" :title="data?.scopeLabel || 'Разрешено ранее в этой задаче'">авторазрешено</span>
|
|
378
391
|
<span class="aux" no-flex ~if="statusLabel">{{statusLabel}}</span>
|
|
379
392
|
<span class="aux" no-flex ~if="duration">{{duration}}</span>
|
|
380
393
|
<oda-icon no-flex :icon="statusIcon" :icon-size="16" :bad="['error', 'denied'].includes(data?.status)" :good="data?.status === 'ok'" :hold="attention"></oda-icon>
|
|
@@ -387,8 +400,15 @@ ODA({ is: 'microchat-tool',
|
|
|
387
400
|
<div class="why" ~if="data?.reason">{{data.reason}}</div>
|
|
388
401
|
<div class="btns">
|
|
389
402
|
<oda-button hide-icon accent-invert label="Разрешить" @tap="approve(true)"></oda-button>
|
|
390
|
-
<oda-button hide-icon class="ghost" ~if="!data?.noAlways" label="
|
|
403
|
+
<oda-button hide-icon class="ghost" ~if="!data?.noAlways" :label="alwaysBtnLabel" :title="alwaysBtnTitle" @tap="approve(true, true)"></oda-button>
|
|
391
404
|
<oda-button hide-icon class="ghost danger" label="Отклонить" @tap="approve(false)"></oda-button>
|
|
405
|
+
<oda-button hide-icon class="ghost help-btn" label="?" :disabled="explainLoading" title="Кратко объяснить действие и последствия с помощью ИИ" @tap="toggleExplain()"></oda-button>
|
|
406
|
+
</div>
|
|
407
|
+
<div class="why" ~if="!data?.noAlways && data?.approvalLabel">Общее разрешение: {{data.approvalLabel}}</div>
|
|
408
|
+
<div class="explain-box" ~if="explainLoading">Анализирую действие…</div>
|
|
409
|
+
<div class="explain-err" ~if="explainError && !explainLoading">{{explainError}}</div>
|
|
410
|
+
<div class="explain-box" ~if="explainOpen && !explainLoading && explainText">
|
|
411
|
+
<oda-markdown-viewer vertical :value="explainText"></oda-markdown-viewer>
|
|
392
412
|
</div>
|
|
393
413
|
</div>
|
|
394
414
|
|
|
@@ -638,6 +658,50 @@ ODA({ is: 'microchat-tool',
|
|
|
638
658
|
return shell.reply(this.data.id, { values: this.values, content: text || undefined });
|
|
639
659
|
shell.reply(this.data.id, { content: text });
|
|
640
660
|
},
|
|
661
|
+
explainOpen: false,
|
|
662
|
+
explainLoading: false,
|
|
663
|
+
explainError: '',
|
|
664
|
+
explainLocal: '',
|
|
665
|
+
get explainText() {
|
|
666
|
+
return this.explainLocal || this.data?.explanation || '';
|
|
667
|
+
},
|
|
668
|
+
get alwaysBtnLabel() {
|
|
669
|
+
return this.data?.alwaysLabel || 'Разрешить подобные';
|
|
670
|
+
},
|
|
671
|
+
get alwaysBtnTitle() {
|
|
672
|
+
return this.data?.approvalLabel
|
|
673
|
+
? 'Не спрашивать в этой задаче: ' + this.data.approvalLabel
|
|
674
|
+
: 'Не спрашивать про «' + (this.meta?.label || '') + '» в этой задаче';
|
|
675
|
+
},
|
|
676
|
+
async toggleExplain() {
|
|
677
|
+
if (this.explainLoading)
|
|
678
|
+
return;
|
|
679
|
+
if (this.explainText) {
|
|
680
|
+
this.explainOpen = !this.explainOpen;
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const shell = findShell(this);
|
|
684
|
+
if (typeof shell?.explainCall !== 'function') {
|
|
685
|
+
this.explainError = 'Пояснение недоступно вне окна задачи';
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
this.explainLoading = true;
|
|
689
|
+
this.explainError = '';
|
|
690
|
+
this.explainOpen = true;
|
|
691
|
+
try {
|
|
692
|
+
const res = await shell.explainCall(this.data.id);
|
|
693
|
+
if (res?.ok && res.text)
|
|
694
|
+
this.explainLocal = String(res.text);
|
|
695
|
+
else
|
|
696
|
+
this.explainError = res?.error || 'Не удалось получить пояснение от модели';
|
|
697
|
+
}
|
|
698
|
+
catch (e) {
|
|
699
|
+
this.explainError = String(e?.message || e || 'Ошибка запроса');
|
|
700
|
+
}
|
|
701
|
+
finally {
|
|
702
|
+
this.explainLoading = false;
|
|
703
|
+
}
|
|
704
|
+
},
|
|
641
705
|
approve(accept, always) {
|
|
642
706
|
findShell(this)?.reply(this.data.id, { accept, always: !!always, content: String(this.comment || '').trim() || undefined });
|
|
643
707
|
},
|
|
@@ -1282,6 +1282,15 @@ ODA({
|
|
|
1282
1282
|
const res = await this.taskItem?.fetch('approve', {}, JSON.stringify({ call: callId, ...payload }));
|
|
1283
1283
|
if (res && res.ok === false)
|
|
1284
1284
|
this.toast(res.error || 'Не удалось отправить ответ');
|
|
1285
|
+
else if (this.taskItem?.path && navigator.serviceWorker?.controller) {
|
|
1286
|
+
try {
|
|
1287
|
+
navigator.serviceWorker.controller.postMessage({ type: 'work:task-visible', task: this.taskItem.path });
|
|
1288
|
+
}
|
|
1289
|
+
catch { /* ignore */ }
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
async explainCall(callId) {
|
|
1293
|
+
return this.taskItem?.fetch('explain_call', {}, JSON.stringify({ call: callId }));
|
|
1285
1294
|
},
|
|
1286
1295
|
|
|
1287
1296
|
async revert(item) {
|
|
@@ -294,10 +294,11 @@ export default {
|
|
|
294
294
|
{{testing ? 'Выполняю…' : testButtonLabel}}
|
|
295
295
|
</button>
|
|
296
296
|
</div>
|
|
297
|
-
<div class="msg warn" ~if="testMissingDeps.length">
|
|
298
|
-
<span
|
|
297
|
+
<div class="msg warn" ~if="testPythonMissing || testMissingDeps.length">
|
|
298
|
+
<span ~if="testPythonMissing">На ПК не найден Python — WORK автоматически установит изолированный Python 3.11 и библиотеки: <code>{{testDepsToInstall.join(', ')}}</code></span>
|
|
299
|
+
<span ~if="!testPythonMissing">Не хватает Python-библиотек: <code>{{testMissingDeps.join(', ')}}</code></span>
|
|
299
300
|
<button type="button" class="btn primary" :disabled="installingDeps" @tap="installMissingDeps()">
|
|
300
|
-
{{installingDeps ? '
|
|
301
|
+
{{installingDeps ? 'Установка среды…' : (testPythonMissing ? 'Установить Python и пакеты' : 'Доустановить зависимости')}}
|
|
301
302
|
</button>
|
|
302
303
|
</div>
|
|
303
304
|
<div class="toolbar" ~if="testMetricsLine" style="font-size:12px;opacity:0.85;">
|
|
@@ -323,8 +324,22 @@ export default {
|
|
|
323
324
|
testImageUrl: '',
|
|
324
325
|
testMetricsLine: '',
|
|
325
326
|
testMissingDeps: [],
|
|
327
|
+
testPythonMissing: false,
|
|
326
328
|
testing: false,
|
|
327
329
|
installingDeps: false,
|
|
330
|
+
get testDepsToInstall() {
|
|
331
|
+
if (this.testMissingDeps?.length)
|
|
332
|
+
return this.testMissingDeps;
|
|
333
|
+
const map = {
|
|
334
|
+
llm: ['torch'],
|
|
335
|
+
embed: ['torch', 'transformers'],
|
|
336
|
+
rerank: ['torch', 'transformers'],
|
|
337
|
+
image: ['torch', 'diffusers', 'accelerate', 'pillow', 'transformers'],
|
|
338
|
+
tts: ['torch', 'qwen-tts', 'soundfile', 'transformers'],
|
|
339
|
+
stt: ['torch', 'qwen-asr', 'soundfile', 'transformers'],
|
|
340
|
+
};
|
|
341
|
+
return map[this.testModality] || ['torch', 'transformers'];
|
|
342
|
+
},
|
|
328
343
|
busyAction: false,
|
|
329
344
|
notice: '',
|
|
330
345
|
error: '',
|
|
@@ -515,20 +530,22 @@ export default {
|
|
|
515
530
|
reader.readAsDataURL(f);
|
|
516
531
|
},
|
|
517
532
|
async installMissingDeps() {
|
|
518
|
-
|
|
533
|
+
const pkgs = this.testDepsToInstall;
|
|
534
|
+
if (!this.$item || !pkgs.length)
|
|
519
535
|
return;
|
|
520
536
|
this.installingDeps = true;
|
|
521
537
|
this.error = '';
|
|
522
538
|
this.notice = '';
|
|
523
539
|
try {
|
|
524
|
-
const res = await this.$item.fetch('trainer_install_python_deps', {}, { packages:
|
|
540
|
+
const res = await this.$item.fetch('trainer_install_python_deps', {}, { packages: pkgs });
|
|
525
541
|
if (res?.ok) {
|
|
526
542
|
this.testMissingDeps = [];
|
|
527
|
-
this.
|
|
543
|
+
this.testPythonMissing = false;
|
|
544
|
+
this.notice = 'Среда готова, пакеты установлены: ' + (res.packages || []).join(', ') + '. Повторяем проверку…';
|
|
528
545
|
await this.runTestPrompt();
|
|
529
546
|
}
|
|
530
547
|
else {
|
|
531
|
-
this.error = res?.error || 'Не удалось установить Python
|
|
548
|
+
this.error = res?.error || 'Не удалось установить Python-среду и пакеты.';
|
|
532
549
|
}
|
|
533
550
|
}
|
|
534
551
|
catch (e) {
|
|
@@ -552,6 +569,7 @@ export default {
|
|
|
552
569
|
this.testImageUrl = '';
|
|
553
570
|
this.testMetricsLine = '';
|
|
554
571
|
this.testMissingDeps = [];
|
|
572
|
+
this.testPythonMissing = false;
|
|
555
573
|
try {
|
|
556
574
|
const body = { modality: m };
|
|
557
575
|
if (m === 'llm')
|
|
@@ -572,6 +590,8 @@ export default {
|
|
|
572
590
|
const res = await this.$item.fetch('trainer_test_model', {}, body);
|
|
573
591
|
if (!res?.ok) {
|
|
574
592
|
this.error = res?.error || 'Ошибка проверки модели.';
|
|
593
|
+
if (res?.pythonMissing)
|
|
594
|
+
this.testPythonMissing = true;
|
|
575
595
|
if (Array.isArray(res?.missingDeps))
|
|
576
596
|
this.testMissingDeps = res.missingDeps;
|
|
577
597
|
return;
|
|
@@ -413,9 +413,9 @@ export default {
|
|
|
413
413
|
<div class="model-main" style="margin-bottom:6px;">
|
|
414
414
|
<strong>Диагностика локальных моделей (/MODELS/Local)</strong>
|
|
415
415
|
<div class="toolbar">
|
|
416
|
-
<span class="status-chip ok" ~if="checkAllResult.pythonDeps?.deviceName">Python: {{checkAllResult.pythonDeps.deviceName}}</span>
|
|
416
|
+
<span class="status-chip" ~class="checkAllResult.pythonDeps?.pythonMissing ? 'err' : 'ok'" ~if="checkAllResult.pythonDeps?.deviceName">Python: {{checkAllResult.pythonDeps.deviceName}}</span>
|
|
417
417
|
<button type="button" class="btn primary" ~if="missingPythonPkgs.length" :disabled="installingPythonDeps" @tap="installMissingPythonDeps()">
|
|
418
|
-
{{installingPythonDeps ? '
|
|
418
|
+
{{installingPythonDeps ? 'Установка среды (это займёт 1–3 мин)…' : (checkAllResult.pythonDeps?.pythonMissing ? 'Установить Python 3.11 и все библиотеки' : ('Доустановить пакеты (' + missingPythonPkgs.join(', ') + ')'))}}
|
|
419
419
|
</button>
|
|
420
420
|
</div>
|
|
421
421
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "sources/work.js",
|
package/sources/data/progress.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Прогресс: sources/data
|
|
2
2
|
|
|
3
3
|
## Последние изменения
|
|
4
|
+
- [~21:40, 17.11] «Разрешить подобные» с точной областью действия, кнопка `?` с пояснением ИИ, автооткрытие «Монитора» песочницы и авторазвёртывание Python-среды ИИ (`sources/modules/agent/{permissions,system,loop,session}.js`, `sources/modules/agent/tools/{chrome,desktop,net,os-proc,services}.js`, `sources/modules/agent/tools/dev/{git,checks}.js`, `sources/modules/trainer/{index,local-engine}.js`, `sources/modules/trainer/worker/local_infer_worker.py`, `$server/$folder/$file/$task/{class.js,handlers/pages/form/file/$handler/{file.js,ui/feed.js}}`, `$server/$folder/lib/consultant/consultant.js`, `MODELS/$ai/$folder/$class/{$ai,$provider}/handlers/pages/form/trainer/$handler/trainer.js`, `tests/{agent-core,chrome-bridge,dev-tools}.test.js`, `tests/ui/{task-dock,task-page,chat-create}.html`, `odant-work@1.0.41`):
|
|
5
|
+
- **Умные разрешения в задаче вместо «Разрешить всегда» наугад (`permissions.js`):** `classifyShellCommand` и `resolveApprovalScope` вычисляют точную область «подобных» вызовов: `shell:read` для чтения и проверки состояния (`Get-Content`, `Get-Process`, `git status/log/diff`, `wsl --status`, `docker ps` и т.п.), `shell:prog:<утилита>` для запуска конкретной программы, `os_service:<служба>`, `chrome:page:<домен>` для клика/ввода/перехода на конкретном сайте, `desktop_file:write`, `desktop_app:open:<приложение>`, `desktop_app:focus` и `svc:<id>` для прочих сервисов. Разрушительные команды (`Remove-Item`, `rm`, `del`, `format`, `Stop-Process`, `taskkill`, `shutdown`, `wsl --unregister`, конвейеры `curl | …`) и опасные инструменты (`taint`, `os_delete`, `computer_destroy`, `git_push`, `merge_branch`, `open_page`, `os_kill`, `http_request`, `desktop_mode`, `chrome_mode`) по-прежнему требуют подтверждения каждый раз (`noAlways: true`).
|
|
6
|
+
- **Кнопка «Разрешить подобные» и бейдж «авторазрешено» (`ui/feed.js`, `loop.js`, `session.js`):** кнопка подтверждения переименована и показывает в `title`/подписи, что именно разрешается («команды чтения и проверки состояния (логи, статусы, файлы без изменений)», «команды с утилитой «node» в этой задаче» и т.д.); выданная область сохраняется в `body.allowed` задачи и переиспользуется при перезапуске; автоматически разрешённые вызовы в ленте помечаются бейджем **`авторазрешено`**. Кнопки `Разрешить` / `Отклонить` в push-уведомлениях Windows по-прежнему работают, а после ответа в карточке видимые уведомления задачи закрываются (`work:task-visible`).
|
|
7
|
+
- **Кнопка `?` с пояснением вызова ИИ (`explain_call`, `explainCall`):** рядом с `Разрешить` появилась кнопка `?`, которая просит модель кратко объяснить суть вызова и его последствия (`compactLlm`, при недоступности — модель задачи, `effort: 'off'`); ответ кэшируется в `entry.explanation` и показывается в `.explain-box`, повторные нажатия не тратят токены. Тот же метод доступен в карточке подтверждения Консультанта (`consultant.js`).
|
|
8
|
+
- **Автооткрытие правой панели на вкладке «Монитор» (`file.js`):** при появлении в задаче первого вызова `sandbox_*` / `computer_*` (кроме `computer_destroy`) или при переходе контейнера в состояние `running` правая панель открывается сама и встаёт на вкладку **«Монитор»** (один раз на задачу, чтобы не перебивать ручной выбор пользователя).
|
|
9
|
+
- **Авторазвёртывание изолированного Python 3.11 и библиотек ИИ (`local-engine.js`, `local_infer_worker.py`, `form/trainer`):** если на ПК нет Python вне заглушки Microsoft Store, карточка модели и `/MODELS/Local` показывают кнопку **«Установить Python и пакеты»**: WORK скачивает `uv`, разворачивает Python 3.11 + `venv` в `MODELS/Local/$provider/#runtime/` (без прав администратора и без Microsoft Store) и ставит `torch`, `transformers`, `diffusers`, `accelerate`, `pillow`, `soundfile`, `qwen-tts`, `qwen-asr`. Поиск интерпретатора проверяет фактический `sys.executable` и отсекает `WindowsApps\python.exe`; воркер больше не падает при отсутствии `torch`, а возвращает `missingDeps`; ответы `pythonMissing`/`missingDeps` доводятся до UI (`trainer_test_model`, `trainer_check_all_models`).
|
|
4
10
|
- [~19:00, 17.11] Единая личная лента по умолчанию в чате всех точек, переключатель «Мои записи / Местный лог» для BOSS и очистка пустых дат (`$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js`, `sources/server/{class/feed.js,logs.js}`, `sources/reactor.js`, `tests/{access,logs-module}.test.js`, `tests/ui/chat-create.html`, `odant-work@1.0.40`):
|
|
5
11
|
- **Личная лента пользователя везде по умолчанию (`feed.js`, `chat.js`):** `chatSource` по умолчанию всегда возвращает личный кабинет (`/USERS//<uid>`), независимо от того, открыт ли `WORK` (`$server`), база или подразделение и есть ли там роль `BOSS`. Местный лог точки (`this.path`) открывается только при явном `local: true` и подтверждённой роли `BOSS` (в т.ч. унаследованной сверху по дереву).
|
|
6
12
|
- **Переключатель `[ Мои записи | Местный лог ]` (`oda-chat`):** компактная капсула в правом верхнем углу чата, видимая только на наследниках `$structure` (включая `$server`) и только для `BOSS` (при открытии/смене точки сбрасывается в «Мои записи»). В режиме «Мои записи» `chat-ribbon` слушает `changed` и на точке, и на личном кабинете, а при отсутствии прав на запись в чужую точку отправка задачи/сообщения автоматически сохраняется в `/USERS/<uid>`.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { log } from './log.js';
|
|
25
25
|
import { genId, clip, estimateTokens, resultText, StopError, throwIfStopped } from './util.js';
|
|
26
|
-
import { decide } from './permissions.js';
|
|
26
|
+
import { decide, resolveApprovalScope } from './permissions.js';
|
|
27
27
|
import { newNonce, wrapUntrusted, taintSources, untrustedNames } from './taint.js';
|
|
28
28
|
import { runPreTool, runAppend, runNotify } from './hooks.js';
|
|
29
29
|
import { costOf, recordUsage, budgetExceeded } from './cost.js';
|
|
@@ -734,6 +734,11 @@ async function runOne({ entry, tool, it, host, llm, opts, preapproved }) {
|
|
|
734
734
|
await noteAudit(tool, entry, ctx, 'deny', 'policy', { reason: clip(entry.error, 300) });
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
|
+
if (decision.verdict === 'allow' && decision.autoAllowed) {
|
|
738
|
+
entry.autoAllowed = true;
|
|
739
|
+
if (decision.scopeLabel)
|
|
740
|
+
entry.scopeLabel = decision.scopeLabel;
|
|
741
|
+
}
|
|
737
742
|
if (decision.verdict === 'ask' && typeof host.wait !== 'function') {
|
|
738
743
|
entry.status = 'denied';
|
|
739
744
|
entry.error = 'нужно подтверждение человека (' + (decision.reason || 'политика') + '), а запуск автономный — предложи действие в ответе';
|
|
@@ -748,23 +753,53 @@ async function runOne({ entry, tool, it, host, llm, opts, preapproved }) {
|
|
|
748
753
|
entry.status = 'approval';
|
|
749
754
|
entry.reason = decision.reason;
|
|
750
755
|
// действия во внешнем мире — каждое подтверждается отдельно («разрешить всегда» не предлагается)
|
|
751
|
-
if (decision.noAlways)
|
|
756
|
+
if (decision.noAlways) {
|
|
752
757
|
entry.noAlways = true;
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
const scope = decision.scope || resolveApprovalScope(tool, entry.args || {}, ctx);
|
|
761
|
+
if (scope?.noAlways) {
|
|
762
|
+
entry.noAlways = true;
|
|
763
|
+
}
|
|
764
|
+
else if (scope?.key) {
|
|
765
|
+
entry.approvalScope = scope.key;
|
|
766
|
+
if (scope.label)
|
|
767
|
+
entry.approvalLabel = scope.label;
|
|
768
|
+
if (scope.buttonLabel)
|
|
769
|
+
entry.alwaysLabel = scope.buttonLabel;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
753
772
|
if (decision.hideArgs)
|
|
754
773
|
entry.hideArgs = true;
|
|
755
774
|
await host.save();
|
|
756
|
-
const res = await host.wait({
|
|
775
|
+
const res = await host.wait({
|
|
776
|
+
kind: 'approval',
|
|
777
|
+
item: it.id,
|
|
778
|
+
call: entry.id,
|
|
779
|
+
tool: entry.name,
|
|
780
|
+
args: entry.args,
|
|
781
|
+
reason: decision.reason,
|
|
782
|
+
hideArgs: decision.hideArgs,
|
|
783
|
+
approvalScope: entry.approvalScope,
|
|
784
|
+
approvalLabel: entry.approvalLabel,
|
|
785
|
+
alwaysLabel: entry.alwaysLabel,
|
|
786
|
+
}) || {};
|
|
757
787
|
throwIfStopped(host.signal);
|
|
758
788
|
delete entry.reason;
|
|
789
|
+
const scopeKey = entry.approvalScope || entry.name;
|
|
790
|
+
delete entry.approvalLabel;
|
|
791
|
+
delete entry.alwaysLabel;
|
|
759
792
|
if (res.always && !entry.noAlways)
|
|
760
|
-
host.allowed?.add?.(
|
|
793
|
+
host.allowed?.add?.(scopeKey);
|
|
761
794
|
if (!res.accept) {
|
|
795
|
+
delete entry.approvalScope;
|
|
762
796
|
entry.status = 'denied';
|
|
763
797
|
entry.answer = res.content ? String(res.content) : undefined;
|
|
764
798
|
await host.save();
|
|
765
799
|
await noteAudit(tool, entry, ctx, 'ask', 'denied', { reason: clip(decision.reason, 300), answer: entry.answer ? clip(entry.answer, 300) : undefined });
|
|
766
800
|
return;
|
|
767
801
|
}
|
|
802
|
+
delete entry.approvalScope;
|
|
768
803
|
approved = { reason: decision.reason, always: !!(res.always && !entry.noAlways) };
|
|
769
804
|
}
|
|
770
805
|
entry.status = 'running';
|