Commit 8cc9c50
phase 1.2: JS/TS client library — wire-compatible mirror of Python
js/ workspace shipping @zawwarsami/zhub on npm. browser + Node clients
can publish() and connect() with the same primitives as Python. tsc
checks clean locally; CI gets a parallel js-test job.
components:
- js/package.json: ESM-only, single dependency on `ws` for Node, types
via tsc emit. exports field with .d.ts.
- js/tsconfig.json: strict, ES2022 target, declaration+types.
- js/src/manifest.ts: Manifest + Capability types, chatOnlyManifest()
helper, byte-equivalent JSON shape to Python.
- js/src/protocol.ts: Envelope + helpers (registerPublisher,
registerConnection, chatRequest, chatResponse, chatChunk,
invokeRequest, invokeResult, errorEnvelope). request_id matches
Python's uuid4().hex (32 lowercase hex chars).
- js/src/errors.ts: ZhubError hierarchy mirroring Python.
- js/src/client.ts: ZhubPublication + ZhubConnection classes with
publish() and connect() factories.
* Auto-reconnect with backoff (mirrors Phase 1.5 Python).
* Picks global WebSocket in browsers, falls back to `ws` in Node.
* Streaming chat (sync + async iterators yield chat-chunks).
* Bidirectional invoke (publisher.invoke(cid, cap, args)).
* AuthError on register_failed = terminal, no busy-loop.
- js/src/index.ts: re-exports.
- js/test/protocol.test.ts: 9 cases — all envelope shapes round-trip
+ match Python wire format exactly.
- js/test/manifest.test.ts: 3 cases — chatOnlyManifest defaults,
rate_limit thread-through, public flag.
- js/README.md: install + publish + connect examples + browser caveat.
- .github/workflows/ci.yml: js-test job runs npm install + tsc check
+ vitest. parallel with python matrix + kotlin job.
local testing caveat (proot only): rollup native binding dlopen blocked
in Termux, so vitest can't run locally. tsc-noEmit is clean. CI runs
the full vitest suite on real Linux.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ed87285 commit 8cc9c50
911 files changed
Lines changed: 592170 additions & 0 deletions
File tree
- .github/workflows
- js
- node_modules
- .bin
- @esbuild/android-arm64
- bin
- @jest/schemas
- @jridgewell/sourcemap-codec
- src
- types
- @rollup/rollup-android-arm64
- @sinclair/typebox
- compiler
- errors
- system
- value
- @types
- estree
- node
- assert
- compatibility
- dns
- fs
- readline
- stream
- timers
- ts5.6
- web-globals
- ws
- @vitest
- expect
- runner
- snapshot
- spy
- utils
- acorn-walk
- acorn
- bin
- ansi-styles
- assertion-error
- cac
- deno
- chai
- lib
- chai
- core
- interface
- utils
- check-error
- confbox
- cross-spawn
- lib
- util
- debug
- src
- deep-eql
- diff-sequences
- esbuild
- bin
- lib
- estree-walker
- src
- types
- execa
- lib
- get-func-name
- get-stream
- source
- human-signals
- is-stream
- isexe
- test
- js-tokens
- local-pkg
- loupe
- lib
- magic-string
- merge-stream
- mimic-fn
- mlly
- node_modules/pathe
- ms
- nanoid
- .claude
- async
- bin
- non-secure
- url-alphabet
- npm-run-path
- node_modules/path-key
- onetime
- p-limit
- path-key
- pathe
- pathval
- picocolors
- pkg-types
- node_modules/pathe
- postcss
- lib
- pretty-format
- react-is
- cjs
- umd
- rollup
- node_modules/@types/estree
- shebang-command
- shebang-regex
- siginfo
- signal-exit
- source-map-js
- lib
- stackback
- std-env
- strip-final-newline
- strip-literal
- tinybench
- tinypool
- tinyspy
- type-detect
- typescript
- bin
- lib
- cs
- de
- es
- fr
- it
- ja
- ko
- pl
- pt-br
- ru
- tr
- zh-cn
- zh-tw
- ufo
- undici-types
- vite-node
- vitest
- vite
- bin
- types
- which
- bin
- why-is-node-running
- .github
- ws
- lib
- yocto-queue
- src
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments