zas-agent 0.3.0 → 0.5.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.
Files changed (4) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +39 -15
  3. package/dist/cli.js +2383 -828
  4. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.0] - 2026-09-03
11
+
12
+ ### Added
13
+
14
+ - `zas_receive_direct` receives a file the owner sends through Directo,
15
+ straight onto this machine. It waits for the offer, takes it, and writes
16
+ the file to disk; nothing is stored anywhere. Receiving is reading, so it
17
+ needs a grant with `read`, and the channel has to be in Directo mode. The
18
+ call returns the result, or a job id after a minute; `zas_jobs` follows the
19
+ phases `waiting`, `connecting`, `flight`, `finishing`.
20
+ - `zas_receive_direct_fallback` finishes a receive that failed in flight,
21
+ when the sender chose reliable delivery for it: the encrypted copy is
22
+ downloaded and decrypted onto the same destination.
23
+ - New error codes: `no_offer` and `offer_taken`.
24
+
25
+ ### Changed
26
+
27
+ - The agent claims an offer only inside a tool call. It never watches a
28
+ channel: an exchange takes two devices and the first claim wins, so a
29
+ watcher would take files meant for the owner's own phone.
30
+ - A received file never overwrites an existing one. It is written 0600
31
+ through a temporary name and renamed only once the transfer is verified,
32
+ so a run that breaks leaves nothing that reads as complete. The answered
33
+ `path` is where the bytes actually went.
34
+ - `zas_status` says `receive (Directo)` where it said `read` for a channel
35
+ in Directo mode: such a channel stores nothing, so there is no list of
36
+ items behind the grant, only live offers to take.
37
+
38
+ ## [0.4.0] - 2026-09-03
39
+
40
+ ### Added
41
+
42
+ - `zas_send_direct` sends a file through Directo: a live, device-to-device
43
+ transfer into a channel in Directo mode. Nothing is stored. The agent
44
+ offers, the owner presses Receive on another device within ten minutes,
45
+ and the bytes travel encrypted over WebRTC. The call returns the result,
46
+ or a job id after a minute; `zas_jobs` follows the phases `offer`,
47
+ `connecting`, `flight`, `finishing`.
48
+ - `zas_send_direct_fallback` delivers the file of a Directo send that
49
+ failed in flight through reliable delivery: encrypted on this machine,
50
+ stored in Cloudflare R2 for up to 24 hours, off the owner's quota. It is
51
+ the owner's choice; the tool description tells the model to ask.
52
+ - A native dependency: `node-datachannel`, WebRTC for Node. npm installs a
53
+ prebuilt binary; the module loads the first time `zas_send_direct` runs,
54
+ and a machine where it cannot load answers `webrtc_unavailable`.
55
+ - New error codes: `not_claimed`, `direct_cancelled`, `direct_failed`,
56
+ `direct_not_failed`, `file_changed`, `webrtc_unavailable`,
57
+ `fallback_unavailable`.
58
+
59
+ ### Changed
60
+
61
+ - `zas_status` says `send (Directo)` for a channel in Directo mode, where it
62
+ said nothing. `zas_send_file` still refuses such a channel.
63
+
10
64
  ## [0.3.0] - 2026-09-03
11
65
 
12
66
  ### Added
package/README.md CHANGED
@@ -25,8 +25,9 @@ scope to the channels you choose, and that you can revoke.
25
25
 
26
26
  ## What it does
27
27
 
28
- Your coding agent gets seven tools. It can send a file or a note into a channel
29
- you picked, list what is in that channel, and pull one item back onto disk.
28
+ Your coding agent gets eleven tools. It can send a file or a note into a channel
29
+ you picked, send or receive a file live through Directo, list what is in that
30
+ channel, and pull one item back onto disk.
30
31
  Everything it sends is encrypted on your machine before it leaves, lands in your
31
32
  account, and is marked in the channel as sent by that agent. The agent has an
32
33
  identity of its own and never holds your account key: pairing mints a key pair
@@ -147,8 +148,13 @@ ones marked *(server-side)* are enforced by the Zas server.
147
148
  *(server-side)*.
148
149
  - **No reading unless the grant says so.** `read` is a separate switch from
149
150
  `send`; without it, `zas_list_items` and `zas_get_item` are refused.
150
- - **No sending into a view-only channel, and none into a channel in Directo
151
- mode.** Both are refused before a byte is uploaded.
151
+ - **No stored sending into a view-only channel, and none into a channel in
152
+ Directo mode.** Both are refused before a byte is uploaded. A channel in
153
+ Directo mode takes `zas_send_direct`, a live transfer that stores nothing.
154
+ - **No receiving unless the grant says read.** Receiving through Directo
155
+ writes a file onto this machine, so `zas_receive_direct` takes the same
156
+ `read` switch as listing. And it only ever runs inside a tool call: the
157
+ agent never watches your channels, so nothing arrives unasked.
152
158
  - **Nothing outside its allowlist.** The API refuses an agent on every route
153
159
  that is not on a short, explicit list, and Firestore rules refuse it your
154
160
  account document, your devices, and any channel without an active read grant
@@ -177,6 +183,15 @@ string ever reaches a terminal.
177
183
  | `read_forbidden` | This agent cannot read that channel. |
178
184
  | `direct_mode` | That channel is in Directo mode. |
179
185
  | `not_direct_mode` | That channel is not in Directo mode. |
186
+ | `not_claimed` | Nobody received the file within ten minutes; the offer was withdrawn. |
187
+ | `no_offer` | Nobody offered a file through Directo while the call waited. |
188
+ | `offer_taken` | Another device received that file first. |
189
+ | `direct_cancelled` | The offer was cancelled from the other side. |
190
+ | `direct_failed` | The Directo transfer failed in flight. |
191
+ | `direct_not_failed` | That job is not a Directo transfer that failed in flight. |
192
+ | `file_changed` | The file changed since the Directo offer. |
193
+ | `webrtc_unavailable` | The WebRTC engine could not be loaded on this machine. |
194
+ | `fallback_unavailable` | Reliable delivery is not available right now. |
180
195
  | `key_stale` | The channel key changed; the owner refreshes it by opening Zas. |
181
196
  | `quota_exceeded` | The account reached its storage limit. |
182
197
  | `rate_limited` | Too many sends in a row. |
@@ -207,26 +222,35 @@ stack trace.
207
222
  | `zas_pair` | Pairs this agent with a Zas account. The first call returns a URL for the owner to open; a later call says whether they approved. If the page shows a code, a call with `code` claims with it. In a profile that is already paired, approval replaces the old agent. |
208
223
  | `zas_send_file` | Sends a file from this machine into one of the owner's channels. Returns the item id, or a job id when the upload takes longer than a minute. |
209
224
  | `zas_send_note` | Sends a note — plain text, or a code snippet with its language — into one of the owner's channels. |
225
+ | `zas_send_direct` | Sends a file through Directo: a live, device-to-device transfer into a channel in Directo mode. Nothing is stored. The owner presses Receive on another device within ten minutes; the call returns the result, or a job id after a minute. |
226
+ | `zas_send_direct_fallback` | After a Directo send failed in flight, delivers the same file through reliable delivery: encrypted on this machine, stored in Cloudflare R2 for up to 24 hours, off the owner's quota. The owner's choice; the model is told to ask. |
227
+ | `zas_receive_direct` | Receives a file the owner sends through Directo, onto this machine. Waits for the offer, takes it, and writes the file to disk. Needs a grant that includes reading, and a channel in Directo mode. Returns the path written, or a job id after a minute. |
228
+ | `zas_receive_direct_fallback` | After a Directo receive failed in flight, downloads the encrypted copy the sender chose to store, and decrypts it to the same destination. |
210
229
  | `zas_list_items` | Lists the most recent items in one of the owner's channels. Needs a grant that includes reading. |
211
230
  | `zas_get_item` | Fetches one item. A note comes back as text; a file is written to disk. It never overwrites, so the path it answers with can differ from the one you asked for. |
212
- | `zas_jobs` | Lists the sends this server started, newest first, with the phase each one reached — and where a `job_id` from a long send is redeemed. |
231
+ | `zas_jobs` | Lists the sends and Directo transfers this server started, newest first, with the phase each one reached — and where a `job_id` from a long send is redeemed. |
213
232
 
214
233
  `channel` takes a channel name or a channel id. A name has to match exactly one
215
- of the channels you granted; with exactly one grant, `zas_send_file` and
216
- `zas_send_note` can leave it out.
234
+ of the channels you granted; with exactly one grant, `zas_send_file`,
235
+ `zas_send_note`, `zas_send_direct` and `zas_receive_direct` can leave it out.
236
+
237
+ Directo needs a native module, [node-datachannel](https://github.com/murat-dogan/node-datachannel),
238
+ WebRTC for Node. npm installs a prebuilt binary for Windows, macOS and Linux;
239
+ the module loads the first time a Directo tool runs, and a machine where it
240
+ cannot load answers `webrtc_unavailable`. Every other tool works without it.
217
241
 
218
242
  Two things worth knowing before you point a model at your account:
219
243
 
220
- - `zas_send_file` sends any file this process can read — `~/.ssh/id_rsa` and a
221
- `.env` included. Confirm with the owner before sending secrets, keys or
244
+ - `zas_send_file` and `zas_send_direct` send any file this process can read —
245
+ `~/.ssh/id_rsa` and a `.env` included. Confirm with the owner before sending secrets, keys or
222
246
  credentials. Its tool description says so, so the model reads it too.
223
- - `zas_get_item` writes a new file under `dest`, or under the system temp
224
- directory when you leave `dest` out. It never overwrites an existing file: a
225
- name that is taken gets a suffix, and the path it answers with is the one it
226
- actually wrote.
247
+ - `zas_get_item` and `zas_receive_direct` write a new file under `dest`, or
248
+ under the system temp directory when you leave `dest` out. Neither ever
249
+ overwrites an existing file: a name that is taken gets a suffix, and the path
250
+ they answer with is the one they actually wrote.
227
251
 
228
- Everything either tool touches lands inside your own account and your own
229
- machine. Revoking the agent stops both.
252
+ Everything those tools touch lands inside your own account and your own
253
+ machine. Revoking the agent stops all of them.
230
254
 
231
255
  ## Data on disk
232
256