@aria-cli/tools 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/index.js +378 -70
  2. package/dist/network-runtime/index.js +8 -12
  3. package/dist-cjs/index.js +400 -435
  4. package/dist-cjs/network-runtime/index.js +8 -172
  5. package/package.json +8 -6
  6. package/dist/.tsbuildinfo +0 -1
  7. package/dist/ask-user-interaction.js +0 -22
  8. package/dist/cache/web-cache.js +0 -66
  9. package/dist/definitions/arion.js +0 -104
  10. package/dist/definitions/browser/browser.js +0 -418
  11. package/dist/definitions/browser/index.js +0 -4
  12. package/dist/definitions/browser/pw-downloads.js +0 -114
  13. package/dist/definitions/browser/pw-interactions.js +0 -199
  14. package/dist/definitions/browser/pw-responses.js +0 -76
  15. package/dist/definitions/browser/pw-session.js +0 -310
  16. package/dist/definitions/browser/pw-shared.js +0 -66
  17. package/dist/definitions/browser/pw-snapshot.js +0 -301
  18. package/dist/definitions/browser/pw-state.js +0 -62
  19. package/dist/definitions/browser/types.js +0 -4
  20. package/dist/definitions/code-intelligence.js +0 -470
  21. package/dist/definitions/core.js +0 -109
  22. package/dist/definitions/delegation.js +0 -512
  23. package/dist/definitions/deploy.js +0 -65
  24. package/dist/definitions/filesystem.js +0 -196
  25. package/dist/definitions/frg.js +0 -63
  26. package/dist/definitions/index.js +0 -20
  27. package/dist/definitions/memory.js +0 -123
  28. package/dist/definitions/messaging.js +0 -625
  29. package/dist/definitions/meta.js +0 -349
  30. package/dist/definitions/network.js +0 -159
  31. package/dist/definitions/outlook.js +0 -277
  32. package/dist/definitions/patch/apply-patch.js +0 -184
  33. package/dist/definitions/patch/fuzzy-match.js +0 -166
  34. package/dist/definitions/patch/index.js +0 -1
  35. package/dist/definitions/patch/patch-parser.js +0 -207
  36. package/dist/definitions/patch/sandbox-paths.js +0 -105
  37. package/dist/definitions/process/index.js +0 -4
  38. package/dist/definitions/process/process-registry.js +0 -213
  39. package/dist/definitions/process/process.js +0 -386
  40. package/dist/definitions/process/pty-keys.js +0 -254
  41. package/dist/definitions/process/session-slug.js +0 -142
  42. package/dist/definitions/quip.js +0 -195
  43. package/dist/definitions/search.js +0 -60
  44. package/dist/definitions/session-history.js +0 -69
  45. package/dist/definitions/shell.js +0 -181
  46. package/dist/definitions/slack.js +0 -180
  47. package/dist/definitions/web.js +0 -109
  48. package/dist/executors/apply-patch.js +0 -901
  49. package/dist/executors/arion.js +0 -119
  50. package/dist/executors/code-intelligence.js +0 -882
  51. package/dist/executors/deploy.js +0 -848
  52. package/dist/executors/filesystem.js +0 -1122
  53. package/dist/executors/frg-freshness.js +0 -576
  54. package/dist/executors/frg.js +0 -298
  55. package/dist/executors/index.js +0 -46
  56. package/dist/executors/learning-meta.js +0 -1146
  57. package/dist/executors/lsp-client.js +0 -296
  58. package/dist/executors/memory.js +0 -750
  59. package/dist/executors/meta.js +0 -220
  60. package/dist/executors/process-registry.js +0 -465
  61. package/dist/executors/pty-session-store.js +0 -30
  62. package/dist/executors/pty.js +0 -271
  63. package/dist/executors/restart.js +0 -119
  64. package/dist/executors/search-freshness.js +0 -195
  65. package/dist/executors/search-types.js +0 -52
  66. package/dist/executors/search.js +0 -66
  67. package/dist/executors/self-diagnose.js +0 -398
  68. package/dist/executors/session-history.js +0 -283
  69. package/dist/executors/shell-safety.js +0 -473
  70. package/dist/executors/shell.js +0 -954
  71. package/dist/executors/utils.js +0 -33
  72. package/dist/executors/web.js +0 -542
  73. package/dist/extraction/content-extraction.js +0 -235
  74. package/dist/extraction/index.js +0 -4
  75. package/dist/headless-control-contract.js +0 -967
  76. package/dist/local-control-http-auth.js +0 -2
  77. package/dist/mcp/client.js +0 -181
  78. package/dist/mcp/connection.js +0 -480
  79. package/dist/mcp/index.js +0 -10
  80. package/dist/mcp/jsonrpc.js +0 -144
  81. package/dist/mcp/types.js +0 -7
  82. package/dist/network-control-adapter.js +0 -72
  83. package/dist/network-runtime/address-types.js +0 -165
  84. package/dist/network-runtime/db-owner-fencing.js +0 -69
  85. package/dist/network-runtime/delivery-receipts.js +0 -267
  86. package/dist/network-runtime/direct-endpoint-authority.js +0 -25
  87. package/dist/network-runtime/local-control-contract.js +0 -627
  88. package/dist/network-runtime/node-store-contract.js +0 -34
  89. package/dist/network-runtime/pair-route-contract.js +0 -77
  90. package/dist/network-runtime/peer-capabilities.js +0 -28
  91. package/dist/network-runtime/peer-principal-ref.js +0 -12
  92. package/dist/network-runtime/peer-state-machine.js +0 -121
  93. package/dist/network-runtime/protocol-schemas.js +0 -205
  94. package/dist/network-runtime/runtime-bootstrap-contract.js +0 -60
  95. package/dist/outlook/desktop-session.js +0 -279
  96. package/dist/policy.js +0 -149
  97. package/dist/providers/brave.js +0 -62
  98. package/dist/providers/duckduckgo.js +0 -176
  99. package/dist/providers/exa.js +0 -63
  100. package/dist/providers/firecrawl.js +0 -55
  101. package/dist/providers/index.js +0 -7
  102. package/dist/providers/jina.js +0 -49
  103. package/dist/providers/router.js +0 -96
  104. package/dist/providers/search-provider.js +0 -32
  105. package/dist/providers/tavily.js +0 -54
  106. package/dist/quip/desktop-session.js +0 -317
  107. package/dist/registry/index.js +0 -1
  108. package/dist/registry/registry.js +0 -756
  109. package/dist/runtime-socket-local-control-client.js +0 -330
  110. package/dist/security/dns-normalization.js +0 -19
  111. package/dist/security/dns-pinning.js +0 -123
  112. package/dist/security/external-content.js +0 -91
  113. package/dist/security/ssrf.js +0 -181
  114. package/dist/slack/desktop-session.js +0 -324
  115. package/dist/tool-factory.js +0 -47
  116. package/dist/types.js +0 -7
  117. package/dist/utils/retry.js +0 -132
  118. package/dist/utils/safe-parse-json.js +0 -160
  119. package/dist/utils/url.js +0 -19
  120. package/dist-cjs/.tsbuildinfo +0 -1
  121. package/dist-cjs/ask-user-interaction.js +0 -27
  122. package/dist-cjs/cache/web-cache.js +0 -70
  123. package/dist-cjs/definitions/arion.js +0 -107
  124. package/dist-cjs/definitions/browser/browser.js +0 -421
  125. package/dist-cjs/definitions/browser/index.js +0 -8
  126. package/dist-cjs/definitions/browser/pw-downloads.js +0 -117
  127. package/dist-cjs/definitions/browser/pw-interactions.js +0 -213
  128. package/dist-cjs/definitions/browser/pw-responses.js +0 -84
  129. package/dist-cjs/definitions/browser/pw-session.js +0 -326
  130. package/dist-cjs/definitions/browser/pw-shared.js +0 -72
  131. package/dist-cjs/definitions/browser/pw-snapshot.js +0 -307
  132. package/dist-cjs/definitions/browser/pw-state.js +0 -70
  133. package/dist-cjs/definitions/browser/types.js +0 -5
  134. package/dist-cjs/definitions/code-intelligence.js +0 -473
  135. package/dist-cjs/definitions/core.js +0 -133
  136. package/dist-cjs/definitions/delegation.js +0 -515
  137. package/dist-cjs/definitions/deploy.js +0 -68
  138. package/dist-cjs/definitions/filesystem.js +0 -199
  139. package/dist-cjs/definitions/frg.js +0 -66
  140. package/dist-cjs/definitions/index.js +0 -43
  141. package/dist-cjs/definitions/memory.js +0 -126
  142. package/dist-cjs/definitions/messaging.js +0 -631
  143. package/dist-cjs/definitions/meta.js +0 -352
  144. package/dist-cjs/definitions/network.js +0 -162
  145. package/dist-cjs/definitions/outlook.js +0 -280
  146. package/dist-cjs/definitions/patch/apply-patch.js +0 -191
  147. package/dist-cjs/definitions/patch/fuzzy-match.js +0 -172
  148. package/dist-cjs/definitions/patch/index.js +0 -5
  149. package/dist-cjs/definitions/patch/patch-parser.js +0 -215
  150. package/dist-cjs/definitions/patch/sandbox-paths.js +0 -113
  151. package/dist-cjs/definitions/process/index.js +0 -8
  152. package/dist-cjs/definitions/process/process-registry.js +0 -231
  153. package/dist-cjs/definitions/process/process.js +0 -389
  154. package/dist-cjs/definitions/process/pty-keys.js +0 -259
  155. package/dist-cjs/definitions/process/session-slug.js +0 -145
  156. package/dist-cjs/definitions/quip.js +0 -198
  157. package/dist-cjs/definitions/search.js +0 -63
  158. package/dist-cjs/definitions/session-history.js +0 -72
  159. package/dist-cjs/definitions/shell.js +0 -184
  160. package/dist-cjs/definitions/slack.js +0 -183
  161. package/dist-cjs/definitions/web.js +0 -112
  162. package/dist-cjs/executors/apply-patch.js +0 -938
  163. package/dist-cjs/executors/arion.js +0 -125
  164. package/dist-cjs/executors/code-intelligence.js +0 -925
  165. package/dist-cjs/executors/deploy.js +0 -869
  166. package/dist-cjs/executors/filesystem.js +0 -1167
  167. package/dist-cjs/executors/frg-freshness.js +0 -627
  168. package/dist-cjs/executors/frg.js +0 -334
  169. package/dist-cjs/executors/index.js +0 -143
  170. package/dist-cjs/executors/learning-meta.js +0 -1165
  171. package/dist-cjs/executors/lsp-client.js +0 -310
  172. package/dist-cjs/executors/memory.js +0 -796
  173. package/dist-cjs/executors/meta.js +0 -226
  174. package/dist-cjs/executors/process-registry.js +0 -469
  175. package/dist-cjs/executors/pty-session-store.js +0 -34
  176. package/dist-cjs/executors/pty.js +0 -312
  177. package/dist-cjs/executors/restart.js +0 -155
  178. package/dist-cjs/executors/search-freshness.js +0 -234
  179. package/dist-cjs/executors/search-types.js +0 -56
  180. package/dist-cjs/executors/search.js +0 -102
  181. package/dist-cjs/executors/self-diagnose.js +0 -434
  182. package/dist-cjs/executors/session-history.js +0 -320
  183. package/dist-cjs/executors/shell-safety.js +0 -478
  184. package/dist-cjs/executors/shell.js +0 -1001
  185. package/dist-cjs/executors/utils.js +0 -73
  186. package/dist-cjs/executors/web.js +0 -547
  187. package/dist-cjs/extraction/content-extraction.js +0 -243
  188. package/dist-cjs/extraction/index.js +0 -8
  189. package/dist-cjs/headless-control-contract.js +0 -972
  190. package/dist-cjs/local-control-http-auth.js +0 -5
  191. package/dist-cjs/mcp/client.js +0 -185
  192. package/dist-cjs/mcp/connection.js +0 -484
  193. package/dist-cjs/mcp/index.js +0 -30
  194. package/dist-cjs/mcp/jsonrpc.js +0 -148
  195. package/dist-cjs/mcp/types.js +0 -8
  196. package/dist-cjs/network-control-adapter.js +0 -77
  197. package/dist-cjs/network-runtime/address-types.js +0 -168
  198. package/dist-cjs/network-runtime/db-owner-fencing.js +0 -76
  199. package/dist-cjs/network-runtime/delivery-receipts.js +0 -276
  200. package/dist-cjs/network-runtime/direct-endpoint-authority.js +0 -29
  201. package/dist-cjs/network-runtime/local-control-contract.js +0 -633
  202. package/dist-cjs/network-runtime/node-store-contract.js +0 -38
  203. package/dist-cjs/network-runtime/pair-route-contract.js +0 -80
  204. package/dist-cjs/network-runtime/peer-capabilities.js +0 -37
  205. package/dist-cjs/network-runtime/peer-principal-ref.js +0 -15
  206. package/dist-cjs/network-runtime/peer-state-machine.js +0 -129
  207. package/dist-cjs/network-runtime/protocol-schemas.js +0 -212
  208. package/dist-cjs/network-runtime/runtime-bootstrap-contract.js +0 -63
  209. package/dist-cjs/outlook/desktop-session.js +0 -318
  210. package/dist-cjs/policy.js +0 -155
  211. package/dist-cjs/providers/brave.js +0 -66
  212. package/dist-cjs/providers/duckduckgo.js +0 -180
  213. package/dist-cjs/providers/exa.js +0 -67
  214. package/dist-cjs/providers/firecrawl.js +0 -59
  215. package/dist-cjs/providers/index.js +0 -17
  216. package/dist-cjs/providers/jina.js +0 -53
  217. package/dist-cjs/providers/router.js +0 -100
  218. package/dist-cjs/providers/search-provider.js +0 -36
  219. package/dist-cjs/providers/tavily.js +0 -58
  220. package/dist-cjs/quip/desktop-session.js +0 -353
  221. package/dist-cjs/registry/index.js +0 -6
  222. package/dist-cjs/registry/registry.js +0 -761
  223. package/dist-cjs/runtime-socket-local-control-client.js +0 -367
  224. package/dist-cjs/security/dns-normalization.js +0 -22
  225. package/dist-cjs/security/dns-pinning.js +0 -160
  226. package/dist-cjs/security/external-content.js +0 -95
  227. package/dist-cjs/security/ssrf.js +0 -221
  228. package/dist-cjs/slack/desktop-session.js +0 -366
  229. package/dist-cjs/tool-factory.js +0 -50
  230. package/dist-cjs/types.js +0 -8
  231. package/dist-cjs/utils/retry.js +0 -169
  232. package/dist-cjs/utils/safe-parse-json.js +0 -164
  233. package/dist-cjs/utils/url.js +0 -23
@@ -1,349 +0,0 @@
1
- /**
2
- * Meta tool definitions
3
- *
4
- * Tools:
5
- * - ask_user, quest_update, quest_list
6
- * - search, learn_tool, learn_skill
7
- * - create_tool, create_skill, use_skill
8
- */
9
- import { executeAskUser, executeQuestUpdate, executeQuestList, executeSearchKnowledge, executeLearnLegacy, executeCreateTool, executeCreateSkill, executeUseSkill, executeRestart, executeSelfDiagnose, } from "../executors/index.js";
10
- const ask_user = {
11
- name: "ask_user",
12
- description: "Ask the user clarifying questions. Supports optional multiple-choice answers. Use when you need user input to proceed.",
13
- category: "meta",
14
- parameters: {
15
- type: "object",
16
- properties: {
17
- questions: {
18
- type: "array",
19
- description: "List of questions to ask the user",
20
- items: {
21
- type: "object",
22
- properties: {
23
- question: {
24
- type: "string",
25
- description: "The question to ask",
26
- },
27
- options: {
28
- type: "array",
29
- items: { type: "string" },
30
- description: "Optional multiple-choice answers",
31
- },
32
- },
33
- required: ["question"],
34
- },
35
- },
36
- },
37
- required: ["questions"],
38
- },
39
- riskLevel: "moderate",
40
- // Human interaction is a resumable barrier, not a parallel read-only batch item.
41
- isReadOnly: false,
42
- loadingTier: "always",
43
- execute: executeAskUser,
44
- };
45
- const quest_update = {
46
- name: "quest_update",
47
- description: "Create, update, or complete quests (task tracking). Quests persist in a structured database across sessions.",
48
- category: "meta",
49
- parameters: {
50
- type: "object",
51
- properties: {
52
- quests: {
53
- type: "array",
54
- description: "List of quests to create or update",
55
- items: {
56
- type: "object",
57
- properties: {
58
- id: {
59
- type: "string",
60
- description: "Quest ID (omit to create a new quest)",
61
- },
62
- title: {
63
- type: "string",
64
- description: "Quest title",
65
- },
66
- status: {
67
- type: "string",
68
- enum: ["open", "active", "blocked", "done"],
69
- description: "Quest status: open (ready), active (in progress), blocked, done",
70
- },
71
- priority: {
72
- type: "number",
73
- description: "Priority 0-4 (0 = highest, default 2)",
74
- minimum: 0,
75
- maximum: 4,
76
- },
77
- blocked_by: {
78
- type: "string",
79
- description: "ID of quest blocking this one",
80
- },
81
- notes: {
82
- type: "string",
83
- description: "Progress notes or context",
84
- },
85
- },
86
- required: [],
87
- },
88
- },
89
- },
90
- required: ["quests"],
91
- },
92
- riskLevel: "moderate",
93
- isReadOnly: false,
94
- loadingTier: "always",
95
- execute: executeQuestUpdate,
96
- };
97
- const quest_list = {
98
- name: "quest_list",
99
- description: "List current quests with their status, priority, and dependencies.",
100
- category: "meta",
101
- parameters: {
102
- type: "object",
103
- properties: {
104
- status: {
105
- type: "string",
106
- enum: ["all", "open", "active", "blocked", "done"],
107
- description: "Filter by status (default: all)",
108
- default: "all",
109
- },
110
- },
111
- required: [],
112
- },
113
- riskLevel: "safe",
114
- isReadOnly: true,
115
- loadingTier: "always",
116
- execute: executeQuestList,
117
- };
118
- const search = {
119
- name: "search",
120
- description: "Search for tools, skills, and capabilities across Memoria, local skill files, skill registries, and optional web/package sources.",
121
- category: "meta",
122
- parameters: {
123
- type: "object",
124
- properties: {
125
- query: {
126
- type: "string",
127
- description: "What to find — tool name, skill name, or capability description",
128
- },
129
- sources: {
130
- type: "array",
131
- items: {
132
- type: "string",
133
- enum: ["memoria", "local", "registry", "web"],
134
- },
135
- default: ["memoria", "local", "registry"],
136
- description: "Where to search. memoria=learned tools/skills, local=SKILL.md files, registry=skills.sh+clawhub, web=npm/brew+general",
137
- },
138
- limit: { type: "number", minimum: 1, maximum: 50, default: 10 },
139
- },
140
- required: ["query"],
141
- },
142
- riskLevel: "safe",
143
- isReadOnly: true,
144
- loadingTier: "always",
145
- execute: executeSearchKnowledge,
146
- };
147
- const learn_tool = {
148
- name: "learn_tool",
149
- description: "Learn a CLI tool from `<command> --help` and persist it as callable tool knowledge. (Deprecated — use learn instead)",
150
- category: "meta",
151
- parameters: {
152
- type: "object",
153
- properties: {
154
- command: { type: "string", description: "CLI command name (supports subcommands)" },
155
- name: { type: "string" },
156
- description: { type: "string" },
157
- category: {
158
- type: "string",
159
- enum: ["filesystem", "code", "shell", "web", "data", "memory", "meta", "arion"],
160
- },
161
- },
162
- required: ["command"],
163
- },
164
- riskLevel: "moderate",
165
- isReadOnly: false,
166
- loadingTier: "always",
167
- execute: (input, ctx) => executeLearnLegacy({ source: { type: "cli", command: String(input.command ?? "") } }, ctx),
168
- };
169
- const learn_skill = {
170
- name: "learn_skill",
171
- description: "Learn a skill from a SKILL.md file or inline content and persist it in Memoria. (Deprecated — use learn instead)",
172
- category: "meta",
173
- parameters: {
174
- type: "object",
175
- properties: {
176
- path: { type: "string", description: "Path to SKILL.md (optional if using inline content)" },
177
- name: { type: "string" },
178
- description: { type: "string" },
179
- content: { type: "string" },
180
- tags: { type: "array", items: { type: "string" } },
181
- toolIds: { type: "array", items: { type: "string" } },
182
- },
183
- required: [],
184
- },
185
- riskLevel: "moderate",
186
- isReadOnly: false,
187
- loadingTier: "always",
188
- execute: (input, ctx) => executeLearnLegacy({ source: { type: "file", path: String(input.path ?? "") } }, ctx),
189
- };
190
- const learn = {
191
- name: "learn",
192
- description: "Backward-compatible learning tool. Delegates to learn_tool (CLI) or learn_skill (file).",
193
- category: "meta",
194
- parameters: {
195
- type: "object",
196
- properties: {
197
- source: {
198
- type: "object",
199
- properties: {
200
- type: { type: "string", enum: ["cli", "file"] },
201
- command: { type: "string" },
202
- path: { type: "string" },
203
- },
204
- required: ["type"],
205
- },
206
- },
207
- required: ["source"],
208
- },
209
- riskLevel: "moderate",
210
- isReadOnly: false,
211
- loadingTier: "always",
212
- execute: executeLearnLegacy,
213
- };
214
- const create_tool = {
215
- name: "create_tool",
216
- description: "Create a reusable script-backed tool and save it to Memoria for future discovery/use.",
217
- category: "meta",
218
- parameters: {
219
- type: "object",
220
- properties: {
221
- name: { type: "string" },
222
- description: { type: "string" },
223
- command: {
224
- type: "string",
225
- description: "Shell command to wrap (optional if script provided)",
226
- },
227
- script: {
228
- type: "string",
229
- description: "Script body to write (optional if command provided)",
230
- },
231
- argsSchema: { type: "object", additionalProperties: true },
232
- tags: { type: "array", items: { type: "string" } },
233
- },
234
- required: ["name", "description"],
235
- },
236
- riskLevel: "dangerous",
237
- isReadOnly: false,
238
- loadingTier: "always",
239
- execute: executeCreateTool,
240
- };
241
- const create_skill = {
242
- name: "create_skill",
243
- description: "Create a reusable skill/procedure and optionally link it to the current arion profile.",
244
- category: "meta",
245
- parameters: {
246
- type: "object",
247
- properties: {
248
- name: { type: "string" },
249
- description: { type: "string" },
250
- content: { type: "string" },
251
- level: { type: "string", enum: ["beginner", "intermediate", "advanced", "expert"] },
252
- tags: { type: "array", items: { type: "string" } },
253
- toolIds: { type: "array", items: { type: "string" } },
254
- },
255
- required: ["name", "description", "content"],
256
- },
257
- riskLevel: "moderate",
258
- isReadOnly: false,
259
- loadingTier: "always",
260
- execute: executeCreateSkill,
261
- };
262
- const use_skill = {
263
- name: "use_skill",
264
- description: "Retrieve a learned skill by name/id and record its execution metrics.",
265
- category: "meta",
266
- parameters: {
267
- type: "object",
268
- properties: {
269
- name: { type: "string" },
270
- skillId: { type: "string" },
271
- success: { type: "boolean", default: true },
272
- durationMs: { type: "number" },
273
- notes: { type: "string" },
274
- },
275
- required: [],
276
- },
277
- riskLevel: "safe",
278
- isReadOnly: false,
279
- loadingTier: "always",
280
- execute: executeUseSkill,
281
- };
282
- const restart = {
283
- name: "restart",
284
- description: "Restart ARIA through the RelaunchSupervisor. Use when you need to pick up code changes after a build, recover from a corrupted state, or when explicitly asked to restart. Fails closed when no supervisor is attached.",
285
- category: "meta",
286
- parameters: {
287
- type: "object",
288
- properties: {
289
- reason: {
290
- type: "string",
291
- description: "Why the restart is needed (logged for diagnostics)",
292
- },
293
- },
294
- },
295
- riskLevel: "dangerous",
296
- requiresConfirmation: true,
297
- loadingTier: "always",
298
- execute: executeRestart,
299
- };
300
- const self_diagnose = {
301
- name: "self_diagnose",
302
- description: "Gather comprehensive diagnostic context for debugging ARIA's own errors, crashes, and runtime issues. Returns structured data from configs, error logs, crash dumps, databases, active quests, sessions, network, and model state — all in one call. Use this as the first step when investigating any ARIA bug or unexpected behavior.",
303
- category: "meta",
304
- parameters: {
305
- type: "object",
306
- properties: {
307
- focus: {
308
- type: "string",
309
- description: "Optional keyword to filter errors/crashes (e.g. 'quest_update', 'OOM', 'crash')",
310
- },
311
- sections: {
312
- type: "array",
313
- items: {
314
- type: "string",
315
- enum: ["runtime", "errors", "crashes", "databases", "daemon", "network"],
316
- },
317
- description: "Optional subset of sections to return (default: all 6)",
318
- },
319
- since: {
320
- type: "string",
321
- description: "ISO timestamp cutoff — only show events after this (default: last 1h)",
322
- },
323
- limit: {
324
- type: "number",
325
- description: "Max entries per section (default: 10)",
326
- default: 10,
327
- },
328
- },
329
- },
330
- riskLevel: "safe",
331
- isReadOnly: true,
332
- loadingTier: "always",
333
- execute: executeSelfDiagnose,
334
- };
335
- /** Meta tool definitions */
336
- export const META_TOOL_DEFINITIONS = [
337
- ask_user,
338
- quest_update,
339
- quest_list,
340
- search,
341
- learn,
342
- learn_tool,
343
- learn_skill,
344
- create_tool,
345
- create_skill,
346
- use_skill,
347
- restart,
348
- self_diagnose,
349
- ];
@@ -1,159 +0,0 @@
1
- /**
2
- * Network management tool definitions.
3
- *
4
- * Tools: manage_network, list_clients (2 tools)
5
- *
6
- * ARIA manages its own secure WireGuard network. The LLM uses this tool
7
- * to invite peers, revoke access, list connections, and check status.
8
- * No user configuration needed — the network auto-creates on first run.
9
- */
10
- import { z } from "zod";
11
- import { tool } from "../tool-factory.js";
12
- import { NodeIdSchema } from "../network-runtime/index.js";
13
- /**
14
- * Network management — ARIA manages its own secure mesh network.
15
- *
16
- * Actions:
17
- * invite: Generate an invite token for a new peer
18
- * revoke: Remove a peer from the network
19
- * list_peers: List all connected Arions
20
- * status: Network health/connectivity status
21
- */
22
- const manage_network = tool({
23
- name: "manage_network",
24
- description: "Manage ARIA's secure WireGuard mesh network. Invite peers to the network, " +
25
- "revoke access, list connected Arions, or check network status. " +
26
- "The network auto-creates on first run — no user configuration needed.",
27
- parameters: z.object({
28
- action: z
29
- .enum(["invite", "revoke", "list_peers", "status"])
30
- .describe("Network management action"),
31
- displayName: z.string().optional().describe("Optional local label for the invite"),
32
- nodeId: NodeIdSchema.optional().describe("Durable remote node id (required for revoke)"),
33
- duration: z.number().optional().describe("Invite token validity in ms (default: no expiry)"),
34
- }),
35
- category: "arion",
36
- riskLevel: "moderate",
37
- isReadOnly: false,
38
- execute: async (input, context) => {
39
- // Network management requires the Memoria DB for peer registry
40
- // The actual implementation lives in @aria-cli/wireguard — we only call it here
41
- // through the runtime-owned control surface when it is wired in.
42
- const networkControl = context.networkControl;
43
- if (!networkControl) {
44
- return {
45
- success: false,
46
- message: "Network manager not available. Secure networking requires the @aria-cli/wireguard package.",
47
- };
48
- }
49
- switch (input.action) {
50
- case "invite": {
51
- try {
52
- const result = networkControl.invite(input.displayName, input.duration);
53
- const inviteLabel = input.displayName?.trim();
54
- return {
55
- success: true,
56
- message: `${inviteLabel ? `Invite token for "${inviteLabel}":\n\n` : "Invite token:\n\n"}${result.token}\n\n` +
57
- `Token security model: bearer credential in plaintext payload form. ` +
58
- `Share only via secure channels. They can join with: aria pairing join <token>`,
59
- data: { token: result.token, ...(inviteLabel ? { displayName: inviteLabel } : {}) },
60
- };
61
- }
62
- catch (e) {
63
- return { success: false, message: `invite failed: ${e.message}` };
64
- }
65
- }
66
- case "revoke": {
67
- if (!input.nodeId) {
68
- return { success: false, message: "nodeId is required for revoke action" };
69
- }
70
- const revoked = networkControl.revokePeer(NodeIdSchema.parse(input.nodeId));
71
- if (!revoked) {
72
- return { success: false, message: `node "${input.nodeId}" not found` };
73
- }
74
- return {
75
- success: true,
76
- message: `Revoked access for "${input.nodeId}". They will be disconnected.`,
77
- data: { nodeId: input.nodeId, revoked: true },
78
- };
79
- }
80
- case "list_peers": {
81
- const peers = networkControl.listPeers();
82
- if (peers.length === 0) {
83
- return {
84
- success: true,
85
- message: "No peers connected. Use manage_network(invite) to add peers.",
86
- data: { peers: [] },
87
- };
88
- }
89
- const networkSummary = peers
90
- .map((p) => `${p.displayNameSnapshot ?? p.nodeId} (membership=${p.membershipStatus ?? p.status}, route=${p.routeOwnership ?? "current"}, session=${p.sessionState ?? "none"}, delivery=${p.deliveryReadiness ?? "cannot_address"}) — ${p.endpointHost ?? "unknown"}:${p.endpointPort ?? "?"}`)
91
- .join("\n");
92
- return {
93
- success: true,
94
- message: `${peers.length} peer(s):\n${networkSummary}`,
95
- data: { peers },
96
- };
97
- }
98
- case "status": {
99
- const status = networkControl.status();
100
- // Include signing public key for message signature verification
101
- const signingPublicKey = status.signingPublicKey ?? null;
102
- return {
103
- success: true,
104
- message: status.configured
105
- ? `Network active. Node: ${status.nodeId?.slice(0, 12) ?? "unknown"}... ` +
106
- `Transport: ${status.transportPublicKey?.slice(0, 12) ?? "unknown"}... ` +
107
- `Port: ${status.listenPort}. ` +
108
- `External: ${status.externalEndpoint ? `${status.externalEndpoint.address}:${status.externalEndpoint.port}` : "unknown"}. ` +
109
- `Peers: ${status.activePeers} trusted / ${status.totalPeers} total. ` +
110
- `Sessions: ${status.connectedPeers ?? 0} connected, ${status.handshakingPeers ?? 0} handshaking. ` +
111
- `Delivery: ${status.queueOnlyPeers ?? 0} queue-only, ${status.supersededPeers ?? 0} superseded.` +
112
- (signingPublicKey ? ` Signing key: ${signingPublicKey.slice(0, 12)}...` : "")
113
- : "Network not configured. It will be created automatically on next startup.",
114
- data: { ...status, signingPublicKey },
115
- };
116
- }
117
- default:
118
- return { success: false, message: `Unknown action: ${input.action}` };
119
- }
120
- },
121
- });
122
- /** Network tool definitions (1) */
123
- const list_clients = tool({
124
- name: "list_clients",
125
- description: "List same-home attached clients that share this runtime. Use this before sending a direct local message to another attached terminal by exact clientId.",
126
- parameters: z.object({}),
127
- category: "arion",
128
- riskLevel: "safe",
129
- isReadOnly: true,
130
- execute: async (_input, context) => {
131
- const networkControl = context.networkControl;
132
- const listAttachedClients = networkControl?.listAttachedClients;
133
- if (!listAttachedClients) {
134
- return {
135
- success: false,
136
- message: "Same-home client directory is not available for this runtime.",
137
- };
138
- }
139
- const clients = await Promise.resolve(listAttachedClients());
140
- const selfClient = clients.find((client) => client.self) ?? null;
141
- const otherClients = clients.filter((client) => !client.self);
142
- if (clients.length === 0) {
143
- return {
144
- success: true,
145
- message: "No same-home attached clients are currently available.",
146
- data: { clients: [], otherClients: [], selfClient: null },
147
- };
148
- }
149
- return {
150
- success: true,
151
- message: otherClients.length > 0
152
- ? `${otherClients.length} other same-home client(s) available`
153
- : "No other same-home attached clients are currently available.",
154
- data: { clients, otherClients, selfClient },
155
- };
156
- },
157
- });
158
- /** Network tool definitions (2) */
159
- export const NETWORK_TOOL_DEFINITIONS = [manage_network, list_clients];