arisa 5.1.13 → 5.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -0
- package/README.md +2 -0
- package/package.json +8 -10
- package/src/core/agent/agent-manager.js +132 -70
- package/src/core/agent/pi-runtime.js +0 -8
- package/src/core/agent/system-shell-tool.js +13 -2
- package/src/core/artifacts/artifact-store.js +17 -18
- package/src/core/config/config-defaults.js +2 -2
- package/src/core/conversation/session-seed-store.js +85 -0
- package/src/core/tools/ipc-client.js +0 -2
- package/src/core/tools/official-tool-installer.js +78 -6
- package/src/core/tools/tool-dependencies.js +99 -0
- package/src/core/tools/tool-output-materializer.js +41 -0
- package/src/core/tools/tool-registry.js +145 -28
- package/src/official-tools.lock.json +209 -5
- package/src/runtime/arisa-capabilities.js +12 -1
- package/src/runtime/create-app.js +1 -0
- package/src/runtime/doctor.js +72 -23
- package/src/runtime/headless-tool-executor.js +2 -32
- package/src/runtime/paths.js +7 -1
- package/src/runtime/restart-receipt.js +90 -0
- package/src/runtime/tool-usage-report.js +25 -10
- package/src/transport/telegram/bot.js +403 -1015
- package/src/transport/telegram/chat-queue.js +132 -0
- package/src/transport/telegram/media.js +2 -2
- package/src/transport/telegram/model-callback.js +211 -0
- package/src/transport/telegram/model-controls.js +164 -0
- package/src/transport/telegram/prompt-builders.js +372 -0
- package/src/transport/telegram/task-dispatcher.js +94 -0
- package/src/transport/telegram/update-command.js +1 -1
- package/src/transport/telegram/workspace-group.js +83 -0
- package/test/agent-tool-policy.test.js +7 -1
- package/test/capabilities-security.test.js +21 -0
- package/test/context-and-task-bounds.test.js +33 -5
- package/test/doctor.test.js +57 -4
- package/test/model-selection.test.js +47 -1
- package/test/official-tool-dependencies.test.js +25 -0
- package/test/official-tool-installer.test.js +37 -9
- package/test/paths.test.js +4 -4
- package/test/restart-receipt.test.js +39 -0
- package/test/session-start-operational-notes.test.js +47 -0
- package/test/telegram-prompt-builders.test.js +33 -0
- package/test/telegram-task-dispatcher.test.js +102 -0
- package/test/telegram-workspace-group.test.js +76 -0
- package/test/tool-dependencies.test.js +53 -0
- package/test/tool-registry-run.test.js +81 -1
- package/test/tool-usage.test.js +26 -4
- package/test/topic-initialization.test.js +66 -0
- package/src/core/conversation/conversation-history-store.js +0 -142
|
@@ -1,12 +1,104 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"repository": "https://github.com/clasen/Arisa.git",
|
|
4
|
-
"commit": "
|
|
4
|
+
"commit": "aaec12e4f63f4959462b26380e7d4c1a60562586",
|
|
5
5
|
"tools": {
|
|
6
|
+
"browser-session-bridge": {
|
|
7
|
+
"version": "0.1.0",
|
|
8
|
+
"files": {
|
|
9
|
+
"bridge-server.js": "87f5a392bc99fd97899836c0731b4694402b04d5dfbe88e66bb4f496bfef351d",
|
|
10
|
+
"chrome-web-store.js": "a6bd9553f1490d5ccda3fe3044c30ee6fe243f422e69a5000bc844884e6d1e95",
|
|
11
|
+
"config.js": "45c8e9e9a159b9125d6ea3458c616926c2ba2b5327fdfd750aa05316d3ce5af8",
|
|
12
|
+
"extension/icons/icon-128.png": "a55af49bb570bd5471fc0a2e15a6bcaf3f76a2c5e7439f16bb1829682b343380",
|
|
13
|
+
"extension/icons/icon-16.png": "a4aedb49e2227222a68dc56455812a9e17938fd197b1f30268f02d6c9f7bf95e",
|
|
14
|
+
"extension/icons/icon-32.png": "2dfc9e6e7ec6b4e9feb9c1326d65116cda8e53306c65c84074c818c9e7f6a2a2",
|
|
15
|
+
"extension/icons/icon-48.png": "2f316f1f2fbc72227e7e1f14cf1ff1553a12fc9aab139799f1ee2970c0303deb",
|
|
16
|
+
"extension/manifest.json": "3e19d7b1c2a9521745b585fbbb3a6f4639d3056703fdbca17e8cd6dd80fc4c91",
|
|
17
|
+
"extension/popup.css": "138811e3e96e9c7741f064f8cf017be75973cd0942efa9668e96a584b7b52c1c",
|
|
18
|
+
"extension/popup.html": "9d7798efd04c57c534840a7966dd3818f9264022c52390f0fd1d462236a01d60",
|
|
19
|
+
"extension/popup.js": "60ea83f17e5d87f072d27c6540b903361f70e03925c3727983cca6beba9696d3",
|
|
20
|
+
"index.js": "4c92afffaec61910e3522f483535c760e8c660604158a23628d2807daa024934",
|
|
21
|
+
"package-lock.json": "e1081b8b48c2eaaeca73c63e64902519b33e8822ce351a45afe8509224776c12",
|
|
22
|
+
"package.json": "b54fad02442d9d09fb42d6c1fa01bb2e441e946babdf73dbc7e5767002a07b28",
|
|
23
|
+
"README.md": "fc2848472b48627838b757bf1a7be9564f31e483e8b673bd4ae95a11016f3309",
|
|
24
|
+
"session-browser.js": "d5544db5c6712327e76b8436cfabe02e34d8e043ff2d251c2c5ff3f00f1a9dd7",
|
|
25
|
+
"session-store.js": "56b33e1a342ba148cb4443e03435e5c728db60903ecd0ae87c05fbff3ca881ab",
|
|
26
|
+
"test/device-enrollment.test.js": "3dd36d37044eaf1043bd8b2e9f10ead9dc87479152a07237ab87d50146782f4c",
|
|
27
|
+
"test/session-refresh.test.js": "8f5facb81444f0d09928d48f22e82112d47bde21927afcd7fd830ce6832b9f79",
|
|
28
|
+
"tool.manifest.json": "40326de8bc08f2fd51ce51d4a20637b9af37de588d6cb97d27bc0b0d16304095",
|
|
29
|
+
"web-store/listing.md": "914e7c38bc67e19f3afbea86288c0cbc49afcb8941f4734fd3f786c5533861e7",
|
|
30
|
+
"web-store/privacy-policy.md": "c96e84f1a112e5949a3e7bd952fcf5ec794eaa5c4bee14a1dbe0c8e0f5888fb7"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"campaign-draft-runner": {
|
|
34
|
+
"version": "0.3.3",
|
|
35
|
+
"toolDependencies": {
|
|
36
|
+
"pr-campaign": "^0.1.0",
|
|
37
|
+
"gmail-workspace": "^0.1.0"
|
|
38
|
+
},
|
|
39
|
+
"files": {
|
|
40
|
+
"README.md": "fb73d47f6825a1c9b419f6667a319c2cbd959dc7b56c488321db72a6e2210a41",
|
|
41
|
+
"config.js": "23b95ad1851e498310eb400b1d53c648c280ddcc73cf91f6fa0ae5dc470ae6d2",
|
|
42
|
+
"index.js": "28d58096adb76e00d74b23ef10816199a5af57e13866ed6ab829da2535d73890",
|
|
43
|
+
"operation-timeout.js": "9b1ced30ec9ed710bb9118b91f6f3feded5111a08e1e21abf163e4cfb91d7ad2",
|
|
44
|
+
"package.json": "a25b7ed1dd2c30cd68c3c10feb8ee1752cac8cd55cd4344690ffad649e231ec1",
|
|
45
|
+
"product-facts.js": "69339e20e7b70a6b9833878d72b10b70ea4ede4aa448097975d0961b6aaced59",
|
|
46
|
+
"search-quality.js": "ab5412d45d5144e976cccef52992e634c11aca0e21b73fd53f9dc2d489c56dd7",
|
|
47
|
+
"source-exhaustion.js": "407f940f5205eb01715a797672d0dad8bd0b0b897024b5fcb87052a062ecd054",
|
|
48
|
+
"telemetry.js": "bab44341ae2176c8a29eed19b89db4e7e251c9938af163ecd85293917d94bfb5",
|
|
49
|
+
"test/selection-policy.test.js": "27dacdc6ac3b1c570229ef624267c5bf7e4b9606dbb71214c2a451a30ac3762b",
|
|
50
|
+
"test/telemetry.test.js": "e297727e382163f18ab0ec4a21f55bf7e47790939510b615fd8e38c4dfc1998f",
|
|
51
|
+
"tool.manifest.json": "1eacb9ccdf0b37bba9745ba20ce3462548bac28c7abb15214e5502e7e53d3e0d"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"creator-scout": {
|
|
55
|
+
"version": "1.0.1",
|
|
56
|
+
"files": {
|
|
57
|
+
"README.md": "4f50850317c0875ad7ddea767c7dda112669112bec107a98e67a31a42787b82c",
|
|
58
|
+
"config.js": "bab728665650b986c0eaef8e1be1c259ec42b1f83df4217c9780f5468d3c7666",
|
|
59
|
+
"index.js": "d1266d622b6abaf77ce1fe93823d4f2faedb8a5991371997c364082a198dc728",
|
|
60
|
+
"package-lock.json": "ed479120b59c2d9b083991dea60eb7750ba36bc7b2c7defb01cfb598889b8d90",
|
|
61
|
+
"package.json": "ad463eeddea6a958ef291d58f216c0b42c5ff3b398b62ed9512b857ea5e4b672",
|
|
62
|
+
"reference-match.js": "762d822ad31f89c06cb5a40f84ba3f864436db486375ed30e48bde94de282c7c",
|
|
63
|
+
"test/reference-match.test.js": "701ce83396126b1e42bd3a54e331ff011a1fc27646a0f3aa99ce1c3e576aff6d",
|
|
64
|
+
"tool.manifest.json": "0617b0488035fd7f8a83a8e5a698558b3d0e956e7ea1e043e2e80bb224d4974f"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"gmail-workspace": {
|
|
68
|
+
"version": "0.1.1",
|
|
69
|
+
"files": {
|
|
70
|
+
"config.js": "6ad295ec4cedbc936835d8f86c7528e0939ef09d5792c003308d2ee85dc5eea4",
|
|
71
|
+
"index.js": "c4b1c27a3c5d2309501b695058da73f6287e2a6239f6e2384c05daae8ee25d43",
|
|
72
|
+
"package.json": "ba87edd5a148da9e99af6b3ab71a0024b86e1a469d56f548c7eeb253bb431f5d",
|
|
73
|
+
"secretary-state.js": "afc27732670420bccf1ce56ce715676dd2266de9f2d36a92015a93842755094a",
|
|
74
|
+
"test/secretary-state.test.mjs": "3aea05524a4ad5ebcb79c6aa1db94fcd009ac8ae69414c8f950b32a32af94370",
|
|
75
|
+
"tool.manifest.json": "2860c5684b9b9532ab4675f5cc5b96238320209086b132a5eda74ba99b6c294a"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"magnific-mcp": {
|
|
79
|
+
"version": "0.1.1",
|
|
80
|
+
"toolDependencies": {
|
|
81
|
+
"mcp-client": "^0.1.0"
|
|
82
|
+
},
|
|
83
|
+
"files": {
|
|
84
|
+
"README.md": "519b68d10c80112f475ab173394e937b0fc5930758415c1fc65ea2f5536b6371",
|
|
85
|
+
"config.js": "98a629781a1b2541806050952aa78a1e6e1b1671a6f1df7ba36c70dd116936a7",
|
|
86
|
+
"delivery-claims.js": "52f05a5bd1ece1ab21f7d9a49f362f9c55f101ef5723efd642dbecf0236921cd",
|
|
87
|
+
"generation-watch-close.js": "0dd780280eef870d2f11cb1800e6e9de19e5ead7b9d02b9983852cc8ddbdc79b",
|
|
88
|
+
"generation-watch-plan.js": "eb60660341f254adc224181ca19dbbb969ef1d676aeaab60b71a8567f52648fe",
|
|
89
|
+
"index.js": "0dcbd84ad03ab59919df57081d34a45c3a8d59b3c37ac31249409210ae7107e6",
|
|
90
|
+
"magnific-api.js": "39fa9a122577029111965c3e8487565c88ce46b61dec5ca685acf1c76cd3b636",
|
|
91
|
+
"network.js": "b45e43b49eea98ca7d80921ebfa6daf8b0a85d2079d4653f9eda682bc82101ae",
|
|
92
|
+
"package.json": "9c44eb43a3555cf79bd327318f9a30d3060f22dd2fd534923e303cca1eed7de9",
|
|
93
|
+
"state-store.js": "c3ee744509f7a6be251cd895406bd1c70827f53cbdc1ac9d1c2a6e48479bfe1e",
|
|
94
|
+
"test/magnific-mcp.test.js": "7a61dd19a2f6f9f48213cabf0de6e87e0b6fb73a94f0ea9dbfe9c8568c2cc32d",
|
|
95
|
+
"tool.manifest.json": "ff886d95250d279eff097430e6f89405a2bdd488d5f0949277cbc3f57f918950"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
6
98
|
"master-slave": {
|
|
7
99
|
"files": {
|
|
8
|
-
"README.md": "
|
|
9
|
-
"batch-runner.js": "
|
|
100
|
+
"README.md": "84d2841d8df31c07065d4fee6e434dc43cad241f3abf63e95efafad51ed69fcb",
|
|
101
|
+
"batch-runner.js": "97756a03b36278cd0315cc16da0c34a7821c322149c51ba6666f1c5081dbecbc",
|
|
10
102
|
"chat-state-store.js": "50de39aa33432733bb688eb01968e314a32b169324a66d0f0089b2a19ed9c880",
|
|
11
103
|
"config.js": "ff1c1cb6701ae1da7a6eb1519ba96a416e48daa73c2155a6f93cf5d64f65cef8",
|
|
12
104
|
"index.js": "8586303b3d1bf937932159adbe9b69c1031e6a393300e7d3aca93910ddfab082",
|
|
@@ -19,11 +111,11 @@
|
|
|
19
111
|
"lib/secure-store.js": "b8f365197f8e60d7f81fde6ed1cfc8851b603f6b0783e4cdc9036bb5c99726e1",
|
|
20
112
|
"master-domain.js": "10b7dfb43eb9939eb5baec54f742076cc73a2add6589a0ff57c51bc79c236faf",
|
|
21
113
|
"network-session.js": "db2d81a7ef47af29236d963b98e21414a11fef68e8b20895126eaad3f696ba3d",
|
|
22
|
-
"package.json": "
|
|
114
|
+
"package.json": "ef4824ccb46ddb3f901dd6e7a94abbd458152a2e73292ec409470643f45ff396",
|
|
23
115
|
"remote-runtime.js": "55dd7e577a822be17c2f337798a2d7f44ad0c5b6d68c46490e058282135c4658",
|
|
24
116
|
"slave-operations.js": "fec2e8addfff98f080284f24f722c1516124e5f6d12d8c03bb3c9cc0c475d1d6",
|
|
25
117
|
"state-store.js": "c56849a3f1b9c990128276e17963034a7836abacedc44f2e500d5732ebf9e451",
|
|
26
|
-
"test/batch-runner.test.js": "
|
|
118
|
+
"test/batch-runner.test.js": "69f69150eadd18c1ad1bc54f429e6cb5bc0c4492e3c6a6e76c2ce6827780ae41",
|
|
27
119
|
"test/bootstrap-url.test.js": "62c112b1a38c59ea2c77f797e32873667b52db32386da661a6ae8410490126fe",
|
|
28
120
|
"test/encrypted-frames.test.js": "cfb3195d3a58df7dc570bc7840a21c1841a53e0abc8b92840e0c24ed3435bcc1",
|
|
29
121
|
"test/handshake-crypto.test.js": "f11d6e95658f2055d8256bd7dfb66b39bedf95bf62a3cec5525b109bb6f9bc95",
|
|
@@ -35,6 +127,118 @@
|
|
|
35
127
|
"test/slave-operations.test.js": "a84526ad7554c7d03192a68655b4637bec18750559a5c3436f7471e912ca74cc",
|
|
36
128
|
"tool.manifest.json": "abf24c67b1d9ef0331ded59e04dcc092772419e74691c0d753ab51b40286d6f6"
|
|
37
129
|
}
|
|
130
|
+
},
|
|
131
|
+
"mcp-client": {
|
|
132
|
+
"version": "0.1.0",
|
|
133
|
+
"files": {
|
|
134
|
+
"README.md": "798125171049f939f4487e1a023cb3a11b3c28aae96b2687df1681a11bad8dc0",
|
|
135
|
+
"config.js": "b5b05fb242034e2d04b6301e848da9701c95be195ba1cdac2421964e9a7db8c9",
|
|
136
|
+
"index.js": "ba828f353ef23cd7acc3a064f859f553705836e4ede5d31ea0824a761cc88c2a",
|
|
137
|
+
"mcp-session.js": "51765b46f410e1cd49647235b611db0b10af20c9707efcacfbe0ff7dabe3c1ff",
|
|
138
|
+
"network-security.js": "60a020d4e3c7a4784a5a4e7b7246ee34e63ac73ee2316e09a09d10668dc8a7bc",
|
|
139
|
+
"oauth-device.js": "698aa9255bae47190c63527db7680aaab4f06392a108a0ff6444e32d31b7b89f",
|
|
140
|
+
"oauth-watch-plan.js": "b1bbed52eeb0e2e50dd52d733897ebd70573fea3ff5f023b3c63347f92633d3e",
|
|
141
|
+
"package-lock.json": "fd7b6bf4545de4056908bd656a4a4e21b9f84acc7b06d8c1d581a8c84c295e90",
|
|
142
|
+
"package.json": "16d423b77a32902671a751b1d673077c789a5bc3c79254bde296e4a4207fc4e3",
|
|
143
|
+
"state-store.js": "a8fb63096b8efdec8de1cb386eff371f1552f3fd71d96f25036e1c724285e0af",
|
|
144
|
+
"test/mcp-client.test.js": "188b253343f551303d1ee6ab2adc34e7153282461ba7399b598fe292e78a22a1",
|
|
145
|
+
"tool.manifest.json": "5659c398922c914c5bf893404519a30071ee685ab49f34a650ecafd585b4d6ec"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"official-tool-sync": {
|
|
149
|
+
"version": "1.0.0",
|
|
150
|
+
"toolDependencies": {
|
|
151
|
+
"trash": "^1.0.0"
|
|
152
|
+
},
|
|
153
|
+
"files": {
|
|
154
|
+
".gitignore": "4d56952b0fb13bf8f9b6c13a6d4c34a075bac3af447636a1df4335d7576e2f97",
|
|
155
|
+
"config.js": "744c445b1d2ff65b77f38a5473c24e50a32f4288c4a08c25a874a478086c08c8",
|
|
156
|
+
"index.js": "fdd4167c63cd33c8e7640cb7ce09fd618dbd416030aa920407392e4591543e94",
|
|
157
|
+
"package.json": "4447cb5d4e0a04526604dfb9820c44af88349c27e208f27baa148686846559da",
|
|
158
|
+
"sync-lib.js": "c9f2cd7e19370088ab5fd10f6b2ada52c07d2e405674a356d0989f9a0f4984f6",
|
|
159
|
+
"sync-lib.test.js": "c97cf850d9f42f6b121a458863b048bdcaa6d7d0475642f20742c5862ebf7cc4",
|
|
160
|
+
"tool.manifest.json": "8e0f94ad786bdaf9edb1a65cd03438e26c1e9927e8db9a5a39e349e7ef3c6cd3"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"pr-campaign": {
|
|
164
|
+
"version": "0.1.0",
|
|
165
|
+
"files": {
|
|
166
|
+
"config.js": "f265f3a15721d3b04fcfd259d62e33c62c35ed03d7cd33e432cd32b1c44ac84f",
|
|
167
|
+
"contact-dedupe.js": "00cec722c5987c40eced127b0528004a5c54c0c6463c27c04ba37daf51c13f25",
|
|
168
|
+
"index.js": "9e858aed2510d3a2e93f38f693f0e0b5d8b2cac6965c84872aad91f785754d0a",
|
|
169
|
+
"package.json": "3919118d382b80153aab2dade602eb7ebad632642997c8d20b3561c517b2b7a6",
|
|
170
|
+
"test/add-contact-dedupe.test.js": "7a8f8c097181d5c42697e4f4c15e6bd080b4c9304a9878fd20d4b4b6a8300340",
|
|
171
|
+
"test/contact-dedupe.test.js": "be636643881c10105c731c923d0ac07db62fc4a663d7ed3badb2649119223a32",
|
|
172
|
+
"tool.manifest.json": "9c68d89276996039b055c43b4b4f82499ea684edbb36d9bfedcc909a3a23a80f"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"process-retrospective": {
|
|
176
|
+
"version": "1.1.0",
|
|
177
|
+
"files": {
|
|
178
|
+
"README.md": "798c5c34893dccabe2101be91581b1845359fb57744efcc56a2b5beb83712c15",
|
|
179
|
+
"config.js": "30703e809f0a2c4b85ffb1e1f9cd7ee599224e9bc62c3bc19e71e271cbc72b5d",
|
|
180
|
+
"index.js": "9bd1ae078293211387ee3035b4c4dc7cc5852d08503cd55cf5fb3187cf1ace34",
|
|
181
|
+
"package.json": "491b490a8c7f5db0fef1202f5d3059f1cc2dd75a84c6668f9fd2f5c81c1a4240",
|
|
182
|
+
"reflection-plan.js": "6c7e088385d39d2e3ba4f74c2d6dd94194e6a506f4ac263e552d34d9c2335488",
|
|
183
|
+
"state-store.js": "6d0d39bff7e5e16558123c088eb8946bf3758596ae974598936b94424618c7cf",
|
|
184
|
+
"test/reflection-plan.test.js": "d7c5953b5c5ba6fed4c403d64affce3f2b70b7975c1f28edcd1b902651fbe727",
|
|
185
|
+
"tool.manifest.json": "33440c26660f74dc381c4b4cc5f8487f4764693a352d37ae7ae2ef67e669754f"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"telemetry-ledger": {
|
|
189
|
+
"version": "0.1.0",
|
|
190
|
+
"files": {
|
|
191
|
+
"README.md": "4cf1b8c7addaa0f6a2d802a7ae261293822c2662efac9c10afa844f9fbcf4e1d",
|
|
192
|
+
"analysis.js": "c0effbff3af519b018e59c0460d2c277b4f7e1422ca2680de217bcb5e8a13136",
|
|
193
|
+
"config.js": "ddc8543cde5aeda634b8df60628d0024bb03e65b8710cf4878b4c6a7d953a641",
|
|
194
|
+
"index.js": "7df14d142a70b725b32ee40741ce1007fd96a080f96a9b2e3e34d917d88621b5",
|
|
195
|
+
"package.json": "e662652038c1c5a6a2a4502b308ae89e1acbd3cb6d3fc494512a730ebe9ccb8a",
|
|
196
|
+
"stats.js": "fc41b065d1f280dc278c53dc4c4baaa385a5bf25416c3e4ff8a153ea624967fb",
|
|
197
|
+
"storage.js": "099187e270ccc2bd6d7300b78a2ee31a837f98694a23a3b40b20a646cdb1db1e",
|
|
198
|
+
"test/telemetry.test.js": "312eef22ad960b19a6fe777aecd520952ae20ed03168edbbef8a0f747bee01c0",
|
|
199
|
+
"tool.manifest.json": "e4b321a56db9030e5b39b764547769c76bcf282ed019ebba0323bf16a73dbe05",
|
|
200
|
+
"validation.js": "1a50c75a5ca1bb7249bb8bfc3f2927b31ff4accd0efb56a48c36df5adae78f61"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"trash": {
|
|
204
|
+
"version": "1.0.0",
|
|
205
|
+
"files": {
|
|
206
|
+
".gitignore": "4d56952b0fb13bf8f9b6c13a6d4c34a075bac3af447636a1df4335d7576e2f97",
|
|
207
|
+
"config.js": "ad76578e9dcc05c2e45854de9fa2cd41285fd8dcdb9a7d9ee2056e0f8b2d68d6",
|
|
208
|
+
"index.js": "d562d2466bddc93dd9a3bc5455962a3457c50368ee5dde0607cae3ff5a88578a",
|
|
209
|
+
"package.json": "18ec594d43b6595c587b16125b9ce0c9426fdf00a28d7e342834e31e360575f8",
|
|
210
|
+
"tool.manifest.json": "4f236d274c891b55e4445d459cff6a3337a5d13adc5e8aca7fb965ff6aba4e4d",
|
|
211
|
+
"trash-store.js": "1318e0f9539292684c0c2ec2f1b7189f066fdba42f78e07821b067792f40e8c9",
|
|
212
|
+
"trash-store.test.js": "5647edba4ab5e5492764ccf8ba3e674e42b63942623d779b0bf69465c5adb53f"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"x-campaign-runner": {
|
|
216
|
+
"version": "0.1.0",
|
|
217
|
+
"toolDependencies": {
|
|
218
|
+
"x-dm": "^0.2.0"
|
|
219
|
+
},
|
|
220
|
+
"files": {
|
|
221
|
+
"README.md": "7cb7264446b9bef41332da9634cd6c94130f55c740142d084cddec776cf703c8",
|
|
222
|
+
"config.js": "5eb3c5667d01705d48504a4bf711347262b8a440605cb6b75ec519dd56cb1309",
|
|
223
|
+
"index.js": "19ca6dd9aa62b15e62481c6c7ce65023af6a25a21ffc622527acae12ff0171ed",
|
|
224
|
+
"package.json": "7a2dd72ce45cb1f3946b2459362ed39b82478d6df622a78690a0cc483fa03043",
|
|
225
|
+
"test/x-campaign-runner.test.mjs": "cf62245bccc7d7b5804117ca02753130e7eec4f56fcc671af82757f922117389",
|
|
226
|
+
"tool.manifest.json": "ebde15ad3666ed985377ae8ff67264567f3d5db408b5ec0823617f386ef46140"
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"x-dm": {
|
|
230
|
+
"version": "0.2.0",
|
|
231
|
+
"toolDependencies": {
|
|
232
|
+
"browser-session-bridge": "^0.1.0"
|
|
233
|
+
},
|
|
234
|
+
"files": {
|
|
235
|
+
"config.js": "69a2dcccd10aa2f1ddcc24d52f4ce8fe4a6f5f5a85be64abbdf9dc9e19de0cd4",
|
|
236
|
+
"index.js": "83e3eb7fbeea8a5183303e0e56b1d6854ca7ccb800e4cd2ad689a5f13637380f",
|
|
237
|
+
"package.json": "3a76a921b1e78e91b1d2a5ae1926b298dfd6b4ee3f716d5382159b474ee400f4",
|
|
238
|
+
"README.md": "503b0ed25ef9a8df3079523ea653178e6e029854b4d199cb8d20be82cc837f9e",
|
|
239
|
+
"test/x-dm.test.mjs": "06352996e14777358eb62ad5e5d757b0dab5c0696927ed54ff40a5b7cdefcfd0",
|
|
240
|
+
"tool.manifest.json": "177e0abac770f89a0f06aa445363393fa38e7f05ad7cd773ea907fa56faed505"
|
|
241
|
+
}
|
|
38
242
|
}
|
|
39
243
|
}
|
|
40
244
|
}
|
|
@@ -43,6 +43,13 @@ function normalizeLimit(limit) {
|
|
|
43
43
|
return Math.min(value, 100);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
function normalizeAcknowledgement(value) {
|
|
47
|
+
if (value == null || value === "") return "";
|
|
48
|
+
const acknowledgement = requireString(value, "acknowledgement").trim();
|
|
49
|
+
if (acknowledgement.length > 500) throw new Error("acknowledgement must be at most 500 characters");
|
|
50
|
+
return acknowledgement;
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
export function createArisaCapabilities({
|
|
47
54
|
artifactStore,
|
|
48
55
|
taskStore,
|
|
@@ -206,7 +213,11 @@ export function createArisaCapabilities({
|
|
|
206
213
|
const resourceId = String(params.resourceId || "").trim();
|
|
207
214
|
return taskStore.add({
|
|
208
215
|
kind: "agent_event",
|
|
209
|
-
payload: {
|
|
216
|
+
payload: {
|
|
217
|
+
prompt: requireString(params.prompt, "prompt"),
|
|
218
|
+
resourceId,
|
|
219
|
+
acknowledgement: normalizeAcknowledgement(params.acknowledgement)
|
|
220
|
+
}
|
|
210
221
|
}, {
|
|
211
222
|
payload: { chatId: scopedChatId },
|
|
212
223
|
source: { type: "tool", toolName: scopedToolName, chatId: scopedChatId, resourceId }
|
|
@@ -135,6 +135,7 @@ export async function createApp({ logger, runtimeOverrides, requestRestart } = {
|
|
|
135
135
|
toolProcessSupervisor,
|
|
136
136
|
daemonPolicy: config.daemons,
|
|
137
137
|
doctorPolicy: config.doctor,
|
|
138
|
+
inspectToolDependencies: async () => toolRegistry.dependencyIssues(),
|
|
138
139
|
inspectInfrastructure: async () => {
|
|
139
140
|
const tool = toolRegistry.get("master-slave");
|
|
140
141
|
if (!tool) return null;
|
package/src/runtime/doctor.js
CHANGED
|
@@ -87,16 +87,43 @@ function daemonLabel(record) {
|
|
|
87
87
|
return `${record.toolName} (${record.instanceId || "global"})`;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
function
|
|
91
|
-
|
|
90
|
+
function daemonState(result) {
|
|
91
|
+
return result.diagnostic?.state || result.outcome;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function daemonStateLabel(state) {
|
|
95
|
+
return String(state || "unknown")
|
|
96
|
+
.split("-")
|
|
97
|
+
.map((part) => part ? `${part[0].toUpperCase()}${part.slice(1)}` : part)
|
|
98
|
+
.join(" ");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function daemonReportLines(results) {
|
|
102
|
+
const priority = ["ready", "starting", "degraded", "unhealthy", "restarting", "stopped", "failed"];
|
|
103
|
+
const groups = new Map();
|
|
92
104
|
for (const result of results) {
|
|
93
|
-
const state = result
|
|
94
|
-
|
|
105
|
+
const state = daemonState(result);
|
|
106
|
+
if (!groups.has(state)) groups.set(state, []);
|
|
107
|
+
groups.get(state).push(result);
|
|
108
|
+
}
|
|
109
|
+
const states = [...groups.keys()].sort((left, right) => {
|
|
110
|
+
const leftIndex = priority.indexOf(left);
|
|
111
|
+
const rightIndex = priority.indexOf(right);
|
|
112
|
+
if (leftIndex === -1 && rightIndex === -1) return left.localeCompare(right);
|
|
113
|
+
if (leftIndex === -1) return 1;
|
|
114
|
+
if (rightIndex === -1) return -1;
|
|
115
|
+
return leftIndex - rightIndex;
|
|
116
|
+
});
|
|
117
|
+
const lines = [];
|
|
118
|
+
for (const state of states) {
|
|
119
|
+
const group = groups.get(state);
|
|
120
|
+
lines.push(` ${daemonStateLabel(state)} (${group.length})`);
|
|
121
|
+
for (const result of group.sort((left, right) => daemonLabel(left.record).localeCompare(daemonLabel(right.record)))) {
|
|
122
|
+
const scope = result.record.scope?.type || (result.record.instanceId === "global" ? "global" : "chat");
|
|
123
|
+
lines.push(...wrapReportText(`${result.record.toolName} [${scope}]`, { firstPrefix: " - ", nextPrefix: " " }));
|
|
124
|
+
}
|
|
95
125
|
}
|
|
96
|
-
return
|
|
97
|
-
.sort(([left], [right]) => left.localeCompare(right))
|
|
98
|
-
.map(([state, count]) => `${count} ${state}`)
|
|
99
|
-
.join(", ");
|
|
126
|
+
return lines;
|
|
100
127
|
}
|
|
101
128
|
|
|
102
129
|
function formatTokenCount(tokens) {
|
|
@@ -123,6 +150,24 @@ function formatUptime(seconds) {
|
|
|
123
150
|
return [days ? `${days}d` : "", hours ? `${hours}h` : "", `${minutes}m`].filter(Boolean).join(" ");
|
|
124
151
|
}
|
|
125
152
|
|
|
153
|
+
function masterSlaveMode(infrastructure) {
|
|
154
|
+
const parts = [infrastructure.role || "unknown", infrastructure.daemon?.state || "unknown"];
|
|
155
|
+
if (infrastructure.paired != null) parts.push(infrastructure.paired ? "paired" : "unpaired");
|
|
156
|
+
return parts.join(" · ");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function masterSlaveActivity(jobs) {
|
|
160
|
+
const active = jobs?.active;
|
|
161
|
+
const queued = jobs?.queued;
|
|
162
|
+
const failed = jobs?.failed;
|
|
163
|
+
if ([active, queued, failed].every((value) => value === 0)) return "idle";
|
|
164
|
+
return `${active ?? "?"} active · ${queued ?? "?"} queued · ${failed ?? "?"} failed`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function compactEndpoint(endpoint) {
|
|
168
|
+
return String(endpoint || "not configured").replace(/^tcp:\/\//, "");
|
|
169
|
+
}
|
|
170
|
+
|
|
126
171
|
export async function inspectSystemResources({ diskPath = arisaHomeDir } = {}) {
|
|
127
172
|
const [load1, load5, load15] = os.loadavg();
|
|
128
173
|
const memoryTotal = os.totalmem();
|
|
@@ -148,7 +193,6 @@ export async function inspectSystemResources({ diskPath = arisaHomeDir } = {}) {
|
|
|
148
193
|
|
|
149
194
|
function assertDoctorPolicy(policy) {
|
|
150
195
|
const positiveValues = [
|
|
151
|
-
"contextInspectionTimeoutMs",
|
|
152
196
|
"contextWarningPercent",
|
|
153
197
|
"contextCriticalPercent",
|
|
154
198
|
"contextInefficientMinTokens",
|
|
@@ -221,22 +265,18 @@ export function formatDoctorReport(report) {
|
|
|
221
265
|
lines.push(...reportRow("Large", large));
|
|
222
266
|
lines.push(...reportRow("Ineff.", inefficient));
|
|
223
267
|
if (measured.length) lines.push(...reportRow("Max", `${Math.max(...measured.map((context) => context.percent)).toFixed(1)}%`));
|
|
224
|
-
lines.push("",
|
|
225
|
-
lines.push(...
|
|
226
|
-
if (report.daemons.length) lines.push(...reportRow("Status", daemonResultSummary(report.daemons)));
|
|
268
|
+
lines.push("", `Daemons (${report.daemons.length})`);
|
|
269
|
+
if (report.daemons.length) lines.push(...daemonReportLines(report.daemons));
|
|
227
270
|
if (report.infrastructure) {
|
|
228
271
|
lines.push("", "Master/Slave");
|
|
229
272
|
if (report.infrastructure.error) {
|
|
230
273
|
lines.push(...reportRow("Status", `unavailable: ${report.infrastructure.error}`));
|
|
231
274
|
} else {
|
|
232
|
-
lines.push(...reportRow("
|
|
233
|
-
lines.push(...reportRow("
|
|
234
|
-
lines.push(...reportRow("
|
|
235
|
-
lines.push(...reportRow("Identity", report.infrastructure.identityFingerprint || "not configured"));
|
|
236
|
-
lines.push(...reportRow("Paired", report.infrastructure.paired == null ? "n/a" : report.infrastructure.paired ? "yes" : "no"));
|
|
275
|
+
lines.push(...reportRow("Mode", masterSlaveMode(report.infrastructure)));
|
|
276
|
+
lines.push(...reportRow("Endpoint", compactEndpoint(report.infrastructure.endpoint)));
|
|
277
|
+
lines.push(...reportRow("Activity", masterSlaveActivity(report.infrastructure.jobs)));
|
|
237
278
|
lines.push(...reportRow("Tools", report.infrastructure.toolCount ?? "unknown"));
|
|
238
|
-
lines.push(...reportRow("
|
|
239
|
-
lines.push(...reportRow("Pending secrets", report.infrastructure.pendingSecrets ?? "unknown"));
|
|
279
|
+
lines.push(...reportRow("Secrets", `${report.infrastructure.pendingSecrets ?? "unknown"} pending`));
|
|
240
280
|
}
|
|
241
281
|
}
|
|
242
282
|
if (report.system) {
|
|
@@ -273,12 +313,11 @@ export async function runDoctor({
|
|
|
273
313
|
stopDaemon = stopManagedDaemon,
|
|
274
314
|
unregisterDaemon = unregisterManagedDaemon,
|
|
275
315
|
inspectResources = inspectSystemResources,
|
|
276
|
-
inspectInfrastructure = null
|
|
316
|
+
inspectInfrastructure = null,
|
|
317
|
+
inspectToolDependencies = null
|
|
277
318
|
}) {
|
|
278
319
|
assertDoctorPolicy(doctorPolicy);
|
|
279
|
-
const runtime = await agentManager.getRuntimeDiagnostic(
|
|
280
|
-
contextInspectionTimeoutMs: doctorPolicy.contextInspectionTimeoutMs
|
|
281
|
-
});
|
|
320
|
+
const runtime = await agentManager.getRuntimeDiagnostic();
|
|
282
321
|
const report = {
|
|
283
322
|
runtime,
|
|
284
323
|
contexts: runtime.contexts.map((context) => evaluateContext(context, doctorPolicy)),
|
|
@@ -290,6 +329,16 @@ export async function runDoctor({
|
|
|
290
329
|
infrastructure: null
|
|
291
330
|
};
|
|
292
331
|
addContextAttention(report);
|
|
332
|
+
if (inspectToolDependencies) {
|
|
333
|
+
try {
|
|
334
|
+
for (const issue of await inspectToolDependencies()) {
|
|
335
|
+
const installed = issue.installedVersion ? `; installed ${issue.installedVersion}` : "";
|
|
336
|
+
report.attention.push(`Tool dependency ${issue.type}: ${issue.tool} requires ${issue.dependency}@${issue.range || "valid"}${installed}.`);
|
|
337
|
+
}
|
|
338
|
+
} catch (error) {
|
|
339
|
+
report.attention.push(`Tool dependency inspection failed: ${error?.message || error}`);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
293
342
|
if (inspectInfrastructure) {
|
|
294
343
|
try {
|
|
295
344
|
report.infrastructure = await inspectInfrastructure();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { unlink } from "node:fs/promises";
|
|
1
|
+
import { materializeToolOutput } from "../core/tools/tool-output-materializer.js";
|
|
3
2
|
|
|
4
3
|
export function createHeadlessToolExecutor({ artifactStore, taskStore, toolRegistry } = {}) {
|
|
5
4
|
if (!artifactStore || !taskStore || !toolRegistry) {
|
|
@@ -10,36 +9,7 @@ export function createHeadlessToolExecutor({ artifactStore, taskStore, toolRegis
|
|
|
10
9
|
async runTool({ name, request, chatId }) {
|
|
11
10
|
await toolRegistry.load();
|
|
12
11
|
const result = await toolRegistry.run({ name, request, chatId });
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (result.output?.text) {
|
|
16
|
-
const artifact = await chatArtifacts.createText({
|
|
17
|
-
text: result.output.text,
|
|
18
|
-
source: { type: "tool", toolName: name },
|
|
19
|
-
metadata: { tool: name }
|
|
20
|
-
});
|
|
21
|
-
result.output.artifactId = artifact.id;
|
|
22
|
-
}
|
|
23
|
-
if (result.output?.filePath) {
|
|
24
|
-
const generated = await chatArtifacts.createFromFile({
|
|
25
|
-
originalPath: result.output.filePath,
|
|
26
|
-
fileName: result.output.fileName || path.basename(result.output.filePath),
|
|
27
|
-
kind: result.output.kind || "file",
|
|
28
|
-
mimeType: result.output.mimeType || "application/octet-stream",
|
|
29
|
-
source: { type: "tool", toolName: name },
|
|
30
|
-
metadata: { tool: name, delivery: result.output.delivery }
|
|
31
|
-
});
|
|
32
|
-
result.output.artifactId = generated.id;
|
|
33
|
-
await unlink(result.output.filePath).catch(() => {});
|
|
34
|
-
}
|
|
35
|
-
if (result.asyncTask || result.asyncTasks?.length) {
|
|
36
|
-
result.asyncTasks = await taskStore.addMany(result.asyncTasks || [result.asyncTask], {
|
|
37
|
-
payload: { chatId },
|
|
38
|
-
source: { type: "tool", toolName: name, chatId }
|
|
39
|
-
});
|
|
40
|
-
delete result.asyncTask;
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
12
|
+
return materializeToolOutput({ result, name, chatId, artifactStore, taskStore });
|
|
43
13
|
}
|
|
44
14
|
};
|
|
45
15
|
}
|
package/src/runtime/paths.js
CHANGED
|
@@ -13,6 +13,8 @@ export const configFile = path.join(stateDir, "config.json");
|
|
|
13
13
|
export const piAuthFile = path.join(stateDir, "pi-auth.json");
|
|
14
14
|
export const servicePidFile = path.join(stateDir, "arisa.pid");
|
|
15
15
|
export const serviceLogFile = path.join(stateDir, "arisa.log");
|
|
16
|
+
export const restartReceiptFile = path.join(stateDir, "restart-receipt.json");
|
|
17
|
+
export const sessionStartOperationalNotesFile = path.join(stateDir, "session-start-operational-notes.json");
|
|
16
18
|
export function createIpcSocketPath({ homeDir = arisaHomeDir, platform = process.platform } = {}) {
|
|
17
19
|
if (platform === "win32") {
|
|
18
20
|
const suffix = crypto.createHash("sha256").update(homeDir).digest("hex").slice(0, 16);
|
|
@@ -47,7 +49,11 @@ export function getChatArtifactsIndexFile(chatId) {
|
|
|
47
49
|
return path.join(getChatDir(chatId), "state", "artifacts.json");
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
export function
|
|
52
|
+
export function getChatSessionSeedFile(chatId) {
|
|
53
|
+
return path.join(getChatDir(chatId), "state", "session-seed.jsonl");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getChatLegacyConversationHistoryFile(chatId) {
|
|
51
57
|
return path.join(getChatDir(chatId), "state", "conversation.jsonl");
|
|
52
58
|
}
|
|
53
59
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { arisaPackageDir, restartReceiptFile } from "./paths.js";
|
|
7
|
+
|
|
8
|
+
const execFileAsync = promisify(execFile);
|
|
9
|
+
|
|
10
|
+
function normalizeDestination({ transportChatId, threadId = null }) {
|
|
11
|
+
const chatId = Number(transportChatId);
|
|
12
|
+
if (!Number.isSafeInteger(chatId)) throw new Error("Restart receipt requires a valid Telegram chat id");
|
|
13
|
+
const topic = threadId == null ? null : Number(threadId);
|
|
14
|
+
if (topic != null && (!Number.isSafeInteger(topic) || topic <= 0)) {
|
|
15
|
+
throw new Error("Restart receipt requires a valid Telegram topic id");
|
|
16
|
+
}
|
|
17
|
+
return { transportChatId: chatId, threadId: topic };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function runtimeIdentity() {
|
|
21
|
+
const packageJson = JSON.parse(await readFile(path.join(arisaPackageDir, "package.json"), "utf8"));
|
|
22
|
+
let commit = null;
|
|
23
|
+
try {
|
|
24
|
+
const result = await execFileAsync("git", ["rev-parse", "--short=12", "HEAD"], { cwd: arisaPackageDir });
|
|
25
|
+
commit = String(result.stdout || "").trim() || null;
|
|
26
|
+
} catch {}
|
|
27
|
+
return { version: String(packageJson.version || "unknown"), commit };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function prepareRestartReceipt(destination, { reason = "requested restart" } = {}, {
|
|
31
|
+
receiptFile = restartReceiptFile,
|
|
32
|
+
getIdentity = runtimeIdentity
|
|
33
|
+
} = {}) {
|
|
34
|
+
const target = normalizeDestination(destination);
|
|
35
|
+
const identity = await getIdentity();
|
|
36
|
+
const receipt = {
|
|
37
|
+
id: crypto.randomUUID(),
|
|
38
|
+
...target,
|
|
39
|
+
reason: String(reason || "requested restart").slice(0, 500),
|
|
40
|
+
expectedVersion: identity.version,
|
|
41
|
+
expectedCommit: identity.commit,
|
|
42
|
+
requestedAt: new Date().toISOString()
|
|
43
|
+
};
|
|
44
|
+
await mkdir(path.dirname(receiptFile), { recursive: true, mode: 0o700 });
|
|
45
|
+
const temporaryFile = `${receiptFile}.${process.pid}.tmp`;
|
|
46
|
+
await writeFile(temporaryFile, `${JSON.stringify(receipt, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
|
|
47
|
+
await rename(temporaryFile, receiptFile);
|
|
48
|
+
return receipt;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function cancelRestartReceipt(receiptId, { receiptFile = restartReceiptFile } = {}) {
|
|
52
|
+
try {
|
|
53
|
+
const receipt = JSON.parse(await readFile(receiptFile, "utf8"));
|
|
54
|
+
if (receipt.id !== receiptId) return false;
|
|
55
|
+
await rm(receiptFile, { force: true });
|
|
56
|
+
return true;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (error?.code === "ENOENT") return false;
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function deliverRestartReceipt(sendMessage, {
|
|
64
|
+
receiptFile = restartReceiptFile,
|
|
65
|
+
getIdentity = runtimeIdentity
|
|
66
|
+
} = {}) {
|
|
67
|
+
let receipt;
|
|
68
|
+
try {
|
|
69
|
+
receipt = JSON.parse(await readFile(receiptFile, "utf8"));
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error?.code === "ENOENT") return null;
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const actual = await getIdentity();
|
|
76
|
+
const versionMatches = receipt.expectedVersion === actual.version;
|
|
77
|
+
const commitMatches = !receipt.expectedCommit || receipt.expectedCommit === actual.commit;
|
|
78
|
+
const genericReasons = new Set(["requested restart", "Agent-requested restart", "Telegram restart", "Telegram /restart", "Telegram update restart"]);
|
|
79
|
+
const resultSummary = String(receipt.reason || "").trim();
|
|
80
|
+
const lines = [
|
|
81
|
+
versionMatches && commitMatches ? "Restart completed." : "Restart completed with an unexpected runtime identity.",
|
|
82
|
+
resultSummary && !genericReasons.has(resultSummary) ? resultSummary : null,
|
|
83
|
+
`Arisa ${actual.version} is running${actual.commit ? ` at commit ${actual.commit}` : ""}.`,
|
|
84
|
+
versionMatches && commitMatches ? null : `Expected: ${receipt.expectedVersion}${receipt.expectedCommit ? ` at ${receipt.expectedCommit}` : ""}.`
|
|
85
|
+
].filter(Boolean);
|
|
86
|
+
const options = receipt.threadId ? { message_thread_id: receipt.threadId } : {};
|
|
87
|
+
await sendMessage(receipt.transportChatId, lines.join("\n"), options);
|
|
88
|
+
await rm(receiptFile, { force: true });
|
|
89
|
+
return { receipt, actual, verified: versionMatches && commitMatches };
|
|
90
|
+
}
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import { renderTextReport } from "./report-format.js";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!tools.length) lines.push(" (none installed)");
|
|
6
|
-
|
|
7
|
-
const sortedTools = [...tools].sort((left, right) =>
|
|
3
|
+
function sortedTools(tools) {
|
|
4
|
+
return [...tools].sort((left, right) =>
|
|
8
5
|
Number(right.count) - Number(left.count) || String(left.name).localeCompare(String(right.name))
|
|
9
6
|
);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function usageRows(tools, nameWidth, countWidth) {
|
|
10
|
+
if (!tools.length) return [" (none)"];
|
|
11
|
+
return sortedTools(tools).map((tool) => {
|
|
13
12
|
const name = String(tool.name).padEnd(nameWidth);
|
|
14
13
|
const count = String(tool.count).padStart(countWidth);
|
|
15
|
-
|
|
16
|
-
}
|
|
14
|
+
return `- ${name} ${count}`;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function formatToolUsageReport(tools) {
|
|
19
|
+
const official = tools.filter((tool) => tool.official);
|
|
20
|
+
const local = tools.filter((tool) => !tool.official);
|
|
21
|
+
const nameWidth = Math.max(0, ...tools.map((tool) => String(tool.name).length));
|
|
22
|
+
const countWidth = Math.max(1, ...tools.map((tool) => String(tool.count).length));
|
|
23
|
+
const lines = [
|
|
24
|
+
"Arisa tools",
|
|
25
|
+
"===========",
|
|
26
|
+
"Official",
|
|
27
|
+
...usageRows(official, nameWidth, countWidth),
|
|
28
|
+
"",
|
|
29
|
+
"Local",
|
|
30
|
+
...usageRows(local, nameWidth, countWidth)
|
|
31
|
+
];
|
|
17
32
|
return renderTextReport(lines);
|
|
18
33
|
}
|