@seed-app-studio/protocol 0.1.1-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -0
- package/dist/index.d.mts +1597 -0
- package/dist/index.mjs +7440 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @happy-creative/seed-bridge-protocol
|
|
2
|
+
|
|
3
|
+
Transport-neutral bridge protocol contracts for SEED App Host, Electron, Web SaaS, and gateway runtimes.
|
|
4
|
+
|
|
5
|
+
## JSON-RPC 2.0 Protocol
|
|
6
|
+
|
|
7
|
+
All cross-runtime communication uses **JSON-RPC 2.0** as the single wire protocol.
|
|
8
|
+
|
|
9
|
+
### Frame Types
|
|
10
|
+
|
|
11
|
+
| Type | Direction | Description |
|
|
12
|
+
| ------------ | --------------- | --------------------------------------------------------- |
|
|
13
|
+
| Request | Client → Server | `{ jsonrpc: "2.0", id, method, params? }` |
|
|
14
|
+
| Response | Server → Client | `{ jsonrpc: "2.0", id, result }` |
|
|
15
|
+
| Error | Server → Client | `{ jsonrpc: "2.0", id, error: { code, message, data? } }` |
|
|
16
|
+
| Notification | Server → Client | `{ jsonrpc: "2.0", method, params? }` (no id) |
|
|
17
|
+
|
|
18
|
+
### Core API
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import {
|
|
22
|
+
// Creation
|
|
23
|
+
createJsonRpcRequest,
|
|
24
|
+
createJsonRpcResponse,
|
|
25
|
+
createJsonRpcError,
|
|
26
|
+
createJsonRpcNotification,
|
|
27
|
+
// Parsing
|
|
28
|
+
parseJsonRpcFrame,
|
|
29
|
+
deserializeJsonRpcFrame,
|
|
30
|
+
// Serialization
|
|
31
|
+
serializeJsonRpcFrame,
|
|
32
|
+
// Validation
|
|
33
|
+
validateJsonRpcRequest,
|
|
34
|
+
// Error codes
|
|
35
|
+
JSON_RPC_ERROR_CODES,
|
|
36
|
+
} from "@happy-creative/seed-bridge-protocol";
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Event Notifications
|
|
40
|
+
|
|
41
|
+
All events use `method: "seed.event"` with a canonical event catalog:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import {
|
|
45
|
+
CANONICAL_EVENT_TYPES,
|
|
46
|
+
createSeedEventNotification,
|
|
47
|
+
validateCanonicalEvent,
|
|
48
|
+
validateCanonicalEventMeta,
|
|
49
|
+
} from '@happy-creative/seed-bridge-protocol';
|
|
50
|
+
|
|
51
|
+
const notification = createSeedEventNotification({
|
|
52
|
+
type: CANONICAL_EVENT_TYPES.AGENT_MESSAGE_DELTA,
|
|
53
|
+
runtime: 'electron', // or 'web-saas'
|
|
54
|
+
payload: { conversationId, runId, content, role },
|
|
55
|
+
meta: { traceId, eventId, seq?, tenantId?, userId? },
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Transport Contracts
|
|
60
|
+
|
|
61
|
+
| Runtime | Transport | Auth | Channel |
|
|
62
|
+
| ------------ | ----------- | ------------------- | --------------------- |
|
|
63
|
+
| electron | IPC | preload-main | `seed-bridge-adapter` |
|
|
64
|
+
| web-saas | WebSocket | session-cookie | `/v1/ws` |
|
|
65
|
+
| local-webui | WebSocket | local-session | `localhost:25809` |
|
|
66
|
+
| react-native | WebView | manifest-capability | postMessage |
|
|
67
|
+
| app-host | postMessage | manifest-capability | postMessage |
|
|
68
|
+
|
|
69
|
+
### Migration Note
|
|
70
|
+
|
|
71
|
+
Legacy `SeedBridgeRequest` / `SeedBridgeResult` / `SeedBridgeEvent` types are **@deprecated**.
|
|
72
|
+
They are retained only for migration-boundary conversion. New code MUST use JSON-RPC 2.0 frames.
|
|
73
|
+
|
|
74
|
+
See: `openspec/changes/unify-jsonrpc-bridge/` for the full migration plan.
|