@agent-device/proxy 0.21.37-nightly.20261111.161 → 0.21.37
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 +6 -2
- package/dist/errors.mjs +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -65,8 +65,12 @@ export default { fetch: proxy.handle };
|
|
|
65
65
|
For a WebSocket or other message transport, turn each incoming message into a `Request` and send
|
|
66
66
|
the `Response` back. Three things the proxy relies on:
|
|
67
67
|
|
|
68
|
-
- `request.url` is the URL the client used. Upload tickets point clients at its origin.
|
|
69
|
-
`x-forwarded-proto`
|
|
68
|
+
- `request.url` is the URL the client used. Upload tickets point clients at its origin. The first
|
|
69
|
+
comma-separated `x-forwarded-proto` value overrides the scheme when it is `http` or `https`
|
|
70
|
+
(case-insensitive). This value is client-controlled unless your ingress replaces it. Configure
|
|
71
|
+
your ingress to replace client-supplied values with the public scheme rather than append to them.
|
|
72
|
+
When you construct `Request` objects, use the public URL and remove untrusted forwarding
|
|
73
|
+
headers before calling `handle`.
|
|
70
74
|
- `request.signal` aborts when the client goes away. The proxy then cancels the daemon request, so
|
|
71
75
|
work the client stopped waiting for does not keep running.
|
|
72
76
|
- Response bodies stream. Artifact downloads can be large, so forward the body as it arrives.
|
package/dist/errors.mjs
CHANGED
|
@@ -318,7 +318,7 @@ function codeRecoveryHint(code) {
|
|
|
318
318
|
case "UNSUPPORTED_PLATFORM": return "This platform is not supported for the requested operation; run devices to inspect available targets.";
|
|
319
319
|
case "AMBIGUOUS_MATCH": return "Multiple candidates matched. Narrow the query or pass an exact identifier.";
|
|
320
320
|
case "DEVICE_IN_USE": return "The device is busy with another agent-device request; retry once it frees up.";
|
|
321
|
-
case "REPLAY_DIVERGENCE": return "
|
|
321
|
+
case "REPLAY_DIVERGENCE": return "Repair the step from the divergence report: its screen and selector suggestions.";
|
|
322
322
|
case "REPAIR_SESSION_EXPIRED": return "The --save-script repair session was reaped before it was finalized; re-run replay <script> --save-script from the start.";
|
|
323
323
|
case "REPAIR_COMMIT_FAILED": return "The repair transaction completed, but committing its healed script failed at teardown (no-clobber refusal or a filesystem error); inspect the target path/permissions, then re-run replay <script> --save-script to retry.";
|
|
324
324
|
case "NOT_IMPLEMENTED": return "This command is part of the planned API but is not implemented yet.";
|
package/dist/index.d.mts
CHANGED
|
@@ -51,7 +51,10 @@ type DaemonProxy = {
|
|
|
51
51
|
readonly instanceId: string;
|
|
52
52
|
/**
|
|
53
53
|
* Answers one client request. `request.url` must be the URL the client used, because upload
|
|
54
|
-
* tickets are rewritten to its origin
|
|
54
|
+
* tickets are rewritten to its origin. The first comma-separated `x-forwarded-proto` value
|
|
55
|
+
* overrides its scheme when it is `http` or `https` (case-insensitive). This value is
|
|
56
|
+
* client-controlled unless ingress replaces it with the public scheme. Replace rather than
|
|
57
|
+
* append forwarding metadata, or remove untrusted headers and construct the public request URL.
|
|
55
58
|
* Abort `request.signal` when the client goes away so in-flight daemon work is cancelled.
|
|
56
59
|
* Resolves with an error response rather than rejecting.
|
|
57
60
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -383,8 +383,9 @@ function rewriteUploadDirectUrl(upstreamUrl, request) {
|
|
|
383
383
|
const requestUrl = new URL(request.url);
|
|
384
384
|
const uploadIndex = requestUrl.pathname.lastIndexOf("/upload/preflight");
|
|
385
385
|
const uploadPrefix = uploadIndex >= 0 ? requestUrl.pathname.slice(0, uploadIndex) : "";
|
|
386
|
-
const forwardedProto = request.headers.get("x-forwarded-proto")?.split(",")[0]?.trim();
|
|
387
|
-
const rewritten = new URL(
|
|
386
|
+
const forwardedProto = request.headers.get("x-forwarded-proto")?.split(",")[0]?.trim().toLowerCase();
|
|
387
|
+
const rewritten = new URL(requestUrl.origin);
|
|
388
|
+
if (forwardedProto === "http" || forwardedProto === "https") rewritten.protocol = forwardedProto;
|
|
388
389
|
rewritten.pathname = `${uploadPrefix}${parsed.pathname}`;
|
|
389
390
|
rewritten.search = parsed.search;
|
|
390
391
|
return rewritten.toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-device/proxy",
|
|
3
|
-
"version": "0.21.37
|
|
3
|
+
"version": "0.21.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Transport-neutral authenticating proxy in front of an agent-device daemon.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@agent-device/contracts": "0.0.0",
|
|
29
28
|
"@agent-device/host-kit": "0.0.0",
|
|
29
|
+
"@agent-device/contracts": "0.0.0",
|
|
30
30
|
"@agent-device/kernel": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|