@sideboard-ai/core 0.1.84 → 0.1.85

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.
Files changed (35) hide show
  1. package/dist/{agents-OPTHS4IX.js → agents-FD77JUOP.js} +10 -10
  2. package/dist/{agents-JFXM66QA.js → agents-YAYNNJWC.js} +6 -6
  3. package/dist/{chunk-ODZ2ZOA4.js → chunk-2N5DVTGH.js} +2 -2
  4. package/dist/{chunk-BBQ6HXKS.js → chunk-3CCRD6WS.js} +19 -9
  5. package/dist/{chunk-AE5VBOFE.js → chunk-3KETJKYA.js} +9 -2
  6. package/dist/{chunk-WJ5TINR6.js → chunk-6GKDYUTJ.js} +2 -2
  7. package/dist/{chunk-VROPG6QF.js → chunk-6K5VAPVR.js} +3 -3
  8. package/dist/{chunk-CKBIQ54F.js → chunk-6WQAYBVE.js} +88 -20
  9. package/dist/{chunk-BTL7EMGT.js → chunk-HHTHF5BQ.js} +4 -4
  10. package/dist/{chunk-UN3LVQB2.js → chunk-JFQ2M6NQ.js} +2 -2
  11. package/dist/{chunk-OIEFHOP7.js → chunk-JTHWVYSD.js} +2 -2
  12. package/dist/{chunk-XW47PL6A.js → chunk-KRAUS3RF.js} +86 -16
  13. package/dist/{chunk-D4DPQ552.js → chunk-LGXBYZZA.js} +9 -2
  14. package/dist/{chunk-JPHG2KCC.js → chunk-SH75CXJR.js} +1 -1
  15. package/dist/{chunk-R753UFSX.js → chunk-WGI6KXKJ.js} +14 -4
  16. package/dist/{chunk-NW7MEJHO.js → chunk-XVFV56JG.js} +1 -1
  17. package/dist/{connected-teams-ZRS53OAT.js → connected-teams-BNBM7OIC.js} +2 -2
  18. package/dist/{connected-teams-35EIRJCP.js → connected-teams-LSQ5TAZP.js} +2 -2
  19. package/dist/{coordinator-prompt-RCTIIZ6C.js → coordinator-prompt-VN7FF76K.js} +3 -3
  20. package/dist/{coordinator-prompt-DOIOSLUN.js → coordinator-prompt-YYQSPLIP.js} +3 -3
  21. package/dist/{global-workspace-73OAKD3C.js → global-workspace-BRIDCBMY.js} +4 -4
  22. package/dist/{global-workspace-33BIG7KK.js → global-workspace-U3XVTQLL.js} +4 -4
  23. package/dist/index.cjs +181 -82
  24. package/dist/index.d.cts +32 -6
  25. package/dist/index.d.ts +32 -6
  26. package/dist/index.js +36 -22
  27. package/dist/mcp/run-stdio.cjs +361 -270
  28. package/dist/mcp/run-stdio.js +34 -27
  29. package/dist/{run-V2WZUMJA.js → run-CFKZPY7F.js} +1 -1
  30. package/dist/{run-A4RHY7HH.js → run-XKTAJRWF.js} +1 -1
  31. package/dist/{workspaces-WDLY34MX.js → workspaces-AIZDG6PS.js} +5 -5
  32. package/dist/{workspaces-SRITISKA.js → workspaces-IWQIWAMQ.js} +5 -5
  33. package/dist/{worktree-TUAO74SI.js → worktree-6ZALJUWG.js} +2 -2
  34. package/dist/{worktree-SGZVAWOQ.js → worktree-7Y22WHR7.js} +2 -2
  35. package/package.json +1 -1
@@ -32,18 +32,22 @@ import {
32
32
  resolveCursorModelId,
33
33
  resolveLoginCommand,
34
34
  resolveQuotaFallbackAgent
35
- } from "./chunk-BBQ6HXKS.js";
36
- import "./chunk-VROPG6QF.js";
35
+ } from "./chunk-3CCRD6WS.js";
36
+ import "./chunk-6K5VAPVR.js";
37
37
  import {
38
38
  ORCHESTRATOR_AGENT_KINDS,
39
39
  assertOrchestratorCapableAgent,
40
40
  coerceOrchestratorAgent,
41
41
  isOrchestratorCapableAgent
42
- } from "./chunk-WJ5TINR6.js";
43
- import "./chunk-NW7MEJHO.js";
44
- import "./chunk-CKBIQ54F.js";
42
+ } from "./chunk-6GKDYUTJ.js";
43
+ import "./chunk-XVFV56JG.js";
44
+ import "./chunk-6WQAYBVE.js";
45
45
  import "./chunk-B3SJXYIJ.js";
46
46
  import "./chunk-7FD7COKE.js";
47
+ import "./chunk-AY53MPDE.js";
48
+ import "./chunk-NSTQ6QKD.js";
49
+ import "./chunk-KGZBYWZ3.js";
50
+ import "./chunk-7MV3RXSC.js";
47
51
  import {
48
52
  conductorBundledBinDir,
49
53
  enrichPathWithNpmGlobalBin,
@@ -52,11 +56,7 @@ import {
52
56
  posixShellSingleQuote,
53
57
  resolveCommandBinarySync,
54
58
  withExportedPath
55
- } from "./chunk-AE5VBOFE.js";
56
- import "./chunk-AY53MPDE.js";
57
- import "./chunk-NSTQ6QKD.js";
58
- import "./chunk-KGZBYWZ3.js";
59
- import "./chunk-7MV3RXSC.js";
59
+ } from "./chunk-3KETJKYA.js";
60
60
  export {
61
61
  CLAUDE_MODEL_CATALOG,
62
62
  ORCHESTRATOR_AGENT_KINDS,
@@ -28,20 +28,20 @@ import {
28
28
  resolveCursorModelId,
29
29
  resolveLoginCommand,
30
30
  resolveQuotaFallbackAgent
31
- } from "./chunk-R753UFSX.js";
31
+ } from "./chunk-WGI6KXKJ.js";
32
32
  import {
33
33
  ORCHESTRATOR_AGENT_KINDS,
34
34
  assertOrchestratorCapableAgent,
35
35
  coerceOrchestratorAgent,
36
36
  isOrchestratorCapableAgent
37
- } from "./chunk-OIEFHOP7.js";
38
- import "./chunk-JPHG2KCC.js";
39
- import "./chunk-BTL7EMGT.js";
37
+ } from "./chunk-JTHWVYSD.js";
38
+ import "./chunk-SH75CXJR.js";
39
+ import "./chunk-HHTHF5BQ.js";
40
40
  import {
41
41
  cursorSdkMessageToEvents,
42
42
  parseCursorRunnerLine
43
43
  } from "./chunk-CBJSPTBG.js";
44
- import "./chunk-XW47PL6A.js";
44
+ import "./chunk-KRAUS3RF.js";
45
45
  import "./chunk-FKOIHGKV.js";
46
46
  import "./chunk-I3FRXL7J.js";
47
47
  import "./chunk-5KLC2MWZ.js";
@@ -57,7 +57,7 @@ import {
57
57
  posixShellSingleQuote,
58
58
  resolveCommandBinarySync,
59
59
  withExportedPath
60
- } from "./chunk-D4DPQ552.js";
60
+ } from "./chunk-LGXBYZZA.js";
61
61
  export {
62
62
  CLAUDE_MODEL_CATALOG,
63
63
  ORCHESTRATOR_AGENT_KINDS,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  isGlobalRepoPath
3
- } from "./chunk-OIEFHOP7.js";
3
+ } from "./chunk-JTHWVYSD.js";
4
4
  import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveRepoRoot
7
- } from "./chunk-XW47PL6A.js";
7
+ } from "./chunk-KRAUS3RF.js";
8
8
  import {
9
9
  appDataDir
10
10
  } from "./chunk-M37RITA6.js";
@@ -6,17 +6,14 @@ import {
6
6
  ensureCliTeamTracked,
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  loadBrightsyConfig
9
- } from "./chunk-VROPG6QF.js";
9
+ } from "./chunk-6K5VAPVR.js";
10
10
  import {
11
11
  isOrchestratorThread
12
- } from "./chunk-WJ5TINR6.js";
12
+ } from "./chunk-6GKDYUTJ.js";
13
13
  import {
14
- enrichPathWithNpmGlobalBin,
15
- isConductorBundledCli,
16
- resolveCommandBinarySync,
17
- run,
18
- withExportedPath
19
- } from "./chunk-AE5VBOFE.js";
14
+ codexUnattendedGitConfigArgs,
15
+ resolveAgentGitAuthEnv
16
+ } from "./chunk-6WQAYBVE.js";
20
17
  import {
21
18
  claudeChromeEnabled,
22
19
  isStrippedElectronLaunch,
@@ -28,6 +25,13 @@ import {
28
25
  import {
29
26
  appDataDir
30
27
  } from "./chunk-7MV3RXSC.js";
28
+ import {
29
+ enrichPathWithNpmGlobalBin,
30
+ isConductorBundledCli,
31
+ resolveCommandBinarySync,
32
+ run,
33
+ withExportedPath
34
+ } from "./chunk-3KETJKYA.js";
31
35
 
32
36
  // src/agents/brightsy.ts
33
37
  import { existsSync } from "fs";
@@ -814,6 +818,10 @@ async function buildInjectedMcpServers(opts) {
814
818
  if (orchId) {
815
819
  sideboard.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID = orchId;
816
820
  }
821
+ try {
822
+ Object.assign(sideboard.env, await resolveAgentGitAuthEnv(sideboard.env));
823
+ } catch {
824
+ }
817
825
  servers.push(sideboard);
818
826
  }
819
827
  if (opts.includeBrightsy && isBrightsyConnected()) {
@@ -1092,7 +1100,7 @@ var claudeAdapter = {
1092
1100
  );
1093
1101
  }
1094
1102
  const mode = permissionMode(thread);
1095
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-33BIG7KK.js");
1103
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-U3XVTQLL.js");
1096
1104
  const isOrchestrator = isOrchestratorThread2(thread);
1097
1105
  const injectedServers = await buildInjectedMcpServers({
1098
1106
  includeSideboard: true,
@@ -1474,6 +1482,8 @@ var codexAdapter = {
1474
1482
  // `codex exec` rejects `--ask-for-approval` (global-only on newer CLIs).
1475
1483
  "-c",
1476
1484
  'approval_policy="never"',
1485
+ // Seatbelt cannot use the login Keychain; default policy also strips GH_TOKEN.
1486
+ ...codexUnattendedGitConfigArgs(mode.codexSandbox),
1477
1487
  ...model ? ["--model", model] : [],
1478
1488
  ...mcpOverrides
1479
1489
  ];
@@ -142,7 +142,10 @@ async function git(args, cwd, opts) {
142
142
  env: {
143
143
  GIT_TERMINAL_PROMPT: "0",
144
144
  GIT_ASKPASS: process.env.GIT_ASKPASS || "echo",
145
+ SSH_ASKPASS: process.env.SSH_ASKPASS || "echo",
145
146
  GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || "ssh -o BatchMode=yes -o ConnectTimeout=15",
147
+ GCM_INTERACTIVE: "never",
148
+ GH_PROMPT_DISABLED: "1",
146
149
  ...opts?.env
147
150
  }
148
151
  });
@@ -151,11 +154,15 @@ async function gh(args, cwd, opts) {
151
154
  return run("gh", args, {
152
155
  cwd,
153
156
  reject: opts?.reject,
154
- timeoutMs: opts?.timeoutMs
157
+ timeoutMs: opts?.timeoutMs,
158
+ env: {
159
+ GH_PROMPT_DISABLED: "1",
160
+ GIT_TERMINAL_PROMPT: "0"
161
+ }
155
162
  });
156
163
  }
157
164
  async function resolveGhAuthToken(cwd) {
158
- const result = await gh(["auth", "token"], cwd, { reject: false });
165
+ const result = await gh(["auth", "token"], cwd, { reject: false, timeoutMs: 8e3 });
159
166
  if (result.exitCode !== 0) return null;
160
167
  const token = result.stdout.trim();
161
168
  return token || null;
@@ -2,12 +2,12 @@
2
2
 
3
3
  import {
4
4
  ensureGlobalCoordinatorCwd
5
- } from "./chunk-NW7MEJHO.js";
5
+ } from "./chunk-XVFV56JG.js";
6
6
  import {
7
7
  allocateTeamName,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-CKBIQ54F.js";
10
+ } from "./chunk-6WQAYBVE.js";
11
11
  import {
12
12
  createEmptyThread,
13
13
  listThreads,
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import {
4
- run
5
- } from "./chunk-AE5VBOFE.js";
6
3
  import {
7
4
  appDataDir
8
5
  } from "./chunk-7MV3RXSC.js";
6
+ import {
7
+ run
8
+ } from "./chunk-3KETJKYA.js";
9
9
 
10
10
  // src/brightsy/connected-teams.ts
11
11
  import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
@@ -6,11 +6,6 @@ import {
6
6
  import {
7
7
  listThreads
8
8
  } from "./chunk-7FD7COKE.js";
9
- import {
10
- gh,
11
- git,
12
- resolveGhAuthToken
13
- } from "./chunk-AE5VBOFE.js";
14
9
  import {
15
10
  getGithubGitAuthMode,
16
11
  getGithubPat
@@ -18,6 +13,11 @@ import {
18
13
  import {
19
14
  worktreesRoot
20
15
  } from "./chunk-7MV3RXSC.js";
16
+ import {
17
+ gh,
18
+ git,
19
+ resolveGhAuthToken
20
+ } from "./chunk-3KETJKYA.js";
21
21
 
22
22
  // src/git/worktree.ts
23
23
  import { existsSync, readdirSync } from "fs";
@@ -902,8 +902,20 @@ function formatMergePrError(raw) {
902
902
  var HTTPS_REWRITE = [
903
903
  { key: "url.https://github.com/.insteadOf", value: "git@github.com:" },
904
904
  { key: "url.https://github.com/.insteadOf", value: "ssh://git@github.com/" },
905
- { key: "credential.https://github.com.helper", value: "!gh auth git-credential" }
905
+ // Empty helper disables ~/.gitconfig osxkeychain so GUI agents cannot pop
906
+ // "git-credential-osxkeychain wants to use the keychain".
907
+ { key: "credential.helper", value: "" }
906
908
  ];
909
+ function nonInteractiveGitProcessEnv() {
910
+ return {
911
+ GIT_TERMINAL_PROMPT: "0",
912
+ GIT_ASKPASS: process.env.GIT_ASKPASS?.trim() || "echo",
913
+ SSH_ASKPASS: process.env.SSH_ASKPASS?.trim() || "echo",
914
+ GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND?.trim() || "ssh -o BatchMode=yes -o ConnectTimeout=15",
915
+ GCM_INTERACTIVE: "never",
916
+ GH_PROMPT_DISABLED: "1"
917
+ };
918
+ }
907
919
  function appendIndexedGitConfig(existing, entries) {
908
920
  const start = Number.parseInt(String(existing?.GIT_CONFIG_COUNT ?? "0"), 10);
909
921
  const count = Number.isFinite(start) && start > 0 ? start : 0;
@@ -919,18 +931,72 @@ function appendIndexedGitConfig(existing, entries) {
919
931
  function githubAgentGitEnv(existing) {
920
932
  return appendIndexedGitConfig(existing, HTTPS_REWRITE);
921
933
  }
934
+ function githubHttpsBearerEnv(existing, token) {
935
+ const rewrite = githubAgentGitEnv(existing);
936
+ const header = appendIndexedGitConfig(
937
+ { ...existing, ...rewrite },
938
+ [
939
+ {
940
+ key: "http.https://github.com/.extraHeader",
941
+ value: `AUTHORIZATION: bearer ${token}`
942
+ }
943
+ ]
944
+ );
945
+ return { ...rewrite, ...header };
946
+ }
922
947
  function applyGithubGitAuthEnv(existing, opts) {
923
- const out = {};
924
- if (opts.mode === "gh" || opts.mode === "token") {
925
- Object.assign(out, githubAgentGitEnv(existing));
948
+ const out = { ...nonInteractiveGitProcessEnv() };
949
+ if (opts.mode === "ssh") return out;
950
+ const existingToken = existing?.GH_TOKEN?.trim() || "";
951
+ const provided = existingToken ? "" : opts.token?.trim() || "";
952
+ const token = existingToken || provided;
953
+ Object.assign(
954
+ out,
955
+ token ? githubHttpsBearerEnv(existing, token) : githubAgentGitEnv(existing)
956
+ );
957
+ if (provided) out.GH_TOKEN = provided;
958
+ return out;
959
+ }
960
+ async function resolveGithubAgentToken(mode, cwd) {
961
+ if (mode === "ssh") return null;
962
+ if (mode === "token") return getGithubPat();
963
+ try {
964
+ return await resolveGhAuthToken(cwd);
965
+ } catch {
966
+ return null;
926
967
  }
927
- if (opts.mode === "token") {
928
- const token = opts.token?.trim();
929
- if (token && !existing?.GH_TOKEN?.trim()) {
930
- out.GH_TOKEN = token;
968
+ }
969
+ async function resolveAgentGitAuthEnv(existing, opts) {
970
+ let mode = "auto";
971
+ if (opts?.mode) {
972
+ mode = opts.mode;
973
+ } else {
974
+ try {
975
+ mode = getGithubGitAuthMode();
976
+ } catch {
977
+ mode = "auto";
931
978
  }
932
979
  }
933
- return out;
980
+ const cwd = opts?.cwd?.trim() || process.cwd();
981
+ let token = null;
982
+ try {
983
+ token = await resolveGithubAgentToken(mode, cwd);
984
+ } catch {
985
+ token = null;
986
+ }
987
+ return applyGithubGitAuthEnv(existing, { mode, token });
988
+ }
989
+ function codexUnattendedGitConfigArgs(sandbox) {
990
+ const args = [
991
+ "-c",
992
+ 'shell_environment_policy.inherit="all"',
993
+ "-c",
994
+ "shell_environment_policy.ignore_default_excludes=true"
995
+ ];
996
+ if (sandbox === "workspace-write") {
997
+ args.push("-c", "sandbox_workspace_write.network_access=true");
998
+ }
999
+ return args;
934
1000
  }
935
1001
  function formatGitAuthModeDirective(mode) {
936
1002
  switch (mode) {
@@ -938,14 +1004,14 @@ function formatGitAuthModeDirective(mode) {
938
1004
  return [
939
1005
  "Git authentication (Account \u2192 GitHub mode: gh CLI):",
940
1006
  "- This process rewrites `git@github.com:` and `ssh://git@github.com/` to HTTPS.",
941
- "- `gh` supplies credentials (`gh auth git-credential`). Do not switch remotes to SSH.",
1007
+ "- `GH_TOKEN` is injected from `gh auth token` (no macOS Keychain prompts). Do not switch remotes to SSH.",
942
1008
  "- Push with `git push -u origin HEAD`. Create/update PRs with `gh` as below."
943
1009
  ].join("\n");
944
1010
  case "ssh":
945
1011
  return [
946
1012
  "Git authentication (Account \u2192 GitHub mode: SSH):",
947
1013
  "- Keep SSH remotes (`git@github.com:\u2026`). Do not rewrite them to HTTPS.",
948
- "- Use this Mac\u2019s SSH agent / keys. If push fails with `Permission denied (publickey)`, tell the user to start ssh-agent or switch Account \u2192 GitHub to Auto / gh CLI \u2014 do not rewrite remotes yourself.",
1014
+ "- SSH is batch-mode: it will not prompt for a Keychain password. If push fails with `Permission denied (publickey)`, tell the user to unlock ssh-agent or switch Account \u2192 GitHub to Auto / gh CLI \u2014 do not rewrite remotes yourself.",
949
1015
  "- Push with `git push -u origin HEAD`. Create/update PRs with `gh` as below (API still uses `gh`)."
950
1016
  ].join("\n");
951
1017
  case "token":
@@ -959,9 +1025,9 @@ function formatGitAuthModeDirective(mode) {
959
1025
  default:
960
1026
  return [
961
1027
  "Git authentication (Account \u2192 GitHub mode: auto):",
962
- "- Prefer the existing remote URL (SSH or HTTPS). Do not rewrite remotes unless a push/fetch fails.",
963
- '- If `git push` fails with `Permission denied (publickey)`, this shell has no ssh-agent. Retry over HTTPS (do not stop): `git -c url.https://github.com/.insteadOf=git@github.com: -c http.extraHeader="AUTHORIZATION: bearer $(gh auth token)" push -u origin HEAD`.',
964
- "- Then create/update the PR with `gh` as below."
1028
+ "- This process rewrites GitHub SSH remotes to HTTPS and authenticates with `GH_TOKEN` from `gh` so git/ssh never prompt the macOS Keychain (required for Slack / unattended Cursor).",
1029
+ "- Do not switch remotes to SSH. Push with `git push -u origin HEAD`.",
1030
+ "- If HTTPS auth fails, tell the user to run `gh auth login` on this Mac or set Account \u2192 GitHub to a PAT \u2014 do not wait for a Keychain dialog."
965
1031
  ].join("\n");
966
1032
  }
967
1033
  }
@@ -1342,7 +1408,7 @@ async function originGhRepoEnv(cwd, opts) {
1342
1408
  await ensureGhPreferOrigin(cwd);
1343
1409
  const slug = await resolveGithubRepoSlug(cwd);
1344
1410
  const mode = opts?.mode ?? getGithubGitAuthMode();
1345
- const token = mode === "token" ? getGithubPat() : null;
1411
+ const token = mode === "token" ? getGithubPat() : mode === "ssh" ? null : await resolveGhAuthToken(cwd);
1346
1412
  return {
1347
1413
  ...applyGithubGitAuthEnv(opts?.env, { mode, token }),
1348
1414
  ...slug ? { GH_REPO: slug } : {}
@@ -2347,6 +2413,8 @@ export {
2347
2413
  worktreeDisplayLabelForGroup,
2348
2414
  formatGhLandError,
2349
2415
  githubAgentGitEnv,
2416
+ resolveAgentGitAuthEnv,
2417
+ codexUnattendedGitConfigArgs,
2350
2418
  formatGitAuthModeDirective,
2351
2419
  detectGhStack,
2352
2420
  getPrStack,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-M37RITA6.js";
4
4
  import {
5
5
  run
6
- } from "./chunk-D4DPQ552.js";
6
+ } from "./chunk-LGXBYZZA.js";
7
7
 
8
8
  // src/brightsy/connected-teams.ts
9
9
  import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
@@ -36,7 +36,7 @@ function saveBrightsyConfig(cfg) {
36
36
 
37
37
  // src/brightsy/accounts.ts
38
38
  async function loadConnectedTeams() {
39
- const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-ZRS53OAT.js");
39
+ const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-BNBM7OIC.js");
40
40
  return listConnectedBrightsyTeams2();
41
41
  }
42
42
  async function runBrightsyTeamsJson(args) {
@@ -68,7 +68,7 @@ async function getBrightsySession() {
68
68
  const data = await runBrightsyTeamsJson([]);
69
69
  const accounts = Array.isArray(data.teams) ? data.teams : [];
70
70
  const active = data.active ?? accounts.find((a) => a.active) ?? null;
71
- const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-ZRS53OAT.js");
71
+ const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-BNBM7OIC.js");
72
72
  const connectedTeams = ensureCliTeamTracked2(
73
73
  active ? { id: active.id, slug: active.slug, name: active.name } : void 0
74
74
  );
@@ -108,7 +108,7 @@ async function performBrightsyAccountSwitch(accountIdOrSlug) {
108
108
  return { cfg, target: data.active };
109
109
  }
110
110
  async function switchBrightsyAccount(accountIdOrSlug) {
111
- const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-ZRS53OAT.js");
111
+ const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-BNBM7OIC.js");
112
112
  await connectBrightsyTeam2(accountIdOrSlug);
113
113
  return getBrightsySession();
114
114
  }
@@ -2,11 +2,11 @@
2
2
 
3
3
  import {
4
4
  isGlobalRepoPath
5
- } from "./chunk-WJ5TINR6.js";
5
+ } from "./chunk-6GKDYUTJ.js";
6
6
  import {
7
7
  ensureGhPreferOrigin,
8
8
  resolveRepoRoot
9
- } from "./chunk-CKBIQ54F.js";
9
+ } from "./chunk-6WQAYBVE.js";
10
10
  import {
11
11
  appDataDir
12
12
  } from "./chunk-7MV3RXSC.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
- } from "./chunk-JPHG2KCC.js";
3
+ } from "./chunk-SH75CXJR.js";
4
4
  import {
5
5
  allocateTeamName,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-XW47PL6A.js";
8
+ } from "./chunk-KRAUS3RF.js";
9
9
  import {
10
10
  resolveNewThreadOptions,
11
11
  resolveThreadDefaults
@@ -15,7 +15,7 @@ import {
15
15
  gh,
16
16
  git,
17
17
  resolveGhAuthToken
18
- } from "./chunk-D4DPQ552.js";
18
+ } from "./chunk-LGXBYZZA.js";
19
19
 
20
20
  // src/git/worktree.ts
21
21
  import { existsSync, readdirSync } from "fs";
@@ -908,8 +908,20 @@ function formatIpcInvokeError(err) {
908
908
  var HTTPS_REWRITE = [
909
909
  { key: "url.https://github.com/.insteadOf", value: "git@github.com:" },
910
910
  { key: "url.https://github.com/.insteadOf", value: "ssh://git@github.com/" },
911
- { key: "credential.https://github.com.helper", value: "!gh auth git-credential" }
911
+ // Empty helper disables ~/.gitconfig osxkeychain so GUI agents cannot pop
912
+ // "git-credential-osxkeychain wants to use the keychain".
913
+ { key: "credential.helper", value: "" }
912
914
  ];
915
+ function nonInteractiveGitProcessEnv() {
916
+ return {
917
+ GIT_TERMINAL_PROMPT: "0",
918
+ GIT_ASKPASS: process.env.GIT_ASKPASS?.trim() || "echo",
919
+ SSH_ASKPASS: process.env.SSH_ASKPASS?.trim() || "echo",
920
+ GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND?.trim() || "ssh -o BatchMode=yes -o ConnectTimeout=15",
921
+ GCM_INTERACTIVE: "never",
922
+ GH_PROMPT_DISABLED: "1"
923
+ };
924
+ }
913
925
  function appendIndexedGitConfig(existing, entries) {
914
926
  const start = Number.parseInt(String(existing?.GIT_CONFIG_COUNT ?? "0"), 10);
915
927
  const count = Number.isFinite(start) && start > 0 ? start : 0;
@@ -925,18 +937,72 @@ function appendIndexedGitConfig(existing, entries) {
925
937
  function githubAgentGitEnv(existing) {
926
938
  return appendIndexedGitConfig(existing, HTTPS_REWRITE);
927
939
  }
940
+ function githubHttpsBearerEnv(existing, token) {
941
+ const rewrite = githubAgentGitEnv(existing);
942
+ const header = appendIndexedGitConfig(
943
+ { ...existing, ...rewrite },
944
+ [
945
+ {
946
+ key: "http.https://github.com/.extraHeader",
947
+ value: `AUTHORIZATION: bearer ${token}`
948
+ }
949
+ ]
950
+ );
951
+ return { ...rewrite, ...header };
952
+ }
928
953
  function applyGithubGitAuthEnv(existing, opts) {
929
- const out = {};
930
- if (opts.mode === "gh" || opts.mode === "token") {
931
- Object.assign(out, githubAgentGitEnv(existing));
954
+ const out = { ...nonInteractiveGitProcessEnv() };
955
+ if (opts.mode === "ssh") return out;
956
+ const existingToken = existing?.GH_TOKEN?.trim() || "";
957
+ const provided = existingToken ? "" : opts.token?.trim() || "";
958
+ const token = existingToken || provided;
959
+ Object.assign(
960
+ out,
961
+ token ? githubHttpsBearerEnv(existing, token) : githubAgentGitEnv(existing)
962
+ );
963
+ if (provided) out.GH_TOKEN = provided;
964
+ return out;
965
+ }
966
+ async function resolveGithubAgentToken(mode, cwd) {
967
+ if (mode === "ssh") return null;
968
+ if (mode === "token") return getGithubPat();
969
+ try {
970
+ return await resolveGhAuthToken(cwd);
971
+ } catch {
972
+ return null;
932
973
  }
933
- if (opts.mode === "token") {
934
- const token = opts.token?.trim();
935
- if (token && !existing?.GH_TOKEN?.trim()) {
936
- out.GH_TOKEN = token;
974
+ }
975
+ async function resolveAgentGitAuthEnv(existing, opts) {
976
+ let mode = "auto";
977
+ if (opts?.mode) {
978
+ mode = opts.mode;
979
+ } else {
980
+ try {
981
+ mode = getGithubGitAuthMode();
982
+ } catch {
983
+ mode = "auto";
937
984
  }
938
985
  }
939
- return out;
986
+ const cwd = opts?.cwd?.trim() || process.cwd();
987
+ let token = null;
988
+ try {
989
+ token = await resolveGithubAgentToken(mode, cwd);
990
+ } catch {
991
+ token = null;
992
+ }
993
+ return applyGithubGitAuthEnv(existing, { mode, token });
994
+ }
995
+ function codexUnattendedGitConfigArgs(sandbox) {
996
+ const args = [
997
+ "-c",
998
+ 'shell_environment_policy.inherit="all"',
999
+ "-c",
1000
+ "shell_environment_policy.ignore_default_excludes=true"
1001
+ ];
1002
+ if (sandbox === "workspace-write") {
1003
+ args.push("-c", "sandbox_workspace_write.network_access=true");
1004
+ }
1005
+ return args;
940
1006
  }
941
1007
  function formatGitAuthModeDirective(mode) {
942
1008
  switch (mode) {
@@ -944,14 +1010,14 @@ function formatGitAuthModeDirective(mode) {
944
1010
  return [
945
1011
  "Git authentication (Account \u2192 GitHub mode: gh CLI):",
946
1012
  "- This process rewrites `git@github.com:` and `ssh://git@github.com/` to HTTPS.",
947
- "- `gh` supplies credentials (`gh auth git-credential`). Do not switch remotes to SSH.",
1013
+ "- `GH_TOKEN` is injected from `gh auth token` (no macOS Keychain prompts). Do not switch remotes to SSH.",
948
1014
  "- Push with `git push -u origin HEAD`. Create/update PRs with `gh` as below."
949
1015
  ].join("\n");
950
1016
  case "ssh":
951
1017
  return [
952
1018
  "Git authentication (Account \u2192 GitHub mode: SSH):",
953
1019
  "- Keep SSH remotes (`git@github.com:\u2026`). Do not rewrite them to HTTPS.",
954
- "- Use this Mac\u2019s SSH agent / keys. If push fails with `Permission denied (publickey)`, tell the user to start ssh-agent or switch Account \u2192 GitHub to Auto / gh CLI \u2014 do not rewrite remotes yourself.",
1020
+ "- SSH is batch-mode: it will not prompt for a Keychain password. If push fails with `Permission denied (publickey)`, tell the user to unlock ssh-agent or switch Account \u2192 GitHub to Auto / gh CLI \u2014 do not rewrite remotes yourself.",
955
1021
  "- Push with `git push -u origin HEAD`. Create/update PRs with `gh` as below (API still uses `gh`)."
956
1022
  ].join("\n");
957
1023
  case "token":
@@ -965,9 +1031,9 @@ function formatGitAuthModeDirective(mode) {
965
1031
  default:
966
1032
  return [
967
1033
  "Git authentication (Account \u2192 GitHub mode: auto):",
968
- "- Prefer the existing remote URL (SSH or HTTPS). Do not rewrite remotes unless a push/fetch fails.",
969
- '- If `git push` fails with `Permission denied (publickey)`, this shell has no ssh-agent. Retry over HTTPS (do not stop): `git -c url.https://github.com/.insteadOf=git@github.com: -c http.extraHeader="AUTHORIZATION: bearer $(gh auth token)" push -u origin HEAD`.',
970
- "- Then create/update the PR with `gh` as below."
1034
+ "- This process rewrites GitHub SSH remotes to HTTPS and authenticates with `GH_TOKEN` from `gh` so git/ssh never prompt the macOS Keychain (required for Slack / unattended Cursor).",
1035
+ "- Do not switch remotes to SSH. Push with `git push -u origin HEAD`.",
1036
+ "- If HTTPS auth fails, tell the user to run `gh auth login` on this Mac or set Account \u2192 GitHub to a PAT \u2014 do not wait for a Keychain dialog."
971
1037
  ].join("\n");
972
1038
  }
973
1039
  }
@@ -1376,7 +1442,7 @@ async function originGhRepoEnv(cwd, opts) {
1376
1442
  await ensureGhPreferOrigin(cwd);
1377
1443
  const slug = await resolveGithubRepoSlug(cwd);
1378
1444
  const mode = opts?.mode ?? getGithubGitAuthMode();
1379
- const token = mode === "token" ? getGithubPat() : null;
1445
+ const token = mode === "token" ? getGithubPat() : mode === "ssh" ? null : await resolveGhAuthToken(cwd);
1380
1446
  return {
1381
1447
  ...applyGithubGitAuthEnv(opts?.env, { mode, token }),
1382
1448
  ...slug ? { GH_REPO: slug } : {}
@@ -2386,9 +2452,13 @@ export {
2386
2452
  isPrNotMergeableError,
2387
2453
  formatMergePrError,
2388
2454
  formatIpcInvokeError,
2455
+ nonInteractiveGitProcessEnv,
2389
2456
  appendIndexedGitConfig,
2390
2457
  githubAgentGitEnv,
2391
2458
  applyGithubGitAuthEnv,
2459
+ resolveGithubAgentToken,
2460
+ resolveAgentGitAuthEnv,
2461
+ codexUnattendedGitConfigArgs,
2392
2462
  formatGitAuthModeDirective,
2393
2463
  detectGhStack,
2394
2464
  resetGhStackDetectCache,
@@ -139,7 +139,10 @@ async function git(args, cwd, opts) {
139
139
  env: {
140
140
  GIT_TERMINAL_PROMPT: "0",
141
141
  GIT_ASKPASS: process.env.GIT_ASKPASS || "echo",
142
+ SSH_ASKPASS: process.env.SSH_ASKPASS || "echo",
142
143
  GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || "ssh -o BatchMode=yes -o ConnectTimeout=15",
144
+ GCM_INTERACTIVE: "never",
145
+ GH_PROMPT_DISABLED: "1",
143
146
  ...opts?.env
144
147
  }
145
148
  });
@@ -148,11 +151,15 @@ async function gh(args, cwd, opts) {
148
151
  return run("gh", args, {
149
152
  cwd,
150
153
  reject: opts?.reject,
151
- timeoutMs: opts?.timeoutMs
154
+ timeoutMs: opts?.timeoutMs,
155
+ env: {
156
+ GH_PROMPT_DISABLED: "1",
157
+ GIT_TERMINAL_PROMPT: "0"
158
+ }
152
159
  });
153
160
  }
154
161
  async function resolveGhAuthToken(cwd) {
155
- const result = await gh(["auth", "token"], cwd, { reject: false });
162
+ const result = await gh(["auth", "token"], cwd, { reject: false, timeoutMs: 8e3 });
156
163
  if (result.exitCode !== 0) return null;
157
164
  const token = result.stdout.trim();
158
165
  return token || null;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveGithubRepoSlug
3
- } from "./chunk-XW47PL6A.js";
3
+ } from "./chunk-KRAUS3RF.js";
4
4
  import {
5
5
  resolveThreadDefaults
6
6
  } from "./chunk-I3FRXL7J.js";