@typescript-agent-harness/mcp 0.15.0
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/LICENSE +21 -0
- package/dist/adapt.d.ts +4 -0
- package/dist/adapt.d.ts.map +1 -0
- package/dist/adapt.js +11 -0
- package/dist/adapt.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/ping-backend.d.ts +3 -0
- package/dist/ping-backend.d.ts.map +1 -0
- package/dist/ping-backend.js +29 -0
- package/dist/ping-backend.js.map +1 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +19 -0
- package/dist/plugin.js.map +1 -0
- package/dist/stdio-backend.d.ts +9 -0
- package/dist/stdio-backend.d.ts.map +1 -0
- package/dist/stdio-backend.js +110 -0
- package/dist/stdio-backend.js.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 typescript-agent-harness contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/adapt.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapt.d.ts","sourceRoot":"","sources":["../src/adapt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,YAAY,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAS7G"}
|
package/dist/adapt.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function toolsFromMcp(backend, infos) {
|
|
2
|
+
return infos.map((info) => ({
|
|
3
|
+
name: info.name,
|
|
4
|
+
description: info.description,
|
|
5
|
+
inputSchema: info.inputSchema,
|
|
6
|
+
async execute(input) {
|
|
7
|
+
return backend.callTool(info.name, input);
|
|
8
|
+
},
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=adapt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapt.js","sourceRoot":"","sources":["../src/adapt.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,YAAY,CAAC,OAAmB,EAAE,KAAmD;IACnG,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,KAAK,CAAC,OAAO,CAAC,KAAK;YACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { mcpPlugin, type McpPluginOptions } from "./plugin.js";
|
|
2
|
+
export { inProcessPingBackend } from "./ping-backend.js";
|
|
3
|
+
export { stdioMcpBackend, type StdioMcpOptions } from "./stdio-backend.js";
|
|
4
|
+
export { toolsFromMcp } from "./adapt.js";
|
|
5
|
+
export type { McpBackend, McpToolInfo } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ping-backend.d.ts","sourceRoot":"","sources":["../src/ping-backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAE1D,wBAAgB,oBAAoB,IAAI,UAAU,CA4BjD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function inProcessPingBackend() {
|
|
2
|
+
const tools = [
|
|
3
|
+
{
|
|
4
|
+
name: "ping",
|
|
5
|
+
description: "MCP ping. Returns { pong: text }.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
text: { type: "string", description: "Optional payload" },
|
|
10
|
+
},
|
|
11
|
+
additionalProperties: false,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
return {
|
|
16
|
+
async listTools() {
|
|
17
|
+
return tools;
|
|
18
|
+
},
|
|
19
|
+
async callTool(name, args) {
|
|
20
|
+
if (name !== "ping")
|
|
21
|
+
throw new Error(`unknown MCP tool: ${name}`);
|
|
22
|
+
const text = args && typeof args === "object" && "text" in args
|
|
23
|
+
? String(args.text ?? "")
|
|
24
|
+
: "";
|
|
25
|
+
return { pong: text || "ok" };
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ping-backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ping-backend.js","sourceRoot":"","sources":["../src/ping-backend.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB;IAClC,MAAM,KAAK,GAAkB;QAC3B;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,mCAAmC;YAChD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;iBAC1D;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;KACF,CAAC;IAEF,OAAO;QACL,KAAK,CAAC,SAAS;YACb,OAAO,KAAK,CAAC;QACf,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI;YACvB,IAAI,IAAI,KAAK,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;YAClE,MAAM,IAAI,GACR,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,IAAI,IAAI;gBAChD,CAAC,CAAC,MAAM,CAAE,IAA0B,CAAC,IAAI,IAAI,EAAE,CAAC;gBAChD,CAAC,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Plugin } from "@typescript-agent-harness/core";
|
|
2
|
+
import type { McpBackend } from "./types.js";
|
|
3
|
+
export type McpPluginOptions = {
|
|
4
|
+
backend: McpBackend;
|
|
5
|
+
};
|
|
6
|
+
export declare function mcpPlugin(options: McpPluginOptions): Plugin;
|
|
7
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAe3D"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TOOLS } from "@typescript-agent-harness/tools";
|
|
2
|
+
import { toolsFromMcp } from "./adapt.js";
|
|
3
|
+
export function mcpPlugin(options) {
|
|
4
|
+
const { backend } = options;
|
|
5
|
+
return {
|
|
6
|
+
name: "mcp",
|
|
7
|
+
async setup(ctx) {
|
|
8
|
+
const tools = ctx.get(TOOLS);
|
|
9
|
+
const infos = await backend.listTools();
|
|
10
|
+
for (const tool of toolsFromMcp(backend, infos)) {
|
|
11
|
+
tools.register(tool);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
async dispose() {
|
|
15
|
+
await backend.close?.();
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO1C,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,OAAO;QACL,IAAI,EAAE,KAAK;QACX,KAAK,CAAC,KAAK,CAAC,GAAG;YACb,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;YACxC,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;gBAChD,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QACD,KAAK,CAAC,OAAO;YACX,MAAM,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QAC1B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpBackend } from "./types.js";
|
|
2
|
+
export type StdioMcpOptions = {
|
|
3
|
+
command: string;
|
|
4
|
+
args?: string[];
|
|
5
|
+
cwd?: string;
|
|
6
|
+
env?: Record<string, string | undefined>;
|
|
7
|
+
};
|
|
8
|
+
export declare function stdioMcpBackend(options: StdioMcpOptions): McpBackend;
|
|
9
|
+
//# sourceMappingURL=stdio-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-backend.d.ts","sourceRoot":"","sources":["../src/stdio-backend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C,CAAC;AAWF,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,UAAU,CAiHpE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
export function stdioMcpBackend(options) {
|
|
3
|
+
let child;
|
|
4
|
+
let nextId = 1;
|
|
5
|
+
let stdoutBuf = Buffer.alloc(0);
|
|
6
|
+
const pending = new Map();
|
|
7
|
+
let started;
|
|
8
|
+
function write(msg) {
|
|
9
|
+
if (!child)
|
|
10
|
+
throw new Error("MCP stdio process is not running");
|
|
11
|
+
const json = JSON.stringify(msg);
|
|
12
|
+
const body = Buffer.from(json, "utf8");
|
|
13
|
+
child.stdin.write(`Content-Length: ${body.length}\r\n\r\n`);
|
|
14
|
+
child.stdin.write(body);
|
|
15
|
+
}
|
|
16
|
+
function onMessage(msg) {
|
|
17
|
+
if (msg.id === undefined)
|
|
18
|
+
return;
|
|
19
|
+
const waiter = pending.get(msg.id);
|
|
20
|
+
if (!waiter)
|
|
21
|
+
return;
|
|
22
|
+
pending.delete(msg.id);
|
|
23
|
+
if (msg.error) {
|
|
24
|
+
waiter.reject(new Error(msg.error.message));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
waiter.resolve(msg.result);
|
|
28
|
+
}
|
|
29
|
+
function ingest(chunk) {
|
|
30
|
+
stdoutBuf = Buffer.concat([stdoutBuf, chunk]);
|
|
31
|
+
while (true) {
|
|
32
|
+
const headerEnd = stdoutBuf.indexOf("\r\n\r\n");
|
|
33
|
+
if (headerEnd === -1)
|
|
34
|
+
break;
|
|
35
|
+
const header = stdoutBuf.subarray(0, headerEnd).toString("utf8");
|
|
36
|
+
const match = /Content-Length:\s*(\d+)/i.exec(header);
|
|
37
|
+
if (!match) {
|
|
38
|
+
stdoutBuf = stdoutBuf.subarray(headerEnd + 4);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const len = Number(match[1]);
|
|
42
|
+
const start = headerEnd + 4;
|
|
43
|
+
if (stdoutBuf.length < start + len)
|
|
44
|
+
break;
|
|
45
|
+
const body = stdoutBuf.subarray(start, start + len).toString("utf8");
|
|
46
|
+
stdoutBuf = stdoutBuf.subarray(start + len);
|
|
47
|
+
onMessage(JSON.parse(body));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function request(method, params) {
|
|
51
|
+
const id = nextId;
|
|
52
|
+
nextId += 1;
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
pending.set(id, { resolve, reject });
|
|
55
|
+
const msg = { jsonrpc: "2.0", id, method };
|
|
56
|
+
if (params !== undefined)
|
|
57
|
+
msg.params = params;
|
|
58
|
+
write(msg);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function start() {
|
|
62
|
+
const spawnOpts = { stdio: ["pipe", "pipe", "pipe"] };
|
|
63
|
+
if (options.cwd)
|
|
64
|
+
spawnOpts.cwd = options.cwd;
|
|
65
|
+
if (options.env)
|
|
66
|
+
spawnOpts.env = { ...process.env, ...options.env };
|
|
67
|
+
child = spawn(options.command, options.args ?? [], spawnOpts);
|
|
68
|
+
child.stdout.on("data", (chunk) => ingest(chunk));
|
|
69
|
+
child.on("exit", (code) => {
|
|
70
|
+
const err = new Error(`MCP stdio process exited (${code ?? "null"})`);
|
|
71
|
+
for (const waiter of pending.values())
|
|
72
|
+
waiter.reject(err);
|
|
73
|
+
pending.clear();
|
|
74
|
+
});
|
|
75
|
+
await request("initialize", {
|
|
76
|
+
protocolVersion: "2024-11-05",
|
|
77
|
+
capabilities: {},
|
|
78
|
+
clientInfo: { name: "typescript-agent-harness", version: "0.8.0" },
|
|
79
|
+
});
|
|
80
|
+
write({ jsonrpc: "2.0", method: "notifications/initialized" });
|
|
81
|
+
}
|
|
82
|
+
function ensure() {
|
|
83
|
+
started ??= start();
|
|
84
|
+
return started;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
async listTools() {
|
|
88
|
+
await ensure();
|
|
89
|
+
const result = (await request("tools/list"));
|
|
90
|
+
return result.tools ?? [];
|
|
91
|
+
},
|
|
92
|
+
async callTool(name, args) {
|
|
93
|
+
await ensure();
|
|
94
|
+
return request("tools/call", { name, arguments: args ?? {} });
|
|
95
|
+
},
|
|
96
|
+
async close() {
|
|
97
|
+
if (!child)
|
|
98
|
+
return;
|
|
99
|
+
for (const waiter of pending.values()) {
|
|
100
|
+
waiter.reject(new Error("MCP stdio backend closed"));
|
|
101
|
+
}
|
|
102
|
+
pending.clear();
|
|
103
|
+
child.stdin.end();
|
|
104
|
+
child.kill();
|
|
105
|
+
child = undefined;
|
|
106
|
+
started = undefined;
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL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/dist/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JSONSchema } from "@typescript-agent-harness/llm";
|
|
2
|
+
export type McpToolInfo = {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: JSONSchema;
|
|
6
|
+
};
|
|
7
|
+
export type McpBackend = {
|
|
8
|
+
listTools(): Promise<McpToolInfo[]>;
|
|
9
|
+
callTool(name: string, args: unknown): Promise<unknown>;
|
|
10
|
+
close?(): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@typescript-agent-harness/mcp",
|
|
3
|
+
"version": "0.15.0",
|
|
4
|
+
"description": "MCP tools adapted onto the Tool registry",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@typescript-agent-harness/core": "0.15.0",
|
|
19
|
+
"@typescript-agent-harness/tools": "0.15.0",
|
|
20
|
+
"@typescript-agent-harness/llm": "0.15.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.18.0",
|
|
24
|
+
"typescript": "^5.9.2"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/MichaelVendor/typescript-agent-harness.git",
|
|
37
|
+
"directory": "packages/mcp"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://MichaelVendor.github.io/typescript-agent-harness/",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/MichaelVendor/typescript-agent-harness/issues"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
|
+
"test": "node --test --experimental-strip-types test/*.test.ts"
|
|
47
|
+
}
|
|
48
|
+
}
|