@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.
- package/package.json +9 -5
- package/src/__tests__/web-fetch-download.test.ts +0 -433
- package/src/__tests__/web-tools.test.ts +0 -619
- package/src/ask-user-interaction.ts +0 -33
- package/src/cache/web-cache.ts +0 -110
- package/src/definitions/arion.ts +0 -118
- package/src/definitions/browser/browser.ts +0 -502
- package/src/definitions/browser/index.ts +0 -5
- package/src/definitions/browser/pw-downloads.ts +0 -142
- package/src/definitions/browser/pw-interactions.ts +0 -282
- package/src/definitions/browser/pw-responses.ts +0 -98
- package/src/definitions/browser/pw-session.ts +0 -405
- package/src/definitions/browser/pw-shared.ts +0 -85
- package/src/definitions/browser/pw-snapshot.ts +0 -383
- package/src/definitions/browser/pw-state.ts +0 -101
- package/src/definitions/browser/types.ts +0 -203
- package/src/definitions/code-intelligence.ts +0 -526
- package/src/definitions/core.ts +0 -118
- package/src/definitions/delegation.ts +0 -567
- package/src/definitions/deploy.ts +0 -73
- package/src/definitions/filesystem.ts +0 -217
- package/src/definitions/frg.ts +0 -67
- package/src/definitions/index.ts +0 -28
- package/src/definitions/memory.ts +0 -150
- package/src/definitions/messaging.ts +0 -734
- package/src/definitions/meta.ts +0 -392
- package/src/definitions/network.ts +0 -179
- package/src/definitions/outlook.ts +0 -318
- package/src/definitions/patch/apply-patch.ts +0 -235
- package/src/definitions/patch/fuzzy-match.ts +0 -217
- package/src/definitions/patch/index.ts +0 -1
- package/src/definitions/patch/patch-parser.ts +0 -297
- package/src/definitions/patch/sandbox-paths.ts +0 -129
- package/src/definitions/process/index.ts +0 -5
- package/src/definitions/process/process-registry.ts +0 -303
- package/src/definitions/process/process.ts +0 -456
- package/src/definitions/process/pty-keys.ts +0 -298
- package/src/definitions/process/session-slug.ts +0 -147
- package/src/definitions/quip.ts +0 -225
- package/src/definitions/search.ts +0 -67
- package/src/definitions/session-history.ts +0 -79
- package/src/definitions/shell.ts +0 -202
- package/src/definitions/slack.ts +0 -211
- package/src/definitions/web.ts +0 -119
- package/src/executors/apply-patch.ts +0 -1035
- package/src/executors/arion.ts +0 -199
- package/src/executors/code-intelligence.ts +0 -1179
- package/src/executors/deploy.ts +0 -1066
- package/src/executors/filesystem.ts +0 -1428
- package/src/executors/frg-freshness.ts +0 -743
- package/src/executors/frg.ts +0 -394
- package/src/executors/index.ts +0 -280
- package/src/executors/learning-meta.ts +0 -1367
- package/src/executors/lsp-client.ts +0 -355
- package/src/executors/memory.ts +0 -978
- package/src/executors/meta.ts +0 -293
- package/src/executors/process-registry.ts +0 -570
- package/src/executors/pty-session-store.ts +0 -43
- package/src/executors/pty.ts +0 -342
- package/src/executors/restart.ts +0 -133
- package/src/executors/search-freshness.ts +0 -249
- package/src/executors/search-types.ts +0 -98
- package/src/executors/search.ts +0 -89
- package/src/executors/self-diagnose.ts +0 -552
- package/src/executors/session-history.ts +0 -435
- package/src/executors/shell-safety.ts +0 -519
- package/src/executors/shell.ts +0 -1243
- package/src/executors/utils.ts +0 -40
- package/src/executors/web.ts +0 -786
- package/src/extraction/content-extraction.ts +0 -281
- package/src/extraction/index.ts +0 -5
- package/src/headless-control-contract.ts +0 -1149
- package/src/index.ts +0 -788
- package/src/local-control-http-auth.ts +0 -2
- package/src/mcp/client.ts +0 -218
- package/src/mcp/connection.ts +0 -568
- package/src/mcp/index.ts +0 -11
- package/src/mcp/jsonrpc.ts +0 -195
- package/src/mcp/types.ts +0 -199
- package/src/network-control-adapter.ts +0 -88
- package/src/network-runtime/address-types.ts +0 -218
- package/src/network-runtime/db-owner-fencing.ts +0 -91
- package/src/network-runtime/delivery-receipts.ts +0 -372
- package/src/network-runtime/direct-endpoint-authority.ts +0 -35
- package/src/network-runtime/index.ts +0 -316
- package/src/network-runtime/local-control-contract.ts +0 -784
- package/src/network-runtime/node-store-contract.ts +0 -46
- package/src/network-runtime/pair-route-contract.ts +0 -97
- package/src/network-runtime/peer-capabilities.ts +0 -48
- package/src/network-runtime/peer-principal-ref.ts +0 -20
- package/src/network-runtime/peer-state-machine.ts +0 -160
- package/src/network-runtime/protocol-schemas.ts +0 -265
- package/src/network-runtime/runtime-bootstrap-contract.ts +0 -83
- package/src/outlook/desktop-session.ts +0 -409
- package/src/policy.ts +0 -171
- package/src/providers/brave.ts +0 -80
- package/src/providers/duckduckgo.ts +0 -199
- package/src/providers/exa.ts +0 -85
- package/src/providers/firecrawl.ts +0 -77
- package/src/providers/index.ts +0 -8
- package/src/providers/jina.ts +0 -70
- package/src/providers/router.ts +0 -121
- package/src/providers/search-provider.ts +0 -74
- package/src/providers/tavily.ts +0 -74
- package/src/quip/desktop-session.ts +0 -435
- package/src/registry/index.ts +0 -1
- package/src/registry/registry.ts +0 -905
- package/src/runtime-socket-local-control-client.ts +0 -632
- package/src/security/dns-normalization.ts +0 -34
- package/src/security/dns-pinning.ts +0 -138
- package/src/security/external-content.ts +0 -129
- package/src/security/ssrf.ts +0 -207
- package/src/slack/desktop-session.ts +0 -493
- package/src/tool-factory.ts +0 -91
- package/src/types.ts +0 -1341
- package/src/utils/retry.ts +0 -163
- package/src/utils/safe-parse-json.ts +0 -176
- package/src/utils/url.ts +0 -20
- package/tests/benchmarks/registry.bench.ts +0 -57
- package/tests/cache/web-cache.test.ts +0 -147
- package/tests/critical-integration.test.ts +0 -1465
- package/tests/definitions/apply-patch.test.ts +0 -586
- package/tests/definitions/browser.test.ts +0 -495
- package/tests/definitions/delegation-pause-resume.test.ts +0 -758
- package/tests/definitions/execution.test.ts +0 -671
- package/tests/definitions/messaging-inbox-scope.test.ts +0 -229
- package/tests/definitions/messaging.test.ts +0 -1468
- package/tests/definitions/outlook.test.ts +0 -30
- package/tests/definitions/process.test.ts +0 -469
- package/tests/definitions/slack.test.ts +0 -28
- package/tests/definitions/tool-inventory.test.ts +0 -218
- package/tests/e2e/delegation-quest-orchestration.e2e.test.ts +0 -433
- package/tests/e2e/memory-tool-discovery-contract.e2e.test.ts +0 -81
- package/tests/executors/apply-patch.test.ts +0 -538
- package/tests/executors/arion.test.ts +0 -309
- package/tests/executors/conversation-primitives.test.ts +0 -250
- package/tests/executors/deploy.test.ts +0 -746
- package/tests/executors/filesystem-tools.test.ts +0 -357
- package/tests/executors/filesystem.test.ts +0 -959
- package/tests/executors/frg-freshness.test.ts +0 -136
- package/tests/executors/frg-merge.test.ts +0 -70
- package/tests/executors/frg-session-content.test.ts +0 -40
- package/tests/executors/frg.test.ts +0 -56
- package/tests/executors/memory-bugfixes.test.ts +0 -257
- package/tests/executors/memory-real-memoria.integration.test.ts +0 -316
- package/tests/executors/memory.test.ts +0 -853
- package/tests/executors/meta-tools.test.ts +0 -411
- package/tests/executors/meta.test.ts +0 -683
- package/tests/executors/path-containment.test.ts +0 -51
- package/tests/executors/process-registry.test.ts +0 -505
- package/tests/executors/pty.test.ts +0 -664
- package/tests/executors/quest-security.test.ts +0 -249
- package/tests/executors/read-file-media.test.ts +0 -230
- package/tests/executors/recall-knowledge-schema.test.ts +0 -209
- package/tests/executors/recall-tags.test.ts +0 -278
- package/tests/executors/remember-null-safety.contract.test.ts +0 -41
- package/tests/executors/restart.test.ts +0 -67
- package/tests/executors/search-unified.test.ts +0 -381
- package/tests/executors/session-history.test.ts +0 -340
- package/tests/executors/session-transcript.test.ts +0 -561
- package/tests/executors/shell-abort.test.ts +0 -416
- package/tests/executors/shell-env-blocklist.test.ts +0 -648
- package/tests/executors/shell-env-process.test.ts +0 -245
- package/tests/executors/shell-process-registry.test.ts +0 -334
- package/tests/executors/shell-tools.test.ts +0 -393
- package/tests/executors/shell.test.ts +0 -690
- package/tests/executors/web-abort-vs-timeout.test.ts +0 -213
- package/tests/executors/web-integration.test.ts +0 -633
- package/tests/executors/web-symlink.test.ts +0 -18
- package/tests/executors/web.test.ts +0 -1400
- package/tests/executors/write-stdin.test.ts +0 -145
- package/tests/extraction/content-extraction.test.ts +0 -153
- package/tests/guards/tools-default-test-lane.integration.test.ts +0 -21
- package/tests/guards/tools-package-test-commands.e2e.test.ts +0 -43
- package/tests/guards/tools-test-lane-manifest.contract.test.ts +0 -76
- package/tests/guards/tools-vitest-workspace-alias.contract.test.ts +0 -63
- package/tests/helpers/async-waits.ts +0 -53
- package/tests/integration/headless-control-contract.integration.test.ts +0 -153
- package/tests/integration/memory-tool-schema-parity.integration.test.ts +0 -67
- package/tests/integration/meta-tools-round-trip.integration.test.ts +0 -506
- package/tests/integration/quest-round-trip.test.ts +0 -303
- package/tests/integration/registry-executor-flow.test.ts +0 -85
- package/tests/integration.test.ts +0 -177
- package/tests/loading-tier.test.ts +0 -126
- package/tests/mcp/client-reconnect.test.ts +0 -267
- package/tests/mcp/connection.test.ts +0 -846
- package/tests/mcp/injectable-logger.test.ts +0 -83
- package/tests/mcp/jsonrpc.test.ts +0 -109
- package/tests/mcp/lifecycle.test.ts +0 -879
- package/tests/network-runtime/address-types.contract.test.ts +0 -143
- package/tests/network-runtime/continuity-bind-schema.contract.test.ts +0 -203
- package/tests/network-runtime/local-control-contract.test.ts +0 -869
- package/tests/network-runtime/local-control-invite-token.contract.test.ts +0 -146
- package/tests/network-runtime/node-store-contract.test.ts +0 -11
- package/tests/network-runtime/pair-protocol-nodeid.contract.test.ts +0 -15
- package/tests/network-runtime/peer-state-machine.contract.test.ts +0 -148
- package/tests/network-runtime/protocol-schemas.contract.test.ts +0 -512
- package/tests/network-runtime/relay-pending-nodeid.contract.test.ts +0 -62
- package/tests/network-runtime/runtime-bootstrap-contract.test.ts +0 -227
- package/tests/network-runtime/runtime-socket-local-control-client.test.ts +0 -621
- package/tests/network-runtime/wait-for-message-script.test.ts +0 -288
- package/tests/parallel.test.ts +0 -71
- package/tests/policy.test.ts +0 -184
- package/tests/print-default-test-lane.ts +0 -14
- package/tests/print-test-lane-manifest.ts +0 -22
- package/tests/providers/brave.test.ts +0 -159
- package/tests/providers/duckduckgo.test.ts +0 -207
- package/tests/providers/exa.test.ts +0 -175
- package/tests/providers/firecrawl.test.ts +0 -168
- package/tests/providers/jina.test.ts +0 -144
- package/tests/providers/router.test.ts +0 -328
- package/tests/providers/tavily.test.ts +0 -165
- package/tests/registry/discovery.test.ts +0 -154
- package/tests/registry/injectable-logger.test.ts +0 -230
- package/tests/registry/input-validation.test.ts +0 -361
- package/tests/registry/interface-completeness.test.ts +0 -85
- package/tests/registry/mcp-integration.test.ts +0 -103
- package/tests/registry/mcp-read-only-hint.test.ts +0 -60
- package/tests/registry/memoria-discovery.test.ts +0 -390
- package/tests/registry/nested-validation.test.ts +0 -283
- package/tests/registry/pseudo-tool-filtering.test.ts +0 -258
- package/tests/registry/registration-lifecycle.test.ts +0 -133
- package/tests/registry-validation.test.ts +0 -424
- package/tests/registry.test.ts +0 -460
- package/tests/security/dns-pinning.test.ts +0 -162
- package/tests/security/external-content.test.ts +0 -144
- package/tests/security/ssrf.test.ts +0 -118
- package/tests/shell-safety-integration.test.ts +0 -32
- package/tests/shell-safety.test.ts +0 -365
- package/tests/slack/desktop-session.test.ts +0 -50
- package/tests/test-lane-manifest.ts +0 -440
- package/tests/test-utils.ts +0 -27
- package/tests/tool-factory.test.ts +0 -188
- package/tests/utils/retry.test.ts +0 -231
- package/tests/utils/url.test.ts +0 -63
- package/tsconfig.cjs.json +0 -24
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -55
- package/vitest.e2e.config.ts +0 -24
- package/vitest.integration.config.ts +0 -24
- package/vitest.native.config.ts +0 -24
|
@@ -1,758 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pause_delegation, resume_delegation, and check_delegation tool tests
|
|
3
|
-
*
|
|
4
|
-
* Tests the tool execute functions with mock registry and executor,
|
|
5
|
-
* verifying all error paths, success paths, and quest-native identity.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, it, expect } from "vitest";
|
|
9
|
-
import { DELEGATION_TOOL_DEFINITIONS } from "../../src/definitions/delegation.js";
|
|
10
|
-
import type { ToolContext, DelegationRegistryRef, DelegationExecutorRef } from "../../src/types.js";
|
|
11
|
-
|
|
12
|
-
const pauseTool = DELEGATION_TOOL_DEFINITIONS.find((t) => t.name === "pause_delegation")!;
|
|
13
|
-
const resumeTool = DELEGATION_TOOL_DEFINITIONS.find((t) => t.name === "resume_delegation")!;
|
|
14
|
-
const checkTool = DELEGATION_TOOL_DEFINITIONS.find((t) => t.name === "check_delegation")!;
|
|
15
|
-
|
|
16
|
-
/** Create a mock delegation registry with pre-populated entries */
|
|
17
|
-
function createMockRegistry(
|
|
18
|
-
entries: Record<
|
|
19
|
-
string,
|
|
20
|
-
{
|
|
21
|
-
id: string;
|
|
22
|
-
type: "arion" | "worker" | "cli_agent";
|
|
23
|
-
task: string;
|
|
24
|
-
status: "running" | "completed" | "failed" | "aborted";
|
|
25
|
-
arionName?: string;
|
|
26
|
-
result?: string;
|
|
27
|
-
error?: string;
|
|
28
|
-
metadata?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
> = {},
|
|
31
|
-
): DelegationRegistryRef & { abortCalls: string[] } {
|
|
32
|
-
const abortCalls: string[] = [];
|
|
33
|
-
return {
|
|
34
|
-
abortCalls,
|
|
35
|
-
get: (id: string) => entries[id],
|
|
36
|
-
abort: (id: string) => {
|
|
37
|
-
if (!entries[id] || entries[id].status !== "running") return false;
|
|
38
|
-
abortCalls.push(id);
|
|
39
|
-
entries[id].status = "aborted";
|
|
40
|
-
return true;
|
|
41
|
-
},
|
|
42
|
-
await: async (id: string) => {
|
|
43
|
-
const e = entries[id];
|
|
44
|
-
if (!e) throw new Error(`Not found: ${id}`);
|
|
45
|
-
return e;
|
|
46
|
-
},
|
|
47
|
-
list: () => Object.values(entries),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Create a mock delegation executor that captures calls */
|
|
52
|
-
function createMockExecutor(): DelegationExecutorRef & {
|
|
53
|
-
calls: Array<{ method: string; args: unknown[] }>;
|
|
54
|
-
} {
|
|
55
|
-
const calls: Array<{ method: string; args: unknown[] }> = [];
|
|
56
|
-
return {
|
|
57
|
-
calls,
|
|
58
|
-
delegateToArion: async (name: string, task: string) => {
|
|
59
|
-
calls.push({ method: "delegateToArion", args: [name, task] });
|
|
60
|
-
return "quest_newarion123";
|
|
61
|
-
},
|
|
62
|
-
spawnWorker: async (task: string) => {
|
|
63
|
-
calls.push({ method: "spawnWorker", args: [task] });
|
|
64
|
-
return "quest_newworker12";
|
|
65
|
-
},
|
|
66
|
-
spawnCliAgent: async (opts: unknown) => {
|
|
67
|
-
calls.push({ method: "spawnCliAgent", args: [opts] });
|
|
68
|
-
return "quest_newcli1234";
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** Minimal context with only delegation-relevant fields */
|
|
74
|
-
function makeContext(overrides: Partial<ToolContext> = {}): ToolContext {
|
|
75
|
-
return {
|
|
76
|
-
workingDir: "/tmp/test",
|
|
77
|
-
env: {},
|
|
78
|
-
...overrides,
|
|
79
|
-
} as ToolContext;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
// pause_delegation
|
|
84
|
-
// ---------------------------------------------------------------------------
|
|
85
|
-
|
|
86
|
-
describe("pause_delegation", () => {
|
|
87
|
-
it("is defined in DELEGATION_TOOL_DEFINITIONS", () => {
|
|
88
|
-
expect(pauseTool).toBeDefined();
|
|
89
|
-
expect(pauseTool.name).toBe("pause_delegation");
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("returns error when no delegation registry", async () => {
|
|
93
|
-
const ctx = makeContext({ delegationRegistry: undefined });
|
|
94
|
-
const result = await pauseTool.execute({ id: "quest_abc123def4" }, ctx);
|
|
95
|
-
expect(result.success).toBe(false);
|
|
96
|
-
expect(result.message).toContain("No delegation registry");
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("returns error when delegation not found", async () => {
|
|
100
|
-
const registry = createMockRegistry({});
|
|
101
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
102
|
-
const result = await pauseTool.execute({ id: "quest_ghost12345" }, ctx);
|
|
103
|
-
expect(result.success).toBe(false);
|
|
104
|
-
expect(result.message).toContain("Delegation not found");
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("returns error when delegation not running", async () => {
|
|
108
|
-
const registry = createMockRegistry({
|
|
109
|
-
quest_done1234567: {
|
|
110
|
-
id: "quest_done1234567",
|
|
111
|
-
type: "worker",
|
|
112
|
-
task: "finished task",
|
|
113
|
-
status: "completed",
|
|
114
|
-
result: "all done",
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
118
|
-
const result = await pauseTool.execute({ id: "quest_done1234567" }, ctx);
|
|
119
|
-
expect(result.success).toBe(false);
|
|
120
|
-
expect(result.message).toContain("Cannot pause");
|
|
121
|
-
expect(result.message).toContain("completed");
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it("calls registry.abort() on running delegation", async () => {
|
|
125
|
-
const registry = createMockRegistry({
|
|
126
|
-
quest_run12345678: {
|
|
127
|
-
id: "quest_run12345678",
|
|
128
|
-
type: "worker",
|
|
129
|
-
task: "active task",
|
|
130
|
-
status: "running",
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
134
|
-
|
|
135
|
-
await pauseTool.execute({ id: "quest_run12345678" }, ctx);
|
|
136
|
-
|
|
137
|
-
expect(registry.abortCalls).toContain("quest_run12345678");
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("returns success with aborted status", async () => {
|
|
141
|
-
const registry = createMockRegistry({
|
|
142
|
-
quest_run12345678: {
|
|
143
|
-
id: "quest_run12345678",
|
|
144
|
-
type: "arion",
|
|
145
|
-
task: "running task",
|
|
146
|
-
status: "running",
|
|
147
|
-
arionName: "coder",
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
151
|
-
|
|
152
|
-
const result = await pauseTool.execute({ id: "quest_run12345678" }, ctx);
|
|
153
|
-
|
|
154
|
-
expect(result.success).toBe(true);
|
|
155
|
-
expect(result.message).toContain("aborted");
|
|
156
|
-
expect(result.data).toEqual({ id: "quest_run12345678", status: "aborted" });
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("includes reason in success message when provided", async () => {
|
|
160
|
-
const registry = createMockRegistry({
|
|
161
|
-
quest_run12345678: {
|
|
162
|
-
id: "quest_run12345678",
|
|
163
|
-
type: "worker",
|
|
164
|
-
task: "task",
|
|
165
|
-
status: "running",
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
169
|
-
|
|
170
|
-
const result = await pauseTool.execute(
|
|
171
|
-
{ id: "quest_run12345678", reason: "need user input" },
|
|
172
|
-
ctx,
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
expect(result.success).toBe(true);
|
|
176
|
-
expect(result.message).toContain("need user input");
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it("updates quest store to blocked on pause", async () => {
|
|
180
|
-
const registry = createMockRegistry({
|
|
181
|
-
quest_run12345678: {
|
|
182
|
-
id: "quest_run12345678",
|
|
183
|
-
type: "worker",
|
|
184
|
-
task: "task",
|
|
185
|
-
status: "running",
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
const updateCalls: Array<{ id: string; update: unknown }> = [];
|
|
189
|
-
const mockQuestStore = {
|
|
190
|
-
getQuest: () => null,
|
|
191
|
-
createQuest: () => ({
|
|
192
|
-
id: "",
|
|
193
|
-
title: "",
|
|
194
|
-
status: "open" as const,
|
|
195
|
-
progress: "",
|
|
196
|
-
priority: 2,
|
|
197
|
-
attempts: 0,
|
|
198
|
-
createdAt: 0,
|
|
199
|
-
updatedAt: 0,
|
|
200
|
-
}),
|
|
201
|
-
updateQuest: (id: string, update: unknown) => {
|
|
202
|
-
updateCalls.push({ id, update });
|
|
203
|
-
return {
|
|
204
|
-
id,
|
|
205
|
-
title: "",
|
|
206
|
-
status: "blocked" as const,
|
|
207
|
-
progress: "",
|
|
208
|
-
priority: 2,
|
|
209
|
-
attempts: 0,
|
|
210
|
-
createdAt: 0,
|
|
211
|
-
updatedAt: 0,
|
|
212
|
-
};
|
|
213
|
-
},
|
|
214
|
-
listQuests: () => [],
|
|
215
|
-
};
|
|
216
|
-
const ctx = makeContext({
|
|
217
|
-
delegationRegistry: registry,
|
|
218
|
-
questStore: mockQuestStore,
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
await pauseTool.execute({ id: "quest_run12345678", reason: "waiting for input" }, ctx);
|
|
222
|
-
|
|
223
|
-
expect(updateCalls).toHaveLength(1);
|
|
224
|
-
expect(updateCalls[0].id).toBe("quest_run12345678");
|
|
225
|
-
expect(updateCalls[0].update).toEqual({
|
|
226
|
-
status: "blocked",
|
|
227
|
-
progress: "waiting for input",
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it("uses default progress when no reason provided on pause", async () => {
|
|
232
|
-
const registry = createMockRegistry({
|
|
233
|
-
quest_run12345678: {
|
|
234
|
-
id: "quest_run12345678",
|
|
235
|
-
type: "worker",
|
|
236
|
-
task: "task",
|
|
237
|
-
status: "running",
|
|
238
|
-
},
|
|
239
|
-
});
|
|
240
|
-
const updateCalls: Array<{ id: string; update: unknown }> = [];
|
|
241
|
-
const mockQuestStore = {
|
|
242
|
-
getQuest: () => null,
|
|
243
|
-
createQuest: () => ({
|
|
244
|
-
id: "",
|
|
245
|
-
title: "",
|
|
246
|
-
status: "open" as const,
|
|
247
|
-
progress: "",
|
|
248
|
-
priority: 2,
|
|
249
|
-
attempts: 0,
|
|
250
|
-
createdAt: 0,
|
|
251
|
-
updatedAt: 0,
|
|
252
|
-
}),
|
|
253
|
-
updateQuest: (id: string, update: unknown) => {
|
|
254
|
-
updateCalls.push({ id, update });
|
|
255
|
-
return {
|
|
256
|
-
id,
|
|
257
|
-
title: "",
|
|
258
|
-
status: "blocked" as const,
|
|
259
|
-
progress: "",
|
|
260
|
-
priority: 2,
|
|
261
|
-
attempts: 0,
|
|
262
|
-
createdAt: 0,
|
|
263
|
-
updatedAt: 0,
|
|
264
|
-
};
|
|
265
|
-
},
|
|
266
|
-
listQuests: () => [],
|
|
267
|
-
};
|
|
268
|
-
const ctx = makeContext({
|
|
269
|
-
delegationRegistry: registry,
|
|
270
|
-
questStore: mockQuestStore,
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
await pauseTool.execute({ id: "quest_run12345678" }, ctx);
|
|
274
|
-
|
|
275
|
-
expect(updateCalls).toHaveLength(1);
|
|
276
|
-
expect(updateCalls[0].update).toEqual({
|
|
277
|
-
status: "blocked",
|
|
278
|
-
progress: "Paused by user",
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
// ---------------------------------------------------------------------------
|
|
284
|
-
// resume_delegation
|
|
285
|
-
// ---------------------------------------------------------------------------
|
|
286
|
-
|
|
287
|
-
describe("resume_delegation", () => {
|
|
288
|
-
it("is defined in DELEGATION_TOOL_DEFINITIONS", () => {
|
|
289
|
-
expect(resumeTool).toBeDefined();
|
|
290
|
-
expect(resumeTool.name).toBe("resume_delegation");
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it("returns error when no delegation executor", async () => {
|
|
294
|
-
const registry = createMockRegistry({});
|
|
295
|
-
const ctx = makeContext({
|
|
296
|
-
delegationExecutor: undefined,
|
|
297
|
-
delegationRegistry: registry,
|
|
298
|
-
});
|
|
299
|
-
const result = await resumeTool.execute({ id: "quest_abc123def4" }, ctx);
|
|
300
|
-
expect(result.success).toBe(false);
|
|
301
|
-
expect(result.message).toContain("executor not available");
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it("returns error when no delegation registry", async () => {
|
|
305
|
-
const executor = createMockExecutor();
|
|
306
|
-
const ctx = makeContext({
|
|
307
|
-
delegationExecutor: executor,
|
|
308
|
-
delegationRegistry: undefined,
|
|
309
|
-
});
|
|
310
|
-
const result = await resumeTool.execute({ id: "quest_abc123def4" }, ctx);
|
|
311
|
-
expect(result.success).toBe(false);
|
|
312
|
-
expect(result.message).toContain("No delegation registry");
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
it("returns error when delegation not found", async () => {
|
|
316
|
-
const executor = createMockExecutor();
|
|
317
|
-
const registry = createMockRegistry({});
|
|
318
|
-
const ctx = makeContext({
|
|
319
|
-
delegationExecutor: executor,
|
|
320
|
-
delegationRegistry: registry,
|
|
321
|
-
});
|
|
322
|
-
const result = await resumeTool.execute({ id: "quest_ghost12345" }, ctx);
|
|
323
|
-
expect(result.success).toBe(false);
|
|
324
|
-
expect(result.message).toContain("Delegation not found");
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
it("creates new arion delegation for arion type", async () => {
|
|
328
|
-
const executor = createMockExecutor();
|
|
329
|
-
const registry = createMockRegistry({
|
|
330
|
-
quest_paused12345: {
|
|
331
|
-
id: "quest_paused12345",
|
|
332
|
-
type: "arion",
|
|
333
|
-
task: "build feature",
|
|
334
|
-
status: "aborted",
|
|
335
|
-
arionName: "architect",
|
|
336
|
-
},
|
|
337
|
-
});
|
|
338
|
-
const ctx = makeContext({
|
|
339
|
-
delegationExecutor: executor,
|
|
340
|
-
delegationRegistry: registry,
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
const result = await resumeTool.execute({ id: "quest_paused12345" }, ctx);
|
|
344
|
-
|
|
345
|
-
expect(result.success).toBe(true);
|
|
346
|
-
expect(result.message).toContain("resumed");
|
|
347
|
-
expect(result.data).toEqual({
|
|
348
|
-
originalId: "quest_paused12345",
|
|
349
|
-
newId: "quest_newarion123",
|
|
350
|
-
type: "arion",
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
expect(executor.calls).toHaveLength(1);
|
|
354
|
-
expect(executor.calls[0].method).toBe("delegateToArion");
|
|
355
|
-
expect(executor.calls[0].args[0]).toBe("architect");
|
|
356
|
-
expect(executor.calls[0].args[1] as string).toContain("build feature");
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
it("creates new worker delegation for worker type", async () => {
|
|
360
|
-
const executor = createMockExecutor();
|
|
361
|
-
const registry = createMockRegistry({
|
|
362
|
-
quest_paused12345: {
|
|
363
|
-
id: "quest_paused12345",
|
|
364
|
-
type: "worker",
|
|
365
|
-
task: "run tests",
|
|
366
|
-
status: "aborted",
|
|
367
|
-
},
|
|
368
|
-
});
|
|
369
|
-
const ctx = makeContext({
|
|
370
|
-
delegationExecutor: executor,
|
|
371
|
-
delegationRegistry: registry,
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
const result = await resumeTool.execute({ id: "quest_paused12345" }, ctx);
|
|
375
|
-
|
|
376
|
-
expect(result.success).toBe(true);
|
|
377
|
-
expect(result.data).toEqual({
|
|
378
|
-
originalId: "quest_paused12345",
|
|
379
|
-
newId: "quest_newworker12",
|
|
380
|
-
type: "worker",
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
expect(executor.calls).toHaveLength(1);
|
|
384
|
-
expect(executor.calls[0].method).toBe("spawnWorker");
|
|
385
|
-
expect(executor.calls[0].args[0] as string).toContain("run tests");
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
it("includes additional context in task when provided", async () => {
|
|
389
|
-
const executor = createMockExecutor();
|
|
390
|
-
const registry = createMockRegistry({
|
|
391
|
-
quest_paused12345: {
|
|
392
|
-
id: "quest_paused12345",
|
|
393
|
-
type: "worker",
|
|
394
|
-
task: "original task",
|
|
395
|
-
status: "aborted",
|
|
396
|
-
},
|
|
397
|
-
});
|
|
398
|
-
const ctx = makeContext({
|
|
399
|
-
delegationExecutor: executor,
|
|
400
|
-
delegationRegistry: registry,
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
await resumeTool.execute(
|
|
404
|
-
{ id: "quest_paused12345", additionalContext: "also check edge cases" },
|
|
405
|
-
ctx,
|
|
406
|
-
);
|
|
407
|
-
|
|
408
|
-
const taskArg = executor.calls[0].args[0] as string;
|
|
409
|
-
expect(taskArg).toContain("original task");
|
|
410
|
-
expect(taskArg).toContain("also check edge cases");
|
|
411
|
-
expect(taskArg).toContain("Additional context:");
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
it("builds continuation task without additional context", async () => {
|
|
415
|
-
const executor = createMockExecutor();
|
|
416
|
-
const registry = createMockRegistry({
|
|
417
|
-
quest_paused12345: {
|
|
418
|
-
id: "quest_paused12345",
|
|
419
|
-
type: "worker",
|
|
420
|
-
task: "my task",
|
|
421
|
-
status: "aborted",
|
|
422
|
-
},
|
|
423
|
-
});
|
|
424
|
-
const ctx = makeContext({
|
|
425
|
-
delegationExecutor: executor,
|
|
426
|
-
delegationRegistry: registry,
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
await resumeTool.execute({ id: "quest_paused12345" }, ctx);
|
|
430
|
-
|
|
431
|
-
const taskArg = executor.calls[0].args[0] as string;
|
|
432
|
-
expect(taskArg).toContain("Continue the previous task:");
|
|
433
|
-
expect(taskArg).toContain("my task");
|
|
434
|
-
expect(taskArg).not.toContain("Additional context");
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
it("returns error when executor throws", async () => {
|
|
438
|
-
const executor = createMockExecutor();
|
|
439
|
-
executor.delegateToArion = async () => {
|
|
440
|
-
throw new Error("arion not found");
|
|
441
|
-
};
|
|
442
|
-
const registry = createMockRegistry({
|
|
443
|
-
quest_paused12345: {
|
|
444
|
-
id: "quest_paused12345",
|
|
445
|
-
type: "arion",
|
|
446
|
-
task: "task",
|
|
447
|
-
status: "aborted",
|
|
448
|
-
arionName: "nonexistent",
|
|
449
|
-
},
|
|
450
|
-
});
|
|
451
|
-
const ctx = makeContext({
|
|
452
|
-
delegationExecutor: executor,
|
|
453
|
-
delegationRegistry: registry,
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
const result = await resumeTool.execute({ id: "quest_paused12345" }, ctx);
|
|
457
|
-
|
|
458
|
-
expect(result.success).toBe(false);
|
|
459
|
-
expect(result.message).toContain("Resume failed");
|
|
460
|
-
expect(result.message).toContain("arion not found");
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
it("returns error for cli_agent without driver metadata", async () => {
|
|
464
|
-
const executor = createMockExecutor();
|
|
465
|
-
const registry = createMockRegistry({
|
|
466
|
-
quest_cli123456789: {
|
|
467
|
-
id: "quest_cli123456789",
|
|
468
|
-
type: "cli_agent",
|
|
469
|
-
task: "cli task",
|
|
470
|
-
status: "aborted",
|
|
471
|
-
},
|
|
472
|
-
});
|
|
473
|
-
const ctx = makeContext({
|
|
474
|
-
delegationExecutor: executor,
|
|
475
|
-
delegationRegistry: registry,
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
const result = await resumeTool.execute({ id: "quest_cli123456789" }, ctx);
|
|
479
|
-
|
|
480
|
-
expect(result.success).toBe(false);
|
|
481
|
-
expect(result.message).toContain("Cannot resume CLI agent delegation");
|
|
482
|
-
expect(executor.calls).toHaveLength(0);
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
it("resumes cli_agent with driver metadata via spawnCliAgent", async () => {
|
|
486
|
-
const executor = createMockExecutor();
|
|
487
|
-
const registry = createMockRegistry({
|
|
488
|
-
quest_cli123456789: {
|
|
489
|
-
id: "quest_cli123456789",
|
|
490
|
-
type: "cli_agent",
|
|
491
|
-
task: "cli task",
|
|
492
|
-
status: "aborted",
|
|
493
|
-
metadata: { driver: "claude-code", workspace: "cwd", model: "opus" },
|
|
494
|
-
},
|
|
495
|
-
});
|
|
496
|
-
const ctx = makeContext({
|
|
497
|
-
delegationExecutor: executor,
|
|
498
|
-
delegationRegistry: registry,
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
const result = await resumeTool.execute({ id: "quest_cli123456789" }, ctx);
|
|
502
|
-
|
|
503
|
-
expect(result.success).toBe(true);
|
|
504
|
-
expect(executor.calls[0].method).toBe("spawnCliAgent");
|
|
505
|
-
expect(executor.calls[0].args[0]).toMatchObject({
|
|
506
|
-
driver: "claude-code",
|
|
507
|
-
workspace: "cwd",
|
|
508
|
-
model: "opus",
|
|
509
|
-
});
|
|
510
|
-
});
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
// ---------------------------------------------------------------------------
|
|
514
|
-
// check_delegation
|
|
515
|
-
// ---------------------------------------------------------------------------
|
|
516
|
-
|
|
517
|
-
describe("check_delegation", () => {
|
|
518
|
-
it("is defined in DELEGATION_TOOL_DEFINITIONS", () => {
|
|
519
|
-
expect(checkTool).toBeDefined();
|
|
520
|
-
expect(checkTool.name).toBe("check_delegation");
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
it("looks up by quest ID directly", async () => {
|
|
524
|
-
const registry = createMockRegistry({
|
|
525
|
-
quest_abc123def456: {
|
|
526
|
-
id: "quest_abc123def456",
|
|
527
|
-
type: "worker",
|
|
528
|
-
task: "some task",
|
|
529
|
-
status: "completed",
|
|
530
|
-
result: "All done",
|
|
531
|
-
},
|
|
532
|
-
});
|
|
533
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
534
|
-
|
|
535
|
-
const result = await checkTool.execute({ id: "quest_abc123def456" }, ctx);
|
|
536
|
-
expect(result.success).toBe(true);
|
|
537
|
-
expect(result.message).toBe("All done");
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
it("falls back to quest store for evicted entries", async () => {
|
|
541
|
-
const registry = createMockRegistry({});
|
|
542
|
-
const mockQuestStore = {
|
|
543
|
-
getQuest: (id: string) =>
|
|
544
|
-
id === "quest_evicted1234"
|
|
545
|
-
? {
|
|
546
|
-
id: "quest_evicted1234",
|
|
547
|
-
title: "Test",
|
|
548
|
-
status: "done" as const,
|
|
549
|
-
progress: "Finished!",
|
|
550
|
-
priority: 2,
|
|
551
|
-
attempts: 1,
|
|
552
|
-
createdAt: 1,
|
|
553
|
-
updatedAt: 1,
|
|
554
|
-
}
|
|
555
|
-
: null,
|
|
556
|
-
createQuest: () => ({
|
|
557
|
-
id: "",
|
|
558
|
-
title: "",
|
|
559
|
-
status: "open" as const,
|
|
560
|
-
progress: "",
|
|
561
|
-
priority: 2,
|
|
562
|
-
attempts: 0,
|
|
563
|
-
createdAt: 0,
|
|
564
|
-
updatedAt: 0,
|
|
565
|
-
}),
|
|
566
|
-
updateQuest: () => ({
|
|
567
|
-
id: "",
|
|
568
|
-
title: "",
|
|
569
|
-
status: "open" as const,
|
|
570
|
-
progress: "",
|
|
571
|
-
priority: 2,
|
|
572
|
-
attempts: 0,
|
|
573
|
-
createdAt: 0,
|
|
574
|
-
updatedAt: 0,
|
|
575
|
-
}),
|
|
576
|
-
listQuests: () => [],
|
|
577
|
-
};
|
|
578
|
-
const ctx = makeContext({
|
|
579
|
-
delegationRegistry: registry,
|
|
580
|
-
questStore: mockQuestStore,
|
|
581
|
-
});
|
|
582
|
-
|
|
583
|
-
const result = await checkTool.execute({ id: "quest_evicted1234" }, ctx);
|
|
584
|
-
expect(result.success).toBe(true);
|
|
585
|
-
expect(result.message).toBe("Finished!");
|
|
586
|
-
expect((result.data as Record<string, unknown>).status).toBe("done");
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
it("returns not found for unknown quest ID", async () => {
|
|
590
|
-
const registry = createMockRegistry({});
|
|
591
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
592
|
-
|
|
593
|
-
const result = await checkTool.execute({ id: "quest_ghost12345" }, ctx);
|
|
594
|
-
expect(result.success).toBe(false);
|
|
595
|
-
expect(result.message).toContain("not found");
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
it("returns running status for in-flight delegation", async () => {
|
|
599
|
-
const registry = createMockRegistry({
|
|
600
|
-
quest_inflight1234: {
|
|
601
|
-
id: "quest_inflight1234",
|
|
602
|
-
type: "arion",
|
|
603
|
-
task: "working on it",
|
|
604
|
-
status: "running",
|
|
605
|
-
},
|
|
606
|
-
});
|
|
607
|
-
const ctx = makeContext({ delegationRegistry: registry });
|
|
608
|
-
|
|
609
|
-
const result = await checkTool.execute({ id: "quest_inflight1234" }, ctx);
|
|
610
|
-
expect(result.success).toBe(true);
|
|
611
|
-
expect(result.message).toContain("running");
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
it("returns success:false for blocked quest in store fallback", async () => {
|
|
615
|
-
const registry = createMockRegistry({});
|
|
616
|
-
const mockQuestStore = {
|
|
617
|
-
getQuest: (id: string) =>
|
|
618
|
-
id === "quest_blocked12345"
|
|
619
|
-
? {
|
|
620
|
-
id: "quest_blocked12345",
|
|
621
|
-
title: "Test",
|
|
622
|
-
status: "blocked" as const,
|
|
623
|
-
progress: "Paused by user",
|
|
624
|
-
priority: 2,
|
|
625
|
-
attempts: 1,
|
|
626
|
-
createdAt: 1,
|
|
627
|
-
updatedAt: 1,
|
|
628
|
-
}
|
|
629
|
-
: null,
|
|
630
|
-
createQuest: () => ({
|
|
631
|
-
id: "",
|
|
632
|
-
title: "",
|
|
633
|
-
status: "open" as const,
|
|
634
|
-
progress: "",
|
|
635
|
-
priority: 2,
|
|
636
|
-
attempts: 0,
|
|
637
|
-
createdAt: 0,
|
|
638
|
-
updatedAt: 0,
|
|
639
|
-
}),
|
|
640
|
-
updateQuest: () => ({
|
|
641
|
-
id: "",
|
|
642
|
-
title: "",
|
|
643
|
-
status: "open" as const,
|
|
644
|
-
progress: "",
|
|
645
|
-
priority: 2,
|
|
646
|
-
attempts: 0,
|
|
647
|
-
createdAt: 0,
|
|
648
|
-
updatedAt: 0,
|
|
649
|
-
}),
|
|
650
|
-
listQuests: () => [],
|
|
651
|
-
};
|
|
652
|
-
const ctx = makeContext({
|
|
653
|
-
delegationRegistry: registry,
|
|
654
|
-
questStore: mockQuestStore,
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
const result = await checkTool.execute({ id: "quest_blocked12345" }, ctx);
|
|
658
|
-
expect(result.success).toBe(false);
|
|
659
|
-
expect(result.message).toBe("Paused by user");
|
|
660
|
-
expect((result.data as Record<string, unknown>).status).toBe("blocked");
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
it("returns success:true for done quest in store fallback", async () => {
|
|
664
|
-
const registry = createMockRegistry({});
|
|
665
|
-
const mockQuestStore = {
|
|
666
|
-
getQuest: (id: string) =>
|
|
667
|
-
id === "quest_done12345678"
|
|
668
|
-
? {
|
|
669
|
-
id: "quest_done12345678",
|
|
670
|
-
title: "Test",
|
|
671
|
-
status: "done" as const,
|
|
672
|
-
progress: "All done",
|
|
673
|
-
priority: 2,
|
|
674
|
-
attempts: 1,
|
|
675
|
-
createdAt: 1,
|
|
676
|
-
updatedAt: 1,
|
|
677
|
-
}
|
|
678
|
-
: null,
|
|
679
|
-
createQuest: () => ({
|
|
680
|
-
id: "",
|
|
681
|
-
title: "",
|
|
682
|
-
status: "open" as const,
|
|
683
|
-
progress: "",
|
|
684
|
-
priority: 2,
|
|
685
|
-
attempts: 0,
|
|
686
|
-
createdAt: 0,
|
|
687
|
-
updatedAt: 0,
|
|
688
|
-
}),
|
|
689
|
-
updateQuest: () => ({
|
|
690
|
-
id: "",
|
|
691
|
-
title: "",
|
|
692
|
-
status: "open" as const,
|
|
693
|
-
progress: "",
|
|
694
|
-
priority: 2,
|
|
695
|
-
attempts: 0,
|
|
696
|
-
createdAt: 0,
|
|
697
|
-
updatedAt: 0,
|
|
698
|
-
}),
|
|
699
|
-
listQuests: () => [],
|
|
700
|
-
};
|
|
701
|
-
const ctx = makeContext({
|
|
702
|
-
delegationRegistry: registry,
|
|
703
|
-
questStore: mockQuestStore,
|
|
704
|
-
});
|
|
705
|
-
|
|
706
|
-
const result = await checkTool.execute({ id: "quest_done12345678" }, ctx);
|
|
707
|
-
expect(result.success).toBe(true);
|
|
708
|
-
expect(result.message).toBe("All done");
|
|
709
|
-
});
|
|
710
|
-
|
|
711
|
-
it("returns success:true for active quest in store fallback", async () => {
|
|
712
|
-
const registry = createMockRegistry({});
|
|
713
|
-
const mockQuestStore = {
|
|
714
|
-
getQuest: (id: string) =>
|
|
715
|
-
id === "quest_active123456"
|
|
716
|
-
? {
|
|
717
|
-
id: "quest_active123456",
|
|
718
|
-
title: "Test",
|
|
719
|
-
status: "active" as const,
|
|
720
|
-
progress: "In progress",
|
|
721
|
-
priority: 2,
|
|
722
|
-
attempts: 1,
|
|
723
|
-
createdAt: 1,
|
|
724
|
-
updatedAt: 1,
|
|
725
|
-
}
|
|
726
|
-
: null,
|
|
727
|
-
createQuest: () => ({
|
|
728
|
-
id: "",
|
|
729
|
-
title: "",
|
|
730
|
-
status: "open" as const,
|
|
731
|
-
progress: "",
|
|
732
|
-
priority: 2,
|
|
733
|
-
attempts: 0,
|
|
734
|
-
createdAt: 0,
|
|
735
|
-
updatedAt: 0,
|
|
736
|
-
}),
|
|
737
|
-
updateQuest: () => ({
|
|
738
|
-
id: "",
|
|
739
|
-
title: "",
|
|
740
|
-
status: "open" as const,
|
|
741
|
-
progress: "",
|
|
742
|
-
priority: 2,
|
|
743
|
-
attempts: 0,
|
|
744
|
-
createdAt: 0,
|
|
745
|
-
updatedAt: 0,
|
|
746
|
-
}),
|
|
747
|
-
listQuests: () => [],
|
|
748
|
-
};
|
|
749
|
-
const ctx = makeContext({
|
|
750
|
-
delegationRegistry: registry,
|
|
751
|
-
questStore: mockQuestStore,
|
|
752
|
-
});
|
|
753
|
-
|
|
754
|
-
const result = await checkTool.execute({ id: "quest_active123456" }, ctx);
|
|
755
|
-
expect(result.success).toBe(true);
|
|
756
|
-
expect(result.message).toBe("Quest is active");
|
|
757
|
-
});
|
|
758
|
-
});
|