@autohq/cli 0.1.89 → 0.1.91

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.
@@ -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, path) {
5612
- if (!path)
5681
+ function getElementAtPath(obj, path2) {
5682
+ if (!path2)
5613
5683
  return obj;
5614
- return path.reduce((acc, key) => acc?.[key], obj);
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(path, issues) {
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(path);
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, path = []) => {
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 }, [...path, ...issue2.path]));
6247
+ issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
6178
6248
  } else if (issue2.code === "invalid_key") {
6179
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
6249
+ processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
6180
6250
  } else if (issue2.code === "invalid_element") {
6181
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
6251
+ processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
6182
6252
  } else {
6183
- const fullpath = [...path, ...issue2.path];
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, path = []) => {
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 }, [...path, ...issue2.path]));
6284
+ issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
6215
6285
  } else if (issue2.code === "invalid_key") {
6216
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
6286
+ processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
6217
6287
  } else if (issue2.code === "invalid_element") {
6218
- processError({ issues: issue2.issues }, [...path, ...issue2.path]);
6288
+ processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
6219
6289
  } else {
6220
- const fullpath = [...path, ...issue2.path];
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 path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
6253
- for (const seg of path) {
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 path = ref.slice(1).split("/").filter(Boolean);
18946
- if (path.length === 0) {
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 (path[0] === defsKey) {
18951
- const key = path[1];
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
- (path) => {
21177
- if (path.length === 0 || path.trim() !== path) {
21346
+ (path2) => {
21347
+ if (path2.length === 0 || path2.trim() !== path2) {
21178
21348
  return false;
21179
21349
  }
21180
- if (path.startsWith("$.")) {
21181
- const segments = path.slice(2).split(".");
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 !path.includes(".");
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, path, expected) {
21626
- return trigger.where?.[path] === expected;
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"),
@@ -22346,7 +22516,6 @@ var SessionRunDispatchCommandRecordSchema = external_exports.discriminatedUnion(
22346
22516
  var RuntimeRecordSchema = external_exports.object({
22347
22517
  id: RuntimeIdSchema2,
22348
22518
  sandboxId: external_exports.string().trim().min(1).nullable(),
22349
- gitAuthExpiresAt: external_exports.string().datetime().nullable(),
22350
22519
  createdAt: external_exports.string().datetime(),
22351
22520
  updatedAt: external_exports.string().datetime()
22352
22521
  });
@@ -23678,12 +23847,12 @@ function parse4(str) {
23678
23847
  uri.queryKey = queryKey(uri, uri["query"]);
23679
23848
  return uri;
23680
23849
  }
23681
- function pathNames(obj, path) {
23682
- const regx = /\/{2,9}/g, names = path.replace(regx, "/").split("/");
23683
- if (path.slice(0, 1) == "/" || path.length === 0) {
23850
+ function pathNames(obj, path2) {
23851
+ const regx = /\/{2,9}/g, names = path2.replace(regx, "/").split("/");
23852
+ if (path2.slice(0, 1) == "/" || path2.length === 0) {
23684
23853
  names.splice(0, 1);
23685
23854
  }
23686
- if (path.slice(-1) == "/") {
23855
+ if (path2.slice(-1) == "/") {
23687
23856
  names.splice(names.length - 1, 1);
23688
23857
  }
23689
23858
  return names;
@@ -24300,7 +24469,7 @@ var protocol2 = Socket.protocol;
24300
24469
  // ../../node_modules/socket.io-client/build/esm-debug/url.js
24301
24470
  var import_debug7 = __toESM(require_src(), 1);
24302
24471
  var debug7 = (0, import_debug7.default)("socket.io-client:url");
24303
- function url2(uri, path = "", loc) {
24472
+ function url2(uri, path2 = "", loc) {
24304
24473
  let obj = uri;
24305
24474
  loc = loc || typeof location !== "undefined" && location;
24306
24475
  if (null == uri)
@@ -24334,7 +24503,7 @@ function url2(uri, path = "", loc) {
24334
24503
  obj.path = obj.path || "/";
24335
24504
  const ipv63 = obj.host.indexOf(":") !== -1;
24336
24505
  const host = ipv63 ? "[" + obj.host + "]" : obj.host;
24337
- obj.id = obj.protocol + "://" + host + ":" + obj.port + path;
24506
+ obj.id = obj.protocol + "://" + host + ":" + obj.port + path2;
24338
24507
  obj.href = obj.protocol + "://" + host + (loc && loc.port === obj.port ? "" : ":" + obj.port);
24339
24508
  return obj;
24340
24509
  }
@@ -25965,8 +26134,8 @@ function lookup(uri, opts) {
25965
26134
  const parsed = url2(uri, opts.path || "/socket.io");
25966
26135
  const source = parsed.source;
25967
26136
  const id = parsed.id;
25968
- const path = parsed.path;
25969
- const sameNamespace = cache[id] && path in cache[id]["nsps"];
26137
+ const path2 = parsed.path;
26138
+ const sameNamespace = cache[id] && path2 in cache[id]["nsps"];
25970
26139
  const newConnection = opts.forceNew || opts["force new connection"] || false === opts.multiplex || sameNamespace;
25971
26140
  let io;
25972
26141
  if (newConnection) {
@@ -26034,6 +26203,7 @@ async function runAgentBridgeSocket(options) {
26034
26203
  RUNTIME_BRIDGE_BOOTSTRAP_EVENT,
26035
26204
  createRuntimeBridgeBootstrapListener({
26036
26205
  token: options.token,
26206
+ onBootstrap: options.onBootstrap,
26037
26207
  createHandler: (bootstrap) => options.createHandler({
26038
26208
  emitOutput: (output) => emitOutputWithAck(socket, output),
26039
26209
  claude: bootstrap.claude,
@@ -26132,6 +26302,7 @@ function createRuntimeBridgeBootstrapListener(input) {
26132
26302
  input.writeOutput?.(
26133
26303
  `agent_bridge_bootstrap_decrypted duration_ms=${Date.now() - decryptStartedAt}`
26134
26304
  );
26305
+ await input.onBootstrap?.(bootstrap);
26135
26306
  let handler = input.getHandler();
26136
26307
  if (!handler) {
26137
26308
  handler = input.createHandler(bootstrap);
@@ -46539,21 +46710,21 @@ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as rea
46539
46710
  import { dirname } from "path";
46540
46711
  var AGENT_BRIDGE_RUNTIME_DIR = "/tmp/auto-bridge-runtime";
46541
46712
  var CLAUDE_SESSION_RESUME_PATH = `${AGENT_BRIDGE_RUNTIME_DIR}/claude-session-id`;
46542
- function fileClaudeSessionResumeStore(path = CLAUDE_SESSION_RESUME_PATH) {
46713
+ function fileClaudeSessionResumeStore(path2 = CLAUDE_SESSION_RESUME_PATH) {
46543
46714
  return {
46544
46715
  read(runId) {
46545
- if (!existsSync2(path)) {
46716
+ if (!existsSync2(path2)) {
46546
46717
  return null;
46547
46718
  }
46548
- const record2 = parseResumeRecord(readFileSync2(path, "utf8"));
46719
+ const record2 = parseResumeRecord(readFileSync2(path2, "utf8"));
46549
46720
  if (!record2 || record2.runId !== runId) {
46550
46721
  return null;
46551
46722
  }
46552
46723
  return record2.sessionId;
46553
46724
  },
46554
46725
  write(record2) {
46555
- mkdirSync2(dirname(path), { recursive: true });
46556
- writeFileSync(path, `${JSON.stringify(record2)}
46726
+ mkdirSync2(dirname(path2), { recursive: true });
46727
+ writeFileSync(path2, `${JSON.stringify(record2)}
46557
46728
  `, "utf8");
46558
46729
  }
46559
46730
  };
@@ -46922,7 +47093,10 @@ function deliveryMessage(delivery) {
46922
47093
  // src/commands/agent-bridge/entrypoint.ts
46923
47094
  async function runAgentBridgeProcess(input) {
46924
47095
  const runAgentBridge = input.runAgentBridge ?? runAgentBridgeClaudeCode;
46925
- await runAgentBridge(agentBridgeOptionsFromEnv(input));
47096
+ await runAgentBridge({
47097
+ ...agentBridgeOptionsFromEnv(input),
47098
+ onBootstrap: createGitCredentialRelayStarter(input.writeOutput)
47099
+ });
46926
47100
  }
46927
47101
  function agentBridgeOptionsFromEnv(input) {
46928
47102
  return {
@@ -46931,6 +47105,37 @@ function agentBridgeOptionsFromEnv(input) {
46931
47105
  writeOutput: input.writeOutput
46932
47106
  };
46933
47107
  }
47108
+ function createGitCredentialRelayStarter(writeOutput) {
47109
+ let relay;
47110
+ let startup;
47111
+ return async (bootstrap) => {
47112
+ const gitCredentials = bootstrap.gitCredentials;
47113
+ if (!gitCredentials) {
47114
+ return;
47115
+ }
47116
+ if (relay) {
47117
+ relay.update(gitCredentials);
47118
+ return;
47119
+ }
47120
+ if (startup) {
47121
+ const started = await startup;
47122
+ started?.update(gitCredentials);
47123
+ return;
47124
+ }
47125
+ startup = startGitCredentialRelay(gitCredentials).then((started) => {
47126
+ relay = started;
47127
+ writeOutput?.(`agent_bridge_git_credential_relay port=${started.port}`);
47128
+ return started;
47129
+ }).catch((error51) => {
47130
+ startup = void 0;
47131
+ writeOutput?.(
47132
+ `agent_bridge_git_credential_relay_failed error=${error51 instanceof Error ? error51.message : String(error51)}`
47133
+ );
47134
+ return void 0;
47135
+ });
47136
+ await startup;
47137
+ };
47138
+ }
46934
47139
  function requiredEnv(env, key) {
46935
47140
  const value2 = env[key]?.trim();
46936
47141
  if (!value2) {