@sideboard-ai/core 0.1.289 → 0.1.290
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/{chunk-EBGJXOXT.js → chunk-4VXWLY3L.js} +3 -2
- package/dist/{chunk-C546EOEF.js → chunk-QOUTSISS.js} +3 -2
- package/dist/index.cjs +546 -96
- package/dist/index.js +512 -73
- package/dist/mcp/run-stdio.cjs +2 -1
- package/dist/mcp/run-stdio.js +1 -1
- package/dist/{orchestrator-MKF3YBNK.js → orchestrator-EQSK2RMI.js} +1 -1
- package/dist/{orchestrator-IG4VU7MT.js → orchestrator-GSOW3RPA.js} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
worktreeBoardStatus,
|
|
187
187
|
worktreeCleanupSettings,
|
|
188
188
|
writeWorktreeFile
|
|
189
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-QOUTSISS.js";
|
|
190
190
|
import {
|
|
191
191
|
LEGACY_PLAN_FILE_REL,
|
|
192
192
|
PLAN_FILE_NAME,
|
|
@@ -5126,7 +5126,7 @@ async function handleJobStop(params, _ctx) {
|
|
|
5126
5126
|
return stopDetachedJob(jobCwd(rec), id, reason ? { reason } : void 0);
|
|
5127
5127
|
}
|
|
5128
5128
|
async function defaultTurnWait(ref, timeoutMs) {
|
|
5129
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
5129
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-GSOW3RPA.js");
|
|
5130
5130
|
const orch = getOrchestrator2();
|
|
5131
5131
|
const thread = await orch.waitForTurn(ref, timeoutMs, {
|
|
5132
5132
|
resolveIfStillRunning: true
|
|
@@ -9303,7 +9303,11 @@ var RemoteHub = class {
|
|
|
9303
9303
|
import { WebSocket as WsWebSocket3 } from "ws";
|
|
9304
9304
|
|
|
9305
9305
|
// src/remote/phone-media.ts
|
|
9306
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync5 } from "fs";
|
|
9307
|
+
import { join as join6 } from "path";
|
|
9306
9308
|
var PHONE_IMAGE_MAX_BYTES = 15e5;
|
|
9309
|
+
var PHONE_TEXT_MAX_BYTES = 18e4;
|
|
9310
|
+
var PHONE_DIR_MAX = 200;
|
|
9307
9311
|
var IMAGE_MIME = {
|
|
9308
9312
|
png: "image/png",
|
|
9309
9313
|
jpg: "image/jpeg",
|
|
@@ -9350,9 +9354,74 @@ function phoneImageDataUrl(worktreePath, raw) {
|
|
|
9350
9354
|
return null;
|
|
9351
9355
|
}
|
|
9352
9356
|
}
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9357
|
+
function phoneDirectoryListing(worktreePath, relative) {
|
|
9358
|
+
try {
|
|
9359
|
+
const entries = readdirSync2(join6(worktreePath, relative), { withFileTypes: true });
|
|
9360
|
+
const dirs = new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
|
|
9361
|
+
const names = entries.map((entry) => entry.name).filter((name) => name && !name.includes("/") && !name.includes("\0")).sort((a, b) => a.localeCompare(b));
|
|
9362
|
+
const shown = names.slice(0, PHONE_DIR_MAX);
|
|
9363
|
+
const lines = shown.map((name) => dirs.has(name) ? `${name}/` : name);
|
|
9364
|
+
const truncated = names.length > shown.length;
|
|
9365
|
+
if (truncated) lines.push(`\u2026 ${names.length - shown.length} more`);
|
|
9366
|
+
return { content: lines.join("\n"), truncated };
|
|
9367
|
+
} catch {
|
|
9368
|
+
return null;
|
|
9369
|
+
}
|
|
9370
|
+
}
|
|
9371
|
+
function phoneFilePreview(worktreePath, relative, kind) {
|
|
9372
|
+
if (kind === "dir") {
|
|
9373
|
+
const listing = phoneDirectoryListing(worktreePath, relative);
|
|
9374
|
+
if (!listing) return null;
|
|
9375
|
+
return {
|
|
9376
|
+
content: listing.content,
|
|
9377
|
+
encoding: "utf8",
|
|
9378
|
+
binary: false,
|
|
9379
|
+
directory: true,
|
|
9380
|
+
truncated: listing.truncated
|
|
9381
|
+
};
|
|
9382
|
+
}
|
|
9383
|
+
if (relative.toLowerCase().endsWith(".svg")) {
|
|
9384
|
+
try {
|
|
9385
|
+
const buf = readFileSync5(join6(worktreePath, relative));
|
|
9386
|
+
const truncated = buf.length > PHONE_TEXT_MAX_BYTES;
|
|
9387
|
+
return {
|
|
9388
|
+
content: buf.subarray(0, PHONE_TEXT_MAX_BYTES).toString("utf8"),
|
|
9389
|
+
encoding: "utf8",
|
|
9390
|
+
binary: false,
|
|
9391
|
+
directory: false,
|
|
9392
|
+
truncated,
|
|
9393
|
+
mime: "image/svg+xml"
|
|
9394
|
+
};
|
|
9395
|
+
} catch {
|
|
9396
|
+
return null;
|
|
9397
|
+
}
|
|
9398
|
+
}
|
|
9399
|
+
const mime = phoneImageMime(relative);
|
|
9400
|
+
if (mime) {
|
|
9401
|
+
const dataUrl = phoneImageDataUrl(worktreePath, relative);
|
|
9402
|
+
if (!dataUrl) return null;
|
|
9403
|
+
return {
|
|
9404
|
+
content: dataUrl,
|
|
9405
|
+
encoding: "base64",
|
|
9406
|
+
binary: true,
|
|
9407
|
+
directory: false,
|
|
9408
|
+
truncated: false,
|
|
9409
|
+
mime
|
|
9410
|
+
};
|
|
9411
|
+
}
|
|
9412
|
+
try {
|
|
9413
|
+
const file = readWorktreeFile(worktreePath, relative, { maxBytes: PHONE_TEXT_MAX_BYTES });
|
|
9414
|
+
return {
|
|
9415
|
+
content: file.content,
|
|
9416
|
+
encoding: file.encoding,
|
|
9417
|
+
binary: file.binary,
|
|
9418
|
+
directory: false,
|
|
9419
|
+
truncated: file.truncated
|
|
9420
|
+
};
|
|
9421
|
+
} catch {
|
|
9422
|
+
return null;
|
|
9423
|
+
}
|
|
9424
|
+
}
|
|
9356
9425
|
|
|
9357
9426
|
// src/remote/phone-artifact.ts
|
|
9358
9427
|
var FENCE_RE = /```([a-zA-Z0-9_+-]*)[^\n]*\n([\s\S]*?)(?:```|$)/g;
|
|
@@ -9489,6 +9558,263 @@ function parseOpenArtifact(value, chatId) {
|
|
|
9489
9558
|
const hint = oneLine(str3(record.hint), 200);
|
|
9490
9559
|
return { op: "open-artifact", chatId, title, ...hint ? { hint } : {} };
|
|
9491
9560
|
}
|
|
9561
|
+
var PHONE_ARTIFACT_MAX_CHARS = 18e4;
|
|
9562
|
+
function phoneArtifactDocuments(sources) {
|
|
9563
|
+
const docs = [];
|
|
9564
|
+
for (const source of sources) {
|
|
9565
|
+
const hints = /* @__PURE__ */ new Set();
|
|
9566
|
+
for (const match of source.text.matchAll(new RegExp(FENCE_RE.source, "g"))) {
|
|
9567
|
+
const language = match[1] ?? "";
|
|
9568
|
+
const content = match[2] ?? "";
|
|
9569
|
+
const kind = kindFor(language, content);
|
|
9570
|
+
if (!kind) continue;
|
|
9571
|
+
const hint = artifactHint(content);
|
|
9572
|
+
if (hint) hints.add(hint);
|
|
9573
|
+
docs.push({ title: titleFor(kind, content), content, kind });
|
|
9574
|
+
}
|
|
9575
|
+
for (const part of source.parts ?? []) {
|
|
9576
|
+
if (part.type !== "tool" || part.parentId || !isArtifactTool(part.name)) continue;
|
|
9577
|
+
const input = asRecord2(part.input);
|
|
9578
|
+
const content = toolContent(input);
|
|
9579
|
+
const hint = artifactHint(content);
|
|
9580
|
+
if (hint && hints.has(hint)) continue;
|
|
9581
|
+
const typed = kindFor(str3(input?.type), content) ?? kindFor("", content);
|
|
9582
|
+
const title = oneLine(str3(input?.title), 80) || (typed ? titleFor(typed, content) : "Artifact");
|
|
9583
|
+
if (!str3(input?.title) && content.trim().length < MIN_FENCE_CHARS) continue;
|
|
9584
|
+
if (hint) hints.add(hint);
|
|
9585
|
+
docs.push({ title, content, kind: typed ?? "text" });
|
|
9586
|
+
}
|
|
9587
|
+
}
|
|
9588
|
+
return docs;
|
|
9589
|
+
}
|
|
9590
|
+
function phoneArtifactReply(docs, request) {
|
|
9591
|
+
const match = pickArtifactMatch(docs, request);
|
|
9592
|
+
if (!match) return null;
|
|
9593
|
+
const truncated = match.content.length > PHONE_ARTIFACT_MAX_CHARS;
|
|
9594
|
+
return {
|
|
9595
|
+
title: match.title,
|
|
9596
|
+
kind: match.kind,
|
|
9597
|
+
content: truncated ? match.content.slice(0, PHONE_ARTIFACT_MAX_CHARS) : match.content,
|
|
9598
|
+
truncated
|
|
9599
|
+
};
|
|
9600
|
+
}
|
|
9601
|
+
function newest(items) {
|
|
9602
|
+
return items.length ? items[items.length - 1] ?? null : null;
|
|
9603
|
+
}
|
|
9604
|
+
function pickArtifactMatch(items, request) {
|
|
9605
|
+
const hint = request.hint?.trim();
|
|
9606
|
+
const title = request.title.trim();
|
|
9607
|
+
if (hint) {
|
|
9608
|
+
const exact = items.filter((item) => item.content && artifactHint(item.content) === hint);
|
|
9609
|
+
const exactTitled = title ? exact.filter((item) => item.title === title) : [];
|
|
9610
|
+
const exactMatch = newest(exactTitled.length ? exactTitled : exact);
|
|
9611
|
+
if (exactMatch) return exactMatch;
|
|
9612
|
+
if (title) {
|
|
9613
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
9614
|
+
const item = items[i];
|
|
9615
|
+
if (!item?.content || item.title !== title) continue;
|
|
9616
|
+
if (normalizedBody(item.content).startsWith(hint)) return item;
|
|
9617
|
+
}
|
|
9618
|
+
}
|
|
9619
|
+
}
|
|
9620
|
+
if (!title) return null;
|
|
9621
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
9622
|
+
if (items[i]?.title === title) return items[i] ?? null;
|
|
9623
|
+
}
|
|
9624
|
+
return null;
|
|
9625
|
+
}
|
|
9626
|
+
|
|
9627
|
+
// src/remote/phone-chats.ts
|
|
9628
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
9629
|
+
|
|
9630
|
+
// src/remote/phone-header.ts
|
|
9631
|
+
var PHONE_HEADER_GIT_ACTIONS = [
|
|
9632
|
+
"commit-push",
|
|
9633
|
+
"create-draft",
|
|
9634
|
+
"resolve-conflicts",
|
|
9635
|
+
"ready-for-review",
|
|
9636
|
+
"merge"
|
|
9637
|
+
];
|
|
9638
|
+
var HIDDEN = {
|
|
9639
|
+
visible: false,
|
|
9640
|
+
branch: "",
|
|
9641
|
+
additions: 0,
|
|
9642
|
+
deletions: 0,
|
|
9643
|
+
unpushed: 0,
|
|
9644
|
+
dirty: false,
|
|
9645
|
+
ready: false,
|
|
9646
|
+
title: ""
|
|
9647
|
+
};
|
|
9648
|
+
function phoneHeaderFrom(thread, diff) {
|
|
9649
|
+
if (isGlobalThread(thread)) return HIDDEN;
|
|
9650
|
+
const branch = thread.branchName.trim().replace(/^thread\//, "");
|
|
9651
|
+
if (!branch) return HIDDEN;
|
|
9652
|
+
const ready = diff != null;
|
|
9653
|
+
const uncommitted = diff?.scopeStats?.uncommitted;
|
|
9654
|
+
const additions = ready ? Math.max(0, Math.trunc(uncommitted?.additions ?? 0)) : 0;
|
|
9655
|
+
const deletions = ready ? Math.max(0, Math.trunc(uncommitted?.deletions ?? 0)) : 0;
|
|
9656
|
+
const unpushed = ready ? Math.max(0, Math.trunc(diff?.unpushed ?? 0)) : 0;
|
|
9657
|
+
const dirty = ready && (Boolean(diff?.dirty) || additions > 0 || deletions > 0);
|
|
9658
|
+
const pr = prSnapshot(thread);
|
|
9659
|
+
const action = ready ? headerAction(pr, { dirty: Boolean(diff?.dirty), unpushed }) : null;
|
|
9660
|
+
const lines = [branch];
|
|
9661
|
+
if (!ready) lines.push("Loading git status\u2026");
|
|
9662
|
+
else if (dirty) lines.push(`Uncommitted +${additions} \u2212${deletions}`);
|
|
9663
|
+
else lines.push("Working tree clean");
|
|
9664
|
+
if (unpushed > 0) lines.push(`${unpushed} unpushed commit${unpushed === 1 ? "" : "s"}`);
|
|
9665
|
+
return {
|
|
9666
|
+
visible: true,
|
|
9667
|
+
branch,
|
|
9668
|
+
additions,
|
|
9669
|
+
deletions,
|
|
9670
|
+
unpushed,
|
|
9671
|
+
dirty,
|
|
9672
|
+
ready,
|
|
9673
|
+
title: lines.join("\n"),
|
|
9674
|
+
...pr.url ? { prUrl: pr.url } : {},
|
|
9675
|
+
...pr.number ? { prNumber: pr.number } : {},
|
|
9676
|
+
...pr.status ? { prStatus: pr.status } : {},
|
|
9677
|
+
...action ? { action: action.id, actionLabel: action.label } : {}
|
|
9678
|
+
};
|
|
9679
|
+
}
|
|
9680
|
+
function phonePrPill(thread) {
|
|
9681
|
+
const pr = prSnapshot(thread);
|
|
9682
|
+
if (!pr.url) return null;
|
|
9683
|
+
return { url: pr.url, number: pr.number, status: pr.status };
|
|
9684
|
+
}
|
|
9685
|
+
async function readPhoneHeader(thread) {
|
|
9686
|
+
const pending = phoneHeaderFrom(thread, null);
|
|
9687
|
+
if (!pending.visible) return pending;
|
|
9688
|
+
try {
|
|
9689
|
+
const diff = await getOrchestrator().diff(thread.id, { includePatches: false });
|
|
9690
|
+
return phoneHeaderFrom(thread, diff);
|
|
9691
|
+
} catch {
|
|
9692
|
+
return pending;
|
|
9693
|
+
}
|
|
9694
|
+
}
|
|
9695
|
+
function prSnapshot(thread) {
|
|
9696
|
+
const url = thread.prUrl?.trim() || "";
|
|
9697
|
+
const number = url.match(/\/pull\/(\d+)/)?.[1] ?? "";
|
|
9698
|
+
const state = (thread.prState ?? "").toUpperCase();
|
|
9699
|
+
const merged = state === "MERGED";
|
|
9700
|
+
const closed = state === "CLOSED";
|
|
9701
|
+
const open = Boolean(url) && !merged && !closed;
|
|
9702
|
+
const draft = open && Boolean(thread.prIsDraft);
|
|
9703
|
+
const inMergeQueue = open && Boolean(thread.prIsInMergeQueue);
|
|
9704
|
+
const mergeable = (thread.prMergeable ?? "").toUpperCase();
|
|
9705
|
+
const mergeState = (thread.prMergeStateStatus ?? "").toUpperCase();
|
|
9706
|
+
const mergeConflicts = open && !inMergeQueue && (mergeable === "CONFLICTING" || mergeState === "DIRTY");
|
|
9707
|
+
const branchBehind = open && !inMergeQueue && !mergeConflicts && mergeState === "BEHIND";
|
|
9708
|
+
const checksFailed = Boolean(thread.prChecksFailed);
|
|
9709
|
+
const review = (open && !draft ? thread.prReviewDecision : "") ?? "";
|
|
9710
|
+
return {
|
|
9711
|
+
url,
|
|
9712
|
+
number,
|
|
9713
|
+
status: pillStatus({ url, merged, closed, draft, inMergeQueue, mergeConflicts, branchBehind, checksFailed, review }),
|
|
9714
|
+
merged,
|
|
9715
|
+
closed,
|
|
9716
|
+
open,
|
|
9717
|
+
draft,
|
|
9718
|
+
cowboy: Boolean(thread.cowboy),
|
|
9719
|
+
inMergeQueue,
|
|
9720
|
+
mergeConflicts,
|
|
9721
|
+
branchBehind,
|
|
9722
|
+
checksFailed,
|
|
9723
|
+
review: review.toUpperCase()
|
|
9724
|
+
};
|
|
9725
|
+
}
|
|
9726
|
+
function pillStatus(pr) {
|
|
9727
|
+
if (!pr.url) return "";
|
|
9728
|
+
if (pr.merged) return "Merged";
|
|
9729
|
+
if (pr.closed) return "Closed";
|
|
9730
|
+
if (pr.inMergeQueue) return "Queued";
|
|
9731
|
+
if (pr.mergeConflicts) return "Merge conflicts";
|
|
9732
|
+
if (pr.branchBehind) return "Behind base";
|
|
9733
|
+
if (pr.draft) return "Draft";
|
|
9734
|
+
if (pr.checksFailed) return "Checks failing";
|
|
9735
|
+
if (pr.review === "CHANGES_REQUESTED") return "Changes requested";
|
|
9736
|
+
if (pr.review !== "APPROVED") return "Needs approval";
|
|
9737
|
+
return "Approved";
|
|
9738
|
+
}
|
|
9739
|
+
function headerAction(pr, diff) {
|
|
9740
|
+
const hasLocalChanges = diff.dirty || diff.unpushed > 0;
|
|
9741
|
+
const originInSync = !hasLocalChanges;
|
|
9742
|
+
if (pr.merged) return null;
|
|
9743
|
+
if (pr.closed) return { id: "open-pr", label: "Closed" };
|
|
9744
|
+
if (pr.cowboy) {
|
|
9745
|
+
return hasLocalChanges ? { id: "commit-push", label: "Commit & push" } : { id: "commit-push", label: "Push" };
|
|
9746
|
+
}
|
|
9747
|
+
if (!pr.url) return { id: "create-draft", label: "Create PR" };
|
|
9748
|
+
if (pr.inMergeQueue) return { id: "open-pr", label: "Queued" };
|
|
9749
|
+
if (pr.mergeConflicts) return { id: "resolve-conflicts", label: "Resolve" };
|
|
9750
|
+
if (pr.branchBehind) return { id: "resolve-conflicts", label: "Update" };
|
|
9751
|
+
if (hasLocalChanges) return { id: "commit-push", label: "Commit & push" };
|
|
9752
|
+
if (pr.draft) {
|
|
9753
|
+
return originInSync ? { id: "ready-for-review", label: "Ready for review" } : { id: "commit-push", label: "Commit & push" };
|
|
9754
|
+
}
|
|
9755
|
+
if (pr.checksFailed) return { id: "open-checks", label: "Checks failing" };
|
|
9756
|
+
if (pr.review === "CHANGES_REQUESTED") return { id: "open-pr", label: "Changes requested" };
|
|
9757
|
+
if (pr.review !== "APPROVED") return { id: "open-pr", label: "Needs approval" };
|
|
9758
|
+
return { id: "merge", label: "Merge" };
|
|
9759
|
+
}
|
|
9760
|
+
|
|
9761
|
+
// src/remote/phone-panes.ts
|
|
9762
|
+
var MAX_ROWS = 200;
|
|
9763
|
+
function parsePhonePane(value, chatId) {
|
|
9764
|
+
const pane = value && typeof value === "object" ? value.pane : void 0;
|
|
9765
|
+
if (pane !== "files" && pane !== "changes" && pane !== "checks") return "invalid";
|
|
9766
|
+
const scopeRaw = value.scope;
|
|
9767
|
+
const scope = scopeRaw === "uncommitted" || scopeRaw === "commits" ? scopeRaw : void 0;
|
|
9768
|
+
return { op: "pane", chatId, pane, ...scope && pane === "changes" ? { scope } : {} };
|
|
9769
|
+
}
|
|
9770
|
+
async function readPhonePane(thread, pane, scope) {
|
|
9771
|
+
try {
|
|
9772
|
+
if (pane === "files") return await readFiles(thread.id);
|
|
9773
|
+
if (pane === "changes") return await readChanges(thread.id, scope ?? "commits");
|
|
9774
|
+
return await readChecks(thread.id);
|
|
9775
|
+
} catch (err) {
|
|
9776
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
9777
|
+
return { rows: [], note: message };
|
|
9778
|
+
}
|
|
9779
|
+
}
|
|
9780
|
+
async function readFiles(threadId) {
|
|
9781
|
+
const paths = await getOrchestrator().listFiles(threadId);
|
|
9782
|
+
const shown = paths.slice(0, MAX_ROWS);
|
|
9783
|
+
return {
|
|
9784
|
+
rows: shown.map((path2) => ({ label: path2, path: path2 })),
|
|
9785
|
+
...paths.length > shown.length ? { note: `${paths.length - shown.length} more files on the Mac` } : {}
|
|
9786
|
+
};
|
|
9787
|
+
}
|
|
9788
|
+
async function readChanges(threadId, scope) {
|
|
9789
|
+
const diff = await getOrchestrator().diff(threadId, { includePatches: false, scope });
|
|
9790
|
+
const shown = diff.files.slice(0, MAX_ROWS);
|
|
9791
|
+
return {
|
|
9792
|
+
rows: shown.map((file) => ({
|
|
9793
|
+
label: file.path,
|
|
9794
|
+
path: file.path,
|
|
9795
|
+
detail: changeDetail(file.additions, file.deletions)
|
|
9796
|
+
})),
|
|
9797
|
+
...diff.files.length > shown.length ? { note: `${diff.files.length - shown.length} more changed files` } : {}
|
|
9798
|
+
};
|
|
9799
|
+
}
|
|
9800
|
+
function changeDetail(additions, deletions) {
|
|
9801
|
+
const add = additions ?? 0;
|
|
9802
|
+
const del = deletions ?? 0;
|
|
9803
|
+
if (add === 0 && del === 0) return void 0;
|
|
9804
|
+
return `+${add} \u2212${del}`;
|
|
9805
|
+
}
|
|
9806
|
+
async function readChecks(threadId) {
|
|
9807
|
+
const checks = await getOrchestrator().getPrChecks(threadId);
|
|
9808
|
+
if (!checks) return { rows: [], note: "No pull request on this branch." };
|
|
9809
|
+
const shown = checks.slice(0, MAX_ROWS);
|
|
9810
|
+
return {
|
|
9811
|
+
rows: shown.map((check) => ({
|
|
9812
|
+
label: check.name,
|
|
9813
|
+
detail: check.bucket || check.state,
|
|
9814
|
+
...check.link ? { href: check.link } : {}
|
|
9815
|
+
}))
|
|
9816
|
+
};
|
|
9817
|
+
}
|
|
9492
9818
|
|
|
9493
9819
|
// src/remote/phone-defaults.ts
|
|
9494
9820
|
function row(resolved) {
|
|
@@ -9589,10 +9915,61 @@ function listPhoneMessages(thread) {
|
|
|
9589
9915
|
return live.slice(-TRANSCRIPT_LIMIT);
|
|
9590
9916
|
}
|
|
9591
9917
|
|
|
9592
|
-
// src/remote/phone-
|
|
9593
|
-
var PHONE_CONTROL_PREFIX = "\0sb.phone\n";
|
|
9918
|
+
// src/remote/phone-history.ts
|
|
9594
9919
|
var PREVIEW_LIMIT = 90;
|
|
9595
9920
|
var HISTORY_PAGE_SIZE = 40;
|
|
9921
|
+
function previewOf(thread) {
|
|
9922
|
+
const messages = listPhoneMessages(thread);
|
|
9923
|
+
const last = messages[messages.length - 1];
|
|
9924
|
+
if (!last) return "";
|
|
9925
|
+
return clip(last.text.replace(/\s+/g, " ").trim(), PREVIEW_LIMIT);
|
|
9926
|
+
}
|
|
9927
|
+
function repoName(repoPath) {
|
|
9928
|
+
const parts = repoPath.replace(/\/$/, "").split("/");
|
|
9929
|
+
return parts[parts.length - 1] || repoPath;
|
|
9930
|
+
}
|
|
9931
|
+
function isProjectPath(path2) {
|
|
9932
|
+
if (!path2 || path2 === "/" || path2 === ".") return false;
|
|
9933
|
+
return !isGlobalThread({ repoPath: path2 });
|
|
9934
|
+
}
|
|
9935
|
+
function historyStamp(thread) {
|
|
9936
|
+
return thread.archivedAt || thread.updatedAt;
|
|
9937
|
+
}
|
|
9938
|
+
function historyCursor(chat) {
|
|
9939
|
+
return `${chat.updatedAt} ${chat.id}`;
|
|
9940
|
+
}
|
|
9941
|
+
function listPhoneHistory(opts) {
|
|
9942
|
+
const query = opts?.query?.trim().toLowerCase() ?? "";
|
|
9943
|
+
const after = opts?.after?.trim() ?? "";
|
|
9944
|
+
const all = listThreads({ includeArchived: true }).filter((thread) => thread.status === "archived").filter((thread) => isGlobalThread(thread) || isProjectPath(thread.repoPath)).sort((a, b) => historyStamp(a) < historyStamp(b) ? 1 : historyStamp(a) > historyStamp(b) ? -1 : 0).map((thread) => ({
|
|
9945
|
+
id: thread.id,
|
|
9946
|
+
title: thread.title?.trim() || "Untitled",
|
|
9947
|
+
preview: previewOf(thread),
|
|
9948
|
+
updatedAt: historyStamp(thread),
|
|
9949
|
+
where: isGlobalThread(thread) ? "Orchestration" : repoName(thread.repoPath),
|
|
9950
|
+
agent: thread.agent
|
|
9951
|
+
})).filter((chat) => {
|
|
9952
|
+
if (!query) return true;
|
|
9953
|
+
return `${chat.title} ${chat.where} ${chat.agent} ${chat.preview}`.toLowerCase().includes(query);
|
|
9954
|
+
});
|
|
9955
|
+
let start = 0;
|
|
9956
|
+
if (after) {
|
|
9957
|
+
const index = all.findIndex((chat) => historyCursor(chat) === after);
|
|
9958
|
+
start = index >= 0 ? index + 1 : all.length;
|
|
9959
|
+
}
|
|
9960
|
+
const chats = all.slice(start, start + HISTORY_PAGE_SIZE);
|
|
9961
|
+
const last = chats.at(-1);
|
|
9962
|
+
const more = start + chats.length < all.length;
|
|
9963
|
+
return {
|
|
9964
|
+
chats,
|
|
9965
|
+
total: all.length,
|
|
9966
|
+
...more && last ? { next: historyCursor(last) } : {}
|
|
9967
|
+
};
|
|
9968
|
+
}
|
|
9969
|
+
|
|
9970
|
+
// src/remote/phone-chats.ts
|
|
9971
|
+
var PHONE_CONTROL_PREFIX = "\0sb.phone\n";
|
|
9972
|
+
var PREVIEW_LIMIT2 = 90;
|
|
9596
9973
|
var AGENT_KINDS = /* @__PURE__ */ new Set(["claude", "codex", "opencode", "brightsy", "cursor"]);
|
|
9597
9974
|
var MAX_PHONE_FILES = 8;
|
|
9598
9975
|
var MAX_PHONE_FILE_CHARS = Math.ceil(8 * 1024 * 1024 * 4 / 3);
|
|
@@ -9622,7 +9999,7 @@ function parsePhoneControl(value) {
|
|
|
9622
9999
|
}
|
|
9623
10000
|
if (op === "sources") {
|
|
9624
10001
|
const repoPath = textField(value, "repoPath");
|
|
9625
|
-
if (!repoPath || !
|
|
10002
|
+
if (!repoPath || !isProjectPath2(repoPath)) return "invalid";
|
|
9626
10003
|
const query = textField(value, "query");
|
|
9627
10004
|
return { op: "sources", repoPath, ...query ? { query } : {} };
|
|
9628
10005
|
}
|
|
@@ -9640,7 +10017,15 @@ function parsePhoneControl(value) {
|
|
|
9640
10017
|
if (op === "create") return parsePhoneCreate(value);
|
|
9641
10018
|
const chatId = typeof value.chatId === "string" ? value.chatId.trim() : "";
|
|
9642
10019
|
if (!chatId) return "invalid";
|
|
9643
|
-
if (op === "open" || op === "archive" || op === "restore" || op === "stop"
|
|
10020
|
+
if (op === "open" || op === "archive" || op === "restore" || op === "stop" || op === "review" || op === "header") {
|
|
10021
|
+
return { op, chatId };
|
|
10022
|
+
}
|
|
10023
|
+
if (op === "git") {
|
|
10024
|
+
const action = textField(value, "action");
|
|
10025
|
+
if (!PHONE_HEADER_GIT_ACTIONS.includes(action)) return "invalid";
|
|
10026
|
+
return { op: "git", chatId, action };
|
|
10027
|
+
}
|
|
10028
|
+
if (op === "pane") return parsePhonePane(value, chatId);
|
|
9644
10029
|
if (op === "open-artifact") return parseOpenArtifact(value, chatId);
|
|
9645
10030
|
if (op === "open-file" || op === "media") {
|
|
9646
10031
|
const path2 = textField(value, "path");
|
|
@@ -9780,7 +10165,7 @@ function parsePhoneCreate(value) {
|
|
|
9780
10165
|
}
|
|
9781
10166
|
if (where === "project") {
|
|
9782
10167
|
const repoPath = textField(value, "repoPath");
|
|
9783
|
-
if (!repoPath || !
|
|
10168
|
+
if (!repoPath || !isProjectPath2(repoPath)) return "invalid";
|
|
9784
10169
|
const sourceRaw = textField(value, "sourceType");
|
|
9785
10170
|
let sourceType;
|
|
9786
10171
|
if (sourceRaw === "branch" || sourceRaw === "pr" || sourceRaw === "ticket") sourceType = sourceRaw;
|
|
@@ -9803,26 +10188,30 @@ function parsePhoneCreate(value) {
|
|
|
9803
10188
|
return "invalid";
|
|
9804
10189
|
}
|
|
9805
10190
|
function summarize(thread) {
|
|
10191
|
+
const pr = phonePrPill(thread);
|
|
9806
10192
|
return {
|
|
9807
10193
|
id: thread.id,
|
|
9808
10194
|
title: thread.title?.trim() || "Untitled",
|
|
9809
10195
|
status: thread.status,
|
|
9810
|
-
preview:
|
|
10196
|
+
preview: previewOf2(thread),
|
|
9811
10197
|
updatedAt: thread.updatedAt,
|
|
9812
|
-
agent: thread.agent
|
|
10198
|
+
agent: thread.agent,
|
|
10199
|
+
...pr?.url ? { prUrl: pr.url } : {},
|
|
10200
|
+
...pr?.number ? { prNumber: pr.number } : {},
|
|
10201
|
+
...pr?.status ? { prStatus: pr.status } : {}
|
|
9813
10202
|
};
|
|
9814
10203
|
}
|
|
9815
|
-
function
|
|
10204
|
+
function previewOf2(thread) {
|
|
9816
10205
|
const messages = listPhoneMessages(thread);
|
|
9817
10206
|
const last = messages[messages.length - 1];
|
|
9818
10207
|
if (!last) return "";
|
|
9819
|
-
return clip(last.text.replace(/\s+/g, " ").trim(),
|
|
10208
|
+
return clip(last.text.replace(/\s+/g, " ").trim(), PREVIEW_LIMIT2);
|
|
9820
10209
|
}
|
|
9821
|
-
function
|
|
10210
|
+
function repoName2(repoPath) {
|
|
9822
10211
|
const parts = repoPath.replace(/\/$/, "").split("/");
|
|
9823
10212
|
return parts[parts.length - 1] || repoPath;
|
|
9824
10213
|
}
|
|
9825
|
-
function
|
|
10214
|
+
function isProjectPath2(path2) {
|
|
9826
10215
|
if (!path2 || path2 === "/" || path2 === ".") return false;
|
|
9827
10216
|
return !isGlobalThread({ repoPath: path2 });
|
|
9828
10217
|
}
|
|
@@ -9834,17 +10223,17 @@ function listPhoneSidebar(viewerLogin = phoneViewerLogin()) {
|
|
|
9834
10223
|
const threads = listThreads();
|
|
9835
10224
|
const byRepo = /* @__PURE__ */ new Map();
|
|
9836
10225
|
for (const thread of threads) {
|
|
9837
|
-
if (!
|
|
10226
|
+
if (!isProjectPath2(thread.repoPath) || isRemovedWorkspace(thread.repoPath)) continue;
|
|
9838
10227
|
const list = byRepo.get(thread.repoPath) ?? [];
|
|
9839
10228
|
list.push(thread);
|
|
9840
10229
|
byRepo.set(thread.repoPath, list);
|
|
9841
10230
|
}
|
|
9842
10231
|
for (const workspace of listWorkspaces()) {
|
|
9843
|
-
if (!
|
|
10232
|
+
if (!isProjectPath2(workspace.path) || byRepo.has(workspace.path)) continue;
|
|
9844
10233
|
byRepo.set(workspace.path, []);
|
|
9845
10234
|
}
|
|
9846
|
-
const projects = [...byRepo.entries()].sort(([a], [b]) =>
|
|
9847
|
-
name:
|
|
10235
|
+
const projects = [...byRepo.entries()].sort(([a], [b]) => repoName2(a).localeCompare(repoName2(b))).map(([path2, repoThreads]) => ({
|
|
10236
|
+
name: repoName2(path2),
|
|
9848
10237
|
path: path2,
|
|
9849
10238
|
worktrees: groupHomeBoardWorktrees(repoThreads).map((group) => {
|
|
9850
10239
|
const tags = workspaceTagsFromGroup(group);
|
|
@@ -9863,41 +10252,6 @@ function listPhoneSidebar(viewerLogin = phoneViewerLogin()) {
|
|
|
9863
10252
|
}));
|
|
9864
10253
|
return { orchestration: listPhoneChats(), projects, defaults: phoneAccountDefaults() };
|
|
9865
10254
|
}
|
|
9866
|
-
function historyStamp(thread) {
|
|
9867
|
-
return thread.archivedAt || thread.updatedAt;
|
|
9868
|
-
}
|
|
9869
|
-
function historyCursor(chat) {
|
|
9870
|
-
return `${chat.updatedAt} ${chat.id}`;
|
|
9871
|
-
}
|
|
9872
|
-
function historyQueryMatch(chat, query) {
|
|
9873
|
-
if (!query) return true;
|
|
9874
|
-
return `${chat.title} ${chat.where} ${chat.agent} ${chat.preview}`.toLowerCase().includes(query);
|
|
9875
|
-
}
|
|
9876
|
-
function listPhoneHistory(opts) {
|
|
9877
|
-
const query = opts?.query?.trim().toLowerCase() ?? "";
|
|
9878
|
-
const after = opts?.after?.trim() ?? "";
|
|
9879
|
-
const all = listThreads({ includeArchived: true }).filter((thread) => thread.status === "archived").filter((thread) => isGlobalThread(thread) || isProjectPath(thread.repoPath)).sort((a, b) => historyStamp(a) < historyStamp(b) ? 1 : historyStamp(a) > historyStamp(b) ? -1 : 0).map((thread) => ({
|
|
9880
|
-
id: thread.id,
|
|
9881
|
-
title: thread.title?.trim() || "Untitled",
|
|
9882
|
-
preview: previewOf(thread),
|
|
9883
|
-
updatedAt: historyStamp(thread),
|
|
9884
|
-
where: isGlobalThread(thread) ? "Orchestration" : repoName(thread.repoPath),
|
|
9885
|
-
agent: thread.agent
|
|
9886
|
-
})).filter((chat) => historyQueryMatch(chat, query));
|
|
9887
|
-
let start = 0;
|
|
9888
|
-
if (after) {
|
|
9889
|
-
const index = all.findIndex((chat) => historyCursor(chat) === after);
|
|
9890
|
-
start = index >= 0 ? index + 1 : all.length;
|
|
9891
|
-
}
|
|
9892
|
-
const chats = all.slice(start, start + HISTORY_PAGE_SIZE);
|
|
9893
|
-
const last = chats.at(-1);
|
|
9894
|
-
const more = start + chats.length < all.length;
|
|
9895
|
-
return {
|
|
9896
|
-
chats,
|
|
9897
|
-
total: all.length,
|
|
9898
|
-
...more && last ? { next: historyCursor(last) } : {}
|
|
9899
|
-
};
|
|
9900
|
-
}
|
|
9901
10255
|
function matchPhoneThread(chatId) {
|
|
9902
10256
|
const id = chatId.trim();
|
|
9903
10257
|
if (!id) return null;
|
|
@@ -9910,7 +10264,7 @@ function matchPhoneThread(chatId) {
|
|
|
9910
10264
|
}
|
|
9911
10265
|
function visiblePhoneThread(thread) {
|
|
9912
10266
|
if (isGlobalThread(thread)) return true;
|
|
9913
|
-
return
|
|
10267
|
+
return isProjectPath2(thread.repoPath);
|
|
9914
10268
|
}
|
|
9915
10269
|
function findPhoneChat(chatId) {
|
|
9916
10270
|
const thread = matchPhoneThread(chatId);
|
|
@@ -9976,7 +10330,7 @@ function projectPlace(thread) {
|
|
|
9976
10330
|
}
|
|
9977
10331
|
function assertKnownProject(repoPath) {
|
|
9978
10332
|
const path2 = repoPath.trim();
|
|
9979
|
-
if (!
|
|
10333
|
+
if (!isProjectPath2(path2)) throw new Error("Pick a project on this Mac.");
|
|
9980
10334
|
const known = listWorkspaces().some((workspace) => sameRepoPath(workspace.path, path2)) || listThreads().some(
|
|
9981
10335
|
(thread) => thread.status !== "archived" && sameRepoPath(thread.repoPath, path2)
|
|
9982
10336
|
);
|
|
@@ -10079,6 +10433,55 @@ function archivePhoneChat(chatId) {
|
|
|
10079
10433
|
return true;
|
|
10080
10434
|
}
|
|
10081
10435
|
|
|
10436
|
+
// src/remote/phone-workspace-ops.ts
|
|
10437
|
+
function dispatchPhoneWorkspace(cmd, emit, publishOpened) {
|
|
10438
|
+
if (cmd.op === "pane") {
|
|
10439
|
+
const thread = readPhoneThread(cmd.chatId);
|
|
10440
|
+
if (!thread) {
|
|
10441
|
+
emit({ op: "error", chatId: cmd.chatId, message: "That agent is not on this Mac." });
|
|
10442
|
+
return;
|
|
10443
|
+
}
|
|
10444
|
+
void readPhonePane(thread, cmd.pane, cmd.scope).then((body) => {
|
|
10445
|
+
emit({
|
|
10446
|
+
op: "pane",
|
|
10447
|
+
chatId: cmd.chatId,
|
|
10448
|
+
pane: cmd.pane,
|
|
10449
|
+
rows: body.rows,
|
|
10450
|
+
...body.note ? { note: body.note } : {}
|
|
10451
|
+
});
|
|
10452
|
+
});
|
|
10453
|
+
return;
|
|
10454
|
+
}
|
|
10455
|
+
if (cmd.op === "header") {
|
|
10456
|
+
const thread = readPhoneThread(cmd.chatId);
|
|
10457
|
+
if (!thread) {
|
|
10458
|
+
emit({ op: "error", chatId: cmd.chatId, message: "That agent is not on this Mac." });
|
|
10459
|
+
return;
|
|
10460
|
+
}
|
|
10461
|
+
void readPhoneHeader(thread).then((header) => {
|
|
10462
|
+
emit({ op: "header", chatId: cmd.chatId, ...header });
|
|
10463
|
+
});
|
|
10464
|
+
return;
|
|
10465
|
+
}
|
|
10466
|
+
if (cmd.op === "git") {
|
|
10467
|
+
void getOrchestrator().askGit(cmd.chatId, cmd.action).then((tab) => publishOpened(tab.id)).catch((err) => {
|
|
10468
|
+
emit({
|
|
10469
|
+
op: "error",
|
|
10470
|
+
chatId: cmd.chatId,
|
|
10471
|
+
message: err instanceof Error ? err.message : String(err)
|
|
10472
|
+
});
|
|
10473
|
+
});
|
|
10474
|
+
return;
|
|
10475
|
+
}
|
|
10476
|
+
void getOrchestrator().requestReview(cmd.chatId).then((tab) => publishOpened(tab.id)).catch((err) => {
|
|
10477
|
+
emit({
|
|
10478
|
+
op: "error",
|
|
10479
|
+
chatId: cmd.chatId,
|
|
10480
|
+
message: err instanceof Error ? err.message : String(err)
|
|
10481
|
+
});
|
|
10482
|
+
});
|
|
10483
|
+
}
|
|
10484
|
+
|
|
10082
10485
|
// src/remote/phone-sources.ts
|
|
10083
10486
|
function sourceWarning(label, err) {
|
|
10084
10487
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -10644,10 +11047,25 @@ function handlePhoneControl(cmd, opts) {
|
|
|
10644
11047
|
emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That file is not in this worktree." });
|
|
10645
11048
|
return;
|
|
10646
11049
|
}
|
|
10647
|
-
|
|
10648
|
-
|
|
11050
|
+
const preview = phoneFilePreview(thread.worktreePath, relative, kind === "dir" ? "dir" : "file");
|
|
11051
|
+
if (!preview) {
|
|
11052
|
+
emitControl(opts, {
|
|
11053
|
+
op: "error",
|
|
11054
|
+
chatId: cmd.chatId,
|
|
11055
|
+
message: "That file could not be opened on the phone."
|
|
11056
|
+
});
|
|
11057
|
+
return;
|
|
11058
|
+
}
|
|
11059
|
+
emitControl(opts, {
|
|
11060
|
+
op: "file",
|
|
11061
|
+
chatId: cmd.chatId,
|
|
10649
11062
|
path: relative,
|
|
10650
|
-
|
|
11063
|
+
content: preview.content,
|
|
11064
|
+
encoding: preview.encoding,
|
|
11065
|
+
...preview.binary ? { binary: true } : {},
|
|
11066
|
+
...preview.directory ? { directory: true } : {},
|
|
11067
|
+
...preview.truncated ? { truncated: true } : {},
|
|
11068
|
+
...preview.mime ? { mime: preview.mime } : {},
|
|
10651
11069
|
...cmd.startLine != null ? { startLine: cmd.startLine } : {},
|
|
10652
11070
|
...cmd.endLine != null ? { endLine: cmd.endLine } : {}
|
|
10653
11071
|
});
|
|
@@ -10662,13 +11080,34 @@ function handlePhoneControl(cmd, opts) {
|
|
|
10662
11080
|
emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That agent is not on this Mac." });
|
|
10663
11081
|
return;
|
|
10664
11082
|
}
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
11083
|
+
const liveParts = readTurnLiveParts(thread.id);
|
|
11084
|
+
const docs = phoneArtifactDocuments([
|
|
11085
|
+
...(thread.messages ?? []).filter((message) => message.role === "agent").map((message) => ({ text: message.text.trim(), parts: message.parts })),
|
|
11086
|
+
{ text: visibleAssistantText(void 0, liveParts), parts: liveParts }
|
|
11087
|
+
]);
|
|
11088
|
+
const body = phoneArtifactReply(docs, { title: cmd.title, ...cmd.hint ? { hint: cmd.hint } : {} });
|
|
11089
|
+
if (!body) {
|
|
11090
|
+
emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That artifact is not in this chat." });
|
|
11091
|
+
return;
|
|
11092
|
+
}
|
|
11093
|
+
emitControl(opts, {
|
|
11094
|
+
op: "artifact",
|
|
11095
|
+
chatId: cmd.chatId,
|
|
11096
|
+
title: body.title,
|
|
11097
|
+
kind: body.kind,
|
|
11098
|
+
content: body.content,
|
|
11099
|
+
...body.truncated ? { truncated: true } : {}
|
|
10669
11100
|
});
|
|
10670
11101
|
return;
|
|
10671
11102
|
}
|
|
11103
|
+
if (cmd.op === "pane" || cmd.op === "header" || cmd.op === "git" || cmd.op === "review") {
|
|
11104
|
+
dispatchPhoneWorkspace(
|
|
11105
|
+
cmd,
|
|
11106
|
+
(reply) => emitControl(opts, reply),
|
|
11107
|
+
(chatId2) => publishOpenedChat(opts, chatId2)
|
|
11108
|
+
);
|
|
11109
|
+
return;
|
|
11110
|
+
}
|
|
10672
11111
|
if (cmd.op === "stop") {
|
|
10673
11112
|
if (!readPhoneThread(cmd.chatId)) {
|
|
10674
11113
|
emitControl(opts, { op: "error", chatId: cmd.chatId, message: "That agent is not on this Mac." });
|
|
@@ -11099,14 +11538,14 @@ import { randomBytes as randomBytes7 } from "crypto";
|
|
|
11099
11538
|
|
|
11100
11539
|
// src/relay/accounts.ts
|
|
11101
11540
|
import { createHash as createHash2, randomBytes as randomBytes6, randomUUID as randomUUID8, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
11102
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
11541
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync6, realpathSync } from "fs";
|
|
11103
11542
|
import { createRequire } from "module";
|
|
11104
|
-
import { dirname, join as
|
|
11543
|
+
import { dirname, join as join7 } from "path";
|
|
11105
11544
|
var GITHUB_ACCOUNT_ISSUER = "https://github.com";
|
|
11106
11545
|
var RELAY_DEVICE_CAP = 3;
|
|
11107
11546
|
function thisModuleFile() {
|
|
11108
11547
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
11109
|
-
return cjsFile || process.argv[1] ||
|
|
11548
|
+
return cjsFile || process.argv[1] || join7(process.cwd(), "package.json");
|
|
11110
11549
|
}
|
|
11111
11550
|
function openDatabase(filePath) {
|
|
11112
11551
|
const req = createRequire(thisModuleFile());
|
|
@@ -11144,7 +11583,7 @@ function assertRelayAccountsDurable(filePath) {
|
|
|
11144
11583
|
if (process.env.NODE_ENV !== "production") return;
|
|
11145
11584
|
if (process.platform !== "linux") return;
|
|
11146
11585
|
const dir = realpathSync(dirname(filePath));
|
|
11147
|
-
const mounts =
|
|
11586
|
+
const mounts = readFileSync6("/proc/mounts", "utf8");
|
|
11148
11587
|
const point = longestMountPoint(dir, mounts);
|
|
11149
11588
|
if (point === "/") {
|
|
11150
11589
|
throw new Error(
|
|
@@ -12621,8 +13060,8 @@ async function startRelayServer(opts) {
|
|
|
12621
13060
|
}
|
|
12622
13061
|
|
|
12623
13062
|
// src/slack/outbound-watch.ts
|
|
12624
|
-
import { existsSync as existsSync5, readFileSync as
|
|
12625
|
-
import { join as
|
|
13063
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
|
|
13064
|
+
import { join as join8 } from "path";
|
|
12626
13065
|
var MAX_WATCHES = 40;
|
|
12627
13066
|
var MAX_REPLIES_PER_WATCH = 30;
|
|
12628
13067
|
var WATCH_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -12630,7 +13069,7 @@ var POLL_INTERVAL_MS = 12e3;
|
|
|
12630
13069
|
var lastPollMs = 0;
|
|
12631
13070
|
var nameCache = /* @__PURE__ */ new Map();
|
|
12632
13071
|
function storePath3() {
|
|
12633
|
-
return
|
|
13072
|
+
return join8(appDataDir(), "slack-outbound-watch.json");
|
|
12634
13073
|
}
|
|
12635
13074
|
function watchId(teamId, channelId, ts) {
|
|
12636
13075
|
return `${teamId}:${channelId}:${ts}`;
|
|
@@ -12645,7 +13084,7 @@ function readStore3() {
|
|
|
12645
13084
|
const path2 = storePath3();
|
|
12646
13085
|
if (!existsSync5(path2)) return [];
|
|
12647
13086
|
try {
|
|
12648
|
-
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse(
|
|
13087
|
+
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse(readFileSync7(path2, "utf8"));
|
|
12649
13088
|
return Array.isArray(parsed?.watches) ? parsed.watches : [];
|
|
12650
13089
|
} catch {
|
|
12651
13090
|
return [];
|
|
@@ -12697,7 +13136,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
12697
13136
|
await continueOnReply(threadId, prompt);
|
|
12698
13137
|
return;
|
|
12699
13138
|
}
|
|
12700
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
13139
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-GSOW3RPA.js");
|
|
12701
13140
|
await getOrchestrator2().send(threadId, prompt);
|
|
12702
13141
|
} catch {
|
|
12703
13142
|
}
|