proto: land F2 — download.provideAuth (1.2.0)

The last contract gap blocking an M1 definition-of-done item: CORE's "401
handled" has no return path without it, and B2a's sibling F2 was accepted in
proto-answers-m1.md but never actually landed.

download.provideAuth {taskId, username, password, save?} -> {ok}, exactly as
proposed there. Privileged and Unix-socket-only: a credential-bearing method
must never be reachable from the browser, which is the other half of the
promise event.auth.required's own description already makes ("never back
through this event, never into a log"). It answers the challenge; it does not
itself resume the task -- the daemon retries with the credential attached and
the ordinary event.task.state reports the task leaving retry_wait, the same
as any other state change.

save only tells the daemon whether to persist the credential in the Secret
Service for next time, or use it for this attempt alone -- it never touches
SQLite or a log either way, in keeping with CLAUDE.md's secrets rule.

Three fixtures: the success path, -32010 for a task that no longer exists
(credentials submitted for it are simply discarded), and -32003 confirming
the extension has no path to this method under any transport.

mockd gets a real handler rather than falling through to the generic fixture
responder: it validates the taskId exists (so the -32010 fixture is
replayable) and actually transitions the task out of retry_wait.

Minor bump, 1.1.0 -> 1.2.0: additive method, no existing type touched.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012fgjnqFCS5h5L7gZTZo3rV
This commit is contained in:
2026-09-10 00:01:58 +04:00
co-authored by Claude Sonnet 5
parent f60070c420
commit 2d36e9fef0
17 changed files with 409 additions and 24 deletions
+11 -10
View File
@@ -3,14 +3,14 @@
**This directory is the interface between every lane.** Owner: agent **PROTO**.
Nobody else commits here. Everybody else *generates from* here.
> ## Status: **v1.0.0 — FROZEN** (2026-09-09)
> ## Status: **v1.2.0** (frozen at v1.0.0 on 2026-09-09; minor bumps since)
>
> **v1.0.0** froze 38 methods, 9 events, 26 named types. **v1.1.0** (current) is a minor
> bump on top of it: `bufferBytes` bounds widened to 64 KiB - 16 MiB across all four
> locations, two new settings keys (`connection.maxTotalBufferBytes`,
> `connection.maxActiveSegments`), and `TaskDetail.effectiveBufferBytes` — see
> `docs/adr/0012-buffer-and-segment-budget.md`. See also `docs/adr/0005-...` for the
> versioning rule and `docs/adr/0010-...` for the failure taxonomy and segment ranges.
> **v1.0.0** froze 38 methods, 9 events, 26 named types. **v1.1.0** widened `bufferBytes`
> bounds, added `connection.maxTotalBufferBytes` / `connection.maxActiveSegments`, and
> `TaskDetail.effectiveBufferBytes` (`docs/adr/0012-...`). **v1.2.0** (current) adds
> `download.provideAuth` — F2's credential return path for a paused 401/407, UDS-only
> and privileged. See also `docs/adr/0005-...` for the versioning rule and
> `docs/adr/0010-...` for the failure taxonomy and segment ranges.
>
> Lane requests are answered in writing: `contracts/proto-answers-m1.md` responds to
> `core/docs/proto-requests-m1.md` point by point.
@@ -30,7 +30,7 @@ Nobody else commits here. Everybody else *generates from* here.
```
contracts/
├── VERSION # protocol semver — frozen at 1.0.0
├── VERSION # protocol semver — v1.2.0, minor-bumped from the v1.0.0 freeze
├── openrpc.json # human-readable API doc (generated from schema/)
├── schema/
│ ├── envelope.schema.json # JSON-RPC 2.0 envelope + our error codes
@@ -76,7 +76,7 @@ on rather than as prose a reader has to honour:
| `x-errors` | the error codes this method is documented to return |
| `x-wsRestrictions` | extra limits when the call arrives from the extension |
19 of the 38 methods are privileged: everything that reconfigures the daemon, destroys user
20 of the 39 methods are privileged: everything that reconfigures the daemon, destroys user
data, or names an arbitrary destination path. The extension may *request* a download; it
may not choose where the bytes land.
@@ -93,7 +93,7 @@ All four carry **the same JSON-RPC 2.0 payloads**. The framing differences stop
transport layer; no method behaves differently depending on how it arrived — except that
methods marked `"privileged": true` in the schema are refused over the WebSocket transport.
## Method surface (v1.0.0 target — expand only via PR)
## Method surface (v1.2.0 — expand only via PR)
### Session
| Method | Params → Result |
@@ -114,6 +114,7 @@ methods marked `"privileged": true` in the schema are refused over the WebSocket
| `download.remove` | `{taskIds[], deleteFile:bool}``{removed[]}` |
| `download.update` | `{taskId, patch:{filename?, saveDir?, categoryId?, queueId?, description?, segments?, bufferBytes?}}``TaskSummary` |
| `download.refreshUrl` | `{taskId, url, headers?}``{ok}` *(IDM's "Refresh Download Address")* |
| `download.provideAuth` | `{taskId, username, password, save?}``{ok}` — answers `event.auth.required`. UDS only; privileged. Credentials go to the Secret Service, never SQLite, never logs |
### Organisation
`category.list` · `category.upsert` · `category.remove` · `queue.list` · `queue.upsert` ·