@wireweave/sdk 0.1.1-beta.8 → 0.1.1
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/README.md +10 -6
- package/dist/index.d.ts +19 -25
- package/dist/index.js +321 -38
- package/dist/index.js.map +1 -1
- package/package.json +20 -24
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ The platform client for Wireweave — a typed HTTP client, token-based auth, and
|
|
|
9
9
|
- **Local tools** run in-process via `@wireweave/core`, `@wireweave/ux-rules`, and `@wireweave/language-data`. No network call, no API key required.
|
|
10
10
|
- **Remote tools** are proxied to the Wireweave API server (`api-server`) over HTTP. These require an API key (cloud project/wireframe storage, account & billing, hosted reference content such as the grammar and LLM guide).
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Tool schemas, behavioral annotations and routing are generated offline from this package's public `src/tool-catalog.json`. Both SDK and MCP consume the same catalog. Dispatch validates arguments before local execution or network access.
|
|
13
13
|
|
|
14
14
|
Local dispatch tools:
|
|
15
15
|
|
|
@@ -21,7 +21,7 @@ Local dispatch tools:
|
|
|
21
21
|
npm install @wireweave/sdk
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Requires Node.js
|
|
24
|
+
Requires Node.js >=22.13.0.
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
@@ -33,21 +33,25 @@ const apiConfig: ApiConfig = {
|
|
|
33
33
|
apiKey: process.env.WIREWEAVE_API_KEY ?? '', // empty is fine for local tools
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
const source = 'page "Home" { text "Hello" }'
|
|
37
|
+
|
|
36
38
|
// Local tool — runs in-process, no network, no key needed.
|
|
37
39
|
const parsed = await dispatch(
|
|
38
40
|
'wireweave_parse',
|
|
39
|
-
{ source
|
|
41
|
+
{ source },
|
|
40
42
|
{ apiConfig, endpoints: toolEndpoints },
|
|
41
43
|
)
|
|
42
44
|
|
|
43
45
|
// Remote tool — proxied to api-server, requires a valid apiKey.
|
|
44
46
|
const saved = await dispatch(
|
|
45
47
|
'wireweave_cloud_save_wireframe',
|
|
46
|
-
{ name: 'Home', source },
|
|
48
|
+
{ name: 'Home', code: source },
|
|
47
49
|
{ apiConfig, endpoints: toolEndpoints },
|
|
48
50
|
)
|
|
49
51
|
```
|
|
50
52
|
|
|
53
|
+
Pass `DispatchOptions.signal` to cancel pending work. Remote calls send the API key as `x-api-key` only to the configured API URL, reject redirects and time out after 30 seconds. Cloud saving/updating transmits supplied source and metadata; local failures never fall back to remote calls. See the [credential and data-flow guide](https://github.com/wireweave/wireweave/tree/main/packages/mcp-server#http-and-credentials) and [Privacy Policy](https://www.wireweave.org/privacy).
|
|
54
|
+
|
|
51
55
|
Run a local tool directly, bypassing dispatch:
|
|
52
56
|
|
|
53
57
|
```ts
|
|
@@ -78,11 +82,11 @@ await clearToken()
|
|
|
78
82
|
| `localDispatch(name, args)` | Runs a local tool in-process (parse, validate, render, diff, analyze, export, etc.). |
|
|
79
83
|
| `isLocalDispatchTool(name)` | `true` if the tool is dispatched locally. |
|
|
80
84
|
| `LOCAL_DISPATCH_TOOL_NAMES` | `ReadonlySet<string>` of local tool names. |
|
|
81
|
-
| `callApi(config, endpoint, args, fetchFn?)`
|
|
85
|
+
| `callApi(config, endpoint, args, fetchFn?, signal?)` | Low-level HTTP call with bounded lifetime and cancellation. |
|
|
82
86
|
| `buildRequest(config, endpoint, args?)` | Builds the URL and `RequestInit` for an endpoint (path params, query, body). |
|
|
83
87
|
| `extractCreditInfo(headers)` / `parseErrorMessage(status, body)` | Credit-header parsing and HTTP-status-to-message mapping. |
|
|
84
88
|
| `loadToken` / `saveToken` / `clearToken` / `verifyToken` / `getConfigPath` | Token persistence and verification. |
|
|
85
|
-
| `tools` / `toolEndpoints`
|
|
89
|
+
| `tools` / `toolEndpoints` / `localToolNames` | Generated, fully annotated definitions and dispatch mappings from the public catalog. |
|
|
86
90
|
| Types | `ApiConfig`, `ApiResult`, `ApiErrorBody`, `HttpMethod`, `ToolEndpoint`, `CreditInfo`, `LocalToolResult`, `LocalToolContentBlock`, `DispatchOptions`, `AuthOptions`, `StoredConfig`, `VerifyTokenResult` |
|
|
87
91
|
|
|
88
92
|
Part of the [Wireweave monorepo](https://github.com/wireweave/wireweave).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
1
|
+
import { Tool, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
|
|
3
3
|
interface ApiConfig {
|
|
4
4
|
apiUrl: string;
|
|
@@ -9,9 +9,9 @@ interface CreditInfo {
|
|
|
9
9
|
monthlyRemaining?: number;
|
|
10
10
|
totalAvailable?: number;
|
|
11
11
|
}
|
|
12
|
-
type HttpMethod
|
|
13
|
-
interface ToolEndpoint
|
|
14
|
-
method: HttpMethod
|
|
12
|
+
type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
13
|
+
interface ToolEndpoint {
|
|
14
|
+
method: HttpMethod;
|
|
15
15
|
path: string;
|
|
16
16
|
pathParams?: string[];
|
|
17
17
|
}
|
|
@@ -33,14 +33,14 @@ interface LocalToolResult {
|
|
|
33
33
|
[key: string]: unknown;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
declare function buildRequest(config: ApiConfig, endpoint: ToolEndpoint
|
|
36
|
+
declare function buildRequest(config: ApiConfig, endpoint: ToolEndpoint, args?: Record<string, unknown>): {
|
|
37
37
|
url: string;
|
|
38
38
|
options: RequestInit;
|
|
39
39
|
bodyForGet: Record<string, unknown>;
|
|
40
40
|
};
|
|
41
41
|
declare function parseErrorMessage(status: number, error: ApiErrorBody): string;
|
|
42
42
|
declare function extractCreditInfo(headers: Headers): CreditInfo;
|
|
43
|
-
declare function callApi(config: ApiConfig, endpoint: ToolEndpoint
|
|
43
|
+
declare function callApi(config: ApiConfig, endpoint: ToolEndpoint, args?: Record<string, unknown>, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<unknown>;
|
|
44
44
|
|
|
45
45
|
interface StoredConfig {
|
|
46
46
|
token: string;
|
|
@@ -67,31 +67,25 @@ declare function localDispatch(toolName: string, args: Record<string, unknown>):
|
|
|
67
67
|
|
|
68
68
|
interface DispatchOptions {
|
|
69
69
|
apiConfig: ApiConfig;
|
|
70
|
-
endpoints: Record<string, ToolEndpoint
|
|
70
|
+
endpoints: Record<string, ToolEndpoint>;
|
|
71
71
|
fetchFn?: typeof fetch;
|
|
72
|
+
signal?: AbortSignal;
|
|
72
73
|
}
|
|
73
74
|
declare function dispatch(toolName: string, args: Record<string, unknown>, options: DispatchOptions): Promise<LocalToolResult>;
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* This file is generated by the Wireweave team.
|
|
81
|
-
* To request changes, please open an issue at:
|
|
82
|
-
* https://github.com/wireweave/mcp-server/issues
|
|
83
|
-
*
|
|
84
|
-
* Generated: 2026-05-17T13:36:37.806Z
|
|
85
|
-
* Public tools: 32 (local: 9, server: 23)
|
|
77
|
+
* AUTO-GENERATED. Do not edit directly.
|
|
78
|
+
* Source: packages/sdk/src/tool-catalog.json
|
|
79
|
+
* Regenerate: node scripts/generate-tool-catalog.mjs --write
|
|
80
|
+
* Verify: node scripts/generate-tool-catalog.mjs --check
|
|
86
81
|
*/
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
type
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
pathParams?: string[];
|
|
94
|
-
}
|
|
83
|
+
type RequiredToolAnnotations = Required<Pick<ToolAnnotations, 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'>>;
|
|
84
|
+
type AnnotatedTool = Tool & {
|
|
85
|
+
annotations: RequiredToolAnnotations;
|
|
86
|
+
};
|
|
87
|
+
declare const tools: AnnotatedTool[];
|
|
95
88
|
declare const toolEndpoints: Record<string, ToolEndpoint>;
|
|
89
|
+
declare const localToolNames: ReadonlySet<string>;
|
|
96
90
|
|
|
97
|
-
export { type ApiConfig, type ApiErrorBody, type ApiResult, type AuthOptions, type CreditInfo, type DispatchOptions, type HttpMethod
|
|
91
|
+
export { type AnnotatedTool, type ApiConfig, type ApiErrorBody, type ApiResult, type AuthOptions, type CreditInfo, type DispatchOptions, type HttpMethod, LOCAL_DISPATCH_TOOL_NAMES, type LocalToolContentBlock, type LocalToolResult, type RequiredToolAnnotations, type StoredConfig, type ToolEndpoint, type VerifyTokenResult, buildRequest, callApi, clearToken, dispatch, extractCreditInfo, getConfigPath, isLocalDispatchTool, loadToken, localDispatch, localToolNames, parseErrorMessage, saveToken, toolEndpoints, tools, verifyToken };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import { parse, validate, renderToHtml, render, diff, exportToJson, exportToFigma, analyze, walkDocument } from '@wireweave/core';
|
|
5
5
|
import { validateUX } from '@wireweave/ux-rules';
|
|
6
6
|
import { ALL_COMPONENTS } from '@wireweave/language-data';
|
|
7
|
+
import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv-provider.js';
|
|
7
8
|
|
|
8
9
|
// src/client.ts
|
|
9
10
|
var MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT"]);
|
|
@@ -17,18 +18,20 @@ function stringifyParam(value) {
|
|
|
17
18
|
function buildRequest(config, endpoint, args) {
|
|
18
19
|
let path2 = endpoint.path;
|
|
19
20
|
const body = { ...args };
|
|
20
|
-
if (endpoint.pathParams
|
|
21
|
+
if (endpoint.pathParams) {
|
|
21
22
|
for (const param of endpoint.pathParams) {
|
|
22
|
-
const value = args[param];
|
|
23
|
-
if (value !==
|
|
24
|
-
|
|
25
|
-
delete body[param];
|
|
23
|
+
const value = args?.[param];
|
|
24
|
+
if (typeof value !== "string" && typeof value !== "number" || value === "" || value === "." || value === ".." || typeof value === "number" && !Number.isFinite(value)) {
|
|
25
|
+
throw new Error(`Invalid or missing path parameter: ${param}`);
|
|
26
26
|
}
|
|
27
|
+
path2 = path2.replace(`:${param}`, encodeURIComponent(String(value)));
|
|
28
|
+
delete body[param];
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
let url = `${config.apiUrl}${path2}`;
|
|
30
32
|
const options = {
|
|
31
33
|
method: endpoint.method,
|
|
34
|
+
redirect: "error",
|
|
32
35
|
headers: {
|
|
33
36
|
"Content-Type": "application/json",
|
|
34
37
|
"x-api-key": config.apiKey
|
|
@@ -74,18 +77,23 @@ function extractCreditInfo(headers) {
|
|
|
74
77
|
totalAvailable: totalAvailable !== null ? parseInt(totalAvailable, 10) : void 0
|
|
75
78
|
};
|
|
76
79
|
}
|
|
77
|
-
async function callApi(config, endpoint, args, fetchFn = fetch) {
|
|
80
|
+
async function callApi(config, endpoint, args, fetchFn = fetch, signal) {
|
|
81
|
+
signal?.throwIfAborted();
|
|
78
82
|
if (!config.apiKey) {
|
|
79
83
|
throw new Error("WIREWEAVE_API_KEY environment variable is required");
|
|
80
84
|
}
|
|
81
85
|
const { url, options } = buildRequest(config, endpoint, args);
|
|
86
|
+
const timeout = AbortSignal.timeout(3e4);
|
|
87
|
+
options.signal = signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
82
88
|
const response = await fetchFn(url, options);
|
|
89
|
+
options.signal.throwIfAborted();
|
|
83
90
|
const creditInfo = extractCreditInfo(response.headers);
|
|
84
91
|
if (!response.ok) {
|
|
85
92
|
const error = await response.json().catch(() => ({ error: "Request failed" }));
|
|
86
93
|
throw new Error(parseErrorMessage(response.status, error));
|
|
87
94
|
}
|
|
88
95
|
const result = await response.json();
|
|
96
|
+
options.signal.throwIfAborted();
|
|
89
97
|
if (typeof result === "object" && result !== null && !Array.isArray(result) && (creditInfo.balance !== void 0 || creditInfo.totalAvailable !== void 0)) {
|
|
90
98
|
return { ...result, _credits: creditInfo };
|
|
91
99
|
}
|
|
@@ -160,6 +168,12 @@ var tools = [
|
|
|
160
168
|
}
|
|
161
169
|
},
|
|
162
170
|
required: ["source"]
|
|
171
|
+
},
|
|
172
|
+
annotations: {
|
|
173
|
+
readOnlyHint: true,
|
|
174
|
+
destructiveHint: false,
|
|
175
|
+
idempotentHint: true,
|
|
176
|
+
openWorldHint: false
|
|
163
177
|
}
|
|
164
178
|
},
|
|
165
179
|
{
|
|
@@ -179,6 +193,12 @@ var tools = [
|
|
|
179
193
|
}
|
|
180
194
|
},
|
|
181
195
|
required: ["source"]
|
|
196
|
+
},
|
|
197
|
+
annotations: {
|
|
198
|
+
readOnlyHint: true,
|
|
199
|
+
destructiveHint: false,
|
|
200
|
+
idempotentHint: true,
|
|
201
|
+
openWorldHint: false
|
|
182
202
|
}
|
|
183
203
|
},
|
|
184
204
|
{
|
|
@@ -188,6 +208,12 @@ var tools = [
|
|
|
188
208
|
type: "object",
|
|
189
209
|
properties: {},
|
|
190
210
|
required: []
|
|
211
|
+
},
|
|
212
|
+
annotations: {
|
|
213
|
+
readOnlyHint: true,
|
|
214
|
+
destructiveHint: false,
|
|
215
|
+
idempotentHint: true,
|
|
216
|
+
openWorldHint: false
|
|
191
217
|
}
|
|
192
218
|
},
|
|
193
219
|
{
|
|
@@ -197,6 +223,12 @@ var tools = [
|
|
|
197
223
|
type: "object",
|
|
198
224
|
properties: {},
|
|
199
225
|
required: []
|
|
226
|
+
},
|
|
227
|
+
annotations: {
|
|
228
|
+
readOnlyHint: true,
|
|
229
|
+
destructiveHint: false,
|
|
230
|
+
idempotentHint: true,
|
|
231
|
+
openWorldHint: false
|
|
200
232
|
}
|
|
201
233
|
},
|
|
202
234
|
{
|
|
@@ -206,6 +238,12 @@ var tools = [
|
|
|
206
238
|
type: "object",
|
|
207
239
|
properties: {},
|
|
208
240
|
required: []
|
|
241
|
+
},
|
|
242
|
+
annotations: {
|
|
243
|
+
readOnlyHint: true,
|
|
244
|
+
destructiveHint: false,
|
|
245
|
+
idempotentHint: true,
|
|
246
|
+
openWorldHint: false
|
|
209
247
|
}
|
|
210
248
|
},
|
|
211
249
|
{
|
|
@@ -227,6 +265,12 @@ var tools = [
|
|
|
227
265
|
}
|
|
228
266
|
},
|
|
229
267
|
required: []
|
|
268
|
+
},
|
|
269
|
+
annotations: {
|
|
270
|
+
readOnlyHint: true,
|
|
271
|
+
destructiveHint: false,
|
|
272
|
+
idempotentHint: true,
|
|
273
|
+
openWorldHint: false
|
|
230
274
|
}
|
|
231
275
|
},
|
|
232
276
|
{
|
|
@@ -241,6 +285,12 @@ var tools = [
|
|
|
241
285
|
}
|
|
242
286
|
},
|
|
243
287
|
required: []
|
|
288
|
+
},
|
|
289
|
+
annotations: {
|
|
290
|
+
readOnlyHint: true,
|
|
291
|
+
destructiveHint: false,
|
|
292
|
+
idempotentHint: true,
|
|
293
|
+
openWorldHint: false
|
|
244
294
|
}
|
|
245
295
|
},
|
|
246
296
|
{
|
|
@@ -266,6 +316,12 @@ var tools = [
|
|
|
266
316
|
}
|
|
267
317
|
},
|
|
268
318
|
required: ["source"]
|
|
319
|
+
},
|
|
320
|
+
annotations: {
|
|
321
|
+
readOnlyHint: true,
|
|
322
|
+
destructiveHint: false,
|
|
323
|
+
idempotentHint: true,
|
|
324
|
+
openWorldHint: false
|
|
269
325
|
}
|
|
270
326
|
},
|
|
271
327
|
{
|
|
@@ -316,6 +372,12 @@ var tools = [
|
|
|
316
372
|
}
|
|
317
373
|
},
|
|
318
374
|
required: ["source"]
|
|
375
|
+
},
|
|
376
|
+
annotations: {
|
|
377
|
+
readOnlyHint: true,
|
|
378
|
+
destructiveHint: false,
|
|
379
|
+
idempotentHint: true,
|
|
380
|
+
openWorldHint: false
|
|
319
381
|
}
|
|
320
382
|
},
|
|
321
383
|
{
|
|
@@ -325,6 +387,12 @@ var tools = [
|
|
|
325
387
|
type: "object",
|
|
326
388
|
properties: {},
|
|
327
389
|
required: []
|
|
390
|
+
},
|
|
391
|
+
annotations: {
|
|
392
|
+
readOnlyHint: true,
|
|
393
|
+
destructiveHint: false,
|
|
394
|
+
idempotentHint: true,
|
|
395
|
+
openWorldHint: false
|
|
328
396
|
}
|
|
329
397
|
},
|
|
330
398
|
{
|
|
@@ -353,6 +421,12 @@ var tools = [
|
|
|
353
421
|
}
|
|
354
422
|
},
|
|
355
423
|
required: ["oldSource", "newSource"]
|
|
424
|
+
},
|
|
425
|
+
annotations: {
|
|
426
|
+
readOnlyHint: true,
|
|
427
|
+
destructiveHint: false,
|
|
428
|
+
idempotentHint: true,
|
|
429
|
+
openWorldHint: false
|
|
356
430
|
}
|
|
357
431
|
},
|
|
358
432
|
{
|
|
@@ -377,6 +451,12 @@ var tools = [
|
|
|
377
451
|
}
|
|
378
452
|
},
|
|
379
453
|
required: ["source"]
|
|
454
|
+
},
|
|
455
|
+
annotations: {
|
|
456
|
+
readOnlyHint: true,
|
|
457
|
+
destructiveHint: false,
|
|
458
|
+
idempotentHint: true,
|
|
459
|
+
openWorldHint: false
|
|
380
460
|
}
|
|
381
461
|
},
|
|
382
462
|
{
|
|
@@ -391,6 +471,12 @@ var tools = [
|
|
|
391
471
|
}
|
|
392
472
|
},
|
|
393
473
|
required: ["source"]
|
|
474
|
+
},
|
|
475
|
+
annotations: {
|
|
476
|
+
readOnlyHint: true,
|
|
477
|
+
destructiveHint: false,
|
|
478
|
+
idempotentHint: true,
|
|
479
|
+
openWorldHint: false
|
|
394
480
|
}
|
|
395
481
|
},
|
|
396
482
|
{
|
|
@@ -430,6 +516,12 @@ var tools = [
|
|
|
430
516
|
}
|
|
431
517
|
},
|
|
432
518
|
required: ["source"]
|
|
519
|
+
},
|
|
520
|
+
annotations: {
|
|
521
|
+
readOnlyHint: true,
|
|
522
|
+
destructiveHint: false,
|
|
523
|
+
idempotentHint: true,
|
|
524
|
+
openWorldHint: false
|
|
433
525
|
}
|
|
434
526
|
},
|
|
435
527
|
{
|
|
@@ -445,6 +537,12 @@ var tools = [
|
|
|
445
537
|
}
|
|
446
538
|
},
|
|
447
539
|
required: []
|
|
540
|
+
},
|
|
541
|
+
annotations: {
|
|
542
|
+
readOnlyHint: true,
|
|
543
|
+
destructiveHint: false,
|
|
544
|
+
idempotentHint: true,
|
|
545
|
+
openWorldHint: false
|
|
448
546
|
}
|
|
449
547
|
},
|
|
450
548
|
{
|
|
@@ -467,6 +565,12 @@ var tools = [
|
|
|
467
565
|
}
|
|
468
566
|
},
|
|
469
567
|
required: ["name"]
|
|
568
|
+
},
|
|
569
|
+
annotations: {
|
|
570
|
+
readOnlyHint: false,
|
|
571
|
+
destructiveHint: false,
|
|
572
|
+
idempotentHint: false,
|
|
573
|
+
openWorldHint: false
|
|
470
574
|
}
|
|
471
575
|
},
|
|
472
576
|
{
|
|
@@ -497,6 +601,12 @@ var tools = [
|
|
|
497
601
|
}
|
|
498
602
|
},
|
|
499
603
|
required: ["id"]
|
|
604
|
+
},
|
|
605
|
+
annotations: {
|
|
606
|
+
readOnlyHint: false,
|
|
607
|
+
destructiveHint: true,
|
|
608
|
+
idempotentHint: true,
|
|
609
|
+
openWorldHint: false
|
|
500
610
|
}
|
|
501
611
|
},
|
|
502
612
|
{
|
|
@@ -528,6 +638,12 @@ var tools = [
|
|
|
528
638
|
}
|
|
529
639
|
},
|
|
530
640
|
required: []
|
|
641
|
+
},
|
|
642
|
+
annotations: {
|
|
643
|
+
readOnlyHint: true,
|
|
644
|
+
destructiveHint: false,
|
|
645
|
+
idempotentHint: true,
|
|
646
|
+
openWorldHint: false
|
|
531
647
|
}
|
|
532
648
|
},
|
|
533
649
|
{
|
|
@@ -542,6 +658,12 @@ var tools = [
|
|
|
542
658
|
}
|
|
543
659
|
},
|
|
544
660
|
required: ["id"]
|
|
661
|
+
},
|
|
662
|
+
annotations: {
|
|
663
|
+
readOnlyHint: true,
|
|
664
|
+
destructiveHint: false,
|
|
665
|
+
idempotentHint: true,
|
|
666
|
+
openWorldHint: false
|
|
545
667
|
}
|
|
546
668
|
},
|
|
547
669
|
{
|
|
@@ -580,6 +702,12 @@ var tools = [
|
|
|
580
702
|
}
|
|
581
703
|
},
|
|
582
704
|
required: ["name", "code"]
|
|
705
|
+
},
|
|
706
|
+
annotations: {
|
|
707
|
+
readOnlyHint: false,
|
|
708
|
+
destructiveHint: false,
|
|
709
|
+
idempotentHint: false,
|
|
710
|
+
openWorldHint: true
|
|
583
711
|
}
|
|
584
712
|
},
|
|
585
713
|
{
|
|
@@ -617,6 +745,12 @@ var tools = [
|
|
|
617
745
|
}
|
|
618
746
|
},
|
|
619
747
|
required: ["id"]
|
|
748
|
+
},
|
|
749
|
+
annotations: {
|
|
750
|
+
readOnlyHint: false,
|
|
751
|
+
destructiveHint: true,
|
|
752
|
+
idempotentHint: false,
|
|
753
|
+
openWorldHint: true
|
|
620
754
|
}
|
|
621
755
|
},
|
|
622
756
|
{
|
|
@@ -631,6 +765,12 @@ var tools = [
|
|
|
631
765
|
}
|
|
632
766
|
},
|
|
633
767
|
required: ["id"]
|
|
768
|
+
},
|
|
769
|
+
annotations: {
|
|
770
|
+
readOnlyHint: false,
|
|
771
|
+
destructiveHint: true,
|
|
772
|
+
idempotentHint: true,
|
|
773
|
+
openWorldHint: true
|
|
634
774
|
}
|
|
635
775
|
},
|
|
636
776
|
{
|
|
@@ -645,6 +785,12 @@ var tools = [
|
|
|
645
785
|
}
|
|
646
786
|
},
|
|
647
787
|
required: ["wireframeId"]
|
|
788
|
+
},
|
|
789
|
+
annotations: {
|
|
790
|
+
readOnlyHint: true,
|
|
791
|
+
destructiveHint: false,
|
|
792
|
+
idempotentHint: true,
|
|
793
|
+
openWorldHint: false
|
|
648
794
|
}
|
|
649
795
|
},
|
|
650
796
|
{
|
|
@@ -663,6 +809,12 @@ var tools = [
|
|
|
663
809
|
}
|
|
664
810
|
},
|
|
665
811
|
required: ["wireframeId", "version"]
|
|
812
|
+
},
|
|
813
|
+
annotations: {
|
|
814
|
+
readOnlyHint: false,
|
|
815
|
+
destructiveHint: true,
|
|
816
|
+
idempotentHint: false,
|
|
817
|
+
openWorldHint: true
|
|
666
818
|
}
|
|
667
819
|
},
|
|
668
820
|
{
|
|
@@ -694,6 +846,12 @@ var tools = [
|
|
|
694
846
|
}
|
|
695
847
|
},
|
|
696
848
|
required: ["wireframeId"]
|
|
849
|
+
},
|
|
850
|
+
annotations: {
|
|
851
|
+
readOnlyHint: false,
|
|
852
|
+
destructiveHint: false,
|
|
853
|
+
idempotentHint: false,
|
|
854
|
+
openWorldHint: true
|
|
697
855
|
}
|
|
698
856
|
},
|
|
699
857
|
{
|
|
@@ -708,6 +866,12 @@ var tools = [
|
|
|
708
866
|
}
|
|
709
867
|
},
|
|
710
868
|
required: ["wireframeId"]
|
|
869
|
+
},
|
|
870
|
+
annotations: {
|
|
871
|
+
readOnlyHint: true,
|
|
872
|
+
destructiveHint: false,
|
|
873
|
+
idempotentHint: true,
|
|
874
|
+
openWorldHint: false
|
|
711
875
|
}
|
|
712
876
|
},
|
|
713
877
|
{
|
|
@@ -730,6 +894,12 @@ var tools = [
|
|
|
730
894
|
}
|
|
731
895
|
},
|
|
732
896
|
required: ["wireframeId", "versionA", "versionB"]
|
|
897
|
+
},
|
|
898
|
+
annotations: {
|
|
899
|
+
readOnlyHint: true,
|
|
900
|
+
destructiveHint: false,
|
|
901
|
+
idempotentHint: true,
|
|
902
|
+
openWorldHint: false
|
|
733
903
|
}
|
|
734
904
|
},
|
|
735
905
|
{
|
|
@@ -739,6 +909,12 @@ var tools = [
|
|
|
739
909
|
type: "object",
|
|
740
910
|
properties: {},
|
|
741
911
|
required: []
|
|
912
|
+
},
|
|
913
|
+
annotations: {
|
|
914
|
+
readOnlyHint: true,
|
|
915
|
+
destructiveHint: false,
|
|
916
|
+
idempotentHint: true,
|
|
917
|
+
openWorldHint: false
|
|
742
918
|
}
|
|
743
919
|
},
|
|
744
920
|
{
|
|
@@ -748,6 +924,12 @@ var tools = [
|
|
|
748
924
|
type: "object",
|
|
749
925
|
properties: {},
|
|
750
926
|
required: []
|
|
927
|
+
},
|
|
928
|
+
annotations: {
|
|
929
|
+
readOnlyHint: true,
|
|
930
|
+
destructiveHint: false,
|
|
931
|
+
idempotentHint: true,
|
|
932
|
+
openWorldHint: false
|
|
751
933
|
}
|
|
752
934
|
},
|
|
753
935
|
{
|
|
@@ -768,6 +950,12 @@ var tools = [
|
|
|
768
950
|
}
|
|
769
951
|
},
|
|
770
952
|
required: []
|
|
953
|
+
},
|
|
954
|
+
annotations: {
|
|
955
|
+
readOnlyHint: true,
|
|
956
|
+
destructiveHint: false,
|
|
957
|
+
idempotentHint: true,
|
|
958
|
+
openWorldHint: false
|
|
771
959
|
}
|
|
772
960
|
},
|
|
773
961
|
{
|
|
@@ -777,6 +965,12 @@ var tools = [
|
|
|
777
965
|
type: "object",
|
|
778
966
|
properties: {},
|
|
779
967
|
required: []
|
|
968
|
+
},
|
|
969
|
+
annotations: {
|
|
970
|
+
readOnlyHint: true,
|
|
971
|
+
destructiveHint: false,
|
|
972
|
+
idempotentHint: true,
|
|
973
|
+
openWorldHint: false
|
|
780
974
|
}
|
|
781
975
|
},
|
|
782
976
|
{
|
|
@@ -799,38 +993,98 @@ var tools = [
|
|
|
799
993
|
}
|
|
800
994
|
},
|
|
801
995
|
required: []
|
|
996
|
+
},
|
|
997
|
+
annotations: {
|
|
998
|
+
readOnlyHint: true,
|
|
999
|
+
destructiveHint: false,
|
|
1000
|
+
idempotentHint: true,
|
|
1001
|
+
openWorldHint: true
|
|
802
1002
|
}
|
|
803
1003
|
}
|
|
804
1004
|
];
|
|
805
1005
|
var toolEndpoints = {
|
|
806
|
-
wireweave_parse: {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1006
|
+
wireweave_parse: {
|
|
1007
|
+
method: "POST",
|
|
1008
|
+
path: "/tools/parse"
|
|
1009
|
+
},
|
|
1010
|
+
wireweave_validate: {
|
|
1011
|
+
method: "POST",
|
|
1012
|
+
path: "/tools/validate"
|
|
1013
|
+
},
|
|
1014
|
+
wireweave_grammar: {
|
|
1015
|
+
method: "GET",
|
|
1016
|
+
path: "/tools/grammar"
|
|
1017
|
+
},
|
|
1018
|
+
wireweave_guide: {
|
|
1019
|
+
method: "GET",
|
|
1020
|
+
path: "/tools/guide"
|
|
1021
|
+
},
|
|
1022
|
+
wireweave_patterns: {
|
|
1023
|
+
method: "GET",
|
|
1024
|
+
path: "/tools/patterns"
|
|
1025
|
+
},
|
|
1026
|
+
wireweave_examples: {
|
|
1027
|
+
method: "GET",
|
|
1028
|
+
path: "/tools/examples"
|
|
1029
|
+
},
|
|
1030
|
+
wireweave_list_components: {
|
|
1031
|
+
method: "GET",
|
|
1032
|
+
path: "/tools/list-components"
|
|
1033
|
+
},
|
|
1034
|
+
wireweave_render_html_code: {
|
|
1035
|
+
method: "POST",
|
|
1036
|
+
path: "/tools/render/html"
|
|
1037
|
+
},
|
|
1038
|
+
wireweave_validate_ux: {
|
|
1039
|
+
method: "POST",
|
|
1040
|
+
path: "/tools/validate/ux"
|
|
1041
|
+
},
|
|
1042
|
+
wireweave_ux_rules: {
|
|
1043
|
+
method: "GET",
|
|
1044
|
+
path: "/tools/ux-rules"
|
|
1045
|
+
},
|
|
1046
|
+
wireweave_diff: {
|
|
1047
|
+
method: "POST",
|
|
1048
|
+
path: "/tools/diff"
|
|
1049
|
+
},
|
|
1050
|
+
wireweave_export_json: {
|
|
1051
|
+
method: "POST",
|
|
1052
|
+
path: "/tools/export/json"
|
|
1053
|
+
},
|
|
1054
|
+
wireweave_export_figma: {
|
|
1055
|
+
method: "POST",
|
|
1056
|
+
path: "/tools/export/figma"
|
|
1057
|
+
},
|
|
1058
|
+
wireweave_analyze: {
|
|
1059
|
+
method: "POST",
|
|
1060
|
+
path: "/tools/analyze"
|
|
1061
|
+
},
|
|
1062
|
+
wireweave_cloud_list_projects: {
|
|
1063
|
+
method: "GET",
|
|
1064
|
+
path: "/cloud/projects"
|
|
1065
|
+
},
|
|
1066
|
+
wireweave_cloud_create_project: {
|
|
1067
|
+
method: "POST",
|
|
1068
|
+
path: "/cloud/projects"
|
|
1069
|
+
},
|
|
822
1070
|
wireweave_cloud_update_project: {
|
|
823
1071
|
method: "PATCH",
|
|
824
1072
|
path: "/cloud/projects/:id",
|
|
825
1073
|
pathParams: ["id"]
|
|
826
1074
|
},
|
|
827
|
-
wireweave_cloud_list_wireframes: {
|
|
1075
|
+
wireweave_cloud_list_wireframes: {
|
|
1076
|
+
method: "GET",
|
|
1077
|
+
path: "/cloud/wireframes"
|
|
1078
|
+
},
|
|
828
1079
|
wireweave_cloud_get_wireframe: {
|
|
829
1080
|
method: "GET",
|
|
830
1081
|
path: "/cloud/wireframes/:id",
|
|
831
1082
|
pathParams: ["id"]
|
|
832
1083
|
},
|
|
833
|
-
wireweave_cloud_save_wireframe: {
|
|
1084
|
+
wireweave_cloud_save_wireframe: {
|
|
1085
|
+
method: "POST",
|
|
1086
|
+
path: "/cloud/wireframes"
|
|
1087
|
+
},
|
|
834
1088
|
wireweave_cloud_update_wireframe: {
|
|
835
1089
|
method: "PATCH",
|
|
836
1090
|
path: "/cloud/wireframes/:id",
|
|
@@ -866,11 +1120,26 @@ var toolEndpoints = {
|
|
|
866
1120
|
path: "/cloud/wireframes/:wireframeId/diff",
|
|
867
1121
|
pathParams: ["wireframeId"]
|
|
868
1122
|
},
|
|
869
|
-
wireweave_account_balance: {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1123
|
+
wireweave_account_balance: {
|
|
1124
|
+
method: "GET",
|
|
1125
|
+
path: "/billing/balance"
|
|
1126
|
+
},
|
|
1127
|
+
wireweave_account_subscription: {
|
|
1128
|
+
method: "GET",
|
|
1129
|
+
path: "/billing/subscription"
|
|
1130
|
+
},
|
|
1131
|
+
wireweave_account_transactions: {
|
|
1132
|
+
method: "GET",
|
|
1133
|
+
path: "/billing/transactions"
|
|
1134
|
+
},
|
|
1135
|
+
wireweave_pricing: {
|
|
1136
|
+
method: "GET",
|
|
1137
|
+
path: "/billing/pricing"
|
|
1138
|
+
},
|
|
1139
|
+
wireweave_gallery: {
|
|
1140
|
+
method: "GET",
|
|
1141
|
+
path: "/cloud/gallery"
|
|
1142
|
+
}
|
|
874
1143
|
};
|
|
875
1144
|
var localToolNames = /* @__PURE__ */ new Set([
|
|
876
1145
|
"wireweave_parse",
|
|
@@ -1128,18 +1397,32 @@ function analyzeTool(args) {
|
|
|
1128
1397
|
});
|
|
1129
1398
|
}
|
|
1130
1399
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1400
|
+
var catalog = new Map(tools.map((tool) => [tool.name, tool]));
|
|
1401
|
+
var validators = /* @__PURE__ */ new Map();
|
|
1402
|
+
var schemaValidator;
|
|
1133
1403
|
async function dispatch(toolName, args, options) {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
}
|
|
1137
|
-
const endpoint = options.endpoints[toolName];
|
|
1138
|
-
if (!endpoint) {
|
|
1404
|
+
const tool = catalog.get(toolName);
|
|
1405
|
+
if (!tool) {
|
|
1139
1406
|
return errorResult2(`Unknown tool: ${toolName}`);
|
|
1140
1407
|
}
|
|
1141
1408
|
try {
|
|
1142
|
-
|
|
1409
|
+
options.signal?.throwIfAborted();
|
|
1410
|
+
let validate2 = validators.get(toolName);
|
|
1411
|
+
if (!validate2) {
|
|
1412
|
+
schemaValidator ??= new AjvJsonSchemaValidator();
|
|
1413
|
+
validate2 = schemaValidator.getValidator(tool.inputSchema);
|
|
1414
|
+
validators.set(toolName, validate2);
|
|
1415
|
+
}
|
|
1416
|
+
const validation = validate2(args);
|
|
1417
|
+
if (!validation.valid) {
|
|
1418
|
+
return errorResult2(`Invalid arguments for ${toolName}: ${validation.errorMessage}`);
|
|
1419
|
+
}
|
|
1420
|
+
if (isLocalDispatchTool(toolName)) {
|
|
1421
|
+
return localDispatch(toolName, args);
|
|
1422
|
+
}
|
|
1423
|
+
const endpoint = Object.hasOwn(options.endpoints, toolName) ? options.endpoints[toolName] : void 0;
|
|
1424
|
+
if (!endpoint) return errorResult2(`Unknown tool: ${toolName}`);
|
|
1425
|
+
const result = await callApi(options.apiConfig, endpoint, args, options.fetchFn, options.signal);
|
|
1143
1426
|
return successResult2(result);
|
|
1144
1427
|
} catch (err) {
|
|
1145
1428
|
return errorResult2(err instanceof Error ? err.message : "Unknown error");
|
|
@@ -1160,6 +1443,6 @@ function errorResult2(message) {
|
|
|
1160
1443
|
return { content: [block], isError: true };
|
|
1161
1444
|
}
|
|
1162
1445
|
|
|
1163
|
-
export { LOCAL_DISPATCH_TOOL_NAMES, buildRequest, callApi, clearToken, dispatch, extractCreditInfo, getConfigPath, isLocalDispatchTool, loadToken, localDispatch, parseErrorMessage, saveToken, toolEndpoints, tools, verifyToken };
|
|
1446
|
+
export { LOCAL_DISPATCH_TOOL_NAMES, buildRequest, callApi, clearToken, dispatch, extractCreditInfo, getConfigPath, isLocalDispatchTool, loadToken, localDispatch, localToolNames, parseErrorMessage, saveToken, toolEndpoints, tools, verifyToken };
|
|
1164
1447
|
//# sourceMappingURL=index.js.map
|
|
1165
1448
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/auth.ts","../src/generated/tools.ts","../src/local-dispatcher.ts","../src/dispatcher.ts"],"names":["path","fs","errorResult","successResult"],"mappings":";;;;;;;;AAEA,IAAM,mCAAmB,IAAI,GAAA,CAAI,CAAC,MAAA,EAAQ,OAAA,EAAS,KAAK,CAAC,CAAA;AAEzD,SAAS,eAAe,KAAA,EAAwB;AAC9C,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,OAAO,UAAU,SAAA,IAAa,OAAO,UAAU,QAAA,EAAU;AACxF,IAAA,OAAO,OAAO,KAA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ACnC,IAAA,EAAM,MAAA;AAAA,IACN,IAAA,EAAM,KAAK,SAAA,CAAU,EAAE,OAAO,OAAA,EAAQ,EAAG,MAAM,CAAC;AAAA,GAClD;AACA,EAAA,OAAO,EAAE,OAAA,EAAS,CAAC,KAAK,CAAA,EAAG,SAAS,IAAA,EAAK;AAC3C","file":"index.js","sourcesContent":["import type { ApiConfig, ApiErrorBody, CreditInfo, ToolEndpoint } from './types.js'\n\nconst MUTATING_METHODS = new Set(['POST', 'PATCH', 'PUT'])\n\nfunction stringifyParam(value: unknown): string {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {\n return String(value)\n }\n return JSON.stringify(value)\n}\n\nexport function buildRequest(\n config: ApiConfig,\n endpoint: ToolEndpoint,\n args?: Record<string, unknown>,\n): { url: string; options: RequestInit; bodyForGet: Record<string, unknown> } {\n let path = endpoint.path\n const body: Record<string, unknown> = { ...args }\n\n if (endpoint.pathParams && args) {\n for (const param of endpoint.pathParams) {\n const value = args[param]\n if (value !== undefined) {\n path = path.replace(`:${param}`, stringifyParam(value))\n delete body[param]\n }\n }\n }\n\n let url = `${config.apiUrl}${path}`\n const options: RequestInit = {\n method: endpoint.method,\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': config.apiKey,\n },\n }\n\n if (MUTATING_METHODS.has(endpoint.method) && Object.keys(body).length > 0) {\n options.body = JSON.stringify(body)\n } else if (endpoint.method === 'GET' && Object.keys(body).length > 0) {\n const params = new URLSearchParams()\n for (const [key, value] of Object.entries(body)) {\n if (value === undefined || value === null) continue\n if (Array.isArray(value)) {\n params.append(key, value.map(stringifyParam).join(','))\n } else {\n params.append(key, stringifyParam(value))\n }\n }\n url = `${url}?${params.toString()}`\n }\n\n return { url, options, bodyForGet: body }\n}\n\nexport function parseErrorMessage(status: number, error: ApiErrorBody): string {\n if (status === 401) return 'Invalid API key. Get one at https://wireweave.org'\n if (status === 402) return `Insufficient credits. ${error.message ?? 'Please add more credits.'}`\n if (status === 403) return 'Access denied. Upgrade your plan for this feature.'\n if (status === 404 && error.error?.includes('project')) {\n return 'Project not found. Call wireweave_cloud_list_projects to see available projects.'\n }\n if (status === 400 && error.error?.includes('name')) {\n return 'Invalid wireframe name. Provide a non-empty name for the wireframe.'\n }\n if (status === 429) return 'Rate limit exceeded. Please wait and try again.'\n if (status >= 500) return 'Service temporarily unavailable'\n return error.error ?? error.message ?? 'Request failed'\n}\n\nexport function extractCreditInfo(headers: Headers): CreditInfo {\n const balance = headers.get('X-Credits-Balance')\n const monthlyRemaining = headers.get('X-Credits-Monthly-Remaining')\n const totalAvailable = headers.get('X-Credits-Total-Available')\n return {\n balance: balance !== null ? parseInt(balance, 10) : undefined,\n monthlyRemaining: monthlyRemaining !== null ? parseInt(monthlyRemaining, 10) : undefined,\n totalAvailable: totalAvailable !== null ? parseInt(totalAvailable, 10) : undefined,\n }\n}\n\nexport async function callApi(\n config: ApiConfig,\n endpoint: ToolEndpoint,\n args?: Record<string, unknown>,\n fetchFn: typeof fetch = fetch,\n): Promise<unknown> {\n if (!config.apiKey) {\n throw new Error('WIREWEAVE_API_KEY environment variable is required')\n }\n\n const { url, options } = buildRequest(config, endpoint, args)\n\n const response = await fetchFn(url, options)\n const creditInfo = extractCreditInfo(response.headers)\n\n if (!response.ok) {\n const error = (await response.json().catch(() => ({ error: 'Request failed' }))) as ApiErrorBody\n throw new Error(parseErrorMessage(response.status, error))\n }\n\n const result = (await response.json()) as unknown\n\n if (\n typeof result === 'object' &&\n result !== null &&\n !Array.isArray(result) &&\n (creditInfo.balance !== undefined || creditInfo.totalAvailable !== undefined)\n ) {\n return { ...result, _credits: creditInfo }\n }\n\n return result\n}\n","import { promises as fs } from 'node:fs'\nimport os from 'node:os'\nimport path from 'node:path'\n\nexport interface StoredConfig {\n token: string\n apiUrl?: string\n}\n\nexport interface AuthOptions {\n configDir?: string\n configFileName?: string\n}\n\nconst DEFAULT_CONFIG_DIR_NAME = '.wireweave'\nconst DEFAULT_CONFIG_FILE_NAME = 'config.json'\n\nfunction resolveConfigDir(opts?: AuthOptions): string {\n return opts?.configDir ?? path.join(os.homedir(), DEFAULT_CONFIG_DIR_NAME)\n}\n\nexport function getConfigPath(opts?: AuthOptions): string {\n return path.join(resolveConfigDir(opts), opts?.configFileName ?? DEFAULT_CONFIG_FILE_NAME)\n}\n\nexport async function loadToken(opts?: AuthOptions): Promise<StoredConfig | null> {\n try {\n const raw = await fs.readFile(getConfigPath(opts), 'utf8')\n const parsed = JSON.parse(raw) as Partial<StoredConfig>\n if (typeof parsed.token !== 'string' || parsed.token.length === 0) {\n return null\n }\n return {\n token: parsed.token,\n apiUrl: typeof parsed.apiUrl === 'string' ? parsed.apiUrl : undefined,\n }\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'ENOENT') return null\n return null\n }\n}\n\nexport async function saveToken(config: StoredConfig, opts?: AuthOptions): Promise<void> {\n const configDir = resolveConfigDir(opts)\n await fs.mkdir(configDir, { recursive: true, mode: 0o700 })\n await fs.writeFile(getConfigPath(opts), JSON.stringify(config, null, 2), { mode: 0o600 })\n}\n\nexport async function clearToken(opts?: AuthOptions): Promise<void> {\n try {\n await fs.unlink(getConfigPath(opts))\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code !== 'ENOENT') throw err\n }\n}\n\nexport interface VerifyTokenResult {\n valid: boolean\n status: number\n body?: unknown\n}\n\nexport async function verifyToken(\n token: string,\n apiUrl: string,\n verifyEndpoint: string,\n fetchFn: typeof fetch = fetch,\n): Promise<VerifyTokenResult> {\n const url = `${apiUrl}${verifyEndpoint}`\n const response = await fetchFn(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': token,\n },\n })\n const body = (await response.json().catch(() => undefined)) as unknown\n return {\n valid: response.ok,\n status: response.status,\n body,\n }\n}\n","/**\n * MCP Tool Definitions\n *\n * ⚠️ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY\n *\n * This file is generated by the Wireweave team.\n * To request changes, please open an issue at:\n * https://github.com/wireweave/mcp-server/issues\n *\n * Generated: 2026-05-17T13:36:37.806Z\n * Public tools: 32 (local: 9, server: 23)\n */\n\nimport type { Tool } from '@modelcontextprotocol/sdk/types.js'\n\n// Tool definitions\nexport const tools: Tool[] = [\n {\n name: 'wireweave_parse',\n description: 'Parse Wireweave DSL source code into an AST (Abstract Syntax Tree)',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to parse',\n },\n },\n required: ['source'],\n },\n },\n {\n name: 'wireweave_validate',\n description:\n 'Validate Wireweave DSL syntax without generating output. Use strict mode to also check for unknown attributes.',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to validate',\n },\n strict: {\n type: 'boolean',\n description:\n 'Enable strict mode to also validate that only known attributes are used. Recommended for catching typos and incorrect attribute names.',\n default: false,\n },\n },\n required: ['source'],\n },\n },\n {\n name: 'wireweave_grammar',\n description: 'Get the Wireweave DSL grammar documentation and syntax reference',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n {\n name: 'wireweave_guide',\n description:\n 'Get the comprehensive LLM guide for Wireweave DSL. This is the PRIMARY resource for learning the language - includes syntax, components, patterns, and best practices. Call this FIRST before generating wireframes.',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n {\n name: 'wireweave_patterns',\n description:\n 'Get common layout patterns for wireframes including headers, sidebars, forms, cards, and more. Use these as building blocks.',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n {\n name: 'wireweave_examples',\n description:\n 'Get Wireweave code examples. Use this to learn patterns and best practices for different UI types.',\n inputSchema: {\n type: 'object',\n properties: {\n category: {\n type: 'string',\n enum: ['all', 'basic', 'layout', 'navigation', 'form', 'dashboard'],\n description:\n 'Filter examples by category. Use \"all\" to get all examples. Categories cover generic component compositions (basic, layout, navigation, form) and a domain-agnostic dashboard shell.',\n default: 'all',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of examples to return',\n default: 5,\n },\n },\n required: [],\n },\n },\n {\n name: 'wireweave_list_components',\n description:\n 'List Wireweave DSL components with their categories, attributes, and examples. Use this to discover available components for wireframe generation. Filter by category (layout, navigation, form, etc.) when narrowing the search.',\n inputSchema: {\n type: 'object',\n properties: {\n category: {\n type: 'string',\n description:\n 'Filter components by category (e.g., \"layout\", \"navigation\", \"form\", \"content\", \"interaction\"). Omit to return all components.',\n },\n },\n required: [],\n },\n },\n {\n name: 'wireweave_render_html_code',\n description:\n 'Render Wireweave DSL to HTML code. Returns the HTML content directly. This is an alias for wireweave_render_html with explicit naming.',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to render',\n },\n theme: {\n type: 'string',\n enum: ['light', 'dark'],\n description: 'Color theme for rendering',\n default: 'light',\n },\n fullDocument: {\n type: 'boolean',\n description: 'Return a complete HTML document instead of fragment',\n default: false,\n },\n },\n required: ['source'],\n },\n },\n {\n name: 'wireweave_validate_ux',\n description:\n 'Validate Wireweave DSL for UX best practices. Returns issues with severity levels and actionable recommendations.',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to validate',\n },\n categories: {\n type: 'array',\n items: {\n type: 'string',\n enum: [\n 'accessibility',\n 'usability',\n 'form',\n 'touch-target',\n 'consistency',\n 'navigation',\n 'feedback',\n 'content',\n 'data-display',\n 'interaction',\n ],\n },\n description: 'UX rule categories to check. If not specified, all categories are checked.',\n },\n minSeverity: {\n type: 'string',\n enum: ['error', 'warning', 'info'],\n description: 'Minimum severity level to report',\n default: 'info',\n },\n maxIssues: {\n type: 'number',\n description: 'Maximum number of issues to return',\n },\n disabledRules: {\n type: 'array',\n items: {\n type: 'string',\n },\n description:\n 'List of rule IDs to disable (e.g., [\"a11y-input-label\", \"form-submit-button\"])',\n },\n },\n required: ['source'],\n },\n },\n {\n name: 'wireweave_ux_rules',\n description: 'Get available UX rule categories and their descriptions',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n {\n name: 'wireweave_diff',\n description: 'Compare two Wireweave DSL sources and return the differences between them',\n inputSchema: {\n type: 'object',\n properties: {\n oldSource: {\n type: 'string',\n description: 'The original Wireweave DSL source code',\n },\n newSource: {\n type: 'string',\n description: 'The modified Wireweave DSL source code',\n },\n ignoreAttributes: {\n type: 'boolean',\n description: 'Ignore attribute changes, only compare structure',\n default: false,\n },\n ignoreOrder: {\n type: 'boolean',\n description: 'Ignore the order of children when comparing',\n default: false,\n },\n },\n required: ['oldSource', 'newSource'],\n },\n },\n {\n name: 'wireweave_export_json',\n description: 'Export Wireweave DSL to JSON format',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to export',\n },\n includeLocations: {\n type: 'boolean',\n description: 'Include source location information in output',\n default: false,\n },\n prettyPrint: {\n type: 'boolean',\n description: 'Format JSON with indentation',\n default: true,\n },\n },\n required: ['source'],\n },\n },\n {\n name: 'wireweave_export_figma',\n description: 'Export Wireweave DSL to Figma-compatible format',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to export',\n },\n },\n required: ['source'],\n },\n },\n {\n name: 'wireweave_analyze',\n description:\n 'Analyze Wireweave DSL for statistics and metrics including component usage, tree structure, accessibility score, and complexity',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to analyze',\n },\n includeComponentBreakdown: {\n type: 'boolean',\n description: 'Include detailed component usage breakdown',\n default: true,\n },\n includeAccessibility: {\n type: 'boolean',\n description: 'Include accessibility analysis',\n default: true,\n },\n includeComplexity: {\n type: 'boolean',\n description: 'Include complexity metrics',\n default: true,\n },\n includeLayout: {\n type: 'boolean',\n description: 'Include layout pattern analysis',\n default: true,\n },\n includeContent: {\n type: 'boolean',\n description: 'Include content analysis',\n default: true,\n },\n },\n required: ['source'],\n },\n },\n {\n name: 'wireweave_cloud_list_projects',\n description:\n 'List all your Wireweave projects. Projects help organize your wireframes. WORKFLOW: Call this first before saving wireframes. If the list is empty, ask the user whether to create a new project (call wireweave_cloud_create_project) or use the default project.',\n inputSchema: {\n type: 'object',\n properties: {\n includeArchived: {\n type: 'boolean',\n description: 'Include archived projects',\n default: false,\n },\n },\n required: [],\n },\n },\n {\n name: 'wireweave_cloud_create_project',\n description:\n 'Create a new project to organize wireframes. Use this when the user wants to organize their wireframes into a specific project. The project can have a custom name, description, and color.',\n inputSchema: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'Project name',\n },\n description: {\n type: 'string',\n description: 'Project description',\n },\n color: {\n type: 'string',\n description: 'Project color (hex code, e.g., #6366f1)',\n },\n },\n required: ['name'],\n },\n },\n {\n name: 'wireweave_cloud_update_project',\n description: 'Update an existing project',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Project ID to update',\n },\n name: {\n type: 'string',\n description: 'New project name',\n },\n description: {\n type: 'string',\n description: 'New project description',\n },\n color: {\n type: 'string',\n description: 'New project color (hex code)',\n },\n isArchived: {\n type: 'boolean',\n description: 'Archive or unarchive the project',\n },\n },\n required: ['id'],\n },\n },\n {\n name: 'wireweave_cloud_list_wireframes',\n description: 'List your saved wireframes. Optionally filter by project or tags.',\n inputSchema: {\n type: 'object',\n properties: {\n projectId: {\n type: 'string',\n description: 'Filter by project ID',\n },\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'Filter by tags',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of wireframes to return',\n default: 20,\n },\n offset: {\n type: 'number',\n description: 'Offset for pagination',\n default: 0,\n },\n },\n required: [],\n },\n },\n {\n name: 'wireweave_cloud_get_wireframe',\n description: 'Get a specific wireframe by ID, including its code and metadata',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Wireframe ID',\n },\n },\n required: ['id'],\n },\n },\n {\n name: 'wireweave_cloud_save_wireframe',\n description:\n \"Save a new wireframe to the cloud. Free (v2.0+).\\n\\nRECOMMENDED WORKFLOW:\\n1. Call wireweave_cloud_list_projects to get available projects\\n2. If projects exist: Ask user which project to save to\\n3. If no projects: Ask user to (a) create a new project, or (b) save to default project\\n4. Call this tool with the chosen projectId (or omit for default project)\\n\\nNote: If projectId is not provided, the wireframe will be saved to the user's default project.\",\n inputSchema: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'Wireframe name',\n },\n code: {\n type: 'string',\n description: 'Wireweave DSL code',\n },\n description: {\n type: 'string',\n description: 'Wireframe description',\n },\n projectId: {\n type: 'string',\n description:\n 'Project ID to save to. Get available projects using wireweave_cloud_list_projects first.',\n },\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'Tags for categorization',\n },\n isPublic: {\n type: 'boolean',\n description: 'Make wireframe publicly visible',\n default: false,\n },\n },\n required: ['name', 'code'],\n },\n },\n {\n name: 'wireweave_cloud_update_wireframe',\n description: 'Update an existing wireframe. Creates a new version automatically. Free (v2.0+).',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Wireframe ID to update',\n },\n name: {\n type: 'string',\n description: 'New name (optional)',\n },\n code: {\n type: 'string',\n description: 'New Wireweave DSL code (optional)',\n },\n description: {\n type: 'string',\n description: 'New description (optional)',\n },\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'New tags (optional)',\n },\n isPublic: {\n type: 'boolean',\n description: 'Update public visibility (optional)',\n },\n },\n required: ['id'],\n },\n },\n {\n name: 'wireweave_cloud_delete_wireframe',\n description: 'Delete a wireframe permanently',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Wireframe ID to delete',\n },\n },\n required: ['id'],\n },\n },\n {\n name: 'wireweave_cloud_get_versions',\n description: 'Get version history of a wireframe',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n },\n required: ['wireframeId'],\n },\n },\n {\n name: 'wireweave_cloud_restore_version',\n description: 'Restore a wireframe to a previous version. Free (v2.0+).',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n version: {\n type: 'number',\n description: 'Version number to restore',\n },\n },\n required: ['wireframeId', 'version'],\n },\n },\n {\n name: 'wireweave_cloud_create_share_link',\n description: 'Create a shareable link for a wireframe. Free (v2.0+).',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID to share',\n },\n title: {\n type: 'string',\n description: 'Custom title for the shared view',\n },\n allowCopy: {\n type: 'boolean',\n description: 'Allow viewers to copy the code',\n default: false,\n },\n password: {\n type: 'string',\n description: 'Password protection (optional)',\n },\n expiresInDays: {\n type: 'number',\n description: 'Link expiration in days (optional, null = never)',\n },\n },\n required: ['wireframeId'],\n },\n },\n {\n name: 'wireweave_cloud_list_shares',\n description: 'List share links for a wireframe',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n },\n required: ['wireframeId'],\n },\n },\n {\n name: 'wireweave_cloud_diff_versions',\n description:\n 'Compare two versions of a wireframe and return the differences. Useful for reviewing changes without loading full code.',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n versionA: {\n type: 'number',\n description: 'First version number to compare',\n },\n versionB: {\n type: 'number',\n description: 'Second version number to compare',\n },\n },\n required: ['wireframeId', 'versionA', 'versionB'],\n },\n },\n {\n name: 'wireweave_account_balance',\n description: 'Check your current credit balance and subscription status',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n {\n name: 'wireweave_account_subscription',\n description: 'Get detailed subscription information including plan features',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n {\n name: 'wireweave_account_transactions',\n description: 'View your credit transaction history',\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'number',\n description: 'Number of transactions to return',\n default: 20,\n },\n type: {\n type: 'string',\n enum: ['purchase', 'subscription', 'usage', 'refund', 'bonus', 'admin'],\n description: 'Filter by transaction type',\n },\n },\n required: [],\n },\n },\n {\n name: 'wireweave_pricing',\n description: 'Get current pricing information for plans, credit packs, and feature costs',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n {\n name: 'wireweave_gallery',\n description: 'Browse public wireframe gallery for inspiration',\n inputSchema: {\n type: 'object',\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'Filter by tags',\n },\n limit: {\n type: 'number',\n description: 'Number of wireframes to return',\n default: 20,\n },\n },\n required: [],\n },\n },\n]\n\n// Map tool names to API endpoints (all public tools — local-dispatch tools\n// retain their endpoint mapping for parity with api-server routes).\nexport type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'\n\nexport interface ToolEndpoint {\n method: HttpMethod\n path: string\n pathParams?: string[]\n}\n\nexport const toolEndpoints: Record<string, ToolEndpoint> = {\n wireweave_parse: { method: 'POST', path: '/tools/parse' },\n wireweave_validate: { method: 'POST', path: '/tools/validate' },\n wireweave_grammar: { method: 'GET', path: '/tools/grammar' },\n wireweave_guide: { method: 'GET', path: '/tools/guide' },\n wireweave_patterns: { method: 'GET', path: '/tools/patterns' },\n wireweave_examples: { method: 'GET', path: '/tools/examples' },\n wireweave_list_components: { method: 'GET', path: '/tools/list-components' },\n wireweave_render_html_code: { method: 'POST', path: '/tools/render/html' },\n wireweave_validate_ux: { method: 'POST', path: '/tools/validate/ux' },\n wireweave_ux_rules: { method: 'GET', path: '/tools/ux-rules' },\n wireweave_diff: { method: 'POST', path: '/tools/diff' },\n wireweave_export_json: { method: 'POST', path: '/tools/export/json' },\n wireweave_export_figma: { method: 'POST', path: '/tools/export/figma' },\n wireweave_analyze: { method: 'POST', path: '/tools/analyze' },\n wireweave_cloud_list_projects: { method: 'GET', path: '/cloud/projects' },\n wireweave_cloud_create_project: { method: 'POST', path: '/cloud/projects' },\n wireweave_cloud_update_project: {\n method: 'PATCH',\n path: '/cloud/projects/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_list_wireframes: { method: 'GET', path: '/cloud/wireframes' },\n wireweave_cloud_get_wireframe: {\n method: 'GET',\n path: '/cloud/wireframes/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_save_wireframe: { method: 'POST', path: '/cloud/wireframes' },\n wireweave_cloud_update_wireframe: {\n method: 'PATCH',\n path: '/cloud/wireframes/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_delete_wireframe: {\n method: 'DELETE',\n path: '/cloud/wireframes/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_get_versions: {\n method: 'GET',\n path: '/cloud/wireframes/:wireframeId/versions',\n pathParams: ['wireframeId'],\n },\n wireweave_cloud_restore_version: {\n method: 'POST',\n path: '/cloud/wireframes/:wireframeId/versions/:version/restore',\n pathParams: ['wireframeId', 'version'],\n },\n wireweave_cloud_create_share_link: {\n method: 'POST',\n path: '/cloud/wireframes/:wireframeId/shares',\n pathParams: ['wireframeId'],\n },\n wireweave_cloud_list_shares: {\n method: 'GET',\n path: '/cloud/wireframes/:wireframeId/shares',\n pathParams: ['wireframeId'],\n },\n wireweave_cloud_diff_versions: {\n method: 'GET',\n path: '/cloud/wireframes/:wireframeId/diff',\n pathParams: ['wireframeId'],\n },\n wireweave_account_balance: { method: 'GET', path: '/billing/balance' },\n wireweave_account_subscription: { method: 'GET', path: '/billing/subscription' },\n wireweave_account_transactions: { method: 'GET', path: '/billing/transactions' },\n wireweave_pricing: { method: 'GET', path: '/billing/pricing' },\n wireweave_gallery: { method: 'GET', path: '/cloud/gallery' },\n}\n\n// Tool names that SDK dispatches locally (no api call).\n// Source of truth: api-server/src/tool-definitions.ts (dispatch: 'local').\n// Consumers (mcp-server / cli / skill) route these through @wireweave/sdk\n// localDispatch instead of HTTP.\nexport const localToolNames: ReadonlySet<string> = new Set([\n 'wireweave_parse',\n 'wireweave_validate',\n 'wireweave_list_components',\n 'wireweave_render_html_code',\n 'wireweave_validate_ux',\n 'wireweave_diff',\n 'wireweave_export_json',\n 'wireweave_export_figma',\n 'wireweave_analyze',\n])\n","import {\n analyze,\n diff,\n exportToFigma,\n exportToJson,\n parse,\n render,\n renderToHtml,\n validate,\n walkDocument,\n type AnalysisOptions,\n type DiffOptions,\n type ExportOptions,\n type ParseError,\n type SourceLocation,\n type WireframeDocument,\n} from '@wireweave/core'\nimport { validateUX, type UXRuleCategory, type UXValidationOptions } from '@wireweave/ux-rules'\nimport { ALL_COMPONENTS } from '@wireweave/language-data'\n\nimport { localToolNames } from './generated/tools.js'\nimport type { LocalToolContentBlock, LocalToolResult } from './types.js'\n\nexport const LOCAL_DISPATCH_TOOL_NAMES: ReadonlySet<string> = localToolNames\n\nexport function isLocalDispatchTool(name: string): boolean {\n return localToolNames.has(name)\n}\n\nexport function localDispatch(toolName: string, args: Record<string, unknown>): LocalToolResult {\n switch (toolName) {\n case 'wireweave_parse':\n return parseTool(args)\n case 'wireweave_validate':\n return validateTool(args)\n case 'wireweave_render_html_code':\n return renderHtmlCodeTool(args)\n case 'wireweave_validate_ux':\n return validateUxTool(args)\n case 'wireweave_diff':\n return diffTool(args)\n case 'wireweave_analyze':\n return analyzeTool(args)\n case 'wireweave_list_components':\n return listComponentsTool(args)\n case 'wireweave_export_json':\n return exportJsonTool(args)\n case 'wireweave_export_figma':\n return exportFigmaTool(args)\n default:\n return errorResult(`Unknown local tool: ${toolName}`)\n }\n}\n\nfunction successResult(payload: Record<string, unknown>): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify(payload, null, 2),\n }\n return { content: [block] }\n}\n\nfunction errorResult(message: string): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify({ error: message }, null, 2),\n }\n return { content: [block], isError: true }\n}\n\nfunction requireString(args: Record<string, unknown>, key: string): string | null {\n const value = args[key]\n return typeof value === 'string' && value.length > 0 ? value : null\n}\n\nfunction isParseError(err: unknown): err is ParseError {\n return (\n err instanceof Error &&\n (err as { name?: unknown }).name === 'ParseError' &&\n typeof (err as { location?: unknown }).location === 'object' &&\n (err as { location?: unknown }).location !== null\n )\n}\n\nfunction getParseErrorLocation(err: unknown): SourceLocation | undefined {\n return isParseError(err) ? err.location : undefined\n}\n\nfunction errorMessage(err: unknown, fallback: string): string {\n return err instanceof Error ? err.message : fallback\n}\n\nfunction countComponents(doc: WireframeDocument): number {\n let count = 0\n walkDocument(doc, (n) => {\n if (n.type !== 'Page') count++\n })\n return count\n}\n\nfunction parseTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n return successResult({\n success: true,\n ast,\n pageCount: ast.children.length,\n })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Parse error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction validateTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n const strict = args.strict === true\n try {\n const ast = parse(source)\n const result: {\n valid: boolean\n pageCount: number\n componentCount: number\n error?: string\n strictErrors?: string[]\n } = {\n valid: true,\n pageCount: ast.children.length,\n componentCount: countComponents(ast),\n }\n if (strict) {\n const v = validate(ast)\n if (!v.valid) {\n result.valid = false\n result.error = v.errorSummary ?? 'Unknown attributes found'\n result.strictErrors = v.errors.map((e) => e.message)\n }\n }\n return successResult(result)\n } catch (err) {\n return successResult({\n valid: false,\n error: errorMessage(err, 'Validation error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction renderHtmlCodeTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n const theme = args.theme === 'dark' ? 'dark' : 'light'\n const fullDocument = args.fullDocument === true\n try {\n const ast = parse(source)\n if (fullDocument) {\n const html = renderToHtml(ast, { theme })\n return successResult({ success: true, html })\n }\n const result = render(ast, { theme })\n return successResult({ success: true, html: result.html, css: result.css })\n } catch (err) {\n return successResult({ success: false, error: errorMessage(err, 'Render error') })\n }\n}\n\nfunction validateUxTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const options: UXValidationOptions = {\n categories: Array.isArray(args.categories)\n ? (args.categories as UXRuleCategory[])\n : undefined,\n minSeverity:\n args.minSeverity === 'error' ||\n args.minSeverity === 'warning' ||\n args.minSeverity === 'info'\n ? args.minSeverity\n : undefined,\n maxIssues: typeof args.maxIssues === 'number' ? args.maxIssues : undefined,\n disabledRules: Array.isArray(args.disabledRules)\n ? (args.disabledRules as string[])\n : undefined,\n }\n const result = validateUX(ast, options)\n return successResult({\n success: true,\n valid: result.valid,\n score: result.score,\n issues: result.issues,\n summary: result.summary,\n severityCounts: result.severityCounts,\n })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'UX validation error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction diffTool(args: Record<string, unknown>): LocalToolResult {\n const oldSource = requireString(args, 'oldSource')\n const newSource = requireString(args, 'newSource')\n if (oldSource === null) return errorResult('oldSource is required')\n if (newSource === null) return errorResult('newSource is required')\n try {\n const oldAst = parse(oldSource)\n const newAst = parse(newSource)\n const options: DiffOptions = {\n ignoreAttributes: args.ignoreAttributes === true ? true : undefined,\n ignoreOrder: args.ignoreOrder === true ? true : undefined,\n }\n const result = diff(oldAst, newAst, options)\n return successResult({\n success: true,\n identical: result.identical,\n summary: result.summary,\n changes: result.changes,\n description: result.description,\n })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Diff error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction listComponentsTool(args: Record<string, unknown>): LocalToolResult {\n const category =\n typeof args.category === 'string' && args.category.length > 0 ? args.category : undefined\n const components = category\n ? ALL_COMPONENTS.filter((c) => c.category === category)\n : ALL_COMPONENTS\n return successResult({ count: components.length, components })\n}\n\nfunction exportJsonTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const options: ExportOptions = {\n includeLocations: args.includeLocations === true ? true : undefined,\n prettyPrint: args.prettyPrint === false ? false : undefined,\n includeEmptyAttributes: args.includeEmptyAttributes === true ? true : undefined,\n }\n const result = exportToJson(ast, options)\n return successResult({ success: true, ...(result as unknown as Record<string, unknown>) })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Export error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction exportFigmaTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const result = exportToFigma(ast)\n return successResult({ success: true, ...(result as unknown as Record<string, unknown>) })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Export error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction analyzeTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const options: AnalysisOptions = {\n includeComponentBreakdown: args.includeComponentBreakdown !== false,\n includeAccessibility: args.includeAccessibility !== false,\n includeComplexity: args.includeComplexity !== false,\n includeLayout: args.includeLayout !== false,\n includeContent: args.includeContent !== false,\n }\n const result = analyze(ast, options)\n return successResult(result as unknown as Record<string, unknown>)\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Analysis error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n","import { callApi } from './client.js'\nimport { isLocalDispatchTool, localDispatch } from './local-dispatcher.js'\nimport type { ApiConfig, LocalToolContentBlock, LocalToolResult, ToolEndpoint } from './types.js'\n\nexport interface DispatchOptions {\n apiConfig: ApiConfig\n endpoints: Record<string, ToolEndpoint>\n fetchFn?: typeof fetch\n}\n\nexport async function dispatch(\n toolName: string,\n args: Record<string, unknown>,\n options: DispatchOptions,\n): Promise<LocalToolResult> {\n if (isLocalDispatchTool(toolName)) {\n return localDispatch(toolName, args)\n }\n\n const endpoint = options.endpoints[toolName]\n if (!endpoint) {\n return errorResult(`Unknown tool: ${toolName}`)\n }\n\n try {\n const result = await callApi(options.apiConfig, endpoint, args, options.fetchFn)\n return successResult(result as Record<string, unknown>)\n } catch (err) {\n return errorResult(err instanceof Error ? err.message : 'Unknown error')\n }\n}\n\nfunction successResult(payload: Record<string, unknown>): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify(payload, null, 2),\n }\n return { content: [block] }\n}\n\nfunction errorResult(message: string): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify({ error: message }, null, 2),\n }\n return { content: [block], isError: true }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/auth.ts","../src/generated/tools.ts","../src/local-dispatcher.ts","../src/dispatcher.ts"],"names":["path","fs","errorResult","validate","successResult"],"mappings":";;;;;;;;;AAEA,IAAM,mCAAmB,IAAI,GAAA,CAAI,CAAC,MAAA,EAAQ,OAAA,EAAS,KAAK,CAAC,CAAA;AAEzD,SAAS,eAAe,KAAA,EAAwB;AAC9C,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,OAAO,UAAU,SAAA,IAAa,OAAO,UAAU,QAAA,EAAU;AACxF,IAAA,OAAO,OAAO,KAAK,CAAA;AAAA,EACrB;AACA,EAAA,OAAO,IAAA,CAAK,UAAU,KAAK,CAAA;AAC7B;AAEO,SAAS,YAAA,CACd,MAAA,EACA,QAAA,EACA,IAAA,EAC4E;AAC5E,EAAA,IAAIA,QAAO,QAAA,CAAS,IAAA;AACpB,EAAA,MAAM,IAAA,GAAgC,EAAE,GAAG,IAAA,EAAK;AAEhD,EAAA,IAAI,SAAS,UAAA,EAAY;AACvB,IAAA,KAAA,MAAW,KA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A;AAAA,IACN,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAA,EAAS,MAAM,CAAC;AAAA,GACvC;AACA,EAAA,OAAO,EAAE,OAAA,EAAS,CAAC,KAAK,CAAA,EAAE;AAC5B;AAEA,SAASF,aAAY,OAAA,EAAkC;AACrD,EAAA,MAAM,KAAA,GAA+B;AAAA,IACnC,IAAA,EAAM,MAAA;AAAA,IACN,IAAA,EAAM,KAAK,SAAA,CAAU,EAAE,OAAO,OAAA,EAAQ,EAAG,MAAM,CAAC;AAAA,GAClD;AACA,EAAA,OAAO,EAAE,OAAA,EAAS,CAAC,KAAK,CAAA,EAAG,SAAS,IAAA,EAAK;AAC3C","file":"index.js","sourcesContent":["import type { ApiConfig, ApiErrorBody, CreditInfo, ToolEndpoint } from './types.js'\n\nconst MUTATING_METHODS = new Set(['POST', 'PATCH', 'PUT'])\n\nfunction stringifyParam(value: unknown): string {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {\n return String(value)\n }\n return JSON.stringify(value)\n}\n\nexport function buildRequest(\n config: ApiConfig,\n endpoint: ToolEndpoint,\n args?: Record<string, unknown>,\n): { url: string; options: RequestInit; bodyForGet: Record<string, unknown> } {\n let path = endpoint.path\n const body: Record<string, unknown> = { ...args }\n\n if (endpoint.pathParams) {\n for (const param of endpoint.pathParams) {\n const value = args?.[param]\n if (\n (typeof value !== 'string' && typeof value !== 'number') ||\n value === '' ||\n value === '.' ||\n value === '..' ||\n (typeof value === 'number' && !Number.isFinite(value))\n ) {\n throw new Error(`Invalid or missing path parameter: ${param}`)\n }\n path = path.replace(`:${param}`, encodeURIComponent(String(value)))\n delete body[param]\n }\n }\n\n let url = `${config.apiUrl}${path}`\n const options: RequestInit = {\n method: endpoint.method,\n redirect: 'error',\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': config.apiKey,\n },\n }\n\n if (MUTATING_METHODS.has(endpoint.method) && Object.keys(body).length > 0) {\n options.body = JSON.stringify(body)\n } else if (endpoint.method === 'GET' && Object.keys(body).length > 0) {\n const params = new URLSearchParams()\n for (const [key, value] of Object.entries(body)) {\n if (value === undefined || value === null) continue\n if (Array.isArray(value)) {\n params.append(key, value.map(stringifyParam).join(','))\n } else {\n params.append(key, stringifyParam(value))\n }\n }\n url = `${url}?${params.toString()}`\n }\n\n return { url, options, bodyForGet: body }\n}\n\nexport function parseErrorMessage(status: number, error: ApiErrorBody): string {\n if (status === 401) return 'Invalid API key. Get one at https://wireweave.org'\n if (status === 402) return `Insufficient credits. ${error.message ?? 'Please add more credits.'}`\n if (status === 403) return 'Access denied. Upgrade your plan for this feature.'\n if (status === 404 && error.error?.includes('project')) {\n return 'Project not found. Call wireweave_cloud_list_projects to see available projects.'\n }\n if (status === 400 && error.error?.includes('name')) {\n return 'Invalid wireframe name. Provide a non-empty name for the wireframe.'\n }\n if (status === 429) return 'Rate limit exceeded. Please wait and try again.'\n if (status >= 500) return 'Service temporarily unavailable'\n return error.error ?? error.message ?? 'Request failed'\n}\n\nexport function extractCreditInfo(headers: Headers): CreditInfo {\n const balance = headers.get('X-Credits-Balance')\n const monthlyRemaining = headers.get('X-Credits-Monthly-Remaining')\n const totalAvailable = headers.get('X-Credits-Total-Available')\n return {\n balance: balance !== null ? parseInt(balance, 10) : undefined,\n monthlyRemaining: monthlyRemaining !== null ? parseInt(monthlyRemaining, 10) : undefined,\n totalAvailable: totalAvailable !== null ? parseInt(totalAvailable, 10) : undefined,\n }\n}\n\nexport async function callApi(\n config: ApiConfig,\n endpoint: ToolEndpoint,\n args?: Record<string, unknown>,\n fetchFn: typeof fetch = fetch,\n signal?: AbortSignal,\n): Promise<unknown> {\n signal?.throwIfAborted()\n if (!config.apiKey) {\n throw new Error('WIREWEAVE_API_KEY environment variable is required')\n }\n\n const { url, options } = buildRequest(config, endpoint, args)\n const timeout = AbortSignal.timeout(30_000)\n options.signal = signal ? AbortSignal.any([signal, timeout]) : timeout\n\n const response = await fetchFn(url, options)\n options.signal.throwIfAborted()\n const creditInfo = extractCreditInfo(response.headers)\n\n if (!response.ok) {\n const error = (await response.json().catch(() => ({ error: 'Request failed' }))) as ApiErrorBody\n throw new Error(parseErrorMessage(response.status, error))\n }\n\n const result = (await response.json()) as unknown\n options.signal.throwIfAborted()\n\n if (\n typeof result === 'object' &&\n result !== null &&\n !Array.isArray(result) &&\n (creditInfo.balance !== undefined || creditInfo.totalAvailable !== undefined)\n ) {\n return { ...result, _credits: creditInfo }\n }\n\n return result\n}\n","import { promises as fs } from 'node:fs'\nimport os from 'node:os'\nimport path from 'node:path'\n\nexport interface StoredConfig {\n token: string\n apiUrl?: string\n}\n\nexport interface AuthOptions {\n configDir?: string\n configFileName?: string\n}\n\nconst DEFAULT_CONFIG_DIR_NAME = '.wireweave'\nconst DEFAULT_CONFIG_FILE_NAME = 'config.json'\n\nfunction resolveConfigDir(opts?: AuthOptions): string {\n return opts?.configDir ?? path.join(os.homedir(), DEFAULT_CONFIG_DIR_NAME)\n}\n\nexport function getConfigPath(opts?: AuthOptions): string {\n return path.join(resolveConfigDir(opts), opts?.configFileName ?? DEFAULT_CONFIG_FILE_NAME)\n}\n\nexport async function loadToken(opts?: AuthOptions): Promise<StoredConfig | null> {\n try {\n const raw = await fs.readFile(getConfigPath(opts), 'utf8')\n const parsed = JSON.parse(raw) as Partial<StoredConfig>\n if (typeof parsed.token !== 'string' || parsed.token.length === 0) {\n return null\n }\n return {\n token: parsed.token,\n apiUrl: typeof parsed.apiUrl === 'string' ? parsed.apiUrl : undefined,\n }\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'ENOENT') return null\n return null\n }\n}\n\nexport async function saveToken(config: StoredConfig, opts?: AuthOptions): Promise<void> {\n const configDir = resolveConfigDir(opts)\n await fs.mkdir(configDir, { recursive: true, mode: 0o700 })\n await fs.writeFile(getConfigPath(opts), JSON.stringify(config, null, 2), { mode: 0o600 })\n}\n\nexport async function clearToken(opts?: AuthOptions): Promise<void> {\n try {\n await fs.unlink(getConfigPath(opts))\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code !== 'ENOENT') throw err\n }\n}\n\nexport interface VerifyTokenResult {\n valid: boolean\n status: number\n body?: unknown\n}\n\nexport async function verifyToken(\n token: string,\n apiUrl: string,\n verifyEndpoint: string,\n fetchFn: typeof fetch = fetch,\n): Promise<VerifyTokenResult> {\n const url = `${apiUrl}${verifyEndpoint}`\n const response = await fetchFn(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': token,\n },\n })\n const body = (await response.json().catch(() => undefined)) as unknown\n return {\n valid: response.ok,\n status: response.status,\n body,\n }\n}\n","/**\n * AUTO-GENERATED. Do not edit directly.\n * Source: packages/sdk/src/tool-catalog.json\n * Regenerate: node scripts/generate-tool-catalog.mjs --write\n * Verify: node scripts/generate-tool-catalog.mjs --check\n */\n\nimport type { Tool, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'\nimport type { ToolEndpoint } from '../types.js'\nexport type { HttpMethod, ToolEndpoint } from '../types.js'\n\nexport type RequiredToolAnnotations = Required<\n Pick<ToolAnnotations, 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'>\n>\nexport type AnnotatedTool = Tool & { annotations: RequiredToolAnnotations }\n\nexport const tools: AnnotatedTool[] = [\n {\n name: 'wireweave_parse',\n description: 'Parse Wireweave DSL source code into an AST (Abstract Syntax Tree)',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to parse',\n },\n },\n required: ['source'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_validate',\n description:\n 'Validate Wireweave DSL syntax without generating output. Use strict mode to also check for unknown attributes.',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to validate',\n },\n strict: {\n type: 'boolean',\n description:\n 'Enable strict mode to also validate that only known attributes are used. Recommended for catching typos and incorrect attribute names.',\n default: false,\n },\n },\n required: ['source'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_grammar',\n description: 'Get the Wireweave DSL grammar documentation and syntax reference',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_guide',\n description:\n 'Get the comprehensive LLM guide for Wireweave DSL. This is the PRIMARY resource for learning the language - includes syntax, components, patterns, and best practices. Call this FIRST before generating wireframes.',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_patterns',\n description:\n 'Get common layout patterns for wireframes including headers, sidebars, forms, cards, and more. Use these as building blocks.',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_examples',\n description:\n 'Get Wireweave code examples. Use this to learn patterns and best practices for different UI types.',\n inputSchema: {\n type: 'object',\n properties: {\n category: {\n type: 'string',\n enum: ['all', 'basic', 'layout', 'navigation', 'form', 'dashboard'],\n description:\n 'Filter examples by category. Use \"all\" to get all examples. Categories cover generic component compositions (basic, layout, navigation, form) and a domain-agnostic dashboard shell.',\n default: 'all',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of examples to return',\n default: 5,\n },\n },\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_list_components',\n description:\n 'List Wireweave DSL components with their categories, attributes, and examples. Use this to discover available components for wireframe generation. Filter by category (layout, navigation, form, etc.) when narrowing the search.',\n inputSchema: {\n type: 'object',\n properties: {\n category: {\n type: 'string',\n description:\n 'Filter components by category (e.g., \"layout\", \"navigation\", \"form\", \"content\", \"interaction\"). Omit to return all components.',\n },\n },\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_render_html_code',\n description:\n 'Render Wireweave DSL to HTML code. Returns the HTML content directly. This is an alias for wireweave_render_html with explicit naming.',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to render',\n },\n theme: {\n type: 'string',\n enum: ['light', 'dark'],\n description: 'Color theme for rendering',\n default: 'light',\n },\n fullDocument: {\n type: 'boolean',\n description: 'Return a complete HTML document instead of fragment',\n default: false,\n },\n },\n required: ['source'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_validate_ux',\n description:\n 'Validate Wireweave DSL for UX best practices. Returns issues with severity levels and actionable recommendations.',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to validate',\n },\n categories: {\n type: 'array',\n items: {\n type: 'string',\n enum: [\n 'accessibility',\n 'usability',\n 'form',\n 'touch-target',\n 'consistency',\n 'navigation',\n 'feedback',\n 'content',\n 'data-display',\n 'interaction',\n ],\n },\n description: 'UX rule categories to check. If not specified, all categories are checked.',\n },\n minSeverity: {\n type: 'string',\n enum: ['error', 'warning', 'info'],\n description: 'Minimum severity level to report',\n default: 'info',\n },\n maxIssues: {\n type: 'number',\n description: 'Maximum number of issues to return',\n },\n disabledRules: {\n type: 'array',\n items: {\n type: 'string',\n },\n description:\n 'List of rule IDs to disable (e.g., [\"a11y-input-label\", \"form-submit-button\"])',\n },\n },\n required: ['source'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_ux_rules',\n description: 'Get available UX rule categories and their descriptions',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_diff',\n description: 'Compare two Wireweave DSL sources and return the differences between them',\n inputSchema: {\n type: 'object',\n properties: {\n oldSource: {\n type: 'string',\n description: 'The original Wireweave DSL source code',\n },\n newSource: {\n type: 'string',\n description: 'The modified Wireweave DSL source code',\n },\n ignoreAttributes: {\n type: 'boolean',\n description: 'Ignore attribute changes, only compare structure',\n default: false,\n },\n ignoreOrder: {\n type: 'boolean',\n description: 'Ignore the order of children when comparing',\n default: false,\n },\n },\n required: ['oldSource', 'newSource'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_export_json',\n description: 'Export Wireweave DSL to JSON format',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to export',\n },\n includeLocations: {\n type: 'boolean',\n description: 'Include source location information in output',\n default: false,\n },\n prettyPrint: {\n type: 'boolean',\n description: 'Format JSON with indentation',\n default: true,\n },\n },\n required: ['source'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_export_figma',\n description: 'Export Wireweave DSL to Figma-compatible format',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to export',\n },\n },\n required: ['source'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_analyze',\n description:\n 'Analyze Wireweave DSL for statistics and metrics including component usage, tree structure, accessibility score, and complexity',\n inputSchema: {\n type: 'object',\n properties: {\n source: {\n type: 'string',\n description: 'The Wireweave DSL source code to analyze',\n },\n includeComponentBreakdown: {\n type: 'boolean',\n description: 'Include detailed component usage breakdown',\n default: true,\n },\n includeAccessibility: {\n type: 'boolean',\n description: 'Include accessibility analysis',\n default: true,\n },\n includeComplexity: {\n type: 'boolean',\n description: 'Include complexity metrics',\n default: true,\n },\n includeLayout: {\n type: 'boolean',\n description: 'Include layout pattern analysis',\n default: true,\n },\n includeContent: {\n type: 'boolean',\n description: 'Include content analysis',\n default: true,\n },\n },\n required: ['source'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_list_projects',\n description:\n 'List all your Wireweave projects. Projects help organize your wireframes. WORKFLOW: Call this first before saving wireframes. If the list is empty, ask the user whether to create a new project (call wireweave_cloud_create_project) or use the default project.',\n inputSchema: {\n type: 'object',\n properties: {\n includeArchived: {\n type: 'boolean',\n description: 'Include archived projects',\n default: false,\n },\n },\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_create_project',\n description:\n 'Create a new project to organize wireframes. Use this when the user wants to organize their wireframes into a specific project. The project can have a custom name, description, and color.',\n inputSchema: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'Project name',\n },\n description: {\n type: 'string',\n description: 'Project description',\n },\n color: {\n type: 'string',\n description: 'Project color (hex code, e.g., #6366f1)',\n },\n },\n required: ['name'],\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_update_project',\n description: 'Update an existing project',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Project ID to update',\n },\n name: {\n type: 'string',\n description: 'New project name',\n },\n description: {\n type: 'string',\n description: 'New project description',\n },\n color: {\n type: 'string',\n description: 'New project color (hex code)',\n },\n isArchived: {\n type: 'boolean',\n description: 'Archive or unarchive the project',\n },\n },\n required: ['id'],\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_list_wireframes',\n description: 'List your saved wireframes. Optionally filter by project or tags.',\n inputSchema: {\n type: 'object',\n properties: {\n projectId: {\n type: 'string',\n description: 'Filter by project ID',\n },\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'Filter by tags',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of wireframes to return',\n default: 20,\n },\n offset: {\n type: 'number',\n description: 'Offset for pagination',\n default: 0,\n },\n },\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_get_wireframe',\n description: 'Get a specific wireframe by ID, including its code and metadata',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Wireframe ID',\n },\n },\n required: ['id'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_save_wireframe',\n description:\n \"Save a new wireframe to the cloud. Free (v2.0+).\\n\\nRECOMMENDED WORKFLOW:\\n1. Call wireweave_cloud_list_projects to get available projects\\n2. If projects exist: Ask user which project to save to\\n3. If no projects: Ask user to (a) create a new project, or (b) save to default project\\n4. Call this tool with the chosen projectId (or omit for default project)\\n\\nNote: If projectId is not provided, the wireframe will be saved to the user's default project.\",\n inputSchema: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'Wireframe name',\n },\n code: {\n type: 'string',\n description: 'Wireweave DSL code',\n },\n description: {\n type: 'string',\n description: 'Wireframe description',\n },\n projectId: {\n type: 'string',\n description:\n 'Project ID to save to. Get available projects using wireweave_cloud_list_projects first.',\n },\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'Tags for categorization',\n },\n isPublic: {\n type: 'boolean',\n description: 'Make wireframe publicly visible',\n default: false,\n },\n },\n required: ['name', 'code'],\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n {\n name: 'wireweave_cloud_update_wireframe',\n description: 'Update an existing wireframe. Creates a new version automatically. Free (v2.0+).',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Wireframe ID to update',\n },\n name: {\n type: 'string',\n description: 'New name (optional)',\n },\n code: {\n type: 'string',\n description: 'New Wireweave DSL code (optional)',\n },\n description: {\n type: 'string',\n description: 'New description (optional)',\n },\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'New tags (optional)',\n },\n isPublic: {\n type: 'boolean',\n description: 'Update public visibility (optional)',\n },\n },\n required: ['id'],\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n {\n name: 'wireweave_cloud_delete_wireframe',\n description: 'Delete a wireframe permanently',\n inputSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description: 'Wireframe ID to delete',\n },\n },\n required: ['id'],\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n {\n name: 'wireweave_cloud_get_versions',\n description: 'Get version history of a wireframe',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n },\n required: ['wireframeId'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_restore_version',\n description: 'Restore a wireframe to a previous version. Free (v2.0+).',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n version: {\n type: 'number',\n description: 'Version number to restore',\n },\n },\n required: ['wireframeId', 'version'],\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n {\n name: 'wireweave_cloud_create_share_link',\n description: 'Create a shareable link for a wireframe. Free (v2.0+).',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID to share',\n },\n title: {\n type: 'string',\n description: 'Custom title for the shared view',\n },\n allowCopy: {\n type: 'boolean',\n description: 'Allow viewers to copy the code',\n default: false,\n },\n password: {\n type: 'string',\n description: 'Password protection (optional)',\n },\n expiresInDays: {\n type: 'number',\n description: 'Link expiration in days (optional, null = never)',\n },\n },\n required: ['wireframeId'],\n },\n annotations: {\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: true,\n },\n },\n {\n name: 'wireweave_cloud_list_shares',\n description: 'List share links for a wireframe',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n },\n required: ['wireframeId'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_cloud_diff_versions',\n description:\n 'Compare two versions of a wireframe and return the differences. Useful for reviewing changes without loading full code.',\n inputSchema: {\n type: 'object',\n properties: {\n wireframeId: {\n type: 'string',\n description: 'Wireframe ID',\n },\n versionA: {\n type: 'number',\n description: 'First version number to compare',\n },\n versionB: {\n type: 'number',\n description: 'Second version number to compare',\n },\n },\n required: ['wireframeId', 'versionA', 'versionB'],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_account_balance',\n description: 'Check your current credit balance and subscription status',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_account_subscription',\n description: 'Get detailed subscription information including plan features',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_account_transactions',\n description: 'View your credit transaction history',\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'number',\n description: 'Number of transactions to return',\n default: 20,\n },\n type: {\n type: 'string',\n enum: ['purchase', 'subscription', 'usage', 'refund', 'bonus', 'admin'],\n description: 'Filter by transaction type',\n },\n },\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_pricing',\n description: 'Get current pricing information for plans, credit packs, and feature costs',\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n {\n name: 'wireweave_gallery',\n description: 'Browse public wireframe gallery for inspiration',\n inputSchema: {\n type: 'object',\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n description: 'Filter by tags',\n },\n limit: {\n type: 'number',\n description: 'Number of wireframes to return',\n default: 20,\n },\n },\n required: [],\n },\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: true,\n },\n },\n]\n\n// Local tools retain their service endpoint for existing explicit remote callers.\nexport const toolEndpoints: Record<string, ToolEndpoint> = {\n wireweave_parse: {\n method: 'POST',\n path: '/tools/parse',\n },\n wireweave_validate: {\n method: 'POST',\n path: '/tools/validate',\n },\n wireweave_grammar: {\n method: 'GET',\n path: '/tools/grammar',\n },\n wireweave_guide: {\n method: 'GET',\n path: '/tools/guide',\n },\n wireweave_patterns: {\n method: 'GET',\n path: '/tools/patterns',\n },\n wireweave_examples: {\n method: 'GET',\n path: '/tools/examples',\n },\n wireweave_list_components: {\n method: 'GET',\n path: '/tools/list-components',\n },\n wireweave_render_html_code: {\n method: 'POST',\n path: '/tools/render/html',\n },\n wireweave_validate_ux: {\n method: 'POST',\n path: '/tools/validate/ux',\n },\n wireweave_ux_rules: {\n method: 'GET',\n path: '/tools/ux-rules',\n },\n wireweave_diff: {\n method: 'POST',\n path: '/tools/diff',\n },\n wireweave_export_json: {\n method: 'POST',\n path: '/tools/export/json',\n },\n wireweave_export_figma: {\n method: 'POST',\n path: '/tools/export/figma',\n },\n wireweave_analyze: {\n method: 'POST',\n path: '/tools/analyze',\n },\n wireweave_cloud_list_projects: {\n method: 'GET',\n path: '/cloud/projects',\n },\n wireweave_cloud_create_project: {\n method: 'POST',\n path: '/cloud/projects',\n },\n wireweave_cloud_update_project: {\n method: 'PATCH',\n path: '/cloud/projects/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_list_wireframes: {\n method: 'GET',\n path: '/cloud/wireframes',\n },\n wireweave_cloud_get_wireframe: {\n method: 'GET',\n path: '/cloud/wireframes/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_save_wireframe: {\n method: 'POST',\n path: '/cloud/wireframes',\n },\n wireweave_cloud_update_wireframe: {\n method: 'PATCH',\n path: '/cloud/wireframes/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_delete_wireframe: {\n method: 'DELETE',\n path: '/cloud/wireframes/:id',\n pathParams: ['id'],\n },\n wireweave_cloud_get_versions: {\n method: 'GET',\n path: '/cloud/wireframes/:wireframeId/versions',\n pathParams: ['wireframeId'],\n },\n wireweave_cloud_restore_version: {\n method: 'POST',\n path: '/cloud/wireframes/:wireframeId/versions/:version/restore',\n pathParams: ['wireframeId', 'version'],\n },\n wireweave_cloud_create_share_link: {\n method: 'POST',\n path: '/cloud/wireframes/:wireframeId/shares',\n pathParams: ['wireframeId'],\n },\n wireweave_cloud_list_shares: {\n method: 'GET',\n path: '/cloud/wireframes/:wireframeId/shares',\n pathParams: ['wireframeId'],\n },\n wireweave_cloud_diff_versions: {\n method: 'GET',\n path: '/cloud/wireframes/:wireframeId/diff',\n pathParams: ['wireframeId'],\n },\n wireweave_account_balance: {\n method: 'GET',\n path: '/billing/balance',\n },\n wireweave_account_subscription: {\n method: 'GET',\n path: '/billing/subscription',\n },\n wireweave_account_transactions: {\n method: 'GET',\n path: '/billing/transactions',\n },\n wireweave_pricing: {\n method: 'GET',\n path: '/billing/pricing',\n },\n wireweave_gallery: {\n method: 'GET',\n path: '/cloud/gallery',\n },\n}\n\nexport const localToolNames: ReadonlySet<string> = new Set([\n 'wireweave_parse',\n 'wireweave_validate',\n 'wireweave_list_components',\n 'wireweave_render_html_code',\n 'wireweave_validate_ux',\n 'wireweave_diff',\n 'wireweave_export_json',\n 'wireweave_export_figma',\n 'wireweave_analyze',\n])\n","import {\n analyze,\n diff,\n exportToFigma,\n exportToJson,\n parse,\n render,\n renderToHtml,\n validate,\n walkDocument,\n type AnalysisOptions,\n type DiffOptions,\n type ExportOptions,\n type ParseError,\n type SourceLocation,\n type WireframeDocument,\n} from '@wireweave/core'\nimport { validateUX, type UXRuleCategory, type UXValidationOptions } from '@wireweave/ux-rules'\nimport { ALL_COMPONENTS } from '@wireweave/language-data'\n\nimport { localToolNames } from './generated/tools.js'\nimport type { LocalToolContentBlock, LocalToolResult } from './types.js'\n\nexport const LOCAL_DISPATCH_TOOL_NAMES: ReadonlySet<string> = localToolNames\n\nexport function isLocalDispatchTool(name: string): boolean {\n return localToolNames.has(name)\n}\n\nexport function localDispatch(toolName: string, args: Record<string, unknown>): LocalToolResult {\n switch (toolName) {\n case 'wireweave_parse':\n return parseTool(args)\n case 'wireweave_validate':\n return validateTool(args)\n case 'wireweave_render_html_code':\n return renderHtmlCodeTool(args)\n case 'wireweave_validate_ux':\n return validateUxTool(args)\n case 'wireweave_diff':\n return diffTool(args)\n case 'wireweave_analyze':\n return analyzeTool(args)\n case 'wireweave_list_components':\n return listComponentsTool(args)\n case 'wireweave_export_json':\n return exportJsonTool(args)\n case 'wireweave_export_figma':\n return exportFigmaTool(args)\n default:\n return errorResult(`Unknown local tool: ${toolName}`)\n }\n}\n\nfunction successResult(payload: Record<string, unknown>): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify(payload, null, 2),\n }\n return { content: [block] }\n}\n\nfunction errorResult(message: string): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify({ error: message }, null, 2),\n }\n return { content: [block], isError: true }\n}\n\nfunction requireString(args: Record<string, unknown>, key: string): string | null {\n const value = args[key]\n return typeof value === 'string' && value.length > 0 ? value : null\n}\n\nfunction isParseError(err: unknown): err is ParseError {\n return (\n err instanceof Error &&\n (err as { name?: unknown }).name === 'ParseError' &&\n typeof (err as { location?: unknown }).location === 'object' &&\n (err as { location?: unknown }).location !== null\n )\n}\n\nfunction getParseErrorLocation(err: unknown): SourceLocation | undefined {\n return isParseError(err) ? err.location : undefined\n}\n\nfunction errorMessage(err: unknown, fallback: string): string {\n return err instanceof Error ? err.message : fallback\n}\n\nfunction countComponents(doc: WireframeDocument): number {\n let count = 0\n walkDocument(doc, (n) => {\n if (n.type !== 'Page') count++\n })\n return count\n}\n\nfunction parseTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n return successResult({\n success: true,\n ast,\n pageCount: ast.children.length,\n })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Parse error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction validateTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n const strict = args.strict === true\n try {\n const ast = parse(source)\n const result: {\n valid: boolean\n pageCount: number\n componentCount: number\n error?: string\n strictErrors?: string[]\n } = {\n valid: true,\n pageCount: ast.children.length,\n componentCount: countComponents(ast),\n }\n if (strict) {\n const v = validate(ast)\n if (!v.valid) {\n result.valid = false\n result.error = v.errorSummary ?? 'Unknown attributes found'\n result.strictErrors = v.errors.map((e) => e.message)\n }\n }\n return successResult(result)\n } catch (err) {\n return successResult({\n valid: false,\n error: errorMessage(err, 'Validation error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction renderHtmlCodeTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n const theme = args.theme === 'dark' ? 'dark' : 'light'\n const fullDocument = args.fullDocument === true\n try {\n const ast = parse(source)\n if (fullDocument) {\n const html = renderToHtml(ast, { theme })\n return successResult({ success: true, html })\n }\n const result = render(ast, { theme })\n return successResult({ success: true, html: result.html, css: result.css })\n } catch (err) {\n return successResult({ success: false, error: errorMessage(err, 'Render error') })\n }\n}\n\nfunction validateUxTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const options: UXValidationOptions = {\n categories: Array.isArray(args.categories)\n ? (args.categories as UXRuleCategory[])\n : undefined,\n minSeverity:\n args.minSeverity === 'error' ||\n args.minSeverity === 'warning' ||\n args.minSeverity === 'info'\n ? args.minSeverity\n : undefined,\n maxIssues: typeof args.maxIssues === 'number' ? args.maxIssues : undefined,\n disabledRules: Array.isArray(args.disabledRules)\n ? (args.disabledRules as string[])\n : undefined,\n }\n const result = validateUX(ast, options)\n return successResult({\n success: true,\n valid: result.valid,\n score: result.score,\n issues: result.issues,\n summary: result.summary,\n severityCounts: result.severityCounts,\n })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'UX validation error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction diffTool(args: Record<string, unknown>): LocalToolResult {\n const oldSource = requireString(args, 'oldSource')\n const newSource = requireString(args, 'newSource')\n if (oldSource === null) return errorResult('oldSource is required')\n if (newSource === null) return errorResult('newSource is required')\n try {\n const oldAst = parse(oldSource)\n const newAst = parse(newSource)\n const options: DiffOptions = {\n ignoreAttributes: args.ignoreAttributes === true ? true : undefined,\n ignoreOrder: args.ignoreOrder === true ? true : undefined,\n }\n const result = diff(oldAst, newAst, options)\n return successResult({\n success: true,\n identical: result.identical,\n summary: result.summary,\n changes: result.changes,\n description: result.description,\n })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Diff error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction listComponentsTool(args: Record<string, unknown>): LocalToolResult {\n const category =\n typeof args.category === 'string' && args.category.length > 0 ? args.category : undefined\n const components = category\n ? ALL_COMPONENTS.filter((c) => c.category === category)\n : ALL_COMPONENTS\n return successResult({ count: components.length, components })\n}\n\nfunction exportJsonTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const options: ExportOptions = {\n includeLocations: args.includeLocations === true ? true : undefined,\n prettyPrint: args.prettyPrint === false ? false : undefined,\n includeEmptyAttributes: args.includeEmptyAttributes === true ? true : undefined,\n }\n const result = exportToJson(ast, options)\n return successResult({ success: true, ...(result as unknown as Record<string, unknown>) })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Export error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction exportFigmaTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const result = exportToFigma(ast)\n return successResult({ success: true, ...(result as unknown as Record<string, unknown>) })\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Export error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n\nfunction analyzeTool(args: Record<string, unknown>): LocalToolResult {\n const source = requireString(args, 'source')\n if (source === null) return errorResult('source is required')\n try {\n const ast = parse(source)\n const options: AnalysisOptions = {\n includeComponentBreakdown: args.includeComponentBreakdown !== false,\n includeAccessibility: args.includeAccessibility !== false,\n includeComplexity: args.includeComplexity !== false,\n includeLayout: args.includeLayout !== false,\n includeContent: args.includeContent !== false,\n }\n const result = analyze(ast, options)\n return successResult(result as unknown as Record<string, unknown>)\n } catch (err) {\n return successResult({\n success: false,\n error: errorMessage(err, 'Analysis error'),\n location: getParseErrorLocation(err),\n })\n }\n}\n","import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv-provider.js'\nimport type { JsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/types.js'\nimport { callApi } from './client.js'\nimport { tools } from './generated/tools.js'\nimport { isLocalDispatchTool, localDispatch } from './local-dispatcher.js'\nimport type { ApiConfig, LocalToolContentBlock, LocalToolResult, ToolEndpoint } from './types.js'\n\nexport interface DispatchOptions {\n apiConfig: ApiConfig\n endpoints: Record<string, ToolEndpoint>\n fetchFn?: typeof fetch\n signal?: AbortSignal\n}\n\nconst catalog = new Map(tools.map((tool) => [tool.name, tool]))\nconst validators = new Map<string, JsonSchemaValidator<Record<string, unknown>>>()\nlet schemaValidator: AjvJsonSchemaValidator | undefined\n\nexport async function dispatch(\n toolName: string,\n args: Record<string, unknown>,\n options: DispatchOptions,\n): Promise<LocalToolResult> {\n const tool = catalog.get(toolName)\n if (!tool) {\n return errorResult(`Unknown tool: ${toolName}`)\n }\n\n try {\n options.signal?.throwIfAborted()\n let validate = validators.get(toolName)\n if (!validate) {\n schemaValidator ??= new AjvJsonSchemaValidator()\n validate = schemaValidator.getValidator<Record<string, unknown>>(tool.inputSchema)\n validators.set(toolName, validate)\n }\n const validation = validate(args)\n if (!validation.valid) {\n return errorResult(`Invalid arguments for ${toolName}: ${validation.errorMessage}`)\n }\n\n if (isLocalDispatchTool(toolName)) {\n return localDispatch(toolName, args)\n }\n\n const endpoint = Object.hasOwn(options.endpoints, toolName)\n ? options.endpoints[toolName]\n : undefined\n if (!endpoint) return errorResult(`Unknown tool: ${toolName}`)\n\n const result = await callApi(options.apiConfig, endpoint, args, options.fetchFn, options.signal)\n return successResult(result as Record<string, unknown>)\n } catch (err) {\n return errorResult(err instanceof Error ? err.message : 'Unknown error')\n }\n}\n\nfunction successResult(payload: Record<string, unknown>): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify(payload, null, 2),\n }\n return { content: [block] }\n}\n\nfunction errorResult(message: string): LocalToolResult {\n const block: LocalToolContentBlock = {\n type: 'text',\n text: JSON.stringify({ error: message }, null, 2),\n }\n return { content: [block], isError: true }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wireweave/sdk",
|
|
3
|
-
"version": "0.1.1
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Wireweave SDK - typed HTTP client, auth, and local tools for the Wireweave API. Sole owner of api-server contract for mcp-server, cli, and skill packages.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"sideEffects": false,
|
|
7
6
|
"main": "dist/index.js",
|
|
8
7
|
"types": "dist/index.d.ts",
|
|
9
8
|
"exports": {
|
|
@@ -16,29 +15,27 @@
|
|
|
16
15
|
"dist"
|
|
17
16
|
],
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
20
|
-
"@wireweave/core": "3.
|
|
21
|
-
"@wireweave/language-data": "1.
|
|
22
|
-
"@wireweave/ux-rules": "1.
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
19
|
+
"@wireweave/core": "3.0.1",
|
|
20
|
+
"@wireweave/language-data": "1.5.3",
|
|
21
|
+
"@wireweave/ux-rules": "1.4.1"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
|
-
"@commitlint/cli": "^21.
|
|
26
|
-
"@commitlint/config-conventional": "^21.
|
|
24
|
+
"@commitlint/cli": "^21.2.2",
|
|
25
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
27
26
|
"@eslint/js": "^10.0.1",
|
|
28
|
-
"@types/node": "^25.
|
|
29
|
-
"@vitest/coverage-v8": "^
|
|
30
|
-
"eslint": "^10.
|
|
27
|
+
"@types/node": "^25.9.6",
|
|
28
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
29
|
+
"eslint": "^10.10.0",
|
|
31
30
|
"husky": "^9.1.7",
|
|
32
|
-
"knip": "^6.
|
|
33
|
-
"lint-staged": "^
|
|
34
|
-
"prettier": "^3.
|
|
35
|
-
"publint": "^0.3.
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"typescript-eslint": "^8.59.3",
|
|
41
|
-
"vitest": "^3.1.1"
|
|
31
|
+
"knip": "^6.35.1",
|
|
32
|
+
"lint-staged": "^16.4.0",
|
|
33
|
+
"prettier": "^3.9.6",
|
|
34
|
+
"publint": "^0.3.24",
|
|
35
|
+
"tsup": "^8.5.1",
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"typescript-eslint": "^8.70.0",
|
|
38
|
+
"vitest": "^4.1.11"
|
|
42
39
|
},
|
|
43
40
|
"repository": {
|
|
44
41
|
"type": "git",
|
|
@@ -67,9 +64,9 @@
|
|
|
67
64
|
"publishConfig": {
|
|
68
65
|
"access": "public"
|
|
69
66
|
},
|
|
67
|
+
"sideEffects": false,
|
|
70
68
|
"scripts": {
|
|
71
69
|
"build": "tsup",
|
|
72
|
-
"postbuild": "node ../../scripts/dist-freshness-gate.mjs --write .",
|
|
73
70
|
"dev": "tsup --watch",
|
|
74
71
|
"test": "vitest run",
|
|
75
72
|
"test:watch": "vitest",
|
|
@@ -80,7 +77,6 @@
|
|
|
80
77
|
"format:check": "prettier --check .",
|
|
81
78
|
"knip": "knip",
|
|
82
79
|
"publint": "publint --strict",
|
|
83
|
-
"
|
|
84
|
-
"release:beta": "release-it --preRelease=beta"
|
|
80
|
+
"postbuild": "node ../../scripts/dist-freshness-gate.mjs --write ."
|
|
85
81
|
}
|
|
86
82
|
}
|