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
+15 -1
View File
@@ -3,7 +3,7 @@
//
// Source: contracts/schema/**
// Generator: contracts/codegen/gen_ts.py
// Contract: v1.1.0
// Contract: v1.2.0
//
// Hand-editing this file is a merge blocker. Fix the schema and regenerate:
// python3 contracts/codegen/gen_ts.py
@@ -33,6 +33,8 @@ import type {
DownloadPauseParams,
DownloadProbeParams,
DownloadProbeResult,
DownloadProvideAuthParams,
DownloadProvideAuthResult,
DownloadRefreshUrlParams,
DownloadRefreshUrlResult,
DownloadRemoveParams,
@@ -159,6 +161,17 @@ export interface MethodMap {
* when this lands.
*/
"download.probe": { params: DownloadProbeParams; result: DownloadProbeResult };
/**
* Answer an event.auth.required challenge. The task sits in retry_wait until this arrives;
* on success the daemon retries with the credentials attached and the task resumes on its
* own — this method does not itself start the transfer. Privileged and Unix-socket-only: a
* credential-bearing method must never be reachable from the browser, which is exactly the
* boundary event.auth.required's own description draws ('never back through this event,
* never into a log') — this is the other half of that promise. Credentials are handed to
* the Secret Service, never to SQLite and never logged; save only tells the daemon whether
* to persist them there for next time, or use them for this attempt alone.
*/
"download.provideAuth": { params: DownloadProvideAuthParams; result: DownloadProvideAuthResult };
/**
* IDM's 'Refresh Download Address'. Point an existing task at a freshly-issued URL when a
* signed link has expired, keeping every byte already on disk. The daemon re-probes and
@@ -346,6 +359,7 @@ export const METHODS: { readonly [M in MethodName]: MethodMeta } = {
"download.list": { privileged: false, transports: ['uds', 'ws'], deadlineMs: 5000, errors: [] },
"download.pause": { privileged: false, transports: ['uds', 'ws'], deadlineMs: 5000, errors: [-32010] },
"download.probe": { privileged: false, transports: ['uds', 'ws'], deadlineMs: 30000, errors: [-32013] },
"download.provideAuth": { privileged: true, transports: ['uds'], deadlineMs: 5000, errors: [-32003, -32010] },
"download.refreshUrl": { privileged: false, transports: ['uds', 'ws'], deadlineMs: 30000, errors: [-32010, -32013] },
"download.remove": { privileged: true, transports: ['uds'], deadlineMs: 10000, errors: [-32003, -32010] },
"download.resume": { privileged: false, transports: ['uds', 'ws'], deadlineMs: 5000, errors: [-32010] },