@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,303 +0,0 @@
1
- /**
2
- * Integration tests for the quest system — round-trip through executors
3
- *
4
- * Tests create → list → update → filter flows through executeQuestUpdate and
5
- * executeQuestList with a mock QuestStore that stores data in memory.
6
- */
7
-
8
- import { describe, it, expect, beforeEach, vi } from "vitest";
9
- import type {
10
- ToolContext,
11
- QuestStoreRef,
12
- QuestStoreItem,
13
- QuestStoreStatus,
14
- } from "../../src/types.js";
15
- import {
16
- executeQuestUpdate,
17
- executeQuestList,
18
- type QuestUpdateOutput,
19
- type QuestListOutput,
20
- } from "../../src/executors/meta.js";
21
-
22
- // ─── In-memory QuestStore mock ──────────────────────────────────
23
-
24
- const createMockQuestStore = (): QuestStoreRef & { _quests: Map<string, QuestStoreItem> } => {
25
- const quests = new Map<string, QuestStoreItem>();
26
- return {
27
- _quests: quests,
28
- createQuest: vi.fn(
29
- (input: {
30
- id: string;
31
- title: string;
32
- description?: string;
33
- priority?: number;
34
- status?: QuestStoreStatus;
35
- progress?: string;
36
- blockedBy?: string;
37
- }) => {
38
- const now = Date.now();
39
- const quest: QuestStoreItem = {
40
- id: input.id,
41
- title: input.title,
42
- description: input.description,
43
- priority: input.priority ?? 2,
44
- status: input.status ?? "open",
45
- progress: input.progress ?? "",
46
- blockedBy: input.blockedBy,
47
- attempts: 0,
48
- createdAt: now,
49
- updatedAt: now,
50
- };
51
- quests.set(input.id, quest);
52
- return quest;
53
- },
54
- ),
55
- updateQuest: vi.fn(
56
- (
57
- id: string,
58
- updates: Partial<{
59
- title: string;
60
- description: string;
61
- priority: number;
62
- status: QuestStoreStatus;
63
- progress: string;
64
- blockedBy: string;
65
- }>,
66
- ) => {
67
- const existing = quests.get(id);
68
- if (!existing) throw new Error(`Quest not found: ${id}`);
69
- // Match real QuestStore behavior: only apply non-undefined fields
70
- const updated: QuestStoreItem = { ...existing, updatedAt: Date.now() };
71
- for (const [key, value] of Object.entries(updates)) {
72
- if (value !== undefined) (updated as Record<string, unknown>)[key] = value;
73
- }
74
- quests.set(id, updated);
75
- return updated;
76
- },
77
- ),
78
- getQuest: vi.fn((id: string) => quests.get(id) ?? null),
79
- listQuests: vi.fn((filter?: { status?: string }) => {
80
- const all = Array.from(quests.values());
81
- if (filter?.status) return all.filter((q) => q.status === filter.status);
82
- return all;
83
- }),
84
- };
85
- };
86
-
87
- // ─── Helpers ─────────────────────────────────────────────────────
88
-
89
- function createContext(questStore: QuestStoreRef): ToolContext {
90
- return {
91
- workingDir: "/tmp/test",
92
- env: {},
93
- confirm: async () => true,
94
- questStore,
95
- };
96
- }
97
-
98
- // ─── Tests ───────────────────────────────────────────────────────
99
-
100
- describe("Quest round-trip integration", () => {
101
- let questStore: ReturnType<typeof createMockQuestStore>;
102
- let ctx: ToolContext;
103
-
104
- beforeEach(() => {
105
- questStore = createMockQuestStore();
106
- ctx = createContext(questStore);
107
- });
108
-
109
- it("create a quest → list it → verify it appears", async () => {
110
- // Create
111
- const createResult = await executeQuestUpdate(
112
- {
113
- quests: [{ title: "Fix authentication bug", status: "open" }],
114
- },
115
- ctx,
116
- );
117
-
118
- expect(createResult.success).toBe(true);
119
- const createData = createResult.data as QuestUpdateOutput;
120
- expect(createData.quests).toHaveLength(1);
121
- expect(createData.quests[0]!.action).toBe("created");
122
- const questId = createData.quests[0]!.id;
123
-
124
- // List
125
- const listResult = await executeQuestList({}, ctx);
126
-
127
- expect(listResult.success).toBe(true);
128
- const listData = listResult.data as QuestListOutput;
129
- expect(listData.count).toBeGreaterThanOrEqual(1);
130
-
131
- const found = listData.quests.find((q) => q.id === questId);
132
- expect(found).toBeDefined();
133
- expect(found!.status).toBe("open");
134
- });
135
-
136
- it("create quest → update status → list filtered → verify filter works", async () => {
137
- // Create two quests
138
- const createResult = await executeQuestUpdate(
139
- {
140
- quests: [
141
- { title: "Task A", status: "open" },
142
- { title: "Task B", status: "open" },
143
- ],
144
- },
145
- ctx,
146
- );
147
-
148
- expect(createResult.success).toBe(true);
149
- const createData = createResult.data as QuestUpdateOutput;
150
- const idA = createData.quests[0]!.id;
151
-
152
- // Update Task A to active
153
- const updateResult = await executeQuestUpdate(
154
- {
155
- quests: [{ id: idA, title: "Task A", status: "active" }],
156
- },
157
- ctx,
158
- );
159
-
160
- expect(updateResult.success).toBe(true);
161
- const updateData = updateResult.data as QuestUpdateOutput;
162
- expect(updateData.quests[0]!.action).toBe("updated");
163
-
164
- // List only active quests
165
- const listResult = await executeQuestList({ status: "active" }, ctx);
166
-
167
- expect(listResult.success).toBe(true);
168
- const listData = listResult.data as QuestListOutput;
169
- // Should find Task A (active) but not Task B (open)
170
- expect(listData.count).toBe(1);
171
- expect(listData.quests[0]!.id).toBe(idA);
172
- expect(listData.quests[0]!.status).toBe("active");
173
- });
174
-
175
- it("create quest → complete it → list with status filter", async () => {
176
- // Create
177
- const createResult = await executeQuestUpdate(
178
- {
179
- quests: [{ title: "Deploy to staging", status: "open" }],
180
- },
181
- ctx,
182
- );
183
-
184
- const createData = createResult.data as QuestUpdateOutput;
185
- const questId = createData.quests[0]!.id;
186
-
187
- // Complete it
188
- const completeResult = await executeQuestUpdate(
189
- {
190
- quests: [{ id: questId, title: "Deploy to staging", status: "done" }],
191
- },
192
- ctx,
193
- );
194
-
195
- expect(completeResult.success).toBe(true);
196
-
197
- // List done quests
198
- const listDone = await executeQuestList({ status: "done" }, ctx);
199
- expect(listDone.success).toBe(true);
200
- const doneData = listDone.data as QuestListOutput;
201
- expect(doneData.count).toBe(1);
202
- expect(doneData.quests[0]!.id).toBe(questId);
203
- expect(doneData.quests[0]!.status).toBe("done");
204
-
205
- // List open quests — should NOT include the done quest
206
- const listOpen = await executeQuestList({ status: "open" }, ctx);
207
- expect(listOpen.success).toBe(true);
208
- const openData = listOpen.data as QuestListOutput;
209
- const stillOpen = openData.quests.find((q) => q.id === questId);
210
- expect(stillOpen).toBeUndefined();
211
- });
212
-
213
- it("all quests are visible regardless of creation order", async () => {
214
- await executeQuestUpdate(
215
- {
216
- quests: [{ title: "Quest 1", status: "open" }],
217
- },
218
- ctx,
219
- );
220
-
221
- await executeQuestUpdate(
222
- {
223
- quests: [{ title: "Quest 2", status: "active" }],
224
- },
225
- ctx,
226
- );
227
-
228
- // Both quests should be retrievable
229
- const listResult = await executeQuestList({}, ctx);
230
- expect(listResult.success).toBe(true);
231
- const listData = listResult.data as QuestListOutput;
232
- expect(listData.count).toBe(2);
233
-
234
- const titles = listData.quests.map((q) => q.title);
235
- expect(titles).toContain("Quest 1");
236
- expect(titles).toContain("Quest 2");
237
- });
238
-
239
- it("partial update — status only, title preserved", async () => {
240
- // Create a quest
241
- const createResult = await executeQuestUpdate(
242
- {
243
- quests: [{ title: "Important task", status: "open", notes: "Initial notes" }],
244
- },
245
- ctx,
246
- );
247
-
248
- const createData = createResult.data as QuestUpdateOutput;
249
- const questId = createData.quests[0]!.id;
250
-
251
- // Update only status — no title or notes
252
- const updateResult = await executeQuestUpdate(
253
- {
254
- quests: [{ id: questId, status: "active" }],
255
- },
256
- ctx,
257
- );
258
-
259
- expect(updateResult.success).toBe(true);
260
- const updateData = updateResult.data as QuestUpdateOutput;
261
- expect(updateData.quests[0]!.action).toBe("updated");
262
- expect(updateData.quests[0]!.title).toBe("Important task"); // preserved
263
-
264
- // List and verify all fields preserved
265
- const listResult = await executeQuestList({}, ctx);
266
- const listData = listResult.data as QuestListOutput;
267
- const quest = listData.quests.find((q) => q.id === questId);
268
- expect(quest).toBeDefined();
269
- expect(quest!.title).toBe("Important task");
270
- expect(quest!.status).toBe("active");
271
- expect(quest!.notes).toBe("Initial notes"); // preserved
272
- });
273
-
274
- it("quest with notes and blockedBy round-trips correctly", async () => {
275
- const createResult = await executeQuestUpdate(
276
- {
277
- quests: [
278
- {
279
- title: "Investigate flaky tests",
280
- status: "blocked",
281
- blocked_by: "quest_xyz",
282
- notes: "Waiting on CI fix",
283
- },
284
- ],
285
- },
286
- ctx,
287
- );
288
-
289
- expect(createResult.success).toBe(true);
290
- const createData = createResult.data as QuestUpdateOutput;
291
- const questId = createData.quests[0]!.id;
292
-
293
- const listResult = await executeQuestList({}, ctx);
294
- expect(listResult.success).toBe(true);
295
- const listData = listResult.data as QuestListOutput;
296
-
297
- const quest = listData.quests.find((q) => q.id === questId);
298
- expect(quest).toBeDefined();
299
- expect(quest!.status).toBe("blocked");
300
- expect(quest!.blocked_by).toBe("quest_xyz");
301
- expect(quest!.notes).toBe("Waiting on CI fix");
302
- });
303
- });
@@ -1,85 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
- import { createToolRegistry } from "../../src/index.js";
3
- import type { ToolRegistry, ToolContext } from "../../src/types.js";
4
- import * as fs from "node:fs/promises";
5
- import * as path from "node:path";
6
- import * as os from "node:os";
7
-
8
- describe("Tool Registry→Executor Integration", () => {
9
- let registry: ToolRegistry;
10
- let tempDir: string;
11
- let mockContext: ToolContext;
12
-
13
- beforeEach(async () => {
14
- tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "registry-test-"));
15
- mockContext = {
16
- workingDir: tempDir,
17
- env: {},
18
- confirm: async () => true,
19
- };
20
- registry = createToolRegistry();
21
- });
22
-
23
- afterEach(async () => {
24
- await fs.rm(tempDir, { recursive: true, force: true }).catch(() => {});
25
- });
26
-
27
- it("should execute read_file tool through registry", async () => {
28
- const testFile = path.join(tempDir, "test.txt");
29
- await fs.writeFile(testFile, "Hello from registry test");
30
-
31
- const tool = registry.get("read_file");
32
- expect(tool).toBeDefined();
33
- expect(tool!.name).toBe("read_file");
34
-
35
- const result = await tool!.execute({ path: "test.txt" }, mockContext);
36
-
37
- expect(result.success).toBe(true);
38
- expect(result.data).toBe("Hello from registry test");
39
- });
40
-
41
- it("should execute write_file tool through registry", async () => {
42
- const tool = registry.get("write_file");
43
- expect(tool).toBeDefined();
44
-
45
- const result = await tool!.execute(
46
- { path: "output.txt", content: "Written via registry" },
47
- mockContext,
48
- );
49
-
50
- expect(result.success).toBe(true);
51
-
52
- const writtenContent = await fs.readFile(
53
- path.join(tempDir, "output.txt"),
54
- "utf-8",
55
- );
56
- expect(writtenContent).toBe("Written via registry");
57
- });
58
-
59
- it("should execute bash tool through registry", async () => {
60
- const tool = registry.get("bash");
61
- expect(tool).toBeDefined();
62
-
63
- const result = await tool!.execute(
64
- { command: "echo 'Registry test'" },
65
- mockContext,
66
- );
67
-
68
- expect(result.success).toBe(true);
69
- const data = result.data as { stdout: string };
70
- expect(data.stdout).toMatch(/Registry test/);
71
- });
72
-
73
- it("should return undefined for non-existent tool", () => {
74
- const tool = registry.get("nonexistent_tool");
75
- expect(tool).toBeUndefined();
76
- });
77
-
78
- it("should list all registered tools", () => {
79
- const tools = registry.list();
80
- expect(tools.length).toBeGreaterThan(0);
81
- expect(tools.map((t) => t.name)).toContain("read_file");
82
- expect(tools.map((t) => t.name)).toContain("write_file");
83
- expect(tools.map((t) => t.name)).toContain("bash");
84
- });
85
- });
@@ -1,177 +0,0 @@
1
- // packages/tools/tests/integration.test.ts
2
- import { describe, it, expect, beforeEach, afterEach } from "vitest";
3
- import { mkdir, rm, writeFile } from "fs/promises";
4
- import { join } from "path";
5
- import { tmpdir } from "os";
6
- import {
7
- ToolRegistry,
8
- createToolRegistry,
9
- getCoreTools,
10
- getCoreTool,
11
- executeReadFile,
12
- executeBash,
13
- PTYSession,
14
- createPTYSession,
15
- SpawnedProcessRegistry,
16
- } from "../src/index.js";
17
- import type { ToolContext } from "../src/index.js";
18
-
19
- // Check if PTY is available in this environment
20
- let ptyAvailable = true;
21
- try {
22
- const nodePty = await import("node-pty");
23
- const testPty = nodePty.spawn("/bin/echo", ["test"]);
24
- testPty.kill();
25
- } catch {
26
- ptyAvailable = false;
27
- }
28
-
29
- describe("@aria-cli/tools Integration", () => {
30
- let testDir: string;
31
- let ctx: ToolContext;
32
-
33
- beforeEach(async () => {
34
- testDir = join(tmpdir(), `aria-tools-int-${Date.now()}`);
35
- await mkdir(testDir, { recursive: true });
36
- ctx = { workingDir: testDir, env: {}, confirm: async () => true };
37
- });
38
-
39
- afterEach(async () => {
40
- await rm(testDir, { recursive: true, force: true });
41
- });
42
-
43
- describe("Complete workflow", () => {
44
- it("should register core tools and execute them", async () => {
45
- const registry = new ToolRegistry();
46
-
47
- // Register all core tools
48
- for (const tool of getCoreTools()) {
49
- registry.register(tool);
50
- }
51
-
52
- expect(registry.size).toBe(getCoreTools().length);
53
-
54
- // Use read_file tool
55
- const filePath = join(testDir, "test.txt");
56
- await writeFile(filePath, "Hello from integration test");
57
-
58
- const readTool = registry.get("read_file");
59
- expect(readTool).toBeDefined();
60
-
61
- const result = await readTool!.execute({ path: filePath }, ctx);
62
- expect(result.success).toBe(true);
63
- expect(result.data).toBe("Hello from integration test");
64
- });
65
-
66
- it("should search for tools", async () => {
67
- const registry = new ToolRegistry();
68
-
69
- for (const tool of getCoreTools()) {
70
- registry.register(tool);
71
- }
72
-
73
- const fileTools = registry.search("file");
74
- expect(fileTools.length).toBeGreaterThan(0);
75
-
76
- const shellTools = registry.list("shell");
77
- expect(shellTools).toHaveLength(
78
- getCoreTools().filter((tool) => tool.category === "shell").length,
79
- );
80
- });
81
-
82
- it("should directly use executors", async () => {
83
- const filePath = join(testDir, "direct.txt");
84
- await writeFile(filePath, "Direct access");
85
-
86
- const result = await executeReadFile({ path: filePath }, ctx);
87
- expect(result.success).toBe(true);
88
- expect(result.data).toBe("Direct access");
89
- });
90
-
91
- it("should wire shell process observability tools through definitions", async () => {
92
- const processRegistry = new SpawnedProcessRegistry();
93
- const ctxWithRegistry: ToolContext = {
94
- ...ctx,
95
- processRegistry,
96
- };
97
-
98
- const spawnTool = getCoreTool("spawn");
99
- const listTool = getCoreTool("list_processes");
100
- const waitTool = getCoreTool("wait_process");
101
-
102
- expect(spawnTool).toBeDefined();
103
- expect(listTool).toBeDefined();
104
- expect(waitTool).toBeDefined();
105
-
106
- const spawned = await spawnTool!.execute({ program: "sleep", args: ["1"] }, ctxWithRegistry);
107
- expect(spawned.success).toBe(true);
108
- const { pid } = spawned.data as { pid: number };
109
-
110
- const listed = await listTool!.execute({}, ctxWithRegistry);
111
- expect(listed.success).toBe(true);
112
- expect(listed.data).toMatchObject({
113
- processes: expect.arrayContaining([expect.objectContaining({ pid, status: "running" })]),
114
- });
115
-
116
- const waited = await waitTool!.execute({ pid, timeoutMs: 3_000 }, ctxWithRegistry);
117
- expect(waited.success).toBe(true);
118
- expect(waited.data).toMatchObject({
119
- pid,
120
- exited: true,
121
- timedOut: false,
122
- });
123
- });
124
-
125
- it.skipIf(!ptyAvailable)("should run interactive PTY sessions", async () => {
126
- const session = await createPTYSession({
127
- command: "echo",
128
- args: ["PTY works"],
129
- cwd: testDir,
130
- });
131
-
132
- const output = await session.waitForExit();
133
- expect(output).toContain("PTY works");
134
-
135
- session.close();
136
- });
137
- });
138
-
139
- describe("Exports", () => {
140
- it("should export all necessary types", async () => {
141
- // These imports should all work
142
- const {
143
- ToolRegistry,
144
- getCoreTools,
145
- getCoreTool,
146
- getCoreToolsByCategory,
147
- getCoreToolsByRiskLevel,
148
- CORE_TOOL_DEFINITIONS,
149
- executeReadFile,
150
- executeWriteFile,
151
- executeBash,
152
- executeExec,
153
- PTYSession,
154
- createPTYSession,
155
- runInPTY,
156
- } = await import("../src/index.js");
157
-
158
- expect(ToolRegistry).toBeDefined();
159
- expect(getCoreTools).toBeDefined();
160
- expect(executeReadFile).toBeDefined();
161
- expect(PTYSession).toBeDefined();
162
- });
163
- });
164
-
165
- describe("createToolRegistry", () => {
166
- it("should create registry with builtins by default", () => {
167
- const registry = createToolRegistry();
168
- expect(registry.size).toBeGreaterThan(0);
169
- expect(registry.has("read_file")).toBe(true);
170
- });
171
-
172
- it("should create empty registry when includeBuiltins is false", () => {
173
- const registry = createToolRegistry({ includeBuiltins: false });
174
- expect(registry.size).toBe(0);
175
- });
176
- });
177
- });
@@ -1,126 +0,0 @@
1
- /**
2
- * Tests for loadingTier field on Tool type.
3
- *
4
- * loadingTier determines which tools are sent to the LLM on every request
5
- * ("always") vs. which are only available via search ("deferred").
6
- *
7
- * After the aria-c3x refactoring, ALL built-in tools are "always" (no deferred built-ins).
8
- * MCP tools may still be deferred, but that is handled by the MCP layer.
9
- */
10
-
11
- import { describe, it, expect } from "vitest";
12
- import { z } from "zod";
13
- import { CORE_TOOL_DEFINITIONS } from "../src/definitions/core.js";
14
- import { tool } from "../src/tool-factory.js";
15
-
16
- describe("loadingTier", () => {
17
- describe("Tool interface: all core tools have loadingTier defined", () => {
18
- it("every core tool has loadingTier as either 'always' or 'deferred'", () => {
19
- expect(CORE_TOOL_DEFINITIONS.length).toBeGreaterThan(0);
20
-
21
- for (const t of CORE_TOOL_DEFINITIONS) {
22
- expect(
23
- (t as Record<string, unknown>).loadingTier,
24
- `Tool "${t.name}" should have loadingTier defined`,
25
- ).toBeDefined();
26
-
27
- expect(
28
- ["always", "deferred"],
29
- `Tool "${t.name}" should have loadingTier of "always" or "deferred"`,
30
- ).toContain((t as Record<string, unknown>).loadingTier);
31
- }
32
- });
33
- });
34
-
35
- describe("All built-in tools are always-on or explicitly deferred", () => {
36
- const ALLOWED_DEFERRED = new Set(["session_history", "frg"]);
37
- it("every core tool has loadingTier === 'always' except explicitly deferred tools", () => {
38
- for (const t of CORE_TOOL_DEFINITIONS) {
39
- if (ALLOWED_DEFERRED.has(t.name)) {
40
- expect(
41
- (t as Record<string, unknown>).loadingTier,
42
- `Tool "${t.name}" should have loadingTier === "deferred"`,
43
- ).toBe("deferred");
44
- } else {
45
- expect(
46
- (t as Record<string, unknown>).loadingTier,
47
- `Tool "${t.name}" should have loadingTier === "always"`,
48
- ).toBe("always");
49
- }
50
- }
51
- });
52
- });
53
-
54
- describe("requiresConfirmation tools", () => {
55
- it("forget and kill have requiresConfirmation: true", () => {
56
- const forgetTool = CORE_TOOL_DEFINITIONS.find((t) => t.name === "forget");
57
- const killTool = CORE_TOOL_DEFINITIONS.find((t) => t.name === "kill");
58
-
59
- expect(forgetTool).toBeDefined();
60
- expect(killTool).toBeDefined();
61
- expect(forgetTool!.requiresConfirmation).toBe(true);
62
- expect(killTool!.requiresConfirmation).toBe(true);
63
- });
64
-
65
- it("apply_patch has requiresConfirmation: true", () => {
66
- const applyPatch = CORE_TOOL_DEFINITIONS.find((t) => t.name === "apply_patch");
67
- expect(applyPatch).toBeDefined();
68
- expect(applyPatch!.requiresConfirmation).toBe(true);
69
- });
70
-
71
- it("bash has requiresConfirmation: true", () => {
72
- const bash = CORE_TOOL_DEFINITIONS.find((t) => t.name === "bash");
73
- expect(bash).toBeDefined();
74
- expect(bash!.requiresConfirmation).toBe(true);
75
- });
76
- });
77
-
78
- describe("Tool factory", () => {
79
- it("sets loadingTier when specified", () => {
80
- const t = tool({
81
- name: "test_deferred_tool",
82
- description: "A test tool with deferred loading",
83
- parameters: z.object({ input: z.string() }),
84
- execute: async () => ({ success: true, message: "ok" }),
85
- loadingTier: "deferred",
86
- } as Parameters<typeof tool>[0] & { loadingTier: "deferred" });
87
-
88
- expect(
89
- (t as Record<string, unknown>).loadingTier,
90
- "Tool created with loadingTier: 'deferred' should have that value on the result",
91
- ).toBe("deferred");
92
- });
93
-
94
- it("defaults loadingTier to 'always' when not specified", () => {
95
- const t = tool({
96
- name: "test_default_tool",
97
- description: "A test tool without explicit loadingTier",
98
- parameters: z.object({ input: z.string() }),
99
- execute: async () => ({ success: true, message: "ok" }),
100
- });
101
-
102
- expect(
103
- (t as Record<string, unknown>).loadingTier,
104
- "Tool created without loadingTier should default to 'always'",
105
- ).toBe("always");
106
- });
107
- });
108
-
109
- describe("Total core tools split", () => {
110
- it("72 always + 2 deferred = 74 total core tools", () => {
111
- // 64 original + 4 frg + 8 code-intel (rg,ug,probe,sg,cbm,lsp,serena,fff) - 3 removed + 1 code_search = 74
112
- expect(CORE_TOOL_DEFINITIONS.length).toBe(74);
113
-
114
- const alwaysTools = CORE_TOOL_DEFINITIONS.filter(
115
- (t) => (t as Record<string, unknown>).loadingTier === "always",
116
- );
117
- const deferredTools = CORE_TOOL_DEFINITIONS.filter(
118
- (t) => (t as Record<string, unknown>).loadingTier === "deferred",
119
- );
120
-
121
- expect(alwaysTools.length).toBe(72);
122
- expect(deferredTools.length).toBe(2);
123
- expect(alwaysTools.length + deferredTools.length).toBe(74);
124
- });
125
- });
126
- });