@sideboard-ai/core 0.1.291 → 0.1.293

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 (33) hide show
  1. package/dist/agents/cursor-runner.cjs +329 -36
  2. package/dist/agents/cursor-runner.js +318 -17
  3. package/dist/{agents-4BBCKITL.js → agents-SITR5V6F.js} +3 -3
  4. package/dist/{agents-XAKSP653.js → agents-WT72O5A3.js} +3 -3
  5. package/dist/{chunk-2IXKTAIT.js → chunk-2VGLZIU6.js} +37 -13
  6. package/dist/{chunk-GBAACE3C.js → chunk-4YXXLWDI.js} +3 -3
  7. package/dist/{chunk-4VXWLY3L.js → chunk-IP5WSADC.js} +9 -9
  8. package/dist/{chunk-QOUTSISS.js → chunk-LSHGJI4S.js} +10 -10
  9. package/dist/{chunk-O4324MXE.js → chunk-PO3PDNMV.js} +1 -1
  10. package/dist/{chunk-LUQ7MIVD.js → chunk-RPCKGO3J.js} +3 -3
  11. package/dist/{chunk-5HPMKLJ7.js → chunk-UO5C2L2G.js} +37 -13
  12. package/dist/{chunk-G74TSBJ3.js → chunk-WRDKJRWF.js} +3 -3
  13. package/dist/{chunk-VNCPRMIK.js → chunk-XZW3BXZW.js} +3 -3
  14. package/dist/{chunk-V3BSO2O6.js → chunk-ZRQWV3MS.js} +1 -1
  15. package/dist/{conductor-UFJXJPTF.js → conductor-MAYZSFL6.js} +3 -3
  16. package/dist/{conductor-5MNGC25D.js → conductor-P7XPGYF4.js} +3 -3
  17. package/dist/{coordinator-prompt-5Q66Y5KW.js → coordinator-prompt-NAM5JHLT.js} +2 -2
  18. package/dist/{coordinator-prompt-BYPEW6DE.js → coordinator-prompt-OZFKNCM3.js} +2 -2
  19. package/dist/{global-workspace-BTH2YGDZ.js → global-workspace-CTFQDG7G.js} +2 -2
  20. package/dist/{global-workspace-YKOYXSB2.js → global-workspace-UGR6FQXI.js} +2 -2
  21. package/dist/index.cjs +166 -89
  22. package/dist/index.d.cts +10 -4
  23. package/dist/index.d.ts +10 -4
  24. package/dist/index.js +135 -82
  25. package/dist/mcp/run-stdio.cjs +37 -13
  26. package/dist/mcp/run-stdio.js +5 -5
  27. package/dist/{orchestrator-EQSK2RMI.js → orchestrator-4QVF6CE2.js} +5 -5
  28. package/dist/{orchestrator-GSOW3RPA.js → orchestrator-BOGVTCWI.js} +5 -5
  29. package/dist/{workspaces-ELO2YVTU.js → workspaces-QNKFBA63.js} +2 -2
  30. package/dist/{workspaces-RFD6I4FM.js → workspaces-YNZXVBSF.js} +2 -2
  31. package/dist/{worktree-ADVQ6X6C.js → worktree-EMCWDPZJ.js} +1 -1
  32. package/dist/{worktree-TN7DZDJZ.js → worktree-ERRH4TAG.js} +1 -1
  33. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -10260,15 +10260,8 @@ async function fetchOriginForWorktree(repoPath, sourceRef, opts) {
10260
10260
  async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10261
10261
  try {
10262
10262
  const branch = opts?.branch?.trim() || await resolveDefaultBranch(repoPath, { network: false });
10263
- const head = await git(["rev-parse", "--abbrev-ref", "HEAD"], repoPath, {
10264
- reject: false
10265
- });
10266
- const current = head.stdout.trim();
10267
- if (head.exitCode !== 0 || !current || current === "HEAD" || current !== branch) {
10268
- return { updated: false, reason: "not-on-default" };
10269
- }
10270
- if (await isDirty(repoPath)) {
10271
- return { updated: false, reason: "dirty" };
10263
+ if (!branch || branch === "HEAD" || branch.includes("..")) {
10264
+ return { updated: false, reason: "ff-failed" };
10272
10265
  }
10273
10266
  const remote = `origin/${branch}`;
10274
10267
  const remoteOk = await git(["rev-parse", "--verify", remote], repoPath, {
@@ -10277,8 +10270,27 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10277
10270
  if (remoteOk.exitCode !== 0) {
10278
10271
  return { updated: false, reason: "no-origin-tip" };
10279
10272
  }
10273
+ const worktrees = await listWorktrees(repoPath);
10274
+ if (worktrees.length === 0) {
10275
+ return { updated: false, reason: "ff-failed" };
10276
+ }
10277
+ const checkout = worktrees.find((entry) => entry.branch === branch) ?? null;
10278
+ const localRef = `refs/heads/${branch}`;
10279
+ const localOk = await git(["rev-parse", "--verify", localRef], repoPath, {
10280
+ reject: false
10281
+ });
10282
+ if (localOk.exitCode !== 0) {
10283
+ if (checkout) return { updated: false, reason: "ff-failed" };
10284
+ const created = await git(["branch", "--track", branch, remote], repoPath, {
10285
+ reject: false
10286
+ });
10287
+ if (created.exitCode !== 0) {
10288
+ return { updated: false, reason: "ff-failed" };
10289
+ }
10290
+ return { updated: true, reason: "updated" };
10291
+ }
10280
10292
  const ancestor = await git(
10281
- ["merge-base", "--is-ancestor", "HEAD", remote],
10293
+ ["merge-base", "--is-ancestor", localRef, remote],
10282
10294
  repoPath,
10283
10295
  { reject: false }
10284
10296
  );
@@ -10286,7 +10298,7 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10286
10298
  return { updated: false, reason: "diverged" };
10287
10299
  }
10288
10300
  const behind = await git(
10289
- ["rev-list", "--count", `HEAD..${remote}`],
10301
+ ["rev-list", "--count", `${localRef}..${remote}`],
10290
10302
  repoPath,
10291
10303
  { reject: false }
10292
10304
  );
@@ -10294,10 +10306,22 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10294
10306
  if (behind.exitCode !== 0 || !Number.isFinite(n) || n <= 0) {
10295
10307
  return { updated: false, reason: "already-current" };
10296
10308
  }
10297
- const ff = await git(["merge", "--ff-only", remote], repoPath, {
10309
+ if (checkout) {
10310
+ if (await isDirty(checkout.path)) {
10311
+ return { updated: false, reason: "dirty" };
10312
+ }
10313
+ const ff = await git(["merge", "--ff-only", remote], checkout.path, {
10314
+ reject: false
10315
+ });
10316
+ if (ff.exitCode !== 0) {
10317
+ return { updated: false, reason: "ff-failed" };
10318
+ }
10319
+ return { updated: true, reason: "updated" };
10320
+ }
10321
+ const moved = await git(["branch", "-f", branch, remote], repoPath, {
10298
10322
  reject: false
10299
10323
  });
10300
- if (ff.exitCode !== 0) {
10324
+ if (moved.exitCode !== 0) {
10301
10325
  return { updated: false, reason: "ff-failed" };
10302
10326
  }
10303
10327
  return { updated: true, reason: "updated" };
@@ -40353,6 +40377,98 @@ function pickArtifactMatch(items, request) {
40353
40377
  return null;
40354
40378
  }
40355
40379
 
40380
+ // src/remote/phone-panes.ts
40381
+ init_orchestrator();
40382
+ var MAX_ROWS = 200;
40383
+ var MAX_QUERY = 200;
40384
+ function parsePhonePane(value, chatId) {
40385
+ const pane = value && typeof value === "object" ? value.pane : void 0;
40386
+ if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
40387
+ const scopeRaw = value.scope;
40388
+ const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
40389
+ const queryRaw = value.query;
40390
+ const query = typeof queryRaw === "string" ? queryRaw.trim().slice(0, MAX_QUERY) : "";
40391
+ return {
40392
+ op: "pane",
40393
+ chatId,
40394
+ pane,
40395
+ ...scope && pane === "changes" ? { scope } : {},
40396
+ ...query && pane === "files" ? { query } : {}
40397
+ };
40398
+ }
40399
+ function filterPhoneFiles(paths, query) {
40400
+ const q = query.trim().toLowerCase();
40401
+ if (!q) return paths;
40402
+ return paths.filter((path2) => path2.toLowerCase().includes(q));
40403
+ }
40404
+ async function readPhonePane(thread, pane, scope, query) {
40405
+ try {
40406
+ if (pane === "files") return await readFiles(thread.id, query);
40407
+ if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
40408
+ return await readChecks(thread.id);
40409
+ } catch (err) {
40410
+ const message = err instanceof Error ? err.message : String(err);
40411
+ return { rows: [], note: message };
40412
+ }
40413
+ }
40414
+ async function readFiles(threadId, query) {
40415
+ const paths = filterPhoneFiles(await getOrchestrator().listFiles(threadId), query ?? "");
40416
+ const shown = paths.slice(0, MAX_ROWS);
40417
+ const extra = paths.length - shown.length;
40418
+ const note = extra > 0 ? query?.trim() ? `${extra} more matching files` : `${extra} more files on the Mac` : void 0;
40419
+ return {
40420
+ rows: shown.map((path2) => ({ label: path2, path: path2 })),
40421
+ ...note ? { note } : {}
40422
+ };
40423
+ }
40424
+ async function readChanges(threadId, scope) {
40425
+ const diff = await getOrchestrator().diff(threadId, { includePatches: false, scope });
40426
+ const shown = diff.files.slice(0, MAX_ROWS);
40427
+ return {
40428
+ rows: shown.map((file) => {
40429
+ const detail = changeDetail(file.additions, file.deletions);
40430
+ return {
40431
+ label: file.path,
40432
+ path: file.path,
40433
+ ...file.status ? { status: file.status } : {},
40434
+ ...detail ? { detail } : {}
40435
+ };
40436
+ }),
40437
+ ...diff.files.length > shown.length ? { note: `${diff.files.length - shown.length} more changed files` } : {}
40438
+ };
40439
+ }
40440
+ function changeDetail(additions, deletions) {
40441
+ const add = additions ?? 0;
40442
+ const del = deletions ?? 0;
40443
+ if (add === 0 && del === 0) return void 0;
40444
+ return `+${add} \u2212${del}`;
40445
+ }
40446
+ async function readPhoneChangePatch(threadId, path2) {
40447
+ const diff = await getOrchestrator().diff(threadId, {
40448
+ path: path2,
40449
+ scope: "commits",
40450
+ includePatches: true,
40451
+ includeMeta: false,
40452
+ includeUntracked: false
40453
+ });
40454
+ const file = diff.files.find((row2) => row2.path === path2) ?? diff.files[0];
40455
+ if (!file) return null;
40456
+ const content = file.patch ?? "";
40457
+ return { content, truncated: content.includes("\u2026 truncated") };
40458
+ }
40459
+ async function readChecks(threadId) {
40460
+ const checks = await getOrchestrator().getPrChecks(threadId);
40461
+ if (!checks) return { rows: [], note: "No pull request on this branch." };
40462
+ const shown = checks.slice(0, MAX_ROWS);
40463
+ return {
40464
+ rows: shown.map((check) => ({
40465
+ label: check.name,
40466
+ detail: check.bucket || check.state,
40467
+ ...check.link ? { href: check.link } : {}
40468
+ }))
40469
+ };
40470
+ }
40471
+
40356
40472
  // src/remote/phone-workspace-ops.ts
40357
40473
  init_orchestrator();
40358
40474
 
@@ -40534,81 +40650,6 @@ function parsePhoneCodeRefs(value) {
40534
40650
  return refs;
40535
40651
  }
40536
40652
 
40537
- // src/remote/phone-panes.ts
40538
- init_orchestrator();
40539
- var MAX_ROWS = 200;
40540
- var MAX_QUERY = 200;
40541
- function parsePhonePane(value, chatId) {
40542
- const pane = value && typeof value === "object" ? value.pane : void 0;
40543
- if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
40544
- const scopeRaw = value.scope;
40545
- const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
40546
- const queryRaw = value.query;
40547
- const query = typeof queryRaw === "string" ? queryRaw.trim().slice(0, MAX_QUERY) : "";
40548
- return {
40549
- op: "pane",
40550
- chatId,
40551
- pane,
40552
- ...scope && pane === "changes" ? { scope } : {},
40553
- ...query && pane === "files" ? { query } : {}
40554
- };
40555
- }
40556
- function filterPhoneFiles(paths, query) {
40557
- const q = query.trim().toLowerCase();
40558
- if (!q) return paths;
40559
- return paths.filter((path2) => path2.toLowerCase().includes(q));
40560
- }
40561
- async function readPhonePane(thread, pane, scope, query) {
40562
- try {
40563
- if (pane === "files") return await readFiles(thread.id, query);
40564
- if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
40565
- return await readChecks(thread.id);
40566
- } catch (err) {
40567
- const message = err instanceof Error ? err.message : String(err);
40568
- return { rows: [], note: message };
40569
- }
40570
- }
40571
- async function readFiles(threadId, query) {
40572
- const paths = filterPhoneFiles(await getOrchestrator().listFiles(threadId), query ?? "");
40573
- const shown = paths.slice(0, MAX_ROWS);
40574
- const extra = paths.length - shown.length;
40575
- const note = extra > 0 ? query?.trim() ? `${extra} more matching files` : `${extra} more files on the Mac` : void 0;
40576
- return {
40577
- rows: shown.map((path2) => ({ label: path2, path: path2 })),
40578
- ...note ? { note } : {}
40579
- };
40580
- }
40581
- async function readChanges(threadId, scope) {
40582
- const diff = await getOrchestrator().diff(threadId, { includePatches: false, scope });
40583
- const shown = diff.files.slice(0, MAX_ROWS);
40584
- return {
40585
- rows: shown.map((file) => ({
40586
- label: file.path,
40587
- path: file.path,
40588
- detail: changeDetail(file.additions, file.deletions)
40589
- })),
40590
- ...diff.files.length > shown.length ? { note: `${diff.files.length - shown.length} more changed files` } : {}
40591
- };
40592
- }
40593
- function changeDetail(additions, deletions) {
40594
- const add = additions ?? 0;
40595
- const del = deletions ?? 0;
40596
- if (add === 0 && del === 0) return void 0;
40597
- return `+${add} \u2212${del}`;
40598
- }
40599
- async function readChecks(threadId) {
40600
- const checks = await getOrchestrator().getPrChecks(threadId);
40601
- if (!checks) return { rows: [], note: "No pull request on this branch." };
40602
- const shown = checks.slice(0, MAX_ROWS);
40603
- return {
40604
- rows: shown.map((check) => ({
40605
- label: check.name,
40606
- detail: check.bucket || check.state,
40607
- ...check.link ? { href: check.link } : {}
40608
- }))
40609
- };
40610
- }
40611
-
40612
40653
  // src/remote/phone-defaults.ts
40613
40654
  init_app_settings();
40614
40655
  function row(resolved) {
@@ -40650,6 +40691,7 @@ function refreshPhoneViewerLogin(force = false) {
40650
40691
  }
40651
40692
 
40652
40693
  // src/remote/phone-transcript.ts
40694
+ init_wait_for_job();
40653
40695
  init_turn_live();
40654
40696
 
40655
40697
  // src/remote/phone-stream.ts
@@ -40674,6 +40716,11 @@ function phoneStreamFlushNow(event) {
40674
40716
  var PHONE_USER_PREFIX = "Phone\n\n";
40675
40717
  var TRANSCRIPT_LIMIT = 40;
40676
40718
  var MESSAGE_LIMIT = 4e3;
40719
+ var CRASH_CONTINUE_PREFIX = "The previous agent process ended before it finished.";
40720
+ function isHostContinuePrompt(text7) {
40721
+ const trimmed = text7.trim();
40722
+ return isJobContinuePrompt(trimmed) || trimmed.startsWith(CRASH_CONTINUE_PREFIX);
40723
+ }
40677
40724
  function phoneVisibleText(role, text7) {
40678
40725
  const trimmed = text7.trim();
40679
40726
  if (role === "user" && trimmed.startsWith(PHONE_USER_PREFIX)) {
@@ -40699,6 +40746,9 @@ function listPhoneMessages(thread) {
40699
40746
  const out = [];
40700
40747
  for (const message of thread.messages) {
40701
40748
  if (message.role !== "user" && message.role !== "agent") continue;
40749
+ if (message.origin === "continue" || message.role === "user" && isHostContinuePrompt(message.text)) {
40750
+ continue;
40751
+ }
40702
40752
  const names = (message.attachments ?? []).map((item) => item.name.trim()).filter(Boolean);
40703
40753
  const visible = [phoneVisibleText(message.role, message.text), names.length ? names.join(", ") : ""].filter(Boolean).join("\n");
40704
40754
  const text7 = message.role === "agent" ? phoneArtifactText(visible, message.parts, MESSAGE_LIMIT) : clip(visible, MESSAGE_LIMIT);
@@ -40707,6 +40757,7 @@ function listPhoneMessages(thread) {
40707
40757
  }
40708
40758
  const live = withLiveTail(thread, out);
40709
40759
  for (const prompt of thread.queue) {
40760
+ if (isHostContinuePrompt(prompt)) continue;
40710
40761
  const text7 = clip(phoneVisibleText("user", prompt), MESSAGE_LIMIT);
40711
40762
  if (text7) live.push({ role: "user", text: text7 });
40712
40763
  }
@@ -40833,12 +40884,14 @@ function parsePhoneControl(value) {
40833
40884
  if (op === "media") return { op, chatId, path: path2 };
40834
40885
  const startLine = lineField(value, "startLine");
40835
40886
  const endLine = lineField(value, "endLine");
40887
+ const view = textField(value, "view") === "diff" ? "diff" : void 0;
40836
40888
  return {
40837
40889
  op,
40838
40890
  chatId,
40839
40891
  path: path2,
40840
40892
  ...startLine != null ? { startLine } : {},
40841
- ...endLine != null ? { endLine } : {}
40893
+ ...endLine != null ? { endLine } : {},
40894
+ ...view ? { view } : {}
40842
40895
  };
40843
40896
  }
40844
40897
  const draft = parsePhoneDraft(value);
@@ -41858,6 +41911,30 @@ function handlePhoneControl(cmd, opts) {
41858
41911
  emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file is not in this worktree." });
41859
41912
  return;
41860
41913
  }
41914
+ if (cmd.view === "diff") {
41915
+ void readPhoneChangePatch(thread.id, relative).then((body) => {
41916
+ if (!body) {
41917
+ emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file has no changes to show." });
41918
+ return;
41919
+ }
41920
+ emitControl(opts, {
41921
+ op: "file",
41922
+ chatId: cmd.chatId,
41923
+ path: relative,
41924
+ content: body.content,
41925
+ encoding: "utf8",
41926
+ view: "diff",
41927
+ ...body.truncated ? { truncated: true } : {}
41928
+ });
41929
+ }).catch(() => {
41930
+ emitControl(opts, {
41931
+ op: "error",
41932
+ chatId: cmd.chatId,
41933
+ message: "That file could not be opened on the phone."
41934
+ });
41935
+ });
41936
+ return;
41937
+ }
41861
41938
  void getOrchestrator().statPath(thread.id, relative).then((kind) => {
41862
41939
  if (kind === "missing") {
41863
41940
  emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file is not in this worktree." });
package/dist/index.d.cts CHANGED
@@ -2396,12 +2396,18 @@ declare function fetchOriginForWorktree(repoPath: string, sourceRef: string, opt
2396
2396
  }): Promise<boolean>;
2397
2397
  type FastForwardMainResult = {
2398
2398
  updated: boolean;
2399
- reason: 'updated' | 'already-current' | 'not-on-default' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2399
+ reason: 'updated' | 'already-current' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2400
2400
  };
2401
2401
  /**
2402
- * Fast-forward the project-folder checkout to `origin/<default>` when that is
2403
- * safe: already on the default branch, clean, and a strict ancestor of the
2404
- * remote tip. Never checkout, reset, or merge if it would not fast-forward.
2402
+ * Fast-forward the local default branch to `origin/<default>` when that is a
2403
+ * strict fast-forward.
2404
+ *
2405
+ * Sidecar worktrees do the work, so the project folder is often on some other
2406
+ * branch and `refs/heads/<default>` would otherwise stay stale after every
2407
+ * fetch. When that branch is not checked out anywhere, move the ref only
2408
+ * (`git branch -f`). When it is checked out and that worktree is clean,
2409
+ * `git merge --ff-only` updates the working tree too. Never checkout, reset,
2410
+ * or move a diverged or dirty branch.
2405
2411
  */
2406
2412
  declare function fastForwardMainCheckoutIfSafe(repoPath: string, opts?: {
2407
2413
  branch?: string;
package/dist/index.d.ts CHANGED
@@ -2396,12 +2396,18 @@ declare function fetchOriginForWorktree(repoPath: string, sourceRef: string, opt
2396
2396
  }): Promise<boolean>;
2397
2397
  type FastForwardMainResult = {
2398
2398
  updated: boolean;
2399
- reason: 'updated' | 'already-current' | 'not-on-default' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2399
+ reason: 'updated' | 'already-current' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2400
2400
  };
2401
2401
  /**
2402
- * Fast-forward the project-folder checkout to `origin/<default>` when that is
2403
- * safe: already on the default branch, clean, and a strict ancestor of the
2404
- * remote tip. Never checkout, reset, or merge if it would not fast-forward.
2402
+ * Fast-forward the local default branch to `origin/<default>` when that is a
2403
+ * strict fast-forward.
2404
+ *
2405
+ * Sidecar worktrees do the work, so the project folder is often on some other
2406
+ * branch and `refs/heads/<default>` would otherwise stay stale after every
2407
+ * fetch. When that branch is not checked out anywhere, move the ref only
2408
+ * (`git branch -f`). When it is checked out and that worktree is clean,
2409
+ * `git merge --ff-only` updates the working tree too. Never checkout, reset,
2410
+ * or move a diverged or dirty branch.
2405
2411
  */
2406
2412
  declare function fastForwardMainCheckoutIfSafe(repoPath: string, opts?: {
2407
2413
  branch?: string;