podster 0.0.0-stage → 0.0.1-test.2
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.
- package/README.md +116 -2
- package/build/core/adapter.js +1 -0
- package/build/core/broker.js +461 -0
- package/build/core/capabilities.js +49 -0
- package/build/core/claude-profile.js +35 -0
- package/build/core/connection.js +106 -0
- package/build/core/errors.js +115 -0
- package/build/core/gateway.js +93 -0
- package/build/core/lifecycle.js +1207 -0
- package/build/core/nudge.js +340 -0
- package/build/core/pairing.js +285 -0
- package/build/core/policy.js +741 -0
- package/build/core/poller.js +261 -0
- package/build/core/prompt.js +93 -0
- package/build/core/record.js +106 -0
- package/build/core/repository.js +272 -0
- package/build/core/results.js +149 -0
- package/build/core/run-interface.js +464 -0
- package/build/core/runs.js +172 -0
- package/build/core/runtime.js +38 -0
- package/build/core/state.js +41 -0
- package/build/core/storage.js +125 -0
- package/build/core/thumbprint.js +15 -0
- package/build/core/tool-policy.js +130 -0
- package/build/node/broker-listener.js +183 -0
- package/build/node/child-env.js +26 -0
- package/build/node/claude-driver.js +741 -0
- package/build/node/claude-engine.js +196 -0
- package/build/node/cli.js +273 -0
- package/build/node/docker-sandbox.js +465 -0
- package/build/node/file-runs.js +63 -0
- package/build/node/file-state.js +73 -0
- package/build/node/git.js +124 -0
- package/build/node/github-api.js +79 -0
- package/build/node/hidden-input.js +47 -0
- package/build/node/key-store.js +150 -0
- package/build/node/keychain.js +160 -0
- package/build/node/local-stop.js +67 -0
- package/build/node/lock.js +155 -0
- package/build/node/nudge-command.js +132 -0
- package/build/node/nudge-listener.js +137 -0
- package/build/node/platform.js +127 -0
- package/build/node/policy-file.js +13 -0
- package/build/node/prompter.js +166 -0
- package/build/node/provider-transport.js +181 -0
- package/build/node/repo-path.js +370 -0
- package/build/node/run-command.js +59 -0
- package/build/node/safe-fs.js +244 -0
- package/claude-image/Dockerfile +29 -0
- package/git/credential-helper +23 -0
- package/npm-shrinkwrap.json +3173 -0
- package/package.json +47 -4
- package/sandbox/Dockerfile +17 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The SDK and its bundled Claude Code, as spike B ran them. A new pair is admitted only after spike B's checks pass on it. */
|
|
2
|
+
export const PINNED_SDK_VERSION = "0.3.327";
|
|
3
|
+
export const PINNED_CLAUDE_CODE_VERSION = "2.1.327";
|
|
4
|
+
/** The model Runner asks for. */
|
|
5
|
+
export const CLAUDE_MODEL = "claude-haiku-5-5";
|
|
6
|
+
/**
|
|
7
|
+
* Micro-USD per million tokens. Input and output are Anthropic's list prices for Claude Haiku 5.5 (0.10 and 0.50 USD per
|
|
8
|
+
* million, read 2026-11-18 from the claude-api reference cached 2026-11-03, for prompts up to 100K tokens). Cache writes
|
|
9
|
+
* and reads are taken at 1.25 and 0.1 times input, as spike B assumed and the SDK's figures matched. Above 100K input
|
|
10
|
+
* tokens the list price rises to 0.50 and 2.50 USD; that tier is priced too, and the broker's worst case takes it.
|
|
11
|
+
*/
|
|
12
|
+
const HAIKU_5_5 = {
|
|
13
|
+
input: 100_000,
|
|
14
|
+
output: 500_000,
|
|
15
|
+
cache_write: 125_000,
|
|
16
|
+
cache_read: 10_000,
|
|
17
|
+
// Above 100K input tokens: 0.50 and 2.50 USD per million, cache at the same 1.25 and 0.1 times (L6 on #460).
|
|
18
|
+
long_context: { above_input_tokens: 100_000, input: 500_000, output: 2_500_000, cache_write: 625_000, cache_read: 50_000 },
|
|
19
|
+
};
|
|
20
|
+
export const CLAUDE_PROFILE = Object.freeze({
|
|
21
|
+
provider: "anthropic",
|
|
22
|
+
host: "api.anthropic.com",
|
|
23
|
+
path: "/v1/messages",
|
|
24
|
+
headers: Object.freeze({ "anthropic-version": "2023-06-01", "content-type": "application/json" }),
|
|
25
|
+
prices: Object.freeze({ [CLAUDE_MODEL]: Object.freeze({ ...HAIKU_5_5, long_context: Object.freeze({ ...HAIKU_5_5.long_context }) }) }),
|
|
26
|
+
});
|
|
27
|
+
export const CLAUDE_MODELS = Object.freeze([CLAUDE_MODEL]);
|
|
28
|
+
/** Why the installed pair can't run, or null when it is exactly the pinned one. */
|
|
29
|
+
export function versionRefusal(found) {
|
|
30
|
+
if (found.sdk !== PINNED_SDK_VERSION)
|
|
31
|
+
return "sdk_version";
|
|
32
|
+
if (found.claude_code !== PINNED_CLAUDE_CODE_VERSION)
|
|
33
|
+
return "claude_code_version";
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runner's calls as its paired agent. Each call signs a fresh agent JWT with the stored agent key (the pinned SDK's
|
|
3
|
+
* `signAgentJWT`), naming only the one capability, and posts it to the gateway's execute endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Runner makes this call itself rather than through the SDK's `executeCapability` (M7 plan, the architect's ruling 3 on
|
|
6
|
+
* spike A): the SDK misreads the gateway's own refusals, and its grant cache can refuse locally after a revocation with no
|
|
7
|
+
* HTTP status at all. Here every refusal is the gateway's, read with its status (`errors.ts`).
|
|
8
|
+
*
|
|
9
|
+
* Only the gateway's origin is ever reached: a discovery document naming an issuer or an execute location elsewhere is
|
|
10
|
+
* refused, so an agent JWT is never sent anywhere else.
|
|
11
|
+
*/
|
|
12
|
+
import { discoverProvider, signAgentJWT } from "@auth/agent";
|
|
13
|
+
import { RUNNER_CAPABILITIES } from "./capabilities.js";
|
|
14
|
+
import { errorFrom, GatewayError, readBounded } from "./errors.js";
|
|
15
|
+
import { boundedBodies, gatewayFetch, onGateway } from "./gateway.js";
|
|
16
|
+
const isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
17
|
+
/** The longest answer Runner reads from one call. */
|
|
18
|
+
const MAX_ANSWER_BYTES = 4 * 1024 * 1024;
|
|
19
|
+
const CALL_TIMEOUT_MS = 30_000;
|
|
20
|
+
/** The most of a discovery document Runner reads. */
|
|
21
|
+
export const MAX_DISCOVERY_BYTES = 64 * 1024;
|
|
22
|
+
/** The gateway's discovery document, checked to name the gateway itself as its issuer. */
|
|
23
|
+
export async function discover(origin, fetchImpl) {
|
|
24
|
+
let config;
|
|
25
|
+
try {
|
|
26
|
+
config = await discoverProvider(origin, boundedBodies(gatewayFetch(origin, fetchImpl), MAX_DISCOVERY_BYTES));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (error instanceof GatewayError)
|
|
30
|
+
throw error;
|
|
31
|
+
throw new GatewayError(0, "discovery_failed");
|
|
32
|
+
}
|
|
33
|
+
if (!onGateway(origin, config.issuer))
|
|
34
|
+
throw new GatewayError(0, "wrong_origin");
|
|
35
|
+
return config;
|
|
36
|
+
}
|
|
37
|
+
/** Where a capability executes, from the discovery document, as the SDK resolves it. It must be on the gateway. */
|
|
38
|
+
export function executeLocation(origin, config, capability) {
|
|
39
|
+
const own = config.capabilities?.find((c) => c.name === capability)?.location;
|
|
40
|
+
const issuer = config.issuer.replace(/\/+$/, "");
|
|
41
|
+
const path = config.endpoints.execute ?? "/capability/execute";
|
|
42
|
+
const location = own ?? config.default_location ?? (/^https?:\/\//.test(path) ? path : `${issuer}${path.startsWith("/") ? path : `/${path}`}`);
|
|
43
|
+
if (!onGateway(origin, location))
|
|
44
|
+
throw new GatewayError(0, "wrong_origin");
|
|
45
|
+
return location;
|
|
46
|
+
}
|
|
47
|
+
export class Connection {
|
|
48
|
+
origin;
|
|
49
|
+
pluginAgentId;
|
|
50
|
+
storage;
|
|
51
|
+
fetch;
|
|
52
|
+
config = null;
|
|
53
|
+
constructor(opts) {
|
|
54
|
+
this.origin = opts.origin;
|
|
55
|
+
this.pluginAgentId = opts.pluginAgentId;
|
|
56
|
+
this.storage = opts.storage;
|
|
57
|
+
this.fetch = gatewayFetch(opts.origin, opts.fetch);
|
|
58
|
+
}
|
|
59
|
+
async agentConnection() {
|
|
60
|
+
const connection = await this.storage.getAgentConnection(this.pluginAgentId);
|
|
61
|
+
if (!connection)
|
|
62
|
+
throw new GatewayError(0, "no_local_key");
|
|
63
|
+
return connection;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Calls one capability as the paired agent and answers its result. A refusal throws `GatewayError` with the gateway's
|
|
67
|
+
* status and code. The answer is someone else's content: callers take IDs and numbers from it, never text to act on.
|
|
68
|
+
*/
|
|
69
|
+
async call(capability, args = {}) {
|
|
70
|
+
if (!RUNNER_CAPABILITIES.includes(capability))
|
|
71
|
+
throw new GatewayError(0, "not_runner_capability");
|
|
72
|
+
const connection = await this.agentConnection();
|
|
73
|
+
this.config ??= await discover(this.origin, this.fetch);
|
|
74
|
+
const location = executeLocation(this.origin, this.config, capability);
|
|
75
|
+
const token = await signAgentJWT({ agentKeypair: connection.agentKeypair, agentId: this.pluginAgentId, audience: location, capabilities: [capability] });
|
|
76
|
+
let response;
|
|
77
|
+
try {
|
|
78
|
+
response = await this.fetch(location, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${token}` },
|
|
81
|
+
body: JSON.stringify({ capability, arguments: args }),
|
|
82
|
+
signal: AbortSignal.timeout(CALL_TIMEOUT_MS),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error instanceof GatewayError)
|
|
87
|
+
throw error;
|
|
88
|
+
throw new GatewayError(0, "network");
|
|
89
|
+
}
|
|
90
|
+
if (!response.ok)
|
|
91
|
+
throw await errorFrom(response);
|
|
92
|
+
// Read only up to the bound: an answer past it, or one that never ends, is cut there, never held whole.
|
|
93
|
+
const text = await readBounded(response, MAX_ANSWER_BYTES);
|
|
94
|
+
if (text === null)
|
|
95
|
+
throw new GatewayError(0, "bad_answer");
|
|
96
|
+
let body;
|
|
97
|
+
try {
|
|
98
|
+
body = JSON.parse(text);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
throw new GatewayError(0, "bad_answer");
|
|
102
|
+
}
|
|
103
|
+
// The plugin answers `{ data: result }`.
|
|
104
|
+
return isObject(body) && "data" in body ? body.data : body;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gateway's refusals, read by Runner itself (M7 plan, the architect's ruling 3 on spike A). The pinned client SDK
|
|
3
|
+
* misreads the gateway's own `{ error: { code } }` shape, so Runner never takes a refusal from the SDK's errors: it reads
|
|
4
|
+
* the HTTP status and the body's code, whichever of the three shapes the gateway answers in:
|
|
5
|
+
*
|
|
6
|
+
* - the gateway's own routes and the API: `{ "error": { "code": "not_allowed" } }`;
|
|
7
|
+
* - the Agent Auth plugin: `{ "error": "agent_revoked", "message": "…" }`;
|
|
8
|
+
* - the gateway's refusals on the plugin's capability path: `{ "message": "agent_unclaimed", "code": … }`.
|
|
9
|
+
*
|
|
10
|
+
* A body is someone else's content. Only a short snake-case code is ever taken from it, and anything else reads as
|
|
11
|
+
* `unknown`, so no text from a response reaches a log or the owner's screen.
|
|
12
|
+
*/
|
|
13
|
+
/** A code as Runner keeps it: lower-case snake case, short. Anything else from a body is never kept. */
|
|
14
|
+
const CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
15
|
+
export class GatewayError extends Error {
|
|
16
|
+
status;
|
|
17
|
+
code;
|
|
18
|
+
/** Seconds the gateway asked us to wait, for a 429 or 503, when it said. */
|
|
19
|
+
retryAfter;
|
|
20
|
+
constructor(status, code, retryAfter = null) {
|
|
21
|
+
super(`gateway answered ${status} ${code}`);
|
|
22
|
+
this.name = "GatewayError";
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.code = CODE.test(code) ? code : "unknown";
|
|
25
|
+
this.retryAfter = retryAfter;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
29
|
+
/** The code a refusal's body names, in any of the gateway's three shapes, or `unknown`. */
|
|
30
|
+
export function codeFrom(body) {
|
|
31
|
+
if (!isObject(body))
|
|
32
|
+
return "unknown";
|
|
33
|
+
const { error, code, message } = body;
|
|
34
|
+
const candidates = [isObject(error) ? error.code : undefined, typeof error === "string" ? error : undefined, code, message];
|
|
35
|
+
for (const candidate of candidates)
|
|
36
|
+
if (typeof candidate === "string" && CODE.test(candidate))
|
|
37
|
+
return candidate;
|
|
38
|
+
return "unknown";
|
|
39
|
+
}
|
|
40
|
+
/** The most of a refusal's body Runner reads. */
|
|
41
|
+
export const MAX_ERROR_BYTES = 16_384;
|
|
42
|
+
/**
|
|
43
|
+
* A response's body as text, read only up to `max` bytes: past that the rest is never read, the stream is cancelled,
|
|
44
|
+
* and the answer is null. So an answer that is huge, or never ends, can't make Runner hold it whole (step 12's harness:
|
|
45
|
+
* `text()` read it all before its length was checked). Null too when the body can't be read or isn't UTF-8.
|
|
46
|
+
*/
|
|
47
|
+
export async function readBounded(response, max) {
|
|
48
|
+
const body = response.body;
|
|
49
|
+
if (body === null)
|
|
50
|
+
return "";
|
|
51
|
+
const reader = body.getReader();
|
|
52
|
+
const chunks = [];
|
|
53
|
+
let size = 0;
|
|
54
|
+
try {
|
|
55
|
+
for (;;) {
|
|
56
|
+
const { done, value } = await reader.read();
|
|
57
|
+
if (done)
|
|
58
|
+
break;
|
|
59
|
+
size += value.byteLength;
|
|
60
|
+
if (size > max) {
|
|
61
|
+
void reader.cancel().catch(() => undefined);
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
chunks.push(value);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
void reader.cancel().catch(() => undefined);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const bytes = new Uint8Array(size);
|
|
72
|
+
let at = 0;
|
|
73
|
+
for (const chunk of chunks) {
|
|
74
|
+
bytes.set(chunk, at);
|
|
75
|
+
at += chunk.byteLength;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** A refusal from a response that isn't 2xx. Reads at most a small body, and never keeps more than its code. */
|
|
85
|
+
export async function errorFrom(response) {
|
|
86
|
+
let body = null;
|
|
87
|
+
try {
|
|
88
|
+
const text = await readBounded(response, MAX_ERROR_BYTES);
|
|
89
|
+
body = text === null ? null : JSON.parse(text);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
body = null;
|
|
93
|
+
}
|
|
94
|
+
const header = response.headers.get("retry-after");
|
|
95
|
+
const after = header !== null && /^\d{1,6}$/.test(header.trim()) ? Math.min(Number(header.trim()), 3600) : null;
|
|
96
|
+
return new GatewayError(response.status, codeFrom(body), after);
|
|
97
|
+
}
|
|
98
|
+
/** Codes that say this agent's credential no longer acts, whatever the status. */
|
|
99
|
+
const AUTHORITY = new Set([
|
|
100
|
+
"agent_revoked", "agent_disconnected", "credential_owner_left", "agent_expired", "agent_rejected", "agent_pending",
|
|
101
|
+
"host_revoked", "host_rejected", "capability_not_granted", "invalid_jwt", "jwt_replay", "invalid_credential", "unauthorized",
|
|
102
|
+
]);
|
|
103
|
+
export function meaningOf(error) {
|
|
104
|
+
if (!(error instanceof GatewayError))
|
|
105
|
+
return "transient";
|
|
106
|
+
if (error.status === 0 || error.status >= 500)
|
|
107
|
+
return "transient";
|
|
108
|
+
if (error.status === 429)
|
|
109
|
+
return "rate_limited";
|
|
110
|
+
if (error.status === 403 && error.code === "agent_unclaimed")
|
|
111
|
+
return "unclaimed";
|
|
112
|
+
if (error.status === 401 || AUTHORITY.has(error.code))
|
|
113
|
+
return "authority";
|
|
114
|
+
return "refused";
|
|
115
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runner talks to one place: the gateway the owner named. Never the Rust API, which has no public route, and never a
|
|
3
|
+
* host a response or a discovery document points at. Every request Runner or the SDK makes goes through `gatewayFetch`,
|
|
4
|
+
* which refuses any other origin and never follows a redirect.
|
|
5
|
+
*/
|
|
6
|
+
import { GatewayError, readBounded } from "./errors.js";
|
|
7
|
+
const LOCAL_HOSTS = new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
8
|
+
/**
|
|
9
|
+
* The gateway's origin, from what the owner typed: `https://` and a host, with no path, query, fragment or credentials.
|
|
10
|
+
* Plain `http://` only for a gateway on this machine, for local runs.
|
|
11
|
+
*/
|
|
12
|
+
export function gatewayOrigin(input) {
|
|
13
|
+
let url;
|
|
14
|
+
try {
|
|
15
|
+
url = new URL(input.trim());
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
throw new Error("The gateway must be a URL such as https://podster.dev");
|
|
19
|
+
}
|
|
20
|
+
const local = LOCAL_HOSTS.has(url.hostname);
|
|
21
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && local))
|
|
22
|
+
throw new Error("The gateway must use https://");
|
|
23
|
+
if (url.username || url.password || url.search || url.hash || (url.pathname !== "/" && url.pathname !== "")) {
|
|
24
|
+
throw new Error("The gateway is an origin only, such as https://podster.dev, with no path");
|
|
25
|
+
}
|
|
26
|
+
return url.origin;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The gateway Runner pairs with when the owner names none: Podster's staging gateway. Runner is published only as a test
|
|
30
|
+
* pre-release for staging (the owner's decision of 2026-11-19, narrowing decision 26), and there is no production
|
|
31
|
+
* deployment. `pair --gateway <origin>` still names another, such as a gateway on this machine.
|
|
32
|
+
*/
|
|
33
|
+
export const DEFAULT_GATEWAY = "https://gateway-staging.podster.dev";
|
|
34
|
+
/** The gateway `pair` uses: the one the owner named, or staging's, checked as `gatewayOrigin` checks any. */
|
|
35
|
+
export function pairingGateway(named) {
|
|
36
|
+
return gatewayOrigin(named ?? DEFAULT_GATEWAY);
|
|
37
|
+
}
|
|
38
|
+
/** Whether a URL is on the gateway's origin. */
|
|
39
|
+
export function onGateway(origin, target) {
|
|
40
|
+
try {
|
|
41
|
+
return new URL(target).origin === origin;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A fetch that reaches only the gateway's origin and never follows a redirect: a 3xx is refused, not followed. A
|
|
49
|
+
* request it refuses never leaves the machine. The network failing reads as `GatewayError(0, "network")`.
|
|
50
|
+
*/
|
|
51
|
+
export function gatewayFetch(origin, fetchImpl) {
|
|
52
|
+
return (async (input, init) => {
|
|
53
|
+
const target = input instanceof Request ? input.url : String(input);
|
|
54
|
+
if (!onGateway(origin, target))
|
|
55
|
+
throw new GatewayError(0, "wrong_origin");
|
|
56
|
+
let response;
|
|
57
|
+
try {
|
|
58
|
+
response = await fetchImpl(input instanceof Request ? input : target, { ...init, redirect: "manual" });
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof GatewayError)
|
|
62
|
+
throw error;
|
|
63
|
+
throw new GatewayError(0, "network");
|
|
64
|
+
}
|
|
65
|
+
if (response.status >= 300 && response.status < 400) {
|
|
66
|
+
await response.body?.cancel();
|
|
67
|
+
throw new GatewayError(response.status, "redirect_refused");
|
|
68
|
+
}
|
|
69
|
+
return response;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A fetch for the pinned SDK, which reads every answer whole with `json()`: each answer's body is read here first, only
|
|
74
|
+
* up to `max` bytes, the rest cancelled, and the SDK gets that text. A successful answer past the bound, or one that
|
|
75
|
+
* never ends, is refused as `bad_answer`; a refusal's body past it reaches the SDK empty, with its status (review L3 on
|
|
76
|
+
* #461).
|
|
77
|
+
*/
|
|
78
|
+
export function boundedBodies(reach, max) {
|
|
79
|
+
return (async (input, init) => {
|
|
80
|
+
const response = await reach(input, init);
|
|
81
|
+
const text = await readBounded(response, max);
|
|
82
|
+
if (text === null && response.ok)
|
|
83
|
+
throw new GatewayError(0, "bad_answer");
|
|
84
|
+
const headers = new Headers();
|
|
85
|
+
const type = response.headers.get("content-type");
|
|
86
|
+
if (type !== null)
|
|
87
|
+
headers.set("content-type", type);
|
|
88
|
+
const retry = response.headers.get("retry-after");
|
|
89
|
+
if (retry !== null)
|
|
90
|
+
headers.set("retry-after", retry);
|
|
91
|
+
return new Response(response.status === 204 || text === "" ? null : text, { status: response.status, headers });
|
|
92
|
+
});
|
|
93
|
+
}
|