@sideboard-ai/core 0.1.290 → 0.1.291
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.
- package/dist/index.cjs +61 -10
- package/dist/index.js +61 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -40504,19 +40504,63 @@ function headerAction(pr, diff) {
|
|
|
40504
40504
|
return { id: "merge", label: "Merge" };
|
|
40505
40505
|
}
|
|
40506
40506
|
|
|
40507
|
+
// src/remote/phone-code-refs.ts
|
|
40508
|
+
var MAX_REFS = 8;
|
|
40509
|
+
var MAX_TEXT = 2e4;
|
|
40510
|
+
var MAX_TOTAL = 4e4;
|
|
40511
|
+
function lineNumber(value, key) {
|
|
40512
|
+
const raw = value[key];
|
|
40513
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1 || raw > 1e6) return void 0;
|
|
40514
|
+
return raw;
|
|
40515
|
+
}
|
|
40516
|
+
function parsePhoneCodeRefs(value) {
|
|
40517
|
+
if (value == null) return [];
|
|
40518
|
+
if (!Array.isArray(value) || value.length > MAX_REFS) return "invalid";
|
|
40519
|
+
const refs = [];
|
|
40520
|
+
let total = 0;
|
|
40521
|
+
for (const item of value) {
|
|
40522
|
+
if (!item || typeof item !== "object") return "invalid";
|
|
40523
|
+
const pathRaw = item.path;
|
|
40524
|
+
const path2 = typeof pathRaw === "string" ? pathRaw.trim().replace(/\\/g, "/").slice(0, 500) : "";
|
|
40525
|
+
const startLine = lineNumber(item, "startLine");
|
|
40526
|
+
const endLine = lineNumber(item, "endLine");
|
|
40527
|
+
const textRaw = item.text;
|
|
40528
|
+
const text7 = typeof textRaw === "string" ? textRaw.replace(/\n$/, "").slice(0, MAX_TEXT) : "";
|
|
40529
|
+
if (!path2 || !startLine || !endLine || endLine < startLine || !text7.trim()) return "invalid";
|
|
40530
|
+
total += text7.length;
|
|
40531
|
+
if (total > MAX_TOTAL) return "invalid";
|
|
40532
|
+
refs.push({ path: path2, startLine, endLine, text: text7 });
|
|
40533
|
+
}
|
|
40534
|
+
return refs;
|
|
40535
|
+
}
|
|
40536
|
+
|
|
40507
40537
|
// src/remote/phone-panes.ts
|
|
40508
40538
|
init_orchestrator();
|
|
40509
40539
|
var MAX_ROWS = 200;
|
|
40540
|
+
var MAX_QUERY = 200;
|
|
40510
40541
|
function parsePhonePane(value, chatId) {
|
|
40511
40542
|
const pane = value && typeof value === "object" ? value.pane : void 0;
|
|
40512
40543
|
if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
|
|
40513
40544
|
const scopeRaw = value.scope;
|
|
40514
40545
|
const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
|
|
40515
|
-
|
|
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
|
+
};
|
|
40516
40555
|
}
|
|
40517
|
-
|
|
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) {
|
|
40518
40562
|
try {
|
|
40519
|
-
if (pane === "files") return await readFiles(thread.id);
|
|
40563
|
+
if (pane === "files") return await readFiles(thread.id, query);
|
|
40520
40564
|
if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
|
|
40521
40565
|
return await readChecks(thread.id);
|
|
40522
40566
|
} catch (err) {
|
|
@@ -40524,12 +40568,14 @@ async function readPhonePane(thread, pane, scope) {
|
|
|
40524
40568
|
return { rows: [], note: message };
|
|
40525
40569
|
}
|
|
40526
40570
|
}
|
|
40527
|
-
async function readFiles(threadId) {
|
|
40528
|
-
const paths = await getOrchestrator().listFiles(threadId);
|
|
40571
|
+
async function readFiles(threadId, query) {
|
|
40572
|
+
const paths = filterPhoneFiles(await getOrchestrator().listFiles(threadId), query ?? "");
|
|
40529
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;
|
|
40530
40576
|
return {
|
|
40531
40577
|
rows: shown.map((path2) => ({ label: path2, path: path2 })),
|
|
40532
|
-
...
|
|
40578
|
+
...note ? { note } : {}
|
|
40533
40579
|
};
|
|
40534
40580
|
}
|
|
40535
40581
|
async function readChanges(threadId, scope) {
|
|
@@ -40800,7 +40846,7 @@ function parsePhoneControl(value) {
|
|
|
40800
40846
|
if (op === "options") return { op: "options", chatId, ...draft };
|
|
40801
40847
|
if (op === "prompt") {
|
|
40802
40848
|
const text7 = typeof value.text === "string" ? value.text.trim() : "";
|
|
40803
|
-
const hasPayload = Boolean(text7 || draft.files?.length || draft.links?.length);
|
|
40849
|
+
const hasPayload = Boolean(text7 || draft.files?.length || draft.links?.length || draft.refs?.length);
|
|
40804
40850
|
if (!hasPayload) return "invalid";
|
|
40805
40851
|
return { op: "prompt", chatId, text: text7, ...draft };
|
|
40806
40852
|
}
|
|
@@ -40864,6 +40910,9 @@ function parsePhoneDraft(value) {
|
|
|
40864
40910
|
const links = parsePhoneLinks(value.links);
|
|
40865
40911
|
if (links === "invalid") return "invalid";
|
|
40866
40912
|
if (links.length) draft.links = links;
|
|
40913
|
+
const refs = parsePhoneCodeRefs(value.refs);
|
|
40914
|
+
if (refs === "invalid") return "invalid";
|
|
40915
|
+
if (refs.length) draft.refs = refs;
|
|
40867
40916
|
const prompt = textField(value, "prompt");
|
|
40868
40917
|
if (prompt) draft.prompt = prompt.slice(0, 2e4);
|
|
40869
40918
|
return draft;
|
|
@@ -41195,13 +41244,14 @@ function dispatchPhoneWorkspace(cmd, emit, publishOpened) {
|
|
|
41195
41244
|
emit({ op: "error", chatId: cmd.chatId, message: "That agent is not on this Mac." });
|
|
41196
41245
|
return;
|
|
41197
41246
|
}
|
|
41198
|
-
void readPhonePane(thread, cmd.pane, cmd.scope).then((body) => {
|
|
41247
|
+
void readPhonePane(thread, cmd.pane, cmd.scope, cmd.query).then((body) => {
|
|
41199
41248
|
emit({
|
|
41200
41249
|
op: "pane",
|
|
41201
41250
|
chatId: cmd.chatId,
|
|
41202
41251
|
pane: cmd.pane,
|
|
41203
41252
|
rows: body.rows,
|
|
41204
|
-
...body.note ? { note: body.note } : {}
|
|
41253
|
+
...body.note ? { note: body.note } : {},
|
|
41254
|
+
...cmd.pane === "files" ? { query: cmd.query ?? "" } : {}
|
|
41205
41255
|
});
|
|
41206
41256
|
});
|
|
41207
41257
|
return;
|
|
@@ -41611,7 +41661,8 @@ function stagePhoneTurnFiles(worktreePath, draft) {
|
|
|
41611
41661
|
worktreePath,
|
|
41612
41662
|
(draft.files ?? []).map((file) => ({ name: file.name, dataBase64: file.dataBase64 }))
|
|
41613
41663
|
);
|
|
41614
|
-
|
|
41664
|
+
const refs = (draft.refs ?? []).map((ref) => buildCodeRefAttachment(ref));
|
|
41665
|
+
return [...links, ...files, ...refs];
|
|
41615
41666
|
}
|
|
41616
41667
|
function handlePhoneControl(cmd, opts) {
|
|
41617
41668
|
const log = opts.onLog ?? (() => void 0);
|
package/dist/index.js
CHANGED
|
@@ -9758,18 +9758,62 @@ function headerAction(pr, diff) {
|
|
|
9758
9758
|
return { id: "merge", label: "Merge" };
|
|
9759
9759
|
}
|
|
9760
9760
|
|
|
9761
|
+
// src/remote/phone-code-refs.ts
|
|
9762
|
+
var MAX_REFS = 8;
|
|
9763
|
+
var MAX_TEXT = 2e4;
|
|
9764
|
+
var MAX_TOTAL = 4e4;
|
|
9765
|
+
function lineNumber(value, key) {
|
|
9766
|
+
const raw = value[key];
|
|
9767
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1 || raw > 1e6) return void 0;
|
|
9768
|
+
return raw;
|
|
9769
|
+
}
|
|
9770
|
+
function parsePhoneCodeRefs(value) {
|
|
9771
|
+
if (value == null) return [];
|
|
9772
|
+
if (!Array.isArray(value) || value.length > MAX_REFS) return "invalid";
|
|
9773
|
+
const refs = [];
|
|
9774
|
+
let total = 0;
|
|
9775
|
+
for (const item of value) {
|
|
9776
|
+
if (!item || typeof item !== "object") return "invalid";
|
|
9777
|
+
const pathRaw = item.path;
|
|
9778
|
+
const path2 = typeof pathRaw === "string" ? pathRaw.trim().replace(/\\/g, "/").slice(0, 500) : "";
|
|
9779
|
+
const startLine = lineNumber(item, "startLine");
|
|
9780
|
+
const endLine = lineNumber(item, "endLine");
|
|
9781
|
+
const textRaw = item.text;
|
|
9782
|
+
const text5 = typeof textRaw === "string" ? textRaw.replace(/\n$/, "").slice(0, MAX_TEXT) : "";
|
|
9783
|
+
if (!path2 || !startLine || !endLine || endLine < startLine || !text5.trim()) return "invalid";
|
|
9784
|
+
total += text5.length;
|
|
9785
|
+
if (total > MAX_TOTAL) return "invalid";
|
|
9786
|
+
refs.push({ path: path2, startLine, endLine, text: text5 });
|
|
9787
|
+
}
|
|
9788
|
+
return refs;
|
|
9789
|
+
}
|
|
9790
|
+
|
|
9761
9791
|
// src/remote/phone-panes.ts
|
|
9762
9792
|
var MAX_ROWS = 200;
|
|
9793
|
+
var MAX_QUERY = 200;
|
|
9763
9794
|
function parsePhonePane(value, chatId) {
|
|
9764
9795
|
const pane = value && typeof value === "object" ? value.pane : void 0;
|
|
9765
9796
|
if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
|
|
9766
9797
|
const scopeRaw = value.scope;
|
|
9767
9798
|
const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
|
|
9768
|
-
|
|
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));
|
|
9769
9813
|
}
|
|
9770
|
-
async function readPhonePane(thread, pane, scope) {
|
|
9814
|
+
async function readPhonePane(thread, pane, scope, query) {
|
|
9771
9815
|
try {
|
|
9772
|
-
if (pane === "files") return await readFiles(thread.id);
|
|
9816
|
+
if (pane === "files") return await readFiles(thread.id, query);
|
|
9773
9817
|
if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
|
|
9774
9818
|
return await readChecks(thread.id);
|
|
9775
9819
|
} catch (err) {
|
|
@@ -9777,12 +9821,14 @@ async function readPhonePane(thread, pane, scope) {
|
|
|
9777
9821
|
return { rows: [], note: message };
|
|
9778
9822
|
}
|
|
9779
9823
|
}
|
|
9780
|
-
async function readFiles(threadId) {
|
|
9781
|
-
const paths = await getOrchestrator().listFiles(threadId);
|
|
9824
|
+
async function readFiles(threadId, query) {
|
|
9825
|
+
const paths = filterPhoneFiles(await getOrchestrator().listFiles(threadId), query ?? "");
|
|
9782
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;
|
|
9783
9829
|
return {
|
|
9784
9830
|
rows: shown.map((path2) => ({ label: path2, path: path2 })),
|
|
9785
|
-
...
|
|
9831
|
+
...note ? { note } : {}
|
|
9786
9832
|
};
|
|
9787
9833
|
}
|
|
9788
9834
|
async function readChanges(threadId, scope) {
|
|
@@ -10046,7 +10092,7 @@ function parsePhoneControl(value) {
|
|
|
10046
10092
|
if (op === "options") return { op: "options", chatId, ...draft };
|
|
10047
10093
|
if (op === "prompt") {
|
|
10048
10094
|
const text5 = typeof value.text === "string" ? value.text.trim() : "";
|
|
10049
|
-
const hasPayload = Boolean(text5 || draft.files?.length || draft.links?.length);
|
|
10095
|
+
const hasPayload = Boolean(text5 || draft.files?.length || draft.links?.length || draft.refs?.length);
|
|
10050
10096
|
if (!hasPayload) return "invalid";
|
|
10051
10097
|
return { op: "prompt", chatId, text: text5, ...draft };
|
|
10052
10098
|
}
|
|
@@ -10110,6 +10156,9 @@ function parsePhoneDraft(value) {
|
|
|
10110
10156
|
const links = parsePhoneLinks(value.links);
|
|
10111
10157
|
if (links === "invalid") return "invalid";
|
|
10112
10158
|
if (links.length) draft.links = links;
|
|
10159
|
+
const refs = parsePhoneCodeRefs(value.refs);
|
|
10160
|
+
if (refs === "invalid") return "invalid";
|
|
10161
|
+
if (refs.length) draft.refs = refs;
|
|
10113
10162
|
const prompt = textField(value, "prompt");
|
|
10114
10163
|
if (prompt) draft.prompt = prompt.slice(0, 2e4);
|
|
10115
10164
|
return draft;
|
|
@@ -10441,13 +10490,14 @@ function dispatchPhoneWorkspace(cmd, emit, publishOpened) {
|
|
|
10441
10490
|
emit({ op: "error", chatId: cmd.chatId, message: "That agent is not on this Mac." });
|
|
10442
10491
|
return;
|
|
10443
10492
|
}
|
|
10444
|
-
void readPhonePane(thread, cmd.pane, cmd.scope).then((body) => {
|
|
10493
|
+
void readPhonePane(thread, cmd.pane, cmd.scope, cmd.query).then((body) => {
|
|
10445
10494
|
emit({
|
|
10446
10495
|
op: "pane",
|
|
10447
10496
|
chatId: cmd.chatId,
|
|
10448
10497
|
pane: cmd.pane,
|
|
10449
10498
|
rows: body.rows,
|
|
10450
|
-
...body.note ? { note: body.note } : {}
|
|
10499
|
+
...body.note ? { note: body.note } : {},
|
|
10500
|
+
...cmd.pane === "files" ? { query: cmd.query ?? "" } : {}
|
|
10451
10501
|
});
|
|
10452
10502
|
});
|
|
10453
10503
|
return;
|
|
@@ -10846,7 +10896,8 @@ function stagePhoneTurnFiles(worktreePath, draft) {
|
|
|
10846
10896
|
worktreePath,
|
|
10847
10897
|
(draft.files ?? []).map((file) => ({ name: file.name, dataBase64: file.dataBase64 }))
|
|
10848
10898
|
);
|
|
10849
|
-
|
|
10899
|
+
const refs = (draft.refs ?? []).map((ref) => buildCodeRefAttachment(ref));
|
|
10900
|
+
return [...links, ...files, ...refs];
|
|
10850
10901
|
}
|
|
10851
10902
|
function handlePhoneControl(cmd, opts) {
|
|
10852
10903
|
const log = opts.onLog ?? (() => void 0);
|