@wireweave/sdk 0.1.1-beta.10 → 0.1.1-beta.12

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.
Files changed (2) hide show
  1. package/README.md +14 -79
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,92 +1,27 @@
1
1
  # @wireweave/sdk
2
2
 
3
- The platform client for Wireweave — a typed HTTP client, token-based auth, and an in-process local tool runner, all behind a single `dispatch()` entry point.
3
+ The typed dispatch and I/O adapter used by Wireweave clients.
4
4
 
5
- ## What it does
5
+ The [public tool contract](../../docs/spec/TOOLING.md#3-sdk-dispatch-and-io-admission) defines this package's APIs, behavior, configuration and compatibility. The [language contract](../../docs/spec/LANGUAGE.md) defines the DSL. [Package metadata](package.json) owns package versions, exports, dependencies and scripts.
6
6
 
7
- `@wireweave/sdk` is the contract owner shared by the Wireweave CLI, MCP server, and skill packages. It exposes one tool-dispatch surface that routes each call to the right place:
7
+ ## Installation
8
8
 
9
- - **Local tools** run in-process via `@wireweave/core`, `@wireweave/ux-rules`, and `@wireweave/language-data`. No network call, no API key required.
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
-
12
- The list of local tools and the endpoint map for remote tools are generated from the api-server contract (`src/generated/`), so consumers never hand-maintain routing.
13
-
14
- Local dispatch tools:
15
-
16
- `wireweave_parse` · `wireweave_validate` · `wireweave_render_html_code` · `wireweave_validate_ux` · `wireweave_diff` · `wireweave_analyze` · `wireweave_list_components` · `wireweave_export_json` · `wireweave_export_figma`
17
-
18
- ## Install
9
+ Use Node.js >=22.13.0. Replace `<pinned-version>` with the release selected for your toolchain.
19
10
 
20
11
  ```bash
21
- npm install @wireweave/sdk
22
- ```
23
-
24
- Requires Node.js 20+.
25
-
26
- ## Usage
27
-
28
- ```ts
29
- import { dispatch, toolEndpoints, type ApiConfig } from '@wireweave/sdk'
30
-
31
- const apiConfig: ApiConfig = {
32
- apiUrl: 'https://api.wireweave.org',
33
- apiKey: process.env.WIREWEAVE_API_KEY ?? '', // empty is fine for local tools
34
- }
35
-
36
- // Local tool — runs in-process, no network, no key needed.
37
- const parsed = await dispatch(
38
- 'wireweave_parse',
39
- { source: 'Page "Home"' },
40
- { apiConfig, endpoints: toolEndpoints },
41
- )
42
-
43
- // Remote tool — proxied to api-server, requires a valid apiKey.
44
- const saved = await dispatch(
45
- 'wireweave_cloud_save_wireframe',
46
- { name: 'Home', source },
47
- { apiConfig, endpoints: toolEndpoints },
48
- )
12
+ pnpm add --save-exact '@wireweave/sdk@<pinned-version>'
49
13
  ```
50
14
 
51
- Run a local tool directly, bypassing dispatch:
15
+ ## Development
52
16
 
53
- ```ts
54
- import { localDispatch, isLocalDispatchTool } from '@wireweave/sdk'
17
+ Run from the monorepo root after the [workspace setup](../../README.md).
55
18
 
56
- if (isLocalDispatchTool('wireweave_diff')) {
57
- const result = localDispatch('wireweave_diff', { oldSource, newSource })
58
- }
59
- ```
60
-
61
- Authentication helpers persist a token at `~/.wireweave/config.json` (`0600`):
62
-
63
- ```ts
64
- import { saveToken, loadToken, verifyToken, clearToken } from '@wireweave/sdk'
65
-
66
- const check = await verifyToken(token, 'https://api.wireweave.org', '/verify')
67
- if (check.valid) await saveToken({ token })
68
-
69
- const stored = await loadToken() // { token, apiUrl? } | null
70
- await clearToken()
19
+ ```bash
20
+ pnpm --filter @wireweave/sdk run build
21
+ pnpm --filter @wireweave/sdk run typecheck
22
+ pnpm --filter @wireweave/sdk run lint
23
+ pnpm --filter @wireweave/sdk run test
24
+ pnpm --filter @wireweave/sdk run format:check
71
25
  ```
72
26
 
73
- ## API
74
-
75
- | Export | Description |
76
- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
- | `dispatch(name, args, options)` | Single entry point. Routes local tools to `localDispatch`, remote tools to `callApi`. |
78
- | `localDispatch(name, args)` | Runs a local tool in-process (parse, validate, render, diff, analyze, export, etc.). |
79
- | `isLocalDispatchTool(name)` | `true` if the tool is dispatched locally. |
80
- | `LOCAL_DISPATCH_TOOL_NAMES` | `ReadonlySet<string>` of local tool names. |
81
- | `callApi(config, endpoint, args, fetchFn?)` | Low-level HTTP call to an api-server endpoint. |
82
- | `buildRequest(config, endpoint, args?)` | Builds the URL and `RequestInit` for an endpoint (path params, query, body). |
83
- | `extractCreditInfo(headers)` / `parseErrorMessage(status, body)` | Credit-header parsing and HTTP-status-to-message mapping. |
84
- | `loadToken` / `saveToken` / `clearToken` / `verifyToken` / `getConfigPath` | Token persistence and verification. |
85
- | `tools` / `toolEndpoints` | Generated tool definitions and the remote endpoint map (api-server contract). |
86
- | Types | `ApiConfig`, `ApiResult`, `ApiErrorBody`, `HttpMethod`, `ToolEndpoint`, `CreditInfo`, `LocalToolResult`, `LocalToolContentBlock`, `DispatchOptions`, `AuthOptions`, `StoredConfig`, `VerifyTokenResult` |
87
-
88
- Part of the [Wireweave monorepo](https://github.com/wireweave/wireweave).
89
-
90
- ## License
91
-
92
- MIT
27
+ License: MIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireweave/sdk",
3
- "version": "0.1.1-beta.10",
3
+ "version": "0.1.1-beta.12",
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
6
  "sideEffects": false,
@@ -17,9 +17,9 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@modelcontextprotocol/sdk": "^1.0.0",
20
- "@wireweave/core": "3.1.0-beta.10",
21
- "@wireweave/language-data": "1.6.0-beta.5",
22
- "@wireweave/ux-rules": "1.5.0-beta.10"
20
+ "@wireweave/core": "4.0.0-beta.12",
21
+ "@wireweave/language-data": "1.6.0-beta.7",
22
+ "@wireweave/ux-rules": "1.5.0-beta.12"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@commitlint/cli": "^21.0.1",