@autohq/cli 0.1.472 → 0.1.473
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/dist/agent-bridge.js +48 -8
- package/dist/index.js +58 -13
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -12176,6 +12176,7 @@ import { createServer } from "http";
|
|
|
12176
12176
|
import { homedir } from "os";
|
|
12177
12177
|
import path from "path";
|
|
12178
12178
|
var RELAY_PATH = "/git-credential";
|
|
12179
|
+
var GIT_CREDENTIAL_BROKER_TIMEOUT_MS = 24e3;
|
|
12179
12180
|
function defaultGitCredentialPortFilePath() {
|
|
12180
12181
|
return path.join(homedir(), ".auto", "agent-bridge", "git-credential.json");
|
|
12181
12182
|
}
|
|
@@ -12192,20 +12193,30 @@ async function startGitCredentialRelay(input) {
|
|
|
12192
12193
|
request.on("end", () => {
|
|
12193
12194
|
void (async () => {
|
|
12194
12195
|
try {
|
|
12195
|
-
const
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12196
|
+
const requestTimeoutMs = input.requestTimeoutMs ?? GIT_CREDENTIAL_BROKER_TIMEOUT_MS;
|
|
12197
|
+
const upstream = await fetchWithTimeout({
|
|
12198
|
+
fetchImpl,
|
|
12199
|
+
url: target.url,
|
|
12200
|
+
init: {
|
|
12201
|
+
method: "POST",
|
|
12202
|
+
headers: {
|
|
12203
|
+
authorization: `Bearer ${target.accessToken}`,
|
|
12204
|
+
"content-type": "application/json"
|
|
12205
|
+
},
|
|
12206
|
+
body: Buffer.concat(chunks).toString("utf8") || "{}"
|
|
12200
12207
|
},
|
|
12201
|
-
|
|
12208
|
+
timeoutMs: requestTimeoutMs,
|
|
12209
|
+
message: `git credential broker request timed out after ${requestTimeoutMs}ms`
|
|
12202
12210
|
});
|
|
12203
12211
|
const body = await upstream.text();
|
|
12204
12212
|
response.writeHead(upstream.status, {
|
|
12205
12213
|
"content-type": upstream.headers.get("content-type") ?? "application/json"
|
|
12206
12214
|
}).end(body);
|
|
12207
12215
|
} catch (error51) {
|
|
12208
|
-
|
|
12216
|
+
const timedOut = error51 instanceof GitCredentialRequestTimeoutError;
|
|
12217
|
+
response.writeHead(timedOut ? 504 : 502, {
|
|
12218
|
+
"content-type": "application/json"
|
|
12219
|
+
}).end(
|
|
12209
12220
|
JSON.stringify({
|
|
12210
12221
|
error: error51 instanceof Error ? error51.message : String(error51)
|
|
12211
12222
|
})
|
|
@@ -12238,6 +12249,35 @@ async function startGitCredentialRelay(input) {
|
|
|
12238
12249
|
})
|
|
12239
12250
|
};
|
|
12240
12251
|
}
|
|
12252
|
+
var GitCredentialRequestTimeoutError = class extends Error {
|
|
12253
|
+
constructor(message) {
|
|
12254
|
+
super(message);
|
|
12255
|
+
this.name = "GitCredentialRequestTimeoutError";
|
|
12256
|
+
}
|
|
12257
|
+
};
|
|
12258
|
+
async function fetchWithTimeout(input) {
|
|
12259
|
+
const controller = new AbortController();
|
|
12260
|
+
let timer;
|
|
12261
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
12262
|
+
timer = setTimeout(() => {
|
|
12263
|
+
controller.abort();
|
|
12264
|
+
reject(new GitCredentialRequestTimeoutError(input.message));
|
|
12265
|
+
}, input.timeoutMs);
|
|
12266
|
+
});
|
|
12267
|
+
try {
|
|
12268
|
+
return await Promise.race([
|
|
12269
|
+
input.fetchImpl(input.url, {
|
|
12270
|
+
...input.init,
|
|
12271
|
+
signal: controller.signal
|
|
12272
|
+
}),
|
|
12273
|
+
timeout
|
|
12274
|
+
]);
|
|
12275
|
+
} finally {
|
|
12276
|
+
if (timer) {
|
|
12277
|
+
clearTimeout(timer);
|
|
12278
|
+
}
|
|
12279
|
+
}
|
|
12280
|
+
}
|
|
12241
12281
|
|
|
12242
12282
|
// ../../node_modules/zod/v4/classic/external.js
|
|
12243
12283
|
var external_exports = {};
|
|
@@ -30826,7 +30866,7 @@ Object.assign(lookup, {
|
|
|
30826
30866
|
// package.json
|
|
30827
30867
|
var package_default = {
|
|
30828
30868
|
name: "@autohq/cli",
|
|
30829
|
-
version: "0.1.
|
|
30869
|
+
version: "0.1.473",
|
|
30830
30870
|
license: "SEE LICENSE IN README.md",
|
|
30831
30871
|
publishConfig: {
|
|
30832
30872
|
access: "public"
|
package/dist/index.js
CHANGED
|
@@ -56581,7 +56581,7 @@ var init_package = __esm({
|
|
|
56581
56581
|
"package.json"() {
|
|
56582
56582
|
package_default = {
|
|
56583
56583
|
name: "@autohq/cli",
|
|
56584
|
-
version: "0.1.
|
|
56584
|
+
version: "0.1.473",
|
|
56585
56585
|
license: "SEE LICENSE IN README.md",
|
|
56586
56586
|
publishConfig: {
|
|
56587
56587
|
access: "public"
|
|
@@ -66953,6 +66953,8 @@ import { createServer as createServer2 } from "http";
|
|
|
66953
66953
|
import { homedir as homedir2 } from "os";
|
|
66954
66954
|
import path from "path";
|
|
66955
66955
|
var RELAY_PATH = "/git-credential";
|
|
66956
|
+
var GIT_CREDENTIAL_BROKER_TIMEOUT_MS = 24e3;
|
|
66957
|
+
var GIT_CREDENTIAL_RELAY_TIMEOUT_MS = 26e3;
|
|
66956
66958
|
function defaultGitCredentialPortFilePath() {
|
|
66957
66959
|
return path.join(homedir2(), ".auto", "agent-bridge", "git-credential.json");
|
|
66958
66960
|
}
|
|
@@ -66969,20 +66971,30 @@ async function startGitCredentialRelay(input) {
|
|
|
66969
66971
|
request.on("end", () => {
|
|
66970
66972
|
void (async () => {
|
|
66971
66973
|
try {
|
|
66972
|
-
const
|
|
66973
|
-
|
|
66974
|
-
|
|
66975
|
-
|
|
66976
|
-
|
|
66974
|
+
const requestTimeoutMs = input.requestTimeoutMs ?? GIT_CREDENTIAL_BROKER_TIMEOUT_MS;
|
|
66975
|
+
const upstream = await fetchWithTimeout({
|
|
66976
|
+
fetchImpl,
|
|
66977
|
+
url: target.url,
|
|
66978
|
+
init: {
|
|
66979
|
+
method: "POST",
|
|
66980
|
+
headers: {
|
|
66981
|
+
authorization: `Bearer ${target.accessToken}`,
|
|
66982
|
+
"content-type": "application/json"
|
|
66983
|
+
},
|
|
66984
|
+
body: Buffer.concat(chunks).toString("utf8") || "{}"
|
|
66977
66985
|
},
|
|
66978
|
-
|
|
66986
|
+
timeoutMs: requestTimeoutMs,
|
|
66987
|
+
message: `git credential broker request timed out after ${requestTimeoutMs}ms`
|
|
66979
66988
|
});
|
|
66980
66989
|
const body = await upstream.text();
|
|
66981
66990
|
response.writeHead(upstream.status, {
|
|
66982
66991
|
"content-type": upstream.headers.get("content-type") ?? "application/json"
|
|
66983
66992
|
}).end(body);
|
|
66984
66993
|
} catch (error51) {
|
|
66985
|
-
|
|
66994
|
+
const timedOut = error51 instanceof GitCredentialRequestTimeoutError;
|
|
66995
|
+
response.writeHead(timedOut ? 504 : 502, {
|
|
66996
|
+
"content-type": "application/json"
|
|
66997
|
+
}).end(
|
|
66986
66998
|
JSON.stringify({
|
|
66987
66999
|
error: error51 instanceof Error ? error51.message : String(error51)
|
|
66988
67000
|
})
|
|
@@ -67040,17 +67052,21 @@ async function runGitCredentialHelper(input) {
|
|
|
67040
67052
|
input.writeError("git credential relay port file is malformed");
|
|
67041
67053
|
return 1;
|
|
67042
67054
|
}
|
|
67043
|
-
const
|
|
67044
|
-
|
|
67045
|
-
|
|
67055
|
+
const requestTimeoutMs = input.requestTimeoutMs ?? GIT_CREDENTIAL_RELAY_TIMEOUT_MS;
|
|
67056
|
+
const response = await fetchWithTimeout({
|
|
67057
|
+
fetchImpl: input.fetchImpl ?? fetch,
|
|
67058
|
+
url: `http://127.0.0.1:${portFile.port}${RELAY_PATH}`,
|
|
67059
|
+
init: {
|
|
67046
67060
|
method: "POST",
|
|
67047
67061
|
headers: { "content-type": "application/json" },
|
|
67048
67062
|
body: JSON.stringify({
|
|
67049
67063
|
host: attributes.host,
|
|
67050
67064
|
...attributes.path ? { path: attributes.path } : {}
|
|
67051
67065
|
})
|
|
67052
|
-
}
|
|
67053
|
-
|
|
67066
|
+
},
|
|
67067
|
+
timeoutMs: requestTimeoutMs,
|
|
67068
|
+
message: `git credential relay request timed out after ${requestTimeoutMs}ms`
|
|
67069
|
+
});
|
|
67054
67070
|
if (!response.ok) {
|
|
67055
67071
|
input.writeError(
|
|
67056
67072
|
`git credential broker rejected the request: ${response.status}`
|
|
@@ -67074,6 +67090,35 @@ async function runGitCredentialHelper(input) {
|
|
|
67074
67090
|
return 1;
|
|
67075
67091
|
}
|
|
67076
67092
|
}
|
|
67093
|
+
var GitCredentialRequestTimeoutError = class extends Error {
|
|
67094
|
+
constructor(message) {
|
|
67095
|
+
super(message);
|
|
67096
|
+
this.name = "GitCredentialRequestTimeoutError";
|
|
67097
|
+
}
|
|
67098
|
+
};
|
|
67099
|
+
async function fetchWithTimeout(input) {
|
|
67100
|
+
const controller = new AbortController();
|
|
67101
|
+
let timer;
|
|
67102
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
67103
|
+
timer = setTimeout(() => {
|
|
67104
|
+
controller.abort();
|
|
67105
|
+
reject(new GitCredentialRequestTimeoutError(input.message));
|
|
67106
|
+
}, input.timeoutMs);
|
|
67107
|
+
});
|
|
67108
|
+
try {
|
|
67109
|
+
return await Promise.race([
|
|
67110
|
+
input.fetchImpl(input.url, {
|
|
67111
|
+
...input.init,
|
|
67112
|
+
signal: controller.signal
|
|
67113
|
+
}),
|
|
67114
|
+
timeout
|
|
67115
|
+
]);
|
|
67116
|
+
} finally {
|
|
67117
|
+
if (timer) {
|
|
67118
|
+
clearTimeout(timer);
|
|
67119
|
+
}
|
|
67120
|
+
}
|
|
67121
|
+
}
|
|
67077
67122
|
function parseGitCredentialAttributes(raw) {
|
|
67078
67123
|
const attributes = {};
|
|
67079
67124
|
for (const line of raw.split("\n")) {
|