@vouqis/sdk 0.1.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.
@@ -0,0 +1,23 @@
1
+ interface VouqisSDKOptions {
2
+ projectId: string;
3
+ }
4
+ interface TraceRecord {
5
+ traceId: string;
6
+ projectId: string;
7
+ timestamp: string;
8
+ toolName: string;
9
+ params: Record<string, unknown>;
10
+ response: unknown;
11
+ latencyMs: number;
12
+ error: string | null;
13
+ }
14
+ interface HasCallTool {
15
+ callTool(toolName: string, params: Record<string, unknown>): Promise<unknown>;
16
+ }
17
+ declare class VouqisSDK {
18
+ private readonly projectId;
19
+ constructor(options: VouqisSDKOptions);
20
+ wrap<T extends HasCallTool>(client: T): T;
21
+ }
22
+
23
+ export { type TraceRecord, VouqisSDK, type VouqisSDKOptions };
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ // src/index.ts
2
+ import { randomUUID } from "crypto";
3
+ var VouqisSDK = class {
4
+ projectId;
5
+ constructor(options) {
6
+ this.projectId = options.projectId;
7
+ }
8
+ wrap(client) {
9
+ const projectId = this.projectId;
10
+ return new Proxy(client, {
11
+ get(target, prop, receiver) {
12
+ if (prop !== "callTool") {
13
+ return Reflect.get(target, prop, receiver);
14
+ }
15
+ return async function wrappedCallTool(toolName, params) {
16
+ const startTime = Date.now();
17
+ let response = null;
18
+ let error = null;
19
+ try {
20
+ response = await target.callTool(toolName, params);
21
+ return response;
22
+ } catch (err) {
23
+ error = err instanceof Error ? err.message : String(err);
24
+ throw err;
25
+ } finally {
26
+ const trace = {
27
+ traceId: randomUUID(),
28
+ projectId,
29
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
30
+ toolName,
31
+ params,
32
+ response,
33
+ latencyMs: Date.now() - startTime,
34
+ error
35
+ };
36
+ console.log(JSON.stringify(trace));
37
+ }
38
+ };
39
+ }
40
+ });
41
+ }
42
+ };
43
+ export {
44
+ VouqisSDK
45
+ };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@vouqis/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Vouqis SDK — JSON-RPC trace capture and replay for MCP servers",
5
+ "type": "module",
6
+ "author": "Sundar Sasi",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/Sasisundar2211/vouqis",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Sasisundar2211/vouqis.git"
12
+ },
13
+ "main": "dist/index.js",
14
+ "types": "dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/index.js",
18
+ "types": "./dist/index.d.ts"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsup src/index.ts --format esm --dts --out-dir dist --clean",
26
+ "test": "vitest run",
27
+ "typecheck": "tsc --noEmit",
28
+ "prepack": "npm run build"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^25",
32
+ "tsup": "^8",
33
+ "typescript": "^6",
34
+ "vitest": "^4"
35
+ },
36
+ "engines": {
37
+ "node": ">=20"
38
+ }
39
+ }