@adhd/agent-mcp 2.1.1 → 2.1.2
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/docs/marketing/.catalog/capabilities.md +1 -1
- package/docs/plan/accounting/SCOPE.md +316 -0
- package/docs/provider-call-audit.md +83 -1
- package/package.json +9 -12
- package/src/config.d.ts +59 -30
- package/src/config.d.ts.map +1 -1
- package/src/config.js +202 -205
- package/src/config.js.map +1 -1
- package/src/db/client.d.ts.map +1 -1
- package/src/db/client.js +6 -2
- package/src/db/client.js.map +1 -1
- package/src/db/migrate-runner.d.ts.map +1 -1
- package/src/db/migrate-runner.js.map +1 -1
- package/src/db/migrate.d.ts.map +1 -1
- package/src/db/migrate.js.map +1 -1
- package/src/db/schema.d.ts.map +1 -1
- package/src/db/schema.js.map +1 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +20 -13
- package/src/index.js.map +1 -1
- package/src/logger.d.ts.map +1 -1
- package/src/logger.js +2 -2
- package/src/logger.js.map +1 -1
- package/src/scripts/agent-mcp-tail.d.ts.map +1 -1
- package/src/scripts/agent-mcp-tail.js +202 -122
- package/src/scripts/agent-mcp-tail.js.map +1 -1
- package/src/server.d.ts.map +1 -1
- package/src/server.js +7 -7
- package/src/server.js.map +1 -1
- package/src/store/agent-store.d.ts.map +1 -1
- package/src/store/agent-store.js.map +1 -1
- package/src/streaming/chat-gateway.d.ts.map +1 -1
- package/src/streaming/chat-gateway.js.map +1 -1
- package/src/streaming/event-bus.d.ts.map +1 -1
- package/src/streaming/event-bus.js.map +1 -1
- package/src/streaming/sse-server.d.ts.map +1 -1
- package/src/streaming/sse-server.js +2 -2
- package/src/streaming/sse-server.js.map +1 -1
- package/adhd-agent-mcp-2.1.1.tgz +0 -0
- package/src/__tests__/integration/harness.d.ts +0 -1027
- package/src/__tests__/integration/harness.d.ts.map +0 -1
- package/src/__tests__/integration/harness.js +0 -409
- package/src/__tests__/integration/harness.js.map +0 -1
- package/src/__tests__/integration/scripted-provider.d.ts +0 -43
- package/src/__tests__/integration/scripted-provider.d.ts.map +0 -1
- package/src/__tests__/integration/scripted-provider.js +0 -80
- package/src/__tests__/integration/scripted-provider.js.map +0 -1
- package/src/utils/load-env.d.ts +0 -2
- package/src/utils/load-env.d.ts.map +0 -1
- package/src/utils/load-env.js +0 -9
- package/src/utils/load-env.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../../../../../entrypoint/agent-mcp/src/__tests__/integration/harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,OAAO,EAKL,YAAY,EACZ,SAAS,EAEV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,YAAY,EAEZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,oEAAoE;AACpE,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBzC;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,EACrB,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBzC;AAMD;;GAEG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,OAAO,CAAwB;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;;IAShC,OAAO,IAAI,IAAI;IAIf,IAAI,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI;IAIhB,IAAI,CAAC,SAAS,SAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ7C;AAMD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,SAAQ,EACjB,WAAW,CAAC,EAAE,MAAM,IAAI,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAoErB;AAGD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration test harness.
|
|
3
|
-
*
|
|
4
|
-
* Builds a fully-wired real system against a fresh temp sqlite database.
|
|
5
|
-
* Runs the same drizzle migrations used by the production server.
|
|
6
|
-
* Constructs real stores/queue/PolicyEngine/orchestrator/DagEngine with
|
|
7
|
-
* the same dispatchFn wiring as index.ts.
|
|
8
|
-
*
|
|
9
|
-
* The only scripted/stubbed components are:
|
|
10
|
-
* - LLMProvider (ScriptedProvider from scripted-provider.ts)
|
|
11
|
-
* - External MCP tool clients (in-process stubs at the registry boundary)
|
|
12
|
-
*/
|
|
13
|
-
import os from "node:os";
|
|
14
|
-
import path from "node:path";
|
|
15
|
-
import fs from "node:fs";
|
|
16
|
-
import http from "node:http";
|
|
17
|
-
import crypto from "node:crypto";
|
|
18
|
-
import Database from "better-sqlite3";
|
|
19
|
-
import { drizzle } from "drizzle-orm/better-sqlite3";
|
|
20
|
-
import * as entrypointSchema from "../../db/schema.js";
|
|
21
|
-
import { sessionsTable, messagesTable, tasksTable, taskEventsTable, SessionStore, TaskStore, generateId, } from "@adhd/agent-store-runtime";
|
|
22
|
-
import { BackgroundQueue, DagEngine, Orchestrator, HookRegistry, PolicyEngine, enqueueExistingTask, taskTool, taskCancel, taskResume, } from "@adhd/agent-engine-orchestrator";
|
|
23
|
-
import { AgentStore } from "../../store/agent-store.js";
|
|
24
|
-
import { runMigrationsOn, MIGRATIONS_FOLDER } from "../../db/migrate-runner.js";
|
|
25
|
-
import { startSseServer } from "../../streaming/sse-server.js";
|
|
26
|
-
import { loadConfig } from "../../config.js";
|
|
27
|
-
import { emitTaskEvent } from "../../streaming/event-bus.js";
|
|
28
|
-
import { eq } from "drizzle-orm";
|
|
29
|
-
/** Combined drizzle schema for harness-level direct table access */
|
|
30
|
-
const combinedSchema = {
|
|
31
|
-
...entrypointSchema,
|
|
32
|
-
sessionsTable,
|
|
33
|
-
messagesTable,
|
|
34
|
-
tasksTable,
|
|
35
|
-
taskEventsTable,
|
|
36
|
-
};
|
|
37
|
-
/** Build a test EngineLogger that is silent by default */
|
|
38
|
-
function testLogger(level = "silent") {
|
|
39
|
-
if (level === "silent") {
|
|
40
|
-
return {
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
42
|
-
info: () => { },
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
44
|
-
warn: () => { },
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
46
|
-
error: () => { },
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
48
|
-
debug: () => { },
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
53
|
-
info: () => { },
|
|
54
|
-
warn: (...args) => console.warn(...args),
|
|
55
|
-
error: (...args) => console.error(...args),
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
57
|
-
debug: () => { },
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/** Build a test EngineConfig with defaults suitable for integration tests */
|
|
61
|
-
function testConfig(_opts = {}) {
|
|
62
|
-
const env = {
|
|
63
|
-
ADHD_AGENT_DATABASE_PATH: ":memory:",
|
|
64
|
-
ADHD_AGENT_LOG_LEVEL: "silent",
|
|
65
|
-
};
|
|
66
|
-
const cfg = loadConfig(env);
|
|
67
|
-
return {
|
|
68
|
-
server: {
|
|
69
|
-
contextLimit: 0,
|
|
70
|
-
defaultMaxTokens: cfg.server.defaultMaxTokens,
|
|
71
|
-
},
|
|
72
|
-
queue: { concurrency: 5 },
|
|
73
|
-
sse: { baseUrl: `http://localhost:${cfg.sse.port}` },
|
|
74
|
-
plugins: { entries: [] },
|
|
75
|
-
getProviderConfig(opts) {
|
|
76
|
-
return { secret: opts.secret ? process.env[opts.secret] : undefined, baseURL: opts.inlineBaseURL, model: opts.inlineModel };
|
|
77
|
-
},
|
|
78
|
-
subprocessEnv() {
|
|
79
|
-
return {};
|
|
80
|
-
},
|
|
81
|
-
isEnvNameAllowed(name) {
|
|
82
|
-
return name.startsWith("ADHD_AGENT_") || name.startsWith("LMSTUDIO_");
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Build a fully-wired harness. Call teardown() when done.
|
|
88
|
-
*/
|
|
89
|
-
export async function buildHarness(opts = {}) {
|
|
90
|
-
const dbPath = opts.dbPath ??
|
|
91
|
-
path.join(os.tmpdir(), `agent-mcp-test-${crypto.randomUUID()}.db`);
|
|
92
|
-
const rawSqlite = new Database(dbPath);
|
|
93
|
-
rawSqlite.pragma("journal_mode = WAL");
|
|
94
|
-
rawSqlite.pragma("foreign_keys = ON");
|
|
95
|
-
const db = drizzle(rawSqlite, { schema: combinedSchema });
|
|
96
|
-
// Run migrations — same folder + FK-safe runner as production
|
|
97
|
-
runMigrationsOn(rawSqlite, db, MIGRATIONS_FOLDER);
|
|
98
|
-
const hooks = new HookRegistry();
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
-
const dbAny = db;
|
|
101
|
-
const agentStore = new AgentStore(dbAny, hooks);
|
|
102
|
-
const sessionStore = new SessionStore(dbAny, hooks);
|
|
103
|
-
const taskStore = new TaskStore(dbAny);
|
|
104
|
-
const config = testConfig({ serverMaxToolLoops: opts.serverMaxToolLoops });
|
|
105
|
-
const logger = testLogger("silent");
|
|
106
|
-
const queue = new BackgroundQueue(5, logger);
|
|
107
|
-
const orchestrator = new Orchestrator();
|
|
108
|
-
const policy = new PolicyEngine({
|
|
109
|
-
serverMaxDepth: 5,
|
|
110
|
-
serverMaxToolLoops: opts.serverMaxToolLoops ?? 50,
|
|
111
|
-
});
|
|
112
|
-
// Mirror dispatchFn wiring from index.ts.
|
|
113
|
-
const taskDepsRef = { value: undefined };
|
|
114
|
-
const dispatchFn = async (taskId) => {
|
|
115
|
-
if (!taskDepsRef.value)
|
|
116
|
-
throw new Error("dispatchFn called before harness initialized");
|
|
117
|
-
await enqueueExistingTask(taskId, taskDepsRef.value);
|
|
118
|
-
};
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
|
-
const dagEngine = new DagEngine(dbAny, queue, taskStore, dispatchFn, logger);
|
|
121
|
-
// SSE server (optional)
|
|
122
|
-
let sseServer;
|
|
123
|
-
let ssePort;
|
|
124
|
-
if (opts.withSse) {
|
|
125
|
-
sseServer = startSseServer(taskStore, 0, "127.0.0.1");
|
|
126
|
-
await new Promise((resolve) => {
|
|
127
|
-
const readPort = () => {
|
|
128
|
-
if (!sseServer)
|
|
129
|
-
throw new Error("sseServer not started");
|
|
130
|
-
const addr = sseServer.address();
|
|
131
|
-
ssePort = addr?.port;
|
|
132
|
-
resolve();
|
|
133
|
-
};
|
|
134
|
-
const svr = sseServer;
|
|
135
|
-
if (!svr)
|
|
136
|
-
throw new Error('sseServer not initialized');
|
|
137
|
-
if (svr.listening)
|
|
138
|
-
readPort();
|
|
139
|
-
else
|
|
140
|
-
svr.once("listening", readPort);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
// Build taskDeps — same shape as index.ts.
|
|
144
|
-
const effectiveOrchestrator = opts.defaultProvider
|
|
145
|
-
? {
|
|
146
|
-
run: (input) => {
|
|
147
|
-
const provider = opts.defaultProvider;
|
|
148
|
-
if (!provider)
|
|
149
|
-
throw new Error("Harness: defaultProvider unexpectedly null");
|
|
150
|
-
return orchestrator.run({ ...input, provider });
|
|
151
|
-
},
|
|
152
|
-
}
|
|
153
|
-
: orchestrator;
|
|
154
|
-
taskDepsRef.value = {
|
|
155
|
-
agentStore,
|
|
156
|
-
sessionStore,
|
|
157
|
-
taskStore,
|
|
158
|
-
orchestrator: effectiveOrchestrator,
|
|
159
|
-
queue,
|
|
160
|
-
policy,
|
|
161
|
-
hooks,
|
|
162
|
-
selfUrl: undefined,
|
|
163
|
-
inProcessDescriptors: [],
|
|
164
|
-
inProcessHandler: async () => {
|
|
165
|
-
throw new Error("in-process tools not configured in test harness");
|
|
166
|
-
},
|
|
167
|
-
db: dbAny,
|
|
168
|
-
dagEngine,
|
|
169
|
-
config,
|
|
170
|
-
logger,
|
|
171
|
-
emitTaskEvent: emitTaskEvent,
|
|
172
|
-
};
|
|
173
|
-
// Re-enqueue orphaned pending tasks
|
|
174
|
-
if (!opts.skipOrphanScan) {
|
|
175
|
-
const orphanedPending = dbAny
|
|
176
|
-
.select()
|
|
177
|
-
.from(tasksTable)
|
|
178
|
-
.where(eq(tasksTable.status, "pending"))
|
|
179
|
-
.all();
|
|
180
|
-
for (const row of orphanedPending) {
|
|
181
|
-
try {
|
|
182
|
-
if (!taskDepsRef.value)
|
|
183
|
-
throw new Error("Harness: taskDepsRef.value not initialized");
|
|
184
|
-
await enqueueExistingTask(row.id, taskDepsRef.value);
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
// ignore failures in teardown
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const teardown = async () => {
|
|
192
|
-
if (sseServer) {
|
|
193
|
-
const srv = sseServer;
|
|
194
|
-
await new Promise((resolve) => srv.close(() => resolve()));
|
|
195
|
-
}
|
|
196
|
-
await Promise.race([
|
|
197
|
-
queue.onIdle(),
|
|
198
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error("teardown: queue.onIdle() timed out after 15s")), 15_000)),
|
|
199
|
-
]).catch(() => {
|
|
200
|
-
// Log but don't rethrow — we still need to close the DB.
|
|
201
|
-
});
|
|
202
|
-
await new Promise((r) => setImmediate(r));
|
|
203
|
-
if (rawSqlite.open) {
|
|
204
|
-
try {
|
|
205
|
-
rawSqlite.pragma("wal_checkpoint(TRUNCATE)");
|
|
206
|
-
}
|
|
207
|
-
catch {
|
|
208
|
-
// checkpoint is best-effort
|
|
209
|
-
}
|
|
210
|
-
try {
|
|
211
|
-
rawSqlite.close();
|
|
212
|
-
}
|
|
213
|
-
catch {
|
|
214
|
-
// already closed
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
for (const suffix of ["", "-wal", "-shm"]) {
|
|
218
|
-
try {
|
|
219
|
-
fs.unlinkSync(`${dbPath}${suffix}`);
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
// ignore — file may not exist
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
return {
|
|
227
|
-
db,
|
|
228
|
-
rawSqlite,
|
|
229
|
-
agentStore,
|
|
230
|
-
sessionStore,
|
|
231
|
-
taskStore,
|
|
232
|
-
queue,
|
|
233
|
-
orchestrator: effectiveOrchestrator,
|
|
234
|
-
policy,
|
|
235
|
-
dagEngine,
|
|
236
|
-
taskDeps: taskDepsRef.value,
|
|
237
|
-
hooks,
|
|
238
|
-
teardown,
|
|
239
|
-
dbPath,
|
|
240
|
-
sseServer,
|
|
241
|
-
ssePort,
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Rebuild a harness against the SAME DB file (for restart/persistence tests).
|
|
246
|
-
*/
|
|
247
|
-
export async function rebuildHarness(dbPath, opts = {}) {
|
|
248
|
-
return buildHarness({ ...opts, dbPath });
|
|
249
|
-
}
|
|
250
|
-
// ──────────────────────────────────────────────────────────────────────────────
|
|
251
|
-
// Helpers
|
|
252
|
-
// ──────────────────────────────────────────────────────────────────────────────
|
|
253
|
-
/**
|
|
254
|
-
* Wait for the queue to drain (all enqueued tasks finished).
|
|
255
|
-
*/
|
|
256
|
-
export async function drainQueue(queue, timeoutMs = 10_000) {
|
|
257
|
-
await Promise.race([
|
|
258
|
-
queue.onIdle(),
|
|
259
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error(`drainQueue timed out after ${timeoutMs}ms`)), timeoutMs)),
|
|
260
|
-
]);
|
|
261
|
-
await new Promise((r) => setImmediate(r));
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Create a minimal test agent + open a session. Returns { agentName, sessionId }.
|
|
265
|
-
*/
|
|
266
|
-
export async function createSessionAndAgent(harness, provider, agentOverrides = {}) {
|
|
267
|
-
const agentName = `test-agent-${generateId()}`;
|
|
268
|
-
harness.agentStore.create({
|
|
269
|
-
name: agentName,
|
|
270
|
-
provider: { type: "openai", model: "test-model", baseURL: "http://localhost:1234/v1" },
|
|
271
|
-
systemPrompt: "You are a test assistant.",
|
|
272
|
-
mcpServers: {},
|
|
273
|
-
permissions: {},
|
|
274
|
-
...agentOverrides,
|
|
275
|
-
});
|
|
276
|
-
const agentDef = harness.agentStore.read(agentName);
|
|
277
|
-
const session = harness.sessionStore.create({
|
|
278
|
-
agentName,
|
|
279
|
-
agentDefinition: agentDef,
|
|
280
|
-
});
|
|
281
|
-
return { agentName, sessionId: session.id };
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Run a task synchronously via the real taskTool, injecting the given provider
|
|
285
|
-
* into the orchestrator for this task only.
|
|
286
|
-
*/
|
|
287
|
-
export async function runTaskViaToolWithProvider(harness, sessionId, prompt, provider, extraInput = {}) {
|
|
288
|
-
const realOrchestrator = harness.orchestrator;
|
|
289
|
-
const originalRun = realOrchestrator.run.bind(realOrchestrator);
|
|
290
|
-
const patchedDeps = {
|
|
291
|
-
...harness.taskDeps,
|
|
292
|
-
orchestrator: {
|
|
293
|
-
run: (input) => originalRun({ ...input, provider }),
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
return taskTool({ session_id: sessionId, prompt, background: false, ...extraInput }, patchedDeps);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Background version — enqueues and returns immediately; use drainQueue to wait.
|
|
300
|
-
*/
|
|
301
|
-
export async function enqueueTaskWithProvider(harness, sessionId, prompt, provider, extraInput = {}) {
|
|
302
|
-
const realOrchestrator = harness.orchestrator;
|
|
303
|
-
const originalRun = realOrchestrator.run.bind(realOrchestrator);
|
|
304
|
-
const patchedDeps = {
|
|
305
|
-
...harness.taskDeps,
|
|
306
|
-
orchestrator: {
|
|
307
|
-
run: (input) => originalRun({ ...input, provider }),
|
|
308
|
-
},
|
|
309
|
-
};
|
|
310
|
-
return taskTool({ session_id: sessionId, prompt, background: true, ...extraInput }, patchedDeps);
|
|
311
|
-
}
|
|
312
|
-
// ──────────────────────────────────────────────────────────────────────────────
|
|
313
|
-
// Latch utility
|
|
314
|
-
// ──────────────────────────────────────────────────────────────────────────────
|
|
315
|
-
/**
|
|
316
|
-
* A binary latch. One side waits; the other releases.
|
|
317
|
-
*/
|
|
318
|
-
export class Latch {
|
|
319
|
-
_resolve;
|
|
320
|
-
_reject;
|
|
321
|
-
promise;
|
|
322
|
-
constructor() {
|
|
323
|
-
this.promise = new Promise((res, rej) => {
|
|
324
|
-
this._resolve = res;
|
|
325
|
-
this._reject = rej;
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
release() {
|
|
329
|
-
this._resolve();
|
|
330
|
-
}
|
|
331
|
-
fail(err) {
|
|
332
|
-
this._reject(err);
|
|
333
|
-
}
|
|
334
|
-
async wait(timeoutMs = 5_000) {
|
|
335
|
-
return Promise.race([
|
|
336
|
-
this.promise,
|
|
337
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error(`Latch.wait timed out after ${timeoutMs}ms`)), timeoutMs)),
|
|
338
|
-
]);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Connect to the real SSE server and collect frames until "done" or timeout.
|
|
343
|
-
*/
|
|
344
|
-
export async function collectSseFrames(port, taskId, timeoutMs = 8_000, onConnected) {
|
|
345
|
-
return new Promise((resolve, reject) => {
|
|
346
|
-
const frames = [];
|
|
347
|
-
const timer = setTimeout(() => {
|
|
348
|
-
reject(new Error(`collectSseFrames timed out after ${timeoutMs}ms`));
|
|
349
|
-
}, timeoutMs);
|
|
350
|
-
const req = http.get(`http://127.0.0.1:${port}/tasks/${taskId}/stream`, { headers: { Accept: "text/event-stream" } }, (res) => {
|
|
351
|
-
onConnected?.();
|
|
352
|
-
let buf = "";
|
|
353
|
-
let currentEventType = "";
|
|
354
|
-
res.on("data", (chunk) => {
|
|
355
|
-
buf += chunk.toString();
|
|
356
|
-
const lines = buf.split("\n");
|
|
357
|
-
buf = lines.pop() ?? "";
|
|
358
|
-
for (const line of lines) {
|
|
359
|
-
if (line.startsWith("event: ")) {
|
|
360
|
-
currentEventType = line.slice("event: ".length).trim();
|
|
361
|
-
}
|
|
362
|
-
else if (line.startsWith("data: ")) {
|
|
363
|
-
const raw = line.slice("data: ".length).trim();
|
|
364
|
-
try {
|
|
365
|
-
const data = JSON.parse(raw);
|
|
366
|
-
frames.push({ type: currentEventType, data });
|
|
367
|
-
if (currentEventType === "done") {
|
|
368
|
-
clearTimeout(timer);
|
|
369
|
-
req.destroy();
|
|
370
|
-
resolve(frames);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
// ignore parse errors
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
if (line === "") {
|
|
378
|
-
currentEventType = "";
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
res.on("error", (err) => {
|
|
383
|
-
clearTimeout(timer);
|
|
384
|
-
if (frames.some((f) => f.type === "done")) {
|
|
385
|
-
resolve(frames);
|
|
386
|
-
}
|
|
387
|
-
else {
|
|
388
|
-
reject(err);
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
res.on("end", () => {
|
|
392
|
-
clearTimeout(timer);
|
|
393
|
-
resolve(frames);
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
req.on("error", (err) => {
|
|
397
|
-
clearTimeout(timer);
|
|
398
|
-
if (frames.some((f) => f.type === "done")) {
|
|
399
|
-
resolve(frames);
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
reject(err);
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
// Re-export tools for convenience
|
|
408
|
-
export { taskTool, taskCancel, taskResume };
|
|
409
|
-
//# sourceMappingURL=harness.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"harness.js","sourceRoot":"","sources":["../../../../../../entrypoint/agent-mcp/src/__tests__/integration/harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;A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,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;QAEF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACtB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,CAAC;gBAC1C,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ScriptedProvider — deterministic LLM provider for integration tests.
|
|
3
|
-
*
|
|
4
|
-
* Implements the real LLMProvider interface.
|
|
5
|
-
* Returns programmable responses per chat() call in sequence.
|
|
6
|
-
* After all scripted turns are exhausted, defaults to a "completed" response.
|
|
7
|
-
*
|
|
8
|
-
* Supported turn types:
|
|
9
|
-
* - "completed" → returns stopReason "completed" with given content
|
|
10
|
-
* - "tool_calls" → returns stopReason "tool_calls" with given tool calls
|
|
11
|
-
* - "hitl" → returns a single request_human_input tool call
|
|
12
|
-
*
|
|
13
|
-
* Supports a beforeCall hook so tool stubs can coordinate with Latches.
|
|
14
|
-
*/
|
|
15
|
-
import type { LLMProvider, ProviderChatResponse } from "@adhd/agent-engine-orchestrator";
|
|
16
|
-
export interface ToolCallSpec {
|
|
17
|
-
server: string;
|
|
18
|
-
tool: string;
|
|
19
|
-
arguments: unknown;
|
|
20
|
-
/** Override the generated call ID */
|
|
21
|
-
id?: string;
|
|
22
|
-
}
|
|
23
|
-
export type ScriptedTurn = {
|
|
24
|
-
type: "completed";
|
|
25
|
-
content: string;
|
|
26
|
-
} | {
|
|
27
|
-
type: "tool_calls";
|
|
28
|
-
toolCalls: ToolCallSpec[];
|
|
29
|
-
} | {
|
|
30
|
-
type: "hitl";
|
|
31
|
-
prompt: string;
|
|
32
|
-
};
|
|
33
|
-
export declare class ScriptedProvider implements LLMProvider {
|
|
34
|
-
private readonly turns;
|
|
35
|
-
private callIndex;
|
|
36
|
-
/**
|
|
37
|
-
* Optional hook invoked at the START of each chat() call (before returning).
|
|
38
|
-
*/
|
|
39
|
-
beforeCall?: (callIndex: number) => Promise<void>;
|
|
40
|
-
constructor(turns: ScriptedTurn[]);
|
|
41
|
-
chat(): Promise<ProviderChatResponse>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=scripted-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scripted-provider.d.ts","sourceRoot":"","sources":["../../../../../../entrypoint/agent-mcp/src/__tests__/integration/scripted-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,oBAAoB,EACrB,MAAM,iCAAiC,CAAC;AAIzC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,SAAS,EAAE,YAAY,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAErC,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IACvC,OAAO,CAAC,SAAS,CAAK;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;gBAEtC,KAAK,EAAE,YAAY,EAAE;IAI3B,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAAC;CA6D5C"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ScriptedProvider — deterministic LLM provider for integration tests.
|
|
3
|
-
*
|
|
4
|
-
* Implements the real LLMProvider interface.
|
|
5
|
-
* Returns programmable responses per chat() call in sequence.
|
|
6
|
-
* After all scripted turns are exhausted, defaults to a "completed" response.
|
|
7
|
-
*
|
|
8
|
-
* Supported turn types:
|
|
9
|
-
* - "completed" → returns stopReason "completed" with given content
|
|
10
|
-
* - "tool_calls" → returns stopReason "tool_calls" with given tool calls
|
|
11
|
-
* - "hitl" → returns a single request_human_input tool call
|
|
12
|
-
*
|
|
13
|
-
* Supports a beforeCall hook so tool stubs can coordinate with Latches.
|
|
14
|
-
*/
|
|
15
|
-
import { generateId, nowIso } from "@adhd/agent-store-runtime";
|
|
16
|
-
export class ScriptedProvider {
|
|
17
|
-
turns;
|
|
18
|
-
callIndex = 0;
|
|
19
|
-
/**
|
|
20
|
-
* Optional hook invoked at the START of each chat() call (before returning).
|
|
21
|
-
*/
|
|
22
|
-
beforeCall;
|
|
23
|
-
constructor(turns) {
|
|
24
|
-
this.turns = turns;
|
|
25
|
-
}
|
|
26
|
-
async chat() {
|
|
27
|
-
const idx = this.callIndex++;
|
|
28
|
-
if (this.beforeCall) {
|
|
29
|
-
await this.beforeCall(idx);
|
|
30
|
-
}
|
|
31
|
-
const turn = this.turns[idx] ?? { type: "completed", content: "done" };
|
|
32
|
-
const sessionId = generateId();
|
|
33
|
-
if (turn.type === "completed") {
|
|
34
|
-
const msg = {
|
|
35
|
-
id: generateId(),
|
|
36
|
-
sessionId,
|
|
37
|
-
role: "assistant",
|
|
38
|
-
content: turn.content,
|
|
39
|
-
createdAt: nowIso(),
|
|
40
|
-
};
|
|
41
|
-
return { message: msg, stopReason: "completed" };
|
|
42
|
-
}
|
|
43
|
-
if (turn.type === "hitl") {
|
|
44
|
-
const callId = generateId();
|
|
45
|
-
const msg = {
|
|
46
|
-
id: generateId(),
|
|
47
|
-
sessionId,
|
|
48
|
-
role: "assistant",
|
|
49
|
-
content: undefined,
|
|
50
|
-
toolCalls: [
|
|
51
|
-
{
|
|
52
|
-
id: callId,
|
|
53
|
-
server: "builtin",
|
|
54
|
-
tool: "request_human_input",
|
|
55
|
-
arguments: { prompt: turn.prompt },
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
createdAt: nowIso(),
|
|
59
|
-
};
|
|
60
|
-
return { message: msg, stopReason: "tool_calls" };
|
|
61
|
-
}
|
|
62
|
-
// type === "tool_calls"
|
|
63
|
-
const calls = turn.toolCalls.map((spec) => ({
|
|
64
|
-
id: spec.id ?? generateId(),
|
|
65
|
-
server: spec.server,
|
|
66
|
-
tool: spec.tool,
|
|
67
|
-
arguments: spec.arguments,
|
|
68
|
-
}));
|
|
69
|
-
const msg = {
|
|
70
|
-
id: generateId(),
|
|
71
|
-
sessionId,
|
|
72
|
-
role: "assistant",
|
|
73
|
-
content: undefined,
|
|
74
|
-
toolCalls: calls,
|
|
75
|
-
createdAt: nowIso(),
|
|
76
|
-
};
|
|
77
|
-
return { message: msg, stopReason: "tool_calls" };
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=scripted-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scripted-provider.js","sourceRoot":"","sources":["../../../../../../entrypoint/agent-mcp/src/__tests__/integration/scripted-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAe/D,MAAM,OAAO,gBAAgB;IACV,KAAK,CAAiB;IAC/B,SAAS,GAAG,CAAC,CAAC;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AAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;QACpD,CAAC;QAED,wBAAwB;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1C,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,UAAU,EAAE;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC,CAAC;QAEJ,MAAM,GAAG,GAAY;YACnB,EAAE,EAAE,UAAU,EAAE;YAChB,SAAS;YACT,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,MAAM,EAAE;SACpB,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;IACpD,CAAC;CACF"}
|
package/src/utils/load-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-env.d.ts","sourceRoot":"","sources":["../../../../../entrypoint/agent-mcp/src/utils/load-env.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAsB,GAAG,IAAI,CAIlE"}
|
package/src/utils/load-env.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import { config as dotenvConfig } from "dotenv";
|
|
4
|
-
export function loadEnvHierarchy(cwd = process.cwd()) {
|
|
5
|
-
dotenvConfig({ path: path.join(os.homedir(), ".adhd", ".env") });
|
|
6
|
-
dotenvConfig({ path: path.join(cwd, ".adhd", ".env"), override: true });
|
|
7
|
-
dotenvConfig({ path: path.join(cwd, ".env"), override: true });
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=load-env.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-env.js","sourceRoot":"","sources":["../../../../../entrypoint/agent-mcp/src/utils/load-env.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEhD,MAAM,UAAU,gBAAgB,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACxD,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACjE,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC"}
|