@sideboard-ai/core 0.1.291 → 0.1.292

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 (3) hide show
  1. package/dist/index.cjs +119 -76
  2. package/dist/index.js +118 -75
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -40353,6 +40353,98 @@ function pickArtifactMatch(items, request) {
40353
40353
  return null;
40354
40354
  }
40355
40355
 
40356
+ // src/remote/phone-panes.ts
40357
+ init_orchestrator();
40358
+ var MAX_ROWS = 200;
40359
+ var MAX_QUERY = 200;
40360
+ function parsePhonePane(value, chatId) {
40361
+ const pane = value && typeof value === "object" ? value.pane : void 0;
40362
+ if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
40363
+ const scopeRaw = value.scope;
40364
+ const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
40365
+ const queryRaw = value.query;
40366
+ const query = typeof queryRaw === "string" ? queryRaw.trim().slice(0, MAX_QUERY) : "";
40367
+ return {
40368
+ op: "pane",
40369
+ chatId,
40370
+ pane,
40371
+ ...scope && pane === "changes" ? { scope } : {},
40372
+ ...query && pane === "files" ? { query } : {}
40373
+ };
40374
+ }
40375
+ function filterPhoneFiles(paths, query) {
40376
+ const q = query.trim().toLowerCase();
40377
+ if (!q) return paths;
40378
+ return paths.filter((path2) => path2.toLowerCase().includes(q));
40379
+ }
40380
+ async function readPhonePane(thread, pane, scope, query) {
40381
+ try {
40382
+ if (pane === "files") return await readFiles(thread.id, query);
40383
+ if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
40384
+ return await readChecks(thread.id);
40385
+ } catch (err) {
40386
+ const message = err instanceof Error ? err.message : String(err);
40387
+ return { rows: [], note: message };
40388
+ }
40389
+ }
40390
+ async function readFiles(threadId, query) {
40391
+ const paths = filterPhoneFiles(await getOrchestrator().listFiles(threadId), query ?? "");
40392
+ const shown = paths.slice(0, MAX_ROWS);
40393
+ const extra = paths.length - shown.length;
40394
+ const note = extra > 0 ? query?.trim() ? `${extra} more matching files` : `${extra} more files on the Mac` : void 0;
40395
+ return {
40396
+ rows: shown.map((path2) => ({ label: path2, path: path2 })),
40397
+ ...note ? { note } : {}
40398
+ };
40399
+ }
40400
+ async function readChanges(threadId, scope) {
40401
+ const diff = await getOrchestrator().diff(threadId, { includePatches: false, scope });
40402
+ const shown = diff.files.slice(0, MAX_ROWS);
40403
+ return {
40404
+ rows: shown.map((file) => {
40405
+ const detail = changeDetail(file.additions, file.deletions);
40406
+ return {
40407
+ label: file.path,
40408
+ path: file.path,
40409
+ ...file.status ? { status: file.status } : {},
40410
+ ...detail ? { detail } : {}
40411
+ };
40412
+ }),
40413
+ ...diff.files.length > shown.length ? { note: `${diff.files.length - shown.length} more changed files` } : {}
40414
+ };
40415
+ }
40416
+ function changeDetail(additions, deletions) {
40417
+ const add = additions ?? 0;
40418
+ const del = deletions ?? 0;
40419
+ if (add === 0 && del === 0) return void 0;
40420
+ return `+${add} \u2212${del}`;
40421
+ }
40422
+ async function readPhoneChangePatch(threadId, path2) {
40423
+ const diff = await getOrchestrator().diff(threadId, {
40424
+ path: path2,
40425
+ scope: "commits",
40426
+ includePatches: true,
40427
+ includeMeta: false,
40428
+ includeUntracked: false
40429
+ });
40430
+ const file = diff.files.find((row2) => row2.path === path2) ?? diff.files[0];
40431
+ if (!file) return null;
40432
+ const content = file.patch ?? "";
40433
+ return { content, truncated: content.includes("\u2026 truncated") };
40434
+ }
40435
+ async function readChecks(threadId) {
40436
+ const checks = await getOrchestrator().getPrChecks(threadId);
40437
+ if (!checks) return { rows: [], note: "No pull request on this branch." };
40438
+ const shown = checks.slice(0, MAX_ROWS);
40439
+ return {
40440
+ rows: shown.map((check) => ({
40441
+ label: check.name,
40442
+ detail: check.bucket || check.state,
40443
+ ...check.link ? { href: check.link } : {}
40444
+ }))
40445
+ };
40446
+ }
40447
+
40356
40448
  // src/remote/phone-workspace-ops.ts
40357
40449
  init_orchestrator();
40358
40450
 
@@ -40534,81 +40626,6 @@ function parsePhoneCodeRefs(value) {
40534
40626
  return refs;
40535
40627
  }
40536
40628
 
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
40629
  // src/remote/phone-defaults.ts
40613
40630
  init_app_settings();
40614
40631
  function row(resolved) {
@@ -40833,12 +40850,14 @@ function parsePhoneControl(value) {
40833
40850
  if (op === "media") return { op, chatId, path: path2 };
40834
40851
  const startLine = lineField(value, "startLine");
40835
40852
  const endLine = lineField(value, "endLine");
40853
+ const view = textField(value, "view") === "diff" ? "diff" : void 0;
40836
40854
  return {
40837
40855
  op,
40838
40856
  chatId,
40839
40857
  path: path2,
40840
40858
  ...startLine != null ? { startLine } : {},
40841
- ...endLine != null ? { endLine } : {}
40859
+ ...endLine != null ? { endLine } : {},
40860
+ ...view ? { view } : {}
40842
40861
  };
40843
40862
  }
40844
40863
  const draft = parsePhoneDraft(value);
@@ -41858,6 +41877,30 @@ function handlePhoneControl(cmd, opts) {
41858
41877
  emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file is not in this worktree." });
41859
41878
  return;
41860
41879
  }
41880
+ if (cmd.view === "diff") {
41881
+ void readPhoneChangePatch(thread.id, relative).then((body) => {
41882
+ if (!body) {
41883
+ emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file has no changes to show." });
41884
+ return;
41885
+ }
41886
+ emitControl(opts, {
41887
+ op: "file",
41888
+ chatId: cmd.chatId,
41889
+ path: relative,
41890
+ content: body.content,
41891
+ encoding: "utf8",
41892
+ view: "diff",
41893
+ ...body.truncated ? { truncated: true } : {}
41894
+ });
41895
+ }).catch(() => {
41896
+ emitControl(opts, {
41897
+ op: "error",
41898
+ chatId: cmd.chatId,
41899
+ message: "That file could not be opened on the phone."
41900
+ });
41901
+ });
41902
+ return;
41903
+ }
41861
41904
  void getOrchestrator().statPath(thread.id, relative).then((kind) => {
41862
41905
  if (kind === "missing") {
41863
41906
  emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file is not in this worktree." });
package/dist/index.js CHANGED
@@ -9624,6 +9624,97 @@ function pickArtifactMatch(items, request) {
9624
9624
  return null;
9625
9625
  }
9626
9626
 
9627
+ // src/remote/phone-panes.ts
9628
+ var MAX_ROWS = 200;
9629
+ var MAX_QUERY = 200;
9630
+ function parsePhonePane(value, chatId) {
9631
+ const pane = value && typeof value === "object" ? value.pane : void 0;
9632
+ if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
9633
+ const scopeRaw = value.scope;
9634
+ const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
9635
+ const queryRaw = value.query;
9636
+ const query = typeof queryRaw === "string" ? queryRaw.trim().slice(0, MAX_QUERY) : "";
9637
+ return {
9638
+ op: "pane",
9639
+ chatId,
9640
+ pane,
9641
+ ...scope && pane === "changes" ? { scope } : {},
9642
+ ...query && pane === "files" ? { query } : {}
9643
+ };
9644
+ }
9645
+ function filterPhoneFiles(paths, query) {
9646
+ const q = query.trim().toLowerCase();
9647
+ if (!q) return paths;
9648
+ return paths.filter((path2) => path2.toLowerCase().includes(q));
9649
+ }
9650
+ async function readPhonePane(thread, pane, scope, query) {
9651
+ try {
9652
+ if (pane === "files") return await readFiles(thread.id, query);
9653
+ if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
9654
+ return await readChecks(thread.id);
9655
+ } catch (err) {
9656
+ const message = err instanceof Error ? err.message : String(err);
9657
+ return { rows: [], note: message };
9658
+ }
9659
+ }
9660
+ async function readFiles(threadId, query) {
9661
+ const paths = filterPhoneFiles(await getOrchestrator().listFiles(threadId), query ?? "");
9662
+ const shown = paths.slice(0, MAX_ROWS);
9663
+ const extra = paths.length - shown.length;
9664
+ const note = extra > 0 ? query?.trim() ? `${extra} more matching files` : `${extra} more files on the Mac` : void 0;
9665
+ return {
9666
+ rows: shown.map((path2) => ({ label: path2, path: path2 })),
9667
+ ...note ? { note } : {}
9668
+ };
9669
+ }
9670
+ async function readChanges(threadId, scope) {
9671
+ const diff = await getOrchestrator().diff(threadId, { includePatches: false, scope });
9672
+ const shown = diff.files.slice(0, MAX_ROWS);
9673
+ return {
9674
+ rows: shown.map((file) => {
9675
+ const detail = changeDetail(file.additions, file.deletions);
9676
+ return {
9677
+ label: file.path,
9678
+ path: file.path,
9679
+ ...file.status ? { status: file.status } : {},
9680
+ ...detail ? { detail } : {}
9681
+ };
9682
+ }),
9683
+ ...diff.files.length > shown.length ? { note: `${diff.files.length - shown.length} more changed files` } : {}
9684
+ };
9685
+ }
9686
+ function changeDetail(additions, deletions) {
9687
+ const add = additions ?? 0;
9688
+ const del = deletions ?? 0;
9689
+ if (add === 0 && del === 0) return void 0;
9690
+ return `+${add} \u2212${del}`;
9691
+ }
9692
+ async function readPhoneChangePatch(threadId, path2) {
9693
+ const diff = await getOrchestrator().diff(threadId, {
9694
+ path: path2,
9695
+ scope: "commits",
9696
+ includePatches: true,
9697
+ includeMeta: false,
9698
+ includeUntracked: false
9699
+ });
9700
+ const file = diff.files.find((row2) => row2.path === path2) ?? diff.files[0];
9701
+ if (!file) return null;
9702
+ const content = file.patch ?? "";
9703
+ return { content, truncated: content.includes("\u2026 truncated") };
9704
+ }
9705
+ async function readChecks(threadId) {
9706
+ const checks = await getOrchestrator().getPrChecks(threadId);
9707
+ if (!checks) return { rows: [], note: "No pull request on this branch." };
9708
+ const shown = checks.slice(0, MAX_ROWS);
9709
+ return {
9710
+ rows: shown.map((check) => ({
9711
+ label: check.name,
9712
+ detail: check.bucket || check.state,
9713
+ ...check.link ? { href: check.link } : {}
9714
+ }))
9715
+ };
9716
+ }
9717
+
9627
9718
  // src/remote/phone-chats.ts
9628
9719
  import { randomUUID as randomUUID7 } from "crypto";
9629
9720
 
@@ -9788,80 +9879,6 @@ function parsePhoneCodeRefs(value) {
9788
9879
  return refs;
9789
9880
  }
9790
9881
 
9791
- // src/remote/phone-panes.ts
9792
- var MAX_ROWS = 200;
9793
- var MAX_QUERY = 200;
9794
- function parsePhonePane(value, chatId) {
9795
- const pane = value && typeof value === "object" ? value.pane : void 0;
9796
- if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
9797
- const scopeRaw = value.scope;
9798
- const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
9799
- const queryRaw = value.query;
9800
- const query = typeof queryRaw === "string" ? queryRaw.trim().slice(0, MAX_QUERY) : "";
9801
- return {
9802
- op: "pane",
9803
- chatId,
9804
- pane,
9805
- ...scope && pane === "changes" ? { scope } : {},
9806
- ...query && pane === "files" ? { query } : {}
9807
- };
9808
- }
9809
- function filterPhoneFiles(paths, query) {
9810
- const q = query.trim().toLowerCase();
9811
- if (!q) return paths;
9812
- return paths.filter((path2) => path2.toLowerCase().includes(q));
9813
- }
9814
- async function readPhonePane(thread, pane, scope, query) {
9815
- try {
9816
- if (pane === "files") return await readFiles(thread.id, query);
9817
- if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
9818
- return await readChecks(thread.id);
9819
- } catch (err) {
9820
- const message = err instanceof Error ? err.message : String(err);
9821
- return { rows: [], note: message };
9822
- }
9823
- }
9824
- async function readFiles(threadId, query) {
9825
- const paths = filterPhoneFiles(await getOrchestrator().listFiles(threadId), query ?? "");
9826
- const shown = paths.slice(0, MAX_ROWS);
9827
- const extra = paths.length - shown.length;
9828
- const note = extra > 0 ? query?.trim() ? `${extra} more matching files` : `${extra} more files on the Mac` : void 0;
9829
- return {
9830
- rows: shown.map((path2) => ({ label: path2, path: path2 })),
9831
- ...note ? { note } : {}
9832
- };
9833
- }
9834
- async function readChanges(threadId, scope) {
9835
- const diff = await getOrchestrator().diff(threadId, { includePatches: false, scope });
9836
- const shown = diff.files.slice(0, MAX_ROWS);
9837
- return {
9838
- rows: shown.map((file) => ({
9839
- label: file.path,
9840
- path: file.path,
9841
- detail: changeDetail(file.additions, file.deletions)
9842
- })),
9843
- ...diff.files.length > shown.length ? { note: `${diff.files.length - shown.length} more changed files` } : {}
9844
- };
9845
- }
9846
- function changeDetail(additions, deletions) {
9847
- const add = additions ?? 0;
9848
- const del = deletions ?? 0;
9849
- if (add === 0 && del === 0) return void 0;
9850
- return `+${add} \u2212${del}`;
9851
- }
9852
- async function readChecks(threadId) {
9853
- const checks = await getOrchestrator().getPrChecks(threadId);
9854
- if (!checks) return { rows: [], note: "No pull request on this branch." };
9855
- const shown = checks.slice(0, MAX_ROWS);
9856
- return {
9857
- rows: shown.map((check) => ({
9858
- label: check.name,
9859
- detail: check.bucket || check.state,
9860
- ...check.link ? { href: check.link } : {}
9861
- }))
9862
- };
9863
- }
9864
-
9865
9882
  // src/remote/phone-defaults.ts
9866
9883
  function row(resolved) {
9867
9884
  return {
@@ -10079,12 +10096,14 @@ function parsePhoneControl(value) {
10079
10096
  if (op === "media") return { op, chatId, path: path2 };
10080
10097
  const startLine = lineField(value, "startLine");
10081
10098
  const endLine = lineField(value, "endLine");
10099
+ const view = textField(value, "view") === "diff" ? "diff" : void 0;
10082
10100
  return {
10083
10101
  op,
10084
10102
  chatId,
10085
10103
  path: path2,
10086
10104
  ...startLine != null ? { startLine } : {},
10087
- ...endLine != null ? { endLine } : {}
10105
+ ...endLine != null ? { endLine } : {},
10106
+ ...view ? { view } : {}
10088
10107
  };
10089
10108
  }
10090
10109
  const draft = parsePhoneDraft(value);
@@ -11093,6 +11112,30 @@ function handlePhoneControl(cmd, opts) {
11093
11112
  emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file is not in this worktree." });
11094
11113
  return;
11095
11114
  }
11115
+ if (cmd.view === "diff") {
11116
+ void readPhoneChangePatch(thread.id, relative).then((body) => {
11117
+ if (!body) {
11118
+ emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file has no changes to show." });
11119
+ return;
11120
+ }
11121
+ emitControl(opts, {
11122
+ op: "file",
11123
+ chatId: cmd.chatId,
11124
+ path: relative,
11125
+ content: body.content,
11126
+ encoding: "utf8",
11127
+ view: "diff",
11128
+ ...body.truncated ? { truncated: true } : {}
11129
+ });
11130
+ }).catch(() => {
11131
+ emitControl(opts, {
11132
+ op: "error",
11133
+ chatId: cmd.chatId,
11134
+ message: "That file could not be opened on the phone."
11135
+ });
11136
+ });
11137
+ return;
11138
+ }
11096
11139
  void getOrchestrator().statPath(thread.id, relative).then((kind) => {
11097
11140
  if (kind === "missing") {
11098
11141
  emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file is not in this worktree." });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sideboard-ai/core",
3
- "version": "0.1.291",
3
+ "version": "0.1.292",
4
4
  "description": "Sideboard core — orchestration, agents, git worktrees, MCP server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",