@sideboard-ai/core 0.1.15 → 0.1.22

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.
@@ -3,7 +3,7 @@ import {
3
3
  ensureWorkspace,
4
4
  removeWorkspace,
5
5
  syncWorkspacesFromThreads
6
- } from "./chunk-MGSJQMJA.js";
6
+ } from "./chunk-PER4N6LS.js";
7
7
  import {
8
8
  GLOBAL_WORKSPACE_ID,
9
9
  createGlobalChat,
@@ -13,19 +13,19 @@ import {
13
13
  isGlobalThread,
14
14
  isOrchestratorThread,
15
15
  orchestratorSessionPoisonedByBuiltins
16
- } from "./chunk-3OJG4LP4.js";
16
+ } from "./chunk-Y2EWQ4TL.js";
17
17
  import {
18
18
  coordinatorSystemPrompt,
19
19
  coordinatorTurnReminder,
20
20
  enrichWorkspacesWithGithub,
21
21
  ensureGlobalCoordinatorCwd
22
- } from "./chunk-TNIAXABV.js";
22
+ } from "./chunk-BMB7WCGF.js";
23
23
  import {
24
24
  PLAN_MODE_INSTRUCTION,
25
25
  allAdapters,
26
26
  getAdapter,
27
27
  parseBrightsyCliLine
28
- } from "./chunk-MEI4AXV4.js";
28
+ } from "./chunk-V54GKKCI.js";
29
29
  import {
30
30
  childEnvWithAppSettings,
31
31
  getLinearApiKey,
@@ -53,6 +53,7 @@ import {
53
53
  listWorktrees,
54
54
  mergePr,
55
55
  normalizeWorktreePath,
56
+ originGhRepoEnv,
56
57
  pushBranch,
57
58
  removeWorktree,
58
59
  resolveDefaultBranch,
@@ -63,7 +64,7 @@ import {
63
64
  takenSlugsFromThread,
64
65
  threadDisplayLabel,
65
66
  worktreeNameFromPath
66
- } from "./chunk-L44AX7IG.js";
67
+ } from "./chunk-UFWEANLU.js";
67
68
  import {
68
69
  appendMessage,
69
70
  createEmptyThread,
@@ -431,9 +432,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
431
432
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
432
433
  );
433
434
  }
434
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-H642B5OI.js");
435
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-LM4AA4RO.js");
435
436
  if (isGlobalThread2(thread)) {
436
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-G6T7ORT3.js");
437
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-QH35ES7Y.js");
437
438
  ensureGlobalCoordinatorCwd2();
438
439
  }
439
440
  const adapter = getAdapter(thread.agent);
@@ -443,9 +444,14 @@ async function spawnAgentTurn(thread, input, onEvent) {
443
444
  `Agent cwd must be the thread worktree (got ${cmd.cwd}, expected ${thread.worktreePath})`
444
445
  );
445
446
  }
447
+ const env = childEnvWithAppSettings(cmd.env);
448
+ if (!isOrchestratorThread(thread)) {
449
+ const originEnv = await originGhRepoEnv(thread.worktreePath).catch(() => ({}));
450
+ Object.assign(env, originEnv);
451
+ }
446
452
  const child = execa(cmd.file, cmd.args, {
447
453
  cwd: cmd.cwd,
448
- env: childEnvWithAppSettings(cmd.env),
454
+ env,
449
455
  reject: false,
450
456
  stdout: "pipe",
451
457
  stderr: "pipe",
@@ -548,7 +554,7 @@ function formatRenameBranchDirective(thread, opts) {
548
554
  }
549
555
  return lines.join("\n");
550
556
  }
551
- function formatWorktreeDirective(thread) {
557
+ function formatWorktreeDirective(thread, opts) {
552
558
  const worktree = normPath(thread.worktreePath);
553
559
  const repo = normPath(thread.repoPath);
554
560
  const dir = worktreeNameFromPath(thread.worktreePath);
@@ -569,7 +575,13 @@ function formatWorktreeDirective(thread) {
569
575
  );
570
576
  }
571
577
  lines.push("");
572
- lines.push("Pull requests (when the work is ready to share):");
578
+ lines.push("Git remotes + pull requests (when the work is ready to share):");
579
+ lines.push(
580
+ "- Always use this worktree's `origin` remote (`git remote get-url origin` from this cwd). Never push to or open PRs against `upstream` (template remotes)."
581
+ );
582
+ lines.push(
583
+ "- Push with `git push -u origin HEAD` (or the current branch name). Do not `git push upstream`."
584
+ );
573
585
  lines.push(
574
586
  "- Derive the PR title and body from what the changes actually do and why \u2014 inspect the diff/commits and the user request. Do not use the soccer-team worktree nickname or placeholder branch as the PR title."
575
587
  );
@@ -583,9 +595,13 @@ function formatWorktreeDirective(thread) {
583
595
  lines.push(
584
596
  `- A PR already exists (${thread.prUrl}). Update it (push + edit title/body if the purpose drifted) instead of opening a duplicate.`
585
597
  );
598
+ } else if (opts?.githubSlug) {
599
+ lines.push(
600
+ `- Prefer a draft PR first: \`gh pr create --draft -R ${opts.githubSlug}\` (or update via \`gh pr edit -R ${opts.githubSlug}\`) once the change set is coherent. Always pass \`-R ${opts.githubSlug}\` (this worktree's origin). Bare \`gh pr create\` may target upstream instead of origin on dual-remote checkouts. Mark ready for review only when asked. Title/body must reflect the change purpose, not the worktree name.`
601
+ );
586
602
  } else {
587
603
  lines.push(
588
- "- Prefer a draft PR first: `gh pr create --draft` (or update via `gh pr edit`) once the change set is coherent. Mark ready for review only when asked. Title/body must reflect the change purpose, not the worktree name."
604
+ "- Prefer a draft PR first: `gh pr create --draft -R <origin-owner/name>` (or update via `gh pr edit -R \u2026`) once the change set is coherent. Resolve `<origin-owner/name>` with `git remote get-url origin` in this worktree \u2014 never from `upstream`. Mark ready for review only when asked. Title/body must reflect the change purpose, not the worktree name."
589
605
  );
590
606
  }
591
607
  return lines.join("\n");
@@ -2257,7 +2273,7 @@ async function createThread(input, onSetupLine) {
2257
2273
  return readThread(thread.id) ?? thread;
2258
2274
  }
2259
2275
  async function listLinearIssues(agent, repoPath) {
2260
- const { getAdapter: getAdapter2 } = await import("./agents-RO3AJ76Q.js");
2276
+ const { getAdapter: getAdapter2 } = await import("./agents-RYOW25YJ.js");
2261
2277
  await requireAgent(agent, { requireLinear: true });
2262
2278
  const adapter = getAdapter2(agent);
2263
2279
  if (!adapter.listLinearIssues) {
@@ -2473,7 +2489,7 @@ async function adoptThread(input) {
2473
2489
  messages: input.messages ?? []
2474
2490
  });
2475
2491
  writeThread(thread);
2476
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-4EREGLB7.js");
2492
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-23GHLR7I.js");
2477
2493
  await ensureWorkspace2(repoPath);
2478
2494
  return thread;
2479
2495
  }
@@ -3195,7 +3211,11 @@ var Orchestrator = class {
3195
3211
  }
3196
3212
  const isBrightsy = fresh.agent === "brightsy";
3197
3213
  const isOrchestration = isOrchestratorThread(fresh);
3198
- const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh);
3214
+ const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
3215
+ githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
3216
+ () => null
3217
+ )
3218
+ });
3199
3219
  const settings = loadWorkspaceSettings(fresh.worktreePath, fresh.repoPath);
3200
3220
  const { autoRenameBranchEnabled } = await import("./app-settings-BDMLWCWI.js");
3201
3221
  const renameBranchDirective = !isBrightsy && !isOrchestration && autoRenameBranchEnabled() ? formatRenameBranchDirective(fresh, {
@@ -3839,7 +3859,7 @@ var Orchestrator = class {
3839
3859
  return setStatus(thread.id, "idle");
3840
3860
  }
3841
3861
  if (!existsSync10(thread.worktreePath)) {
3842
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-ZDHZMLSJ.js");
3862
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-RYTBDHHP.js");
3843
3863
  const { execa: execa6 } = await import("execa");
3844
3864
  const slug = thread.worktreePath.split("/").pop();
3845
3865
  const dest = thread.worktreePath;
@@ -3916,7 +3936,7 @@ async function startOrchestration(opts) {
3916
3936
  sourceRef: "default",
3917
3937
  ...createOpts
3918
3938
  }).catch(async () => {
3919
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-ZDHZMLSJ.js");
3939
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-RYTBDHHP.js");
3920
3940
  const repo = await resolveRepoRoot2(repoPath);
3921
3941
  const def = await resolveDefaultBranch2(repo);
3922
3942
  return createThread({
@@ -4359,45 +4379,6 @@ async function startMcpServer() {
4359
4379
  };
4360
4380
  }
4361
4381
  );
4362
- server.tool(
4363
- "preview_land",
4364
- "Preview push+PR land (does NOT push). Use before create_draft_pr.",
4365
- { ref: z.string() },
4366
- async ({ ref }) => {
4367
- const preview = await orch.previewLand(ref);
4368
- return { content: [{ type: "text", text: JSON.stringify(preview, null, 2) }] };
4369
- }
4370
- );
4371
- server.tool(
4372
- "create_draft_pr",
4373
- "Commit dirty changes if needed, push the thread branch, and create/update a DRAFT GitHub PR. Ready-for-review / non-draft land stays human-only (CLI/app confirm_land). Prefer this when the orchestrator should open a PR itself; alternatively send_to_thread asking the worktree agent to run `gh pr create --draft`.",
4374
- { ref: z.string() },
4375
- async ({ ref }) => {
4376
- try {
4377
- const result = await orch.confirmLand(ref, { draft: true });
4378
- return {
4379
- content: [
4380
- {
4381
- type: "text",
4382
- text: JSON.stringify(
4383
- {
4384
- prUrl: result.prUrl,
4385
- pushed: result.pushed,
4386
- committed: result.committed,
4387
- draft: true
4388
- },
4389
- null,
4390
- 2
4391
- )
4392
- }
4393
- ]
4394
- };
4395
- } catch (err) {
4396
- const message = err instanceof Error ? err.message : String(err);
4397
- return { content: [{ type: "text", text: message }], isError: true };
4398
- }
4399
- }
4400
- );
4401
4382
  server.tool(
4402
4383
  "list_branches",
4403
4384
  "List git branches in a registered workspace. Pass repoPath from list_workspaces (unmerged into the default branch by default \u2014 for create_thread sourceType=branch).",
@@ -607,7 +607,21 @@ function permissionMode(thread) {
607
607
  }
608
608
 
609
609
  // src/agents/claude.ts
610
- var BASE_ALLOWED_TOOLS = ["Edit", "Write", "Bash", "Read", "Glob", "Grep"];
610
+ var BASE_ALLOWED_TOOLS = [
611
+ "Edit",
612
+ "Write",
613
+ "Bash",
614
+ "Read",
615
+ "Glob",
616
+ "Grep",
617
+ "WebFetch",
618
+ "WebSearch"
619
+ ];
620
+ var CLAUDE_CHROME_ALLOWED_TOOLS = [
621
+ "mcp__claude-in-chrome",
622
+ "mcp__claude-in-chrome__*",
623
+ "Skill(claude-in-chrome)"
624
+ ];
611
625
  var CLAUDE_PROMPT_ARG_MAX = 2e5;
612
626
  async function loadMcpServers() {
613
627
  const claude = resolveClaudeExecutable();
@@ -719,13 +733,14 @@ var claudeAdapter = {
719
733
  );
720
734
  }
721
735
  const mode = permissionMode(thread);
722
- const { isOrchestratorThread } = await import("./global-workspace-H642B5OI.js");
736
+ const { isOrchestratorThread } = await import("./global-workspace-LM4AA4RO.js");
723
737
  const isOrchestrator = isOrchestratorThread(thread);
724
738
  const injectedServers = await buildInjectedMcpServers({
725
739
  includeSideboard: isOrchestrator,
726
740
  includeBrightsy: isBrightsyConnected()
727
741
  });
728
742
  const injectedBrightsyNames = injectedServers.filter((s) => s.name === "brightsy" || s.name.startsWith("brightsy_")).map((s) => s.name);
743
+ const chromeOn = claudeChromeEnabled();
729
744
  let allowedTools;
730
745
  if (isOrchestrator) {
731
746
  allowedTools = [
@@ -741,6 +756,9 @@ var claudeAdapter = {
741
756
  ...brightsyMcpAllowedTools(injectedBrightsyNames)
742
757
  ];
743
758
  }
759
+ if (chromeOn) {
760
+ allowedTools = [...allowedTools, ...CLAUDE_CHROME_ALLOWED_TOOLS];
761
+ }
744
762
  const args = [
745
763
  "-p",
746
764
  ...useStdin ? [] : [promptText],
@@ -755,7 +773,7 @@ var claudeAdapter = {
755
773
  if (mcpConfigPath) {
756
774
  args.push("--mcp-config", mcpConfigPath);
757
775
  }
758
- if (claudeChromeEnabled()) {
776
+ if (chromeOn) {
759
777
  args.push("--chrome");
760
778
  }
761
779
  if (useStdin) {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
- } from "./chunk-TNIAXABV.js";
3
+ } from "./chunk-BMB7WCGF.js";
4
4
  import {
5
5
  allocateTeamName,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-L44AX7IG.js";
8
+ } from "./chunk-UFWEANLU.js";
9
9
  import {
10
10
  createEmptyThread,
11
11
  listThreads,
@@ -6,8 +6,8 @@ import {
6
6
  enrichWorkspacesWithGithub,
7
7
  ensureGlobalCoordinatorCwd,
8
8
  formatWorkspaceInventory
9
- } from "./chunk-TNIAXABV.js";
10
- import "./chunk-L44AX7IG.js";
9
+ } from "./chunk-BMB7WCGF.js";
10
+ import "./chunk-UFWEANLU.js";
11
11
  import "./chunk-HYRHI3QU.js";
12
12
  import "./chunk-M37RITA6.js";
13
13
  import "./chunk-AJ6ROGD7.js";
@@ -11,9 +11,9 @@ import {
11
11
  orchestrationTitleNeedsSoccerNickname,
12
12
  orchestratorSessionPoisonedByBuiltins,
13
13
  takenTeamSlugsForOrchestration
14
- } from "./chunk-3OJG4LP4.js";
15
- import "./chunk-TNIAXABV.js";
16
- import "./chunk-L44AX7IG.js";
14
+ } from "./chunk-Y2EWQ4TL.js";
15
+ import "./chunk-BMB7WCGF.js";
16
+ import "./chunk-UFWEANLU.js";
17
17
  import "./chunk-HYRHI3QU.js";
18
18
  import {
19
19
  globalAgentCwd