@autohq/cli 0.1.89 → 0.1.90
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 +258 -52
- package/dist/index.js +430 -115
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -4842,6 +4842,76 @@ var require_websocket_server = __commonJS({
|
|
|
4842
4842
|
}
|
|
4843
4843
|
});
|
|
4844
4844
|
|
|
4845
|
+
// src/commands/agent-bridge/git-credentials.ts
|
|
4846
|
+
import { once } from "events";
|
|
4847
|
+
import { chmod, mkdir, readFile, writeFile } from "fs/promises";
|
|
4848
|
+
import { createServer } from "http";
|
|
4849
|
+
import { homedir } from "os";
|
|
4850
|
+
import path from "path";
|
|
4851
|
+
var RELAY_PATH = "/git-credential";
|
|
4852
|
+
function defaultGitCredentialPortFilePath() {
|
|
4853
|
+
return path.join(homedir(), ".auto", "agent-bridge", "git-credential.json");
|
|
4854
|
+
}
|
|
4855
|
+
async function startGitCredentialRelay(input) {
|
|
4856
|
+
const fetchImpl = input.fetchImpl ?? fetch;
|
|
4857
|
+
let target = { url: input.url, accessToken: input.accessToken };
|
|
4858
|
+
const server = createServer((request, response) => {
|
|
4859
|
+
if (request.method !== "POST" || request.url !== RELAY_PATH) {
|
|
4860
|
+
response.writeHead(404).end();
|
|
4861
|
+
return;
|
|
4862
|
+
}
|
|
4863
|
+
const chunks = [];
|
|
4864
|
+
request.on("data", (chunk) => chunks.push(chunk));
|
|
4865
|
+
request.on("end", () => {
|
|
4866
|
+
void (async () => {
|
|
4867
|
+
try {
|
|
4868
|
+
const upstream = await fetchImpl(target.url, {
|
|
4869
|
+
method: "POST",
|
|
4870
|
+
headers: {
|
|
4871
|
+
authorization: `Bearer ${target.accessToken}`,
|
|
4872
|
+
"content-type": "application/json"
|
|
4873
|
+
},
|
|
4874
|
+
body: Buffer.concat(chunks).toString("utf8") || "{}"
|
|
4875
|
+
});
|
|
4876
|
+
const body = await upstream.text();
|
|
4877
|
+
response.writeHead(upstream.status, {
|
|
4878
|
+
"content-type": upstream.headers.get("content-type") ?? "application/json"
|
|
4879
|
+
}).end(body);
|
|
4880
|
+
} catch (error51) {
|
|
4881
|
+
response.writeHead(502, { "content-type": "application/json" }).end(
|
|
4882
|
+
JSON.stringify({
|
|
4883
|
+
error: error51 instanceof Error ? error51.message : String(error51)
|
|
4884
|
+
})
|
|
4885
|
+
);
|
|
4886
|
+
}
|
|
4887
|
+
})();
|
|
4888
|
+
});
|
|
4889
|
+
});
|
|
4890
|
+
server.listen(0, "127.0.0.1");
|
|
4891
|
+
await once(server, "listening");
|
|
4892
|
+
server.unref();
|
|
4893
|
+
const address = server.address();
|
|
4894
|
+
if (!address || typeof address !== "object") {
|
|
4895
|
+
server.close();
|
|
4896
|
+
throw new Error("git credential relay failed to bind a loopback port");
|
|
4897
|
+
}
|
|
4898
|
+
const portFilePath = input.portFilePath ?? defaultGitCredentialPortFilePath();
|
|
4899
|
+
await mkdir(path.dirname(portFilePath), { recursive: true });
|
|
4900
|
+
await writeFile(portFilePath, JSON.stringify({ port: address.port }), {
|
|
4901
|
+
mode: 384
|
|
4902
|
+
});
|
|
4903
|
+
await chmod(portFilePath, 384);
|
|
4904
|
+
return {
|
|
4905
|
+
port: address.port,
|
|
4906
|
+
update: (next) => {
|
|
4907
|
+
target = { url: next.url, accessToken: next.accessToken };
|
|
4908
|
+
},
|
|
4909
|
+
close: () => new Promise((resolve) => {
|
|
4910
|
+
server.close(() => resolve());
|
|
4911
|
+
})
|
|
4912
|
+
};
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4845
4915
|
// ../../node_modules/zod/v4/classic/external.js
|
|
4846
4916
|
var external_exports = {};
|
|
4847
4917
|
__export(external_exports, {
|
|
@@ -5608,10 +5678,10 @@ function mergeDefs(...defs) {
|
|
|
5608
5678
|
function cloneDef(schema) {
|
|
5609
5679
|
return mergeDefs(schema._zod.def);
|
|
5610
5680
|
}
|
|
5611
|
-
function getElementAtPath(obj,
|
|
5612
|
-
if (!
|
|
5681
|
+
function getElementAtPath(obj, path2) {
|
|
5682
|
+
if (!path2)
|
|
5613
5683
|
return obj;
|
|
5614
|
-
return
|
|
5684
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
5615
5685
|
}
|
|
5616
5686
|
function promiseAllObject(promisesObj) {
|
|
5617
5687
|
const keys = Object.keys(promisesObj);
|
|
@@ -6020,11 +6090,11 @@ function explicitlyAborted(x2, startIndex = 0) {
|
|
|
6020
6090
|
}
|
|
6021
6091
|
return false;
|
|
6022
6092
|
}
|
|
6023
|
-
function prefixIssues(
|
|
6093
|
+
function prefixIssues(path2, issues) {
|
|
6024
6094
|
return issues.map((iss) => {
|
|
6025
6095
|
var _a3;
|
|
6026
6096
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
6027
|
-
iss.path.unshift(
|
|
6097
|
+
iss.path.unshift(path2);
|
|
6028
6098
|
return iss;
|
|
6029
6099
|
});
|
|
6030
6100
|
}
|
|
@@ -6171,16 +6241,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
6171
6241
|
}
|
|
6172
6242
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
6173
6243
|
const fieldErrors = { _errors: [] };
|
|
6174
|
-
const processError = (error52,
|
|
6244
|
+
const processError = (error52, path2 = []) => {
|
|
6175
6245
|
for (const issue2 of error52.issues) {
|
|
6176
6246
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
6177
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
6247
|
+
issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
|
|
6178
6248
|
} else if (issue2.code === "invalid_key") {
|
|
6179
|
-
processError({ issues: issue2.issues }, [...
|
|
6249
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
6180
6250
|
} else if (issue2.code === "invalid_element") {
|
|
6181
|
-
processError({ issues: issue2.issues }, [...
|
|
6251
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
6182
6252
|
} else {
|
|
6183
|
-
const fullpath = [...
|
|
6253
|
+
const fullpath = [...path2, ...issue2.path];
|
|
6184
6254
|
if (fullpath.length === 0) {
|
|
6185
6255
|
fieldErrors._errors.push(mapper(issue2));
|
|
6186
6256
|
} else {
|
|
@@ -6207,17 +6277,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
6207
6277
|
}
|
|
6208
6278
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
6209
6279
|
const result = { errors: [] };
|
|
6210
|
-
const processError = (error52,
|
|
6280
|
+
const processError = (error52, path2 = []) => {
|
|
6211
6281
|
var _a3, _b2;
|
|
6212
6282
|
for (const issue2 of error52.issues) {
|
|
6213
6283
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
6214
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
6284
|
+
issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
|
|
6215
6285
|
} else if (issue2.code === "invalid_key") {
|
|
6216
|
-
processError({ issues: issue2.issues }, [...
|
|
6286
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
6217
6287
|
} else if (issue2.code === "invalid_element") {
|
|
6218
|
-
processError({ issues: issue2.issues }, [...
|
|
6288
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
6219
6289
|
} else {
|
|
6220
|
-
const fullpath = [...
|
|
6290
|
+
const fullpath = [...path2, ...issue2.path];
|
|
6221
6291
|
if (fullpath.length === 0) {
|
|
6222
6292
|
result.errors.push(mapper(issue2));
|
|
6223
6293
|
continue;
|
|
@@ -6249,8 +6319,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
6249
6319
|
}
|
|
6250
6320
|
function toDotPath(_path) {
|
|
6251
6321
|
const segs = [];
|
|
6252
|
-
const
|
|
6253
|
-
for (const seg of
|
|
6322
|
+
const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
6323
|
+
for (const seg of path2) {
|
|
6254
6324
|
if (typeof seg === "number")
|
|
6255
6325
|
segs.push(`[${seg}]`);
|
|
6256
6326
|
else if (typeof seg === "symbol")
|
|
@@ -18942,13 +19012,13 @@ function resolveRef(ref, ctx) {
|
|
|
18942
19012
|
if (!ref.startsWith("#")) {
|
|
18943
19013
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
18944
19014
|
}
|
|
18945
|
-
const
|
|
18946
|
-
if (
|
|
19015
|
+
const path2 = ref.slice(1).split("/").filter(Boolean);
|
|
19016
|
+
if (path2.length === 0) {
|
|
18947
19017
|
return ctx.rootSchema;
|
|
18948
19018
|
}
|
|
18949
19019
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
18950
|
-
if (
|
|
18951
|
-
const key =
|
|
19020
|
+
if (path2[0] === defsKey) {
|
|
19021
|
+
const key = path2[1];
|
|
18952
19022
|
if (!key || !ctx.defs[key]) {
|
|
18953
19023
|
throw new Error(`Reference not found: ${ref}`);
|
|
18954
19024
|
}
|
|
@@ -19463,7 +19533,14 @@ var AgentBridgeClaudeConfigSchema = external_exports.object({
|
|
|
19463
19533
|
var RuntimeBridgeBootstrapPlaintextSchema = external_exports.object({
|
|
19464
19534
|
version: external_exports.literal(1),
|
|
19465
19535
|
outputSeqStart: external_exports.number().int().nonnegative(),
|
|
19466
|
-
claude: AgentBridgeClaudeConfigSchema
|
|
19536
|
+
claude: AgentBridgeClaudeConfigSchema,
|
|
19537
|
+
// Endpoint + run token for the git credential broker. Present only when
|
|
19538
|
+
// the run has GitHub App git mounts; rides the encrypted bootstrap so the
|
|
19539
|
+
// token lives in agent-bridge memory, never on disk.
|
|
19540
|
+
gitCredentials: external_exports.object({
|
|
19541
|
+
url: external_exports.string().trim().min(1),
|
|
19542
|
+
accessToken: external_exports.string().trim().min(1)
|
|
19543
|
+
}).strict().optional()
|
|
19467
19544
|
}).strict();
|
|
19468
19545
|
var RuntimeBridgeEncryptedBootstrapSchema = external_exports.object({
|
|
19469
19546
|
version: external_exports.literal(1),
|
|
@@ -19615,6 +19692,8 @@ var AuthScopeSchema = external_exports.enum([
|
|
|
19615
19692
|
"secrets:read",
|
|
19616
19693
|
"secrets:write",
|
|
19617
19694
|
"secrets:use",
|
|
19695
|
+
"github:mcp",
|
|
19696
|
+
"github:credentials",
|
|
19618
19697
|
"projects:admin",
|
|
19619
19698
|
"org:admin"
|
|
19620
19699
|
]);
|
|
@@ -20657,6 +20736,87 @@ var ConnectionRemoveResponseSchema = external_exports.object({
|
|
|
20657
20736
|
message: external_exports.string().trim().min(1)
|
|
20658
20737
|
});
|
|
20659
20738
|
|
|
20739
|
+
// ../../packages/schemas/src/github-credentials.ts
|
|
20740
|
+
var CreateRunGithubCredentialRequestSchema = external_exports.object({
|
|
20741
|
+
host: external_exports.literal("github.com"),
|
|
20742
|
+
path: external_exports.string().trim().min(1).optional()
|
|
20743
|
+
});
|
|
20744
|
+
var RunGithubCredentialResponseSchema = external_exports.object({
|
|
20745
|
+
username: external_exports.literal("x-access-token"),
|
|
20746
|
+
password: external_exports.string().min(1),
|
|
20747
|
+
expiresAt: external_exports.string().datetime()
|
|
20748
|
+
});
|
|
20749
|
+
|
|
20750
|
+
// ../../packages/schemas/src/github-mcp-catalog.ts
|
|
20751
|
+
var GITHUB_MCP_TOOL_NAMES = [
|
|
20752
|
+
"actions_get",
|
|
20753
|
+
"actions_list",
|
|
20754
|
+
"actions_run_trigger",
|
|
20755
|
+
"add_comment_to_pending_review",
|
|
20756
|
+
"add_issue_comment",
|
|
20757
|
+
"add_reply_to_pull_request_comment",
|
|
20758
|
+
"create_branch",
|
|
20759
|
+
"create_or_update_file",
|
|
20760
|
+
"create_pull_request",
|
|
20761
|
+
"create_repository",
|
|
20762
|
+
"delete_file",
|
|
20763
|
+
"fork_repository",
|
|
20764
|
+
"get_commit",
|
|
20765
|
+
"get_file_contents",
|
|
20766
|
+
"get_job_logs",
|
|
20767
|
+
"get_label",
|
|
20768
|
+
"get_latest_release",
|
|
20769
|
+
"get_release_by_tag",
|
|
20770
|
+
"get_tag",
|
|
20771
|
+
"issue_read",
|
|
20772
|
+
"issue_write",
|
|
20773
|
+
"list_branches",
|
|
20774
|
+
"list_commits",
|
|
20775
|
+
"list_issue_types",
|
|
20776
|
+
"list_issues",
|
|
20777
|
+
"list_pull_requests",
|
|
20778
|
+
"list_releases",
|
|
20779
|
+
"list_repository_collaborators",
|
|
20780
|
+
"list_tags",
|
|
20781
|
+
"merge_pull_request",
|
|
20782
|
+
"pull_request_read",
|
|
20783
|
+
"pull_request_review_write",
|
|
20784
|
+
"push_files",
|
|
20785
|
+
"search_code",
|
|
20786
|
+
"search_commits",
|
|
20787
|
+
"search_issues",
|
|
20788
|
+
"search_pull_requests",
|
|
20789
|
+
"search_repositories",
|
|
20790
|
+
"sub_issue_write",
|
|
20791
|
+
"update_pull_request",
|
|
20792
|
+
"update_pull_request_branch"
|
|
20793
|
+
];
|
|
20794
|
+
var GITHUB_MCP_WRITE_TOOLS = [
|
|
20795
|
+
"actions_run_trigger",
|
|
20796
|
+
"add_comment_to_pending_review",
|
|
20797
|
+
"add_issue_comment",
|
|
20798
|
+
"add_reply_to_pull_request_comment",
|
|
20799
|
+
"create_branch",
|
|
20800
|
+
"create_or_update_file",
|
|
20801
|
+
"create_pull_request",
|
|
20802
|
+
"create_repository",
|
|
20803
|
+
"delete_file",
|
|
20804
|
+
"fork_repository",
|
|
20805
|
+
"issue_write",
|
|
20806
|
+
"merge_pull_request",
|
|
20807
|
+
"pull_request_review_write",
|
|
20808
|
+
"push_files",
|
|
20809
|
+
"sub_issue_write",
|
|
20810
|
+
"update_pull_request",
|
|
20811
|
+
"update_pull_request_branch"
|
|
20812
|
+
];
|
|
20813
|
+
var githubMcpToolNameSet = new Set(
|
|
20814
|
+
GITHUB_MCP_TOOL_NAMES
|
|
20815
|
+
);
|
|
20816
|
+
var githubMcpWriteToolSet = new Set(
|
|
20817
|
+
GITHUB_MCP_WRITE_TOOLS
|
|
20818
|
+
);
|
|
20819
|
+
|
|
20660
20820
|
// ../../packages/schemas/src/secrets.ts
|
|
20661
20821
|
var SECRET_ENCRYPTION_ALGORITHM = "AES-256-GCM";
|
|
20662
20822
|
var SecretEnvNameSchema = external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);
|
|
@@ -20831,6 +20991,14 @@ var GITHUB_MOUNT_CAPABILITY_LEVELS = [
|
|
|
20831
20991
|
var GithubMountCapabilityLevelSchema = external_exports.enum(
|
|
20832
20992
|
GITHUB_MOUNT_CAPABILITY_LEVELS
|
|
20833
20993
|
);
|
|
20994
|
+
var DEFAULT_GITHUB_MOUNT_CAPABILITIES = {
|
|
20995
|
+
contents: "write",
|
|
20996
|
+
pullRequests: "write",
|
|
20997
|
+
issues: "write",
|
|
20998
|
+
checks: "read",
|
|
20999
|
+
actions: "read",
|
|
21000
|
+
workflows: "none"
|
|
21001
|
+
};
|
|
20834
21002
|
var GitMountAuthSchema = external_exports.discriminatedUnion("kind", [
|
|
20835
21003
|
external_exports.object({
|
|
20836
21004
|
kind: external_exports.literal("none")
|
|
@@ -20851,14 +21019,7 @@ var GitMountAuthSchema = external_exports.discriminatedUnion("kind", [
|
|
|
20851
21019
|
checks: GithubMountCapabilityLevelSchema.default("read"),
|
|
20852
21020
|
actions: GithubMountCapabilityLevelSchema.default("read"),
|
|
20853
21021
|
workflows: GithubMountCapabilityLevelSchema.default("none")
|
|
20854
|
-
}).default({
|
|
20855
|
-
contents: "write",
|
|
20856
|
-
pullRequests: "write",
|
|
20857
|
-
issues: "write",
|
|
20858
|
-
checks: "read",
|
|
20859
|
-
actions: "read",
|
|
20860
|
-
workflows: "none"
|
|
20861
|
-
})
|
|
21022
|
+
}).default({ ...DEFAULT_GITHUB_MOUNT_CAPABILITIES })
|
|
20862
21023
|
})
|
|
20863
21024
|
]);
|
|
20864
21025
|
var GitMountSchema = external_exports.object({
|
|
@@ -21009,6 +21170,11 @@ var LocalToolSchema = external_exports.discriminatedUnion(
|
|
|
21009
21170
|
error: `Unsupported local tool implementation. Supported implementations: ${LOCAL_TOOL_IMPLEMENTATIONS.join(", ")}`
|
|
21010
21171
|
}
|
|
21011
21172
|
);
|
|
21173
|
+
var GithubToolSchema = external_exports.object({
|
|
21174
|
+
kind: external_exports.literal("github"),
|
|
21175
|
+
description: external_exports.string().trim().min(1).optional(),
|
|
21176
|
+
tools: external_exports.array(external_exports.enum(GITHUB_MCP_TOOL_NAMES)).min(1).optional()
|
|
21177
|
+
});
|
|
21012
21178
|
var ToolSpecSchema = external_exports.discriminatedUnion("kind", [
|
|
21013
21179
|
RemoteMcpToolSchema,
|
|
21014
21180
|
LocalToolSchema
|
|
@@ -21058,6 +21224,10 @@ var InlineSessionToolSchema = RemoteMcpToolSchema.extend({
|
|
|
21058
21224
|
disabled: external_exports.boolean().optional()
|
|
21059
21225
|
})
|
|
21060
21226
|
)
|
|
21227
|
+
).or(
|
|
21228
|
+
GithubToolSchema.extend({
|
|
21229
|
+
disabled: external_exports.boolean().optional()
|
|
21230
|
+
})
|
|
21061
21231
|
);
|
|
21062
21232
|
var SessionToolRefSchema = InlineSessionToolSchema.or(
|
|
21063
21233
|
ReferencedSessionToolRefSchema
|
|
@@ -21173,17 +21343,17 @@ var TriggerFilterScalarSchema = external_exports.union([
|
|
|
21173
21343
|
external_exports.boolean()
|
|
21174
21344
|
]);
|
|
21175
21345
|
var TriggerFilterPathSchema = external_exports.string().refine(
|
|
21176
|
-
(
|
|
21177
|
-
if (
|
|
21346
|
+
(path2) => {
|
|
21347
|
+
if (path2.length === 0 || path2.trim() !== path2) {
|
|
21178
21348
|
return false;
|
|
21179
21349
|
}
|
|
21180
|
-
if (
|
|
21181
|
-
const segments =
|
|
21350
|
+
if (path2.startsWith("$.")) {
|
|
21351
|
+
const segments = path2.slice(2).split(".");
|
|
21182
21352
|
return segments.length > 0 && segments.every(
|
|
21183
21353
|
(segment) => segment.length > 0 && segment.trim() === segment
|
|
21184
21354
|
);
|
|
21185
21355
|
}
|
|
21186
|
-
return !
|
|
21356
|
+
return !path2.includes(".");
|
|
21187
21357
|
},
|
|
21188
21358
|
{
|
|
21189
21359
|
message: "Trigger filter paths must be a single bare key or use $.path.segments"
|
|
@@ -21622,8 +21792,8 @@ function hasAutoAttributionsExists(trigger, expected) {
|
|
|
21622
21792
|
function isChatMessageEvent(trigger) {
|
|
21623
21793
|
return trigger.event.startsWith("chat.message.");
|
|
21624
21794
|
}
|
|
21625
|
-
function hasFilterValue(trigger,
|
|
21626
|
-
return trigger.where?.[
|
|
21795
|
+
function hasFilterValue(trigger, path2, expected) {
|
|
21796
|
+
return trigger.where?.[path2] === expected;
|
|
21627
21797
|
}
|
|
21628
21798
|
|
|
21629
21799
|
// ../../packages/schemas/src/project-resources.ts
|
|
@@ -21842,7 +22012,7 @@ var SessionRunRecordSchema = external_exports.object({
|
|
|
21842
22012
|
external_exports.object({
|
|
21843
22013
|
source: external_exports.literal("inline"),
|
|
21844
22014
|
alias: ToolAliasSchema,
|
|
21845
|
-
spec: RemoteMcpToolSchema.or(LocalToolSchema)
|
|
22015
|
+
spec: RemoteMcpToolSchema.or(LocalToolSchema).or(GithubToolSchema)
|
|
21846
22016
|
}),
|
|
21847
22017
|
external_exports.object({
|
|
21848
22018
|
source: external_exports.literal("resource"),
|
|
@@ -23678,12 +23848,12 @@ function parse4(str) {
|
|
|
23678
23848
|
uri.queryKey = queryKey(uri, uri["query"]);
|
|
23679
23849
|
return uri;
|
|
23680
23850
|
}
|
|
23681
|
-
function pathNames(obj,
|
|
23682
|
-
const regx = /\/{2,9}/g, names =
|
|
23683
|
-
if (
|
|
23851
|
+
function pathNames(obj, path2) {
|
|
23852
|
+
const regx = /\/{2,9}/g, names = path2.replace(regx, "/").split("/");
|
|
23853
|
+
if (path2.slice(0, 1) == "/" || path2.length === 0) {
|
|
23684
23854
|
names.splice(0, 1);
|
|
23685
23855
|
}
|
|
23686
|
-
if (
|
|
23856
|
+
if (path2.slice(-1) == "/") {
|
|
23687
23857
|
names.splice(names.length - 1, 1);
|
|
23688
23858
|
}
|
|
23689
23859
|
return names;
|
|
@@ -24300,7 +24470,7 @@ var protocol2 = Socket.protocol;
|
|
|
24300
24470
|
// ../../node_modules/socket.io-client/build/esm-debug/url.js
|
|
24301
24471
|
var import_debug7 = __toESM(require_src(), 1);
|
|
24302
24472
|
var debug7 = (0, import_debug7.default)("socket.io-client:url");
|
|
24303
|
-
function url2(uri,
|
|
24473
|
+
function url2(uri, path2 = "", loc) {
|
|
24304
24474
|
let obj = uri;
|
|
24305
24475
|
loc = loc || typeof location !== "undefined" && location;
|
|
24306
24476
|
if (null == uri)
|
|
@@ -24334,7 +24504,7 @@ function url2(uri, path = "", loc) {
|
|
|
24334
24504
|
obj.path = obj.path || "/";
|
|
24335
24505
|
const ipv63 = obj.host.indexOf(":") !== -1;
|
|
24336
24506
|
const host = ipv63 ? "[" + obj.host + "]" : obj.host;
|
|
24337
|
-
obj.id = obj.protocol + "://" + host + ":" + obj.port +
|
|
24507
|
+
obj.id = obj.protocol + "://" + host + ":" + obj.port + path2;
|
|
24338
24508
|
obj.href = obj.protocol + "://" + host + (loc && loc.port === obj.port ? "" : ":" + obj.port);
|
|
24339
24509
|
return obj;
|
|
24340
24510
|
}
|
|
@@ -25965,8 +26135,8 @@ function lookup(uri, opts) {
|
|
|
25965
26135
|
const parsed = url2(uri, opts.path || "/socket.io");
|
|
25966
26136
|
const source = parsed.source;
|
|
25967
26137
|
const id = parsed.id;
|
|
25968
|
-
const
|
|
25969
|
-
const sameNamespace = cache[id] &&
|
|
26138
|
+
const path2 = parsed.path;
|
|
26139
|
+
const sameNamespace = cache[id] && path2 in cache[id]["nsps"];
|
|
25970
26140
|
const newConnection = opts.forceNew || opts["force new connection"] || false === opts.multiplex || sameNamespace;
|
|
25971
26141
|
let io;
|
|
25972
26142
|
if (newConnection) {
|
|
@@ -26034,6 +26204,7 @@ async function runAgentBridgeSocket(options) {
|
|
|
26034
26204
|
RUNTIME_BRIDGE_BOOTSTRAP_EVENT,
|
|
26035
26205
|
createRuntimeBridgeBootstrapListener({
|
|
26036
26206
|
token: options.token,
|
|
26207
|
+
onBootstrap: options.onBootstrap,
|
|
26037
26208
|
createHandler: (bootstrap) => options.createHandler({
|
|
26038
26209
|
emitOutput: (output) => emitOutputWithAck(socket, output),
|
|
26039
26210
|
claude: bootstrap.claude,
|
|
@@ -26132,6 +26303,7 @@ function createRuntimeBridgeBootstrapListener(input) {
|
|
|
26132
26303
|
input.writeOutput?.(
|
|
26133
26304
|
`agent_bridge_bootstrap_decrypted duration_ms=${Date.now() - decryptStartedAt}`
|
|
26134
26305
|
);
|
|
26306
|
+
await input.onBootstrap?.(bootstrap);
|
|
26135
26307
|
let handler = input.getHandler();
|
|
26136
26308
|
if (!handler) {
|
|
26137
26309
|
handler = input.createHandler(bootstrap);
|
|
@@ -46539,21 +46711,21 @@ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as rea
|
|
|
46539
46711
|
import { dirname } from "path";
|
|
46540
46712
|
var AGENT_BRIDGE_RUNTIME_DIR = "/tmp/auto-bridge-runtime";
|
|
46541
46713
|
var CLAUDE_SESSION_RESUME_PATH = `${AGENT_BRIDGE_RUNTIME_DIR}/claude-session-id`;
|
|
46542
|
-
function fileClaudeSessionResumeStore(
|
|
46714
|
+
function fileClaudeSessionResumeStore(path2 = CLAUDE_SESSION_RESUME_PATH) {
|
|
46543
46715
|
return {
|
|
46544
46716
|
read(runId) {
|
|
46545
|
-
if (!existsSync2(
|
|
46717
|
+
if (!existsSync2(path2)) {
|
|
46546
46718
|
return null;
|
|
46547
46719
|
}
|
|
46548
|
-
const record2 = parseResumeRecord(readFileSync2(
|
|
46720
|
+
const record2 = parseResumeRecord(readFileSync2(path2, "utf8"));
|
|
46549
46721
|
if (!record2 || record2.runId !== runId) {
|
|
46550
46722
|
return null;
|
|
46551
46723
|
}
|
|
46552
46724
|
return record2.sessionId;
|
|
46553
46725
|
},
|
|
46554
46726
|
write(record2) {
|
|
46555
|
-
mkdirSync2(dirname(
|
|
46556
|
-
writeFileSync(
|
|
46727
|
+
mkdirSync2(dirname(path2), { recursive: true });
|
|
46728
|
+
writeFileSync(path2, `${JSON.stringify(record2)}
|
|
46557
46729
|
`, "utf8");
|
|
46558
46730
|
}
|
|
46559
46731
|
};
|
|
@@ -46922,7 +47094,10 @@ function deliveryMessage(delivery) {
|
|
|
46922
47094
|
// src/commands/agent-bridge/entrypoint.ts
|
|
46923
47095
|
async function runAgentBridgeProcess(input) {
|
|
46924
47096
|
const runAgentBridge = input.runAgentBridge ?? runAgentBridgeClaudeCode;
|
|
46925
|
-
await runAgentBridge(
|
|
47097
|
+
await runAgentBridge({
|
|
47098
|
+
...agentBridgeOptionsFromEnv(input),
|
|
47099
|
+
onBootstrap: createGitCredentialRelayStarter(input.writeOutput)
|
|
47100
|
+
});
|
|
46926
47101
|
}
|
|
46927
47102
|
function agentBridgeOptionsFromEnv(input) {
|
|
46928
47103
|
return {
|
|
@@ -46931,6 +47106,37 @@ function agentBridgeOptionsFromEnv(input) {
|
|
|
46931
47106
|
writeOutput: input.writeOutput
|
|
46932
47107
|
};
|
|
46933
47108
|
}
|
|
47109
|
+
function createGitCredentialRelayStarter(writeOutput) {
|
|
47110
|
+
let relay;
|
|
47111
|
+
let startup;
|
|
47112
|
+
return async (bootstrap) => {
|
|
47113
|
+
const gitCredentials = bootstrap.gitCredentials;
|
|
47114
|
+
if (!gitCredentials) {
|
|
47115
|
+
return;
|
|
47116
|
+
}
|
|
47117
|
+
if (relay) {
|
|
47118
|
+
relay.update(gitCredentials);
|
|
47119
|
+
return;
|
|
47120
|
+
}
|
|
47121
|
+
if (startup) {
|
|
47122
|
+
const started = await startup;
|
|
47123
|
+
started?.update(gitCredentials);
|
|
47124
|
+
return;
|
|
47125
|
+
}
|
|
47126
|
+
startup = startGitCredentialRelay(gitCredentials).then((started) => {
|
|
47127
|
+
relay = started;
|
|
47128
|
+
writeOutput?.(`agent_bridge_git_credential_relay port=${started.port}`);
|
|
47129
|
+
return started;
|
|
47130
|
+
}).catch((error51) => {
|
|
47131
|
+
startup = void 0;
|
|
47132
|
+
writeOutput?.(
|
|
47133
|
+
`agent_bridge_git_credential_relay_failed error=${error51 instanceof Error ? error51.message : String(error51)}`
|
|
47134
|
+
);
|
|
47135
|
+
return void 0;
|
|
47136
|
+
});
|
|
47137
|
+
await startup;
|
|
47138
|
+
};
|
|
47139
|
+
}
|
|
46934
47140
|
function requiredEnv(env, key) {
|
|
46935
47141
|
const value2 = env[key]?.trim();
|
|
46936
47142
|
if (!value2) {
|