@ts-pf/message 0.1.0-beta.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 +14 -0
- package/dist/duplex.d.ts +11 -0
- package/dist/duplex.d.ts.map +1 -0
- package/dist/duplex.js +70 -0
- package/dist/duplex.js.map +1 -0
- package/dist/error.d.ts +8 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +10 -0
- package/dist/error.js.map +1 -0
- package/dist/frame.d.ts +72 -0
- package/dist/frame.d.ts.map +1 -0
- package/dist/frame.js +239 -0
- package/dist/frame.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/port.d.ts +3 -0
- package/dist/port.d.ts.map +1 -0
- package/dist/port.js +56 -0
- package/dist/port.js.map +1 -0
- package/dist/session.d.ts +62 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +337 -0
- package/dist/session.js.map +1 -0
- package/dist/stdio.d.ts +9 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +152 -0
- package/dist/stdio.js.map +1 -0
- package/dist/ws.d.ts +14 -0
- package/dist/ws.d.ts.map +1 -0
- package/dist/ws.js +99 -0
- package/dist/ws.js.map +1 -0
- package/package.json +53 -0
- package/skills/ts-pf-message/SKILL.md +40 -0
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ts-pf/message",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Opt-in JSON text frames and MessageSession for WS, stdio, and MessagePort",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/crobinson42/ts-pf.git",
|
|
9
|
+
"directory": "packages/message"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/crobinson42/ts-pf/tree/main/packages/message#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/crobinson42/ts-pf/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./src/index.ts",
|
|
20
|
+
"import": "./src/index.ts"
|
|
21
|
+
},
|
|
22
|
+
"./stdio": {
|
|
23
|
+
"types": "./src/stdio.ts",
|
|
24
|
+
"import": "./src/stdio.ts"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./stdio": {
|
|
35
|
+
"types": "./dist/stdio.d.ts",
|
|
36
|
+
"import": "./dist/stdio.js"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"skills"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.build.json",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"type-check": "tsc --noEmit",
|
|
48
|
+
"lint": "biome check src tests"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@ts-pf/protocol": "0.1.0-beta.0"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ts-pf-message
|
|
3
|
+
description: Use when framing ts-pf over JSON text frames with MessageSession, Duplex, createPortDuplex, or createWsDuplex. Triggers: @ts-pf/message, MessageSession, encodeFrame, decodeFrame, createStdioDuplex.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @ts-pf/message
|
|
7
|
+
|
|
8
|
+
Opt-in JSON text frames and `MessageSession`. Not an HTTP codec.
|
|
9
|
+
|
|
10
|
+
Install: `npm i @ts-pf/message@beta`
|
|
11
|
+
|
|
12
|
+
Link for agents: `npx skills experimental_sync -y`
|
|
13
|
+
|
|
14
|
+
## Do
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createPortDuplex, createWsDuplex, type WebSocketLike } from '@ts-pf/message'
|
|
18
|
+
import { createStdioDuplex } from '@ts-pf/message/stdio'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Bindings live in `@ts-pf/message-server` / `@ts-pf/message-client`. Inject a `WebSocket` constructor — do not depend on the `ws` npm package. User owns listen / upgrade / spawn / Worker bootstrap.
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
- `MessageSession`, `Duplex`, `encodeFrame`, `decodeFrame`
|
|
26
|
+
- `createMemoryDuplex`, `createPortDuplex`, `createWsDuplex`, `WebSocketLike`
|
|
27
|
+
- `errorFromEnvelope`, `localFailure`
|
|
28
|
+
- `createStdioDuplex` from `./stdio` only
|
|
29
|
+
|
|
30
|
+
## Pair with
|
|
31
|
+
|
|
32
|
+
- Server: `ts-pf-message-server`
|
|
33
|
+
- Client: `ts-pf-message-client`
|
|
34
|
+
- Wire: `@ts-pf/protocol` `PROTOCOL.md` (Message transports)
|
|
35
|
+
|
|
36
|
+
## Don't
|
|
37
|
+
|
|
38
|
+
- Use this as an HTTP `RpcCodec`.
|
|
39
|
+
- Depend on the `ws` npm package — inject a `WebSocket` constructor.
|
|
40
|
+
- Reconstruct HTTP status from `error.code` on this pipe.
|