@aria-cli/tools 1.0.9 → 1.0.11

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 (241) hide show
  1. package/package.json +9 -5
  2. package/src/__tests__/web-fetch-download.test.ts +0 -433
  3. package/src/__tests__/web-tools.test.ts +0 -619
  4. package/src/ask-user-interaction.ts +0 -33
  5. package/src/cache/web-cache.ts +0 -110
  6. package/src/definitions/arion.ts +0 -118
  7. package/src/definitions/browser/browser.ts +0 -502
  8. package/src/definitions/browser/index.ts +0 -5
  9. package/src/definitions/browser/pw-downloads.ts +0 -142
  10. package/src/definitions/browser/pw-interactions.ts +0 -282
  11. package/src/definitions/browser/pw-responses.ts +0 -98
  12. package/src/definitions/browser/pw-session.ts +0 -405
  13. package/src/definitions/browser/pw-shared.ts +0 -85
  14. package/src/definitions/browser/pw-snapshot.ts +0 -383
  15. package/src/definitions/browser/pw-state.ts +0 -101
  16. package/src/definitions/browser/types.ts +0 -203
  17. package/src/definitions/code-intelligence.ts +0 -526
  18. package/src/definitions/core.ts +0 -118
  19. package/src/definitions/delegation.ts +0 -567
  20. package/src/definitions/deploy.ts +0 -73
  21. package/src/definitions/filesystem.ts +0 -217
  22. package/src/definitions/frg.ts +0 -67
  23. package/src/definitions/index.ts +0 -28
  24. package/src/definitions/memory.ts +0 -150
  25. package/src/definitions/messaging.ts +0 -734
  26. package/src/definitions/meta.ts +0 -392
  27. package/src/definitions/network.ts +0 -179
  28. package/src/definitions/outlook.ts +0 -318
  29. package/src/definitions/patch/apply-patch.ts +0 -235
  30. package/src/definitions/patch/fuzzy-match.ts +0 -217
  31. package/src/definitions/patch/index.ts +0 -1
  32. package/src/definitions/patch/patch-parser.ts +0 -297
  33. package/src/definitions/patch/sandbox-paths.ts +0 -129
  34. package/src/definitions/process/index.ts +0 -5
  35. package/src/definitions/process/process-registry.ts +0 -303
  36. package/src/definitions/process/process.ts +0 -456
  37. package/src/definitions/process/pty-keys.ts +0 -298
  38. package/src/definitions/process/session-slug.ts +0 -147
  39. package/src/definitions/quip.ts +0 -225
  40. package/src/definitions/search.ts +0 -67
  41. package/src/definitions/session-history.ts +0 -79
  42. package/src/definitions/shell.ts +0 -202
  43. package/src/definitions/slack.ts +0 -211
  44. package/src/definitions/web.ts +0 -119
  45. package/src/executors/apply-patch.ts +0 -1035
  46. package/src/executors/arion.ts +0 -199
  47. package/src/executors/code-intelligence.ts +0 -1179
  48. package/src/executors/deploy.ts +0 -1066
  49. package/src/executors/filesystem.ts +0 -1428
  50. package/src/executors/frg-freshness.ts +0 -743
  51. package/src/executors/frg.ts +0 -394
  52. package/src/executors/index.ts +0 -280
  53. package/src/executors/learning-meta.ts +0 -1367
  54. package/src/executors/lsp-client.ts +0 -355
  55. package/src/executors/memory.ts +0 -978
  56. package/src/executors/meta.ts +0 -293
  57. package/src/executors/process-registry.ts +0 -570
  58. package/src/executors/pty-session-store.ts +0 -43
  59. package/src/executors/pty.ts +0 -342
  60. package/src/executors/restart.ts +0 -133
  61. package/src/executors/search-freshness.ts +0 -249
  62. package/src/executors/search-types.ts +0 -98
  63. package/src/executors/search.ts +0 -89
  64. package/src/executors/self-diagnose.ts +0 -552
  65. package/src/executors/session-history.ts +0 -435
  66. package/src/executors/shell-safety.ts +0 -519
  67. package/src/executors/shell.ts +0 -1243
  68. package/src/executors/utils.ts +0 -40
  69. package/src/executors/web.ts +0 -786
  70. package/src/extraction/content-extraction.ts +0 -281
  71. package/src/extraction/index.ts +0 -5
  72. package/src/headless-control-contract.ts +0 -1149
  73. package/src/index.ts +0 -788
  74. package/src/local-control-http-auth.ts +0 -2
  75. package/src/mcp/client.ts +0 -218
  76. package/src/mcp/connection.ts +0 -568
  77. package/src/mcp/index.ts +0 -11
  78. package/src/mcp/jsonrpc.ts +0 -195
  79. package/src/mcp/types.ts +0 -199
  80. package/src/network-control-adapter.ts +0 -88
  81. package/src/network-runtime/address-types.ts +0 -218
  82. package/src/network-runtime/db-owner-fencing.ts +0 -91
  83. package/src/network-runtime/delivery-receipts.ts +0 -372
  84. package/src/network-runtime/direct-endpoint-authority.ts +0 -35
  85. package/src/network-runtime/index.ts +0 -316
  86. package/src/network-runtime/local-control-contract.ts +0 -784
  87. package/src/network-runtime/node-store-contract.ts +0 -46
  88. package/src/network-runtime/pair-route-contract.ts +0 -97
  89. package/src/network-runtime/peer-capabilities.ts +0 -48
  90. package/src/network-runtime/peer-principal-ref.ts +0 -20
  91. package/src/network-runtime/peer-state-machine.ts +0 -160
  92. package/src/network-runtime/protocol-schemas.ts +0 -265
  93. package/src/network-runtime/runtime-bootstrap-contract.ts +0 -83
  94. package/src/outlook/desktop-session.ts +0 -409
  95. package/src/policy.ts +0 -171
  96. package/src/providers/brave.ts +0 -80
  97. package/src/providers/duckduckgo.ts +0 -199
  98. package/src/providers/exa.ts +0 -85
  99. package/src/providers/firecrawl.ts +0 -77
  100. package/src/providers/index.ts +0 -8
  101. package/src/providers/jina.ts +0 -70
  102. package/src/providers/router.ts +0 -121
  103. package/src/providers/search-provider.ts +0 -74
  104. package/src/providers/tavily.ts +0 -74
  105. package/src/quip/desktop-session.ts +0 -435
  106. package/src/registry/index.ts +0 -1
  107. package/src/registry/registry.ts +0 -905
  108. package/src/runtime-socket-local-control-client.ts +0 -632
  109. package/src/security/dns-normalization.ts +0 -34
  110. package/src/security/dns-pinning.ts +0 -138
  111. package/src/security/external-content.ts +0 -129
  112. package/src/security/ssrf.ts +0 -207
  113. package/src/slack/desktop-session.ts +0 -493
  114. package/src/tool-factory.ts +0 -91
  115. package/src/types.ts +0 -1341
  116. package/src/utils/retry.ts +0 -163
  117. package/src/utils/safe-parse-json.ts +0 -176
  118. package/src/utils/url.ts +0 -20
  119. package/tests/benchmarks/registry.bench.ts +0 -57
  120. package/tests/cache/web-cache.test.ts +0 -147
  121. package/tests/critical-integration.test.ts +0 -1465
  122. package/tests/definitions/apply-patch.test.ts +0 -586
  123. package/tests/definitions/browser.test.ts +0 -495
  124. package/tests/definitions/delegation-pause-resume.test.ts +0 -758
  125. package/tests/definitions/execution.test.ts +0 -671
  126. package/tests/definitions/messaging-inbox-scope.test.ts +0 -229
  127. package/tests/definitions/messaging.test.ts +0 -1468
  128. package/tests/definitions/outlook.test.ts +0 -30
  129. package/tests/definitions/process.test.ts +0 -469
  130. package/tests/definitions/slack.test.ts +0 -28
  131. package/tests/definitions/tool-inventory.test.ts +0 -218
  132. package/tests/e2e/delegation-quest-orchestration.e2e.test.ts +0 -433
  133. package/tests/e2e/memory-tool-discovery-contract.e2e.test.ts +0 -81
  134. package/tests/executors/apply-patch.test.ts +0 -538
  135. package/tests/executors/arion.test.ts +0 -309
  136. package/tests/executors/conversation-primitives.test.ts +0 -250
  137. package/tests/executors/deploy.test.ts +0 -746
  138. package/tests/executors/filesystem-tools.test.ts +0 -357
  139. package/tests/executors/filesystem.test.ts +0 -959
  140. package/tests/executors/frg-freshness.test.ts +0 -136
  141. package/tests/executors/frg-merge.test.ts +0 -70
  142. package/tests/executors/frg-session-content.test.ts +0 -40
  143. package/tests/executors/frg.test.ts +0 -56
  144. package/tests/executors/memory-bugfixes.test.ts +0 -257
  145. package/tests/executors/memory-real-memoria.integration.test.ts +0 -316
  146. package/tests/executors/memory.test.ts +0 -853
  147. package/tests/executors/meta-tools.test.ts +0 -411
  148. package/tests/executors/meta.test.ts +0 -683
  149. package/tests/executors/path-containment.test.ts +0 -51
  150. package/tests/executors/process-registry.test.ts +0 -505
  151. package/tests/executors/pty.test.ts +0 -664
  152. package/tests/executors/quest-security.test.ts +0 -249
  153. package/tests/executors/read-file-media.test.ts +0 -230
  154. package/tests/executors/recall-knowledge-schema.test.ts +0 -209
  155. package/tests/executors/recall-tags.test.ts +0 -278
  156. package/tests/executors/remember-null-safety.contract.test.ts +0 -41
  157. package/tests/executors/restart.test.ts +0 -67
  158. package/tests/executors/search-unified.test.ts +0 -381
  159. package/tests/executors/session-history.test.ts +0 -340
  160. package/tests/executors/session-transcript.test.ts +0 -561
  161. package/tests/executors/shell-abort.test.ts +0 -416
  162. package/tests/executors/shell-env-blocklist.test.ts +0 -648
  163. package/tests/executors/shell-env-process.test.ts +0 -245
  164. package/tests/executors/shell-process-registry.test.ts +0 -334
  165. package/tests/executors/shell-tools.test.ts +0 -393
  166. package/tests/executors/shell.test.ts +0 -690
  167. package/tests/executors/web-abort-vs-timeout.test.ts +0 -213
  168. package/tests/executors/web-integration.test.ts +0 -633
  169. package/tests/executors/web-symlink.test.ts +0 -18
  170. package/tests/executors/web.test.ts +0 -1400
  171. package/tests/executors/write-stdin.test.ts +0 -145
  172. package/tests/extraction/content-extraction.test.ts +0 -153
  173. package/tests/guards/tools-default-test-lane.integration.test.ts +0 -21
  174. package/tests/guards/tools-package-test-commands.e2e.test.ts +0 -43
  175. package/tests/guards/tools-test-lane-manifest.contract.test.ts +0 -76
  176. package/tests/guards/tools-vitest-workspace-alias.contract.test.ts +0 -63
  177. package/tests/helpers/async-waits.ts +0 -53
  178. package/tests/integration/headless-control-contract.integration.test.ts +0 -153
  179. package/tests/integration/memory-tool-schema-parity.integration.test.ts +0 -67
  180. package/tests/integration/meta-tools-round-trip.integration.test.ts +0 -506
  181. package/tests/integration/quest-round-trip.test.ts +0 -303
  182. package/tests/integration/registry-executor-flow.test.ts +0 -85
  183. package/tests/integration.test.ts +0 -177
  184. package/tests/loading-tier.test.ts +0 -126
  185. package/tests/mcp/client-reconnect.test.ts +0 -267
  186. package/tests/mcp/connection.test.ts +0 -846
  187. package/tests/mcp/injectable-logger.test.ts +0 -83
  188. package/tests/mcp/jsonrpc.test.ts +0 -109
  189. package/tests/mcp/lifecycle.test.ts +0 -879
  190. package/tests/network-runtime/address-types.contract.test.ts +0 -143
  191. package/tests/network-runtime/continuity-bind-schema.contract.test.ts +0 -203
  192. package/tests/network-runtime/local-control-contract.test.ts +0 -869
  193. package/tests/network-runtime/local-control-invite-token.contract.test.ts +0 -146
  194. package/tests/network-runtime/node-store-contract.test.ts +0 -11
  195. package/tests/network-runtime/pair-protocol-nodeid.contract.test.ts +0 -15
  196. package/tests/network-runtime/peer-state-machine.contract.test.ts +0 -148
  197. package/tests/network-runtime/protocol-schemas.contract.test.ts +0 -512
  198. package/tests/network-runtime/relay-pending-nodeid.contract.test.ts +0 -62
  199. package/tests/network-runtime/runtime-bootstrap-contract.test.ts +0 -227
  200. package/tests/network-runtime/runtime-socket-local-control-client.test.ts +0 -621
  201. package/tests/network-runtime/wait-for-message-script.test.ts +0 -288
  202. package/tests/parallel.test.ts +0 -71
  203. package/tests/policy.test.ts +0 -184
  204. package/tests/print-default-test-lane.ts +0 -14
  205. package/tests/print-test-lane-manifest.ts +0 -22
  206. package/tests/providers/brave.test.ts +0 -159
  207. package/tests/providers/duckduckgo.test.ts +0 -207
  208. package/tests/providers/exa.test.ts +0 -175
  209. package/tests/providers/firecrawl.test.ts +0 -168
  210. package/tests/providers/jina.test.ts +0 -144
  211. package/tests/providers/router.test.ts +0 -328
  212. package/tests/providers/tavily.test.ts +0 -165
  213. package/tests/registry/discovery.test.ts +0 -154
  214. package/tests/registry/injectable-logger.test.ts +0 -230
  215. package/tests/registry/input-validation.test.ts +0 -361
  216. package/tests/registry/interface-completeness.test.ts +0 -85
  217. package/tests/registry/mcp-integration.test.ts +0 -103
  218. package/tests/registry/mcp-read-only-hint.test.ts +0 -60
  219. package/tests/registry/memoria-discovery.test.ts +0 -390
  220. package/tests/registry/nested-validation.test.ts +0 -283
  221. package/tests/registry/pseudo-tool-filtering.test.ts +0 -258
  222. package/tests/registry/registration-lifecycle.test.ts +0 -133
  223. package/tests/registry-validation.test.ts +0 -424
  224. package/tests/registry.test.ts +0 -460
  225. package/tests/security/dns-pinning.test.ts +0 -162
  226. package/tests/security/external-content.test.ts +0 -144
  227. package/tests/security/ssrf.test.ts +0 -118
  228. package/tests/shell-safety-integration.test.ts +0 -32
  229. package/tests/shell-safety.test.ts +0 -365
  230. package/tests/slack/desktop-session.test.ts +0 -50
  231. package/tests/test-lane-manifest.ts +0 -440
  232. package/tests/test-utils.ts +0 -27
  233. package/tests/tool-factory.test.ts +0 -188
  234. package/tests/utils/retry.test.ts +0 -231
  235. package/tests/utils/url.test.ts +0 -63
  236. package/tsconfig.cjs.json +0 -24
  237. package/tsconfig.json +0 -12
  238. package/vitest.config.ts +0 -55
  239. package/vitest.e2e.config.ts +0 -24
  240. package/vitest.integration.config.ts +0 -24
  241. package/vitest.native.config.ts +0 -24
@@ -1,392 +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
-
10
- import type { JSONSchema7 } from "json-schema";
11
- import type { Tool } from "../types.js";
12
- import {
13
- executeAskUser,
14
- executeQuestUpdate,
15
- executeQuestList,
16
- executeSearchKnowledge,
17
- executeLearnTool,
18
- executeLearnSkill,
19
- executeLearnLegacy,
20
- executeCreateTool,
21
- executeCreateSkill,
22
- executeUseSkill,
23
- executeRestart,
24
- executeSelfDiagnose,
25
- } from "../executors/index.js";
26
-
27
- const ask_user: Tool = {
28
- name: "ask_user",
29
- description:
30
- "Ask the user clarifying questions. Supports optional multiple-choice answers. Use when you need user input to proceed.",
31
- category: "meta",
32
- parameters: {
33
- type: "object",
34
- properties: {
35
- questions: {
36
- type: "array",
37
- description: "List of questions to ask the user",
38
- items: {
39
- type: "object",
40
- properties: {
41
- question: {
42
- type: "string",
43
- description: "The question to ask",
44
- },
45
- options: {
46
- type: "array",
47
- items: { type: "string" },
48
- description: "Optional multiple-choice answers",
49
- },
50
- },
51
- required: ["question"],
52
- },
53
- },
54
- },
55
- required: ["questions"],
56
- } as JSONSchema7,
57
- riskLevel: "moderate",
58
- // Human interaction is a resumable barrier, not a parallel read-only batch item.
59
- isReadOnly: false,
60
- loadingTier: "always",
61
- execute: executeAskUser,
62
- };
63
-
64
- const quest_update: Tool = {
65
- name: "quest_update",
66
- description:
67
- "Create, update, or complete quests (task tracking). Quests persist in a structured database across sessions.",
68
- category: "meta",
69
- parameters: {
70
- type: "object",
71
- properties: {
72
- quests: {
73
- type: "array",
74
- description: "List of quests to create or update",
75
- items: {
76
- type: "object",
77
- properties: {
78
- id: {
79
- type: "string",
80
- description: "Quest ID (omit to create a new quest)",
81
- },
82
- title: {
83
- type: "string",
84
- description: "Quest title",
85
- },
86
- status: {
87
- type: "string",
88
- enum: ["open", "active", "blocked", "done"],
89
- description: "Quest status: open (ready), active (in progress), blocked, done",
90
- },
91
- priority: {
92
- type: "number",
93
- description: "Priority 0-4 (0 = highest, default 2)",
94
- minimum: 0,
95
- maximum: 4,
96
- },
97
- blocked_by: {
98
- type: "string",
99
- description: "ID of quest blocking this one",
100
- },
101
- notes: {
102
- type: "string",
103
- description: "Progress notes or context",
104
- },
105
- },
106
- required: [],
107
- },
108
- },
109
- },
110
- required: ["quests"],
111
- } as JSONSchema7,
112
- riskLevel: "moderate",
113
- isReadOnly: false,
114
- loadingTier: "always",
115
- execute: executeQuestUpdate,
116
- };
117
-
118
- const quest_list: Tool = {
119
- name: "quest_list",
120
- description: "List current quests with their status, priority, and dependencies.",
121
- category: "meta",
122
- parameters: {
123
- type: "object",
124
- properties: {
125
- status: {
126
- type: "string",
127
- enum: ["all", "open", "active", "blocked", "done"],
128
- description: "Filter by status (default: all)",
129
- default: "all",
130
- },
131
- },
132
- required: [],
133
- } as JSONSchema7,
134
- riskLevel: "safe",
135
- isReadOnly: true,
136
- loadingTier: "always",
137
- execute: executeQuestList,
138
- };
139
-
140
- const search: Tool = {
141
- name: "search",
142
- description:
143
- "Search for tools, skills, and capabilities across Memoria, local skill files, skill registries, and optional web/package sources.",
144
- category: "meta",
145
- parameters: {
146
- type: "object",
147
- properties: {
148
- query: {
149
- type: "string",
150
- description: "What to find — tool name, skill name, or capability description",
151
- },
152
- sources: {
153
- type: "array",
154
- items: {
155
- type: "string",
156
- enum: ["memoria", "local", "registry", "web"],
157
- },
158
- default: ["memoria", "local", "registry"],
159
- description:
160
- "Where to search. memoria=learned tools/skills, local=SKILL.md files, registry=skills.sh+clawhub, web=npm/brew+general",
161
- },
162
- limit: { type: "number", minimum: 1, maximum: 50, default: 10 },
163
- },
164
- required: ["query"],
165
- } as JSONSchema7,
166
- riskLevel: "safe",
167
- isReadOnly: true,
168
- loadingTier: "always",
169
- execute: executeSearchKnowledge,
170
- };
171
-
172
- const learn_tool: Tool = {
173
- name: "learn_tool",
174
- description:
175
- "Learn a CLI tool from `<command> --help` and persist it as callable tool knowledge. (Deprecated — use learn instead)",
176
- category: "meta",
177
- parameters: {
178
- type: "object",
179
- properties: {
180
- command: { type: "string", description: "CLI command name (supports subcommands)" },
181
- name: { type: "string" },
182
- description: { type: "string" },
183
- category: {
184
- type: "string",
185
- enum: ["filesystem", "code", "shell", "web", "data", "memory", "meta", "arion"],
186
- },
187
- },
188
- required: ["command"],
189
- } as JSONSchema7,
190
- riskLevel: "moderate",
191
- isReadOnly: false,
192
- loadingTier: "always",
193
- execute: (input: Record<string, unknown>, ctx: import("../types.js").ToolContext) =>
194
- executeLearnLegacy({ source: { type: "cli", command: String(input.command ?? "") } }, ctx),
195
- };
196
-
197
- const learn_skill: Tool = {
198
- name: "learn_skill",
199
- description:
200
- "Learn a skill from a SKILL.md file or inline content and persist it in Memoria. (Deprecated — use learn instead)",
201
- category: "meta",
202
- parameters: {
203
- type: "object",
204
- properties: {
205
- path: { type: "string", description: "Path to SKILL.md (optional if using inline content)" },
206
- name: { type: "string" },
207
- description: { type: "string" },
208
- content: { type: "string" },
209
- tags: { type: "array", items: { type: "string" } },
210
- toolIds: { type: "array", items: { type: "string" } },
211
- },
212
- required: [],
213
- } as JSONSchema7,
214
- riskLevel: "moderate",
215
- isReadOnly: false,
216
- loadingTier: "always",
217
- execute: (input: Record<string, unknown>, ctx: import("../types.js").ToolContext) =>
218
- executeLearnLegacy({ source: { type: "file", path: String(input.path ?? "") } }, ctx),
219
- };
220
-
221
- const learn: Tool = {
222
- name: "learn",
223
- description:
224
- "Backward-compatible learning tool. Delegates to learn_tool (CLI) or learn_skill (file).",
225
- category: "meta",
226
- parameters: {
227
- type: "object",
228
- properties: {
229
- source: {
230
- type: "object",
231
- properties: {
232
- type: { type: "string", enum: ["cli", "file"] },
233
- command: { type: "string" },
234
- path: { type: "string" },
235
- },
236
- required: ["type"],
237
- },
238
- },
239
- required: ["source"],
240
- } as JSONSchema7,
241
- riskLevel: "moderate",
242
- isReadOnly: false,
243
- loadingTier: "always",
244
- execute: executeLearnLegacy,
245
- };
246
-
247
- const create_tool: Tool = {
248
- name: "create_tool",
249
- description:
250
- "Create a reusable script-backed tool and save it to Memoria for future discovery/use.",
251
- category: "meta",
252
- parameters: {
253
- type: "object",
254
- properties: {
255
- name: { type: "string" },
256
- description: { type: "string" },
257
- command: {
258
- type: "string",
259
- description: "Shell command to wrap (optional if script provided)",
260
- },
261
- script: {
262
- type: "string",
263
- description: "Script body to write (optional if command provided)",
264
- },
265
- argsSchema: { type: "object", additionalProperties: true },
266
- tags: { type: "array", items: { type: "string" } },
267
- },
268
- required: ["name", "description"],
269
- } as JSONSchema7,
270
- riskLevel: "dangerous",
271
- isReadOnly: false,
272
- loadingTier: "always",
273
- execute: executeCreateTool,
274
- };
275
-
276
- const create_skill: Tool = {
277
- name: "create_skill",
278
- description:
279
- "Create a reusable skill/procedure and optionally link it to the current arion profile.",
280
- category: "meta",
281
- parameters: {
282
- type: "object",
283
- properties: {
284
- name: { type: "string" },
285
- description: { type: "string" },
286
- content: { type: "string" },
287
- level: { type: "string", enum: ["beginner", "intermediate", "advanced", "expert"] },
288
- tags: { type: "array", items: { type: "string" } },
289
- toolIds: { type: "array", items: { type: "string" } },
290
- },
291
- required: ["name", "description", "content"],
292
- } as JSONSchema7,
293
- riskLevel: "moderate",
294
- isReadOnly: false,
295
- loadingTier: "always",
296
- execute: executeCreateSkill,
297
- };
298
-
299
- const use_skill: Tool = {
300
- name: "use_skill",
301
- description: "Retrieve a learned skill by name/id and record its execution metrics.",
302
- category: "meta",
303
- parameters: {
304
- type: "object",
305
- properties: {
306
- name: { type: "string" },
307
- skillId: { type: "string" },
308
- success: { type: "boolean", default: true },
309
- durationMs: { type: "number" },
310
- notes: { type: "string" },
311
- },
312
- required: [],
313
- } as JSONSchema7,
314
- riskLevel: "safe",
315
- isReadOnly: false,
316
- loadingTier: "always",
317
- execute: executeUseSkill,
318
- };
319
-
320
- const restart: Tool = {
321
- name: "restart",
322
- description:
323
- "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.",
324
- category: "meta",
325
- parameters: {
326
- type: "object",
327
- properties: {
328
- reason: {
329
- type: "string",
330
- description: "Why the restart is needed (logged for diagnostics)",
331
- },
332
- },
333
- } as JSONSchema7,
334
- riskLevel: "dangerous",
335
- requiresConfirmation: true,
336
- loadingTier: "always",
337
- execute: executeRestart,
338
- };
339
-
340
- const self_diagnose: Tool = {
341
- name: "self_diagnose",
342
- description:
343
- "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.",
344
- category: "meta",
345
- parameters: {
346
- type: "object",
347
- properties: {
348
- focus: {
349
- type: "string",
350
- description:
351
- "Optional keyword to filter errors/crashes (e.g. 'quest_update', 'OOM', 'crash')",
352
- },
353
- sections: {
354
- type: "array",
355
- items: {
356
- type: "string",
357
- enum: ["runtime", "errors", "crashes", "databases", "daemon", "network"],
358
- },
359
- description: "Optional subset of sections to return (default: all 6)",
360
- },
361
- since: {
362
- type: "string",
363
- description: "ISO timestamp cutoff — only show events after this (default: last 1h)",
364
- },
365
- limit: {
366
- type: "number",
367
- description: "Max entries per section (default: 10)",
368
- default: 10,
369
- },
370
- },
371
- } as JSONSchema7,
372
- riskLevel: "safe",
373
- isReadOnly: true,
374
- loadingTier: "always",
375
- execute: executeSelfDiagnose,
376
- };
377
-
378
- /** Meta tool definitions */
379
- export const META_TOOL_DEFINITIONS: Tool[] = [
380
- ask_user,
381
- quest_update,
382
- quest_list,
383
- search,
384
- learn,
385
- learn_tool,
386
- learn_skill,
387
- create_tool,
388
- create_skill,
389
- use_skill,
390
- restart,
391
- self_diagnose,
392
- ];
@@ -1,179 +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
-
11
- import { z } from "zod";
12
- import { tool } from "../tool-factory.js";
13
- import { NodeIdSchema } from "../network-runtime/index.js";
14
- import type { ToolResult, NetworkControlRef } from "../types.js";
15
-
16
- /**
17
- * Network management — ARIA manages its own secure mesh network.
18
- *
19
- * Actions:
20
- * invite: Generate an invite token for a new peer
21
- * revoke: Remove a peer from the network
22
- * list_peers: List all connected Arions
23
- * status: Network health/connectivity status
24
- */
25
- const manage_network = tool({
26
- name: "manage_network",
27
- description:
28
- "Manage ARIA's secure WireGuard mesh network. Invite peers to the network, " +
29
- "revoke access, list connected Arions, or check network status. " +
30
- "The network auto-creates on first run — no user configuration needed.",
31
- parameters: z.object({
32
- action: z
33
- .enum(["invite", "revoke", "list_peers", "status"])
34
- .describe("Network management action"),
35
- displayName: z.string().optional().describe("Optional local label for the invite"),
36
- nodeId: NodeIdSchema.optional().describe("Durable remote node id (required for revoke)"),
37
- duration: z.number().optional().describe("Invite token validity in ms (default: no expiry)"),
38
- }),
39
- category: "arion",
40
- riskLevel: "moderate",
41
- isReadOnly: false,
42
- execute: async (input, context): Promise<ToolResult> => {
43
- // Network management requires the Memoria DB for peer registry
44
- // The actual implementation lives in @aria-cli/wireguard — we only call it here
45
- // through the runtime-owned control surface when it is wired in.
46
- const networkControl: NetworkControlRef | undefined = context.networkControl;
47
-
48
- if (!networkControl) {
49
- return {
50
- success: false,
51
- message:
52
- "Network manager not available. Secure networking requires the @aria-cli/wireguard package.",
53
- };
54
- }
55
-
56
- switch (input.action) {
57
- case "invite": {
58
- try {
59
- const result = networkControl.invite(input.displayName, input.duration);
60
- const inviteLabel = input.displayName?.trim();
61
- return {
62
- success: true,
63
- message:
64
- `${inviteLabel ? `Invite token for "${inviteLabel}":\n\n` : "Invite token:\n\n"}${result.token}\n\n` +
65
- `Token security model: bearer credential in plaintext payload form. ` +
66
- `Share only via secure channels. They can join with: aria pairing join <token>`,
67
- data: { token: result.token, ...(inviteLabel ? { displayName: inviteLabel } : {}) },
68
- };
69
- } catch (e) {
70
- return { success: false, message: `invite failed: ${(e as Error).message}` };
71
- }
72
- }
73
-
74
- case "revoke": {
75
- if (!input.nodeId) {
76
- return { success: false, message: "nodeId is required for revoke action" };
77
- }
78
- const revoked = networkControl.revokePeer(NodeIdSchema.parse(input.nodeId));
79
- if (!revoked) {
80
- return { success: false, message: `node "${input.nodeId}" not found` };
81
- }
82
- return {
83
- success: true,
84
- message: `Revoked access for "${input.nodeId}". They will be disconnected.`,
85
- data: { nodeId: input.nodeId, revoked: true },
86
- };
87
- }
88
-
89
- case "list_peers": {
90
- const peers = networkControl.listPeers();
91
- if (peers.length === 0) {
92
- return {
93
- success: true,
94
- message: "No peers connected. Use manage_network(invite) to add peers.",
95
- data: { peers: [] },
96
- };
97
- }
98
- const networkSummary = peers
99
- .map(
100
- (p) =>
101
- `${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 ?? "?"}`,
102
- )
103
- .join("\n");
104
- return {
105
- success: true,
106
- message: `${peers.length} peer(s):\n${networkSummary}`,
107
- data: { peers },
108
- };
109
- }
110
-
111
- case "status": {
112
- const status = networkControl.status();
113
- // Include signing public key for message signature verification
114
- const signingPublicKey = status.signingPublicKey ?? null;
115
- return {
116
- success: true,
117
- message: status.configured
118
- ? `Network active. Node: ${status.nodeId?.slice(0, 12) ?? "unknown"}... ` +
119
- `Transport: ${status.transportPublicKey?.slice(0, 12) ?? "unknown"}... ` +
120
- `Port: ${status.listenPort}. ` +
121
- `External: ${status.externalEndpoint ? `${status.externalEndpoint.address}:${status.externalEndpoint.port}` : "unknown"}. ` +
122
- `Peers: ${status.activePeers} trusted / ${status.totalPeers} total. ` +
123
- `Sessions: ${status.connectedPeers ?? 0} connected, ${status.handshakingPeers ?? 0} handshaking. ` +
124
- `Delivery: ${status.queueOnlyPeers ?? 0} queue-only, ${status.supersededPeers ?? 0} superseded.` +
125
- (signingPublicKey ? ` Signing key: ${signingPublicKey.slice(0, 12)}...` : "")
126
- : "Network not configured. It will be created automatically on next startup.",
127
- data: { ...status, signingPublicKey },
128
- };
129
- }
130
-
131
- default:
132
- return { success: false, message: `Unknown action: ${input.action}` };
133
- }
134
- },
135
- });
136
-
137
- /** Network tool definitions (1) */
138
- const list_clients = tool({
139
- name: "list_clients",
140
- description:
141
- "List same-home attached clients that share this runtime. Use this before sending a direct local message to another attached terminal by exact clientId.",
142
- parameters: z.object({}),
143
- category: "arion",
144
- riskLevel: "safe",
145
- isReadOnly: true,
146
- execute: async (_input, context): Promise<ToolResult> => {
147
- const networkControl: NetworkControlRef | undefined = context.networkControl;
148
- const listAttachedClients = networkControl?.listAttachedClients;
149
- if (!listAttachedClients) {
150
- return {
151
- success: false,
152
- message: "Same-home client directory is not available for this runtime.",
153
- };
154
- }
155
-
156
- const clients = await Promise.resolve(listAttachedClients());
157
- const selfClient = clients.find((client) => client.self) ?? null;
158
- const otherClients = clients.filter((client) => !client.self);
159
- if (clients.length === 0) {
160
- return {
161
- success: true,
162
- message: "No same-home attached clients are currently available.",
163
- data: { clients: [], otherClients: [], selfClient: null },
164
- };
165
- }
166
-
167
- return {
168
- success: true,
169
- message:
170
- otherClients.length > 0
171
- ? `${otherClients.length} other same-home client(s) available`
172
- : "No other same-home attached clients are currently available.",
173
- data: { clients, otherClients, selfClient },
174
- };
175
- },
176
- });
177
-
178
- /** Network tool definitions (2) */
179
- export const NETWORK_TOOL_DEFINITIONS = [manage_network, list_clients];