bin/lib/pkt.js + wire.js — git fetch conversationThe pure-JS git-wire CLIENT (fetch direction): pkt-line framing + transport spawn
+ refs-advert parse + want/have/done negotiate + side-band-64k demux, yielding the
received packfile bytes. Mirrors keeper/WIRECLI.c (unlinkable). Part of JS-038.
be get over the wire spawns a peer (ssh host keeper upload-pack,
file:// local exec, be:///git:// TCP) and runs the v0/v1 upload-pack
convo. JABC already has the transport: io.spawn → {pid,stdin,stdout} +
io.reap; net.connect + pol for TCP. The convo logic is pure JS.pkt.js: drain/feed/flush pkt-lines (4-hex len + payload); pure JS over
hex (no native leaf — trivial, like status.js text parsing).wire.js: fetch(remoteUri, wantRef?) -> {pack:Uint8Array, refs:[...]} —
spawn, drain advert (sha SP refname \0caps), send want/have/done,
NAK, demux side-band band1 pack / band2,3 → stderr.abc ONLY. Transport classify like WIRECLI.c::wcli_spawn
(file/ssh/be/git). No ingest here (→ JS-040); return raw pack bytes.io.spawn (ssh/exec) or net.connect (be/git TCP); avoid
write/read deadlock with pol non-blocking interleave (WIRECLI poll loop).WIREClassify-equivalent line tokenizer in JS (want/have/advert/ack lines).test/js/get/wire.js (helpers test/js/lib/): against a local
keeper upload-pack (file://) + a real git file://x.git, fetch trunk →
assert advert parsed, pack header (PACK,count) parses via git.pack.bin/lib/pkt.js + bin/lib/wire.js; smoke ssh + be transports.