@sideboard-ai/core 0.1.344 → 0.1.346

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 (36) hide show
  1. package/dist/{abletime-ZIYFR4SI.js → abletime-X2TJ6PPK.js} +4 -4
  2. package/dist/{abletime-oauth-IQZ3LOB2.js → abletime-oauth-DEIENLHC.js} +3 -3
  3. package/dist/{abletime-rest-7YAO5B74.js → abletime-rest-HWBUPI4R.js} +3 -3
  4. package/dist/{agents-FI62PUSY.js → agents-AQM7NLXD.js} +7 -7
  5. package/dist/{app-settings-FS7TM55D.js → app-settings-A6JUT2SF.js} +1 -1
  6. package/dist/{chunk-TKEYXNXY.js → chunk-4PHOJMZI.js} +15 -0
  7. package/dist/{chunk-A4ZI7SA3.js → chunk-4SNEW63T.js} +3 -3
  8. package/dist/{chunk-HRHF6N6S.js → chunk-4YGVJRXY.js} +3 -3
  9. package/dist/{chunk-O2IRQAFB.js → chunk-AG2RM3DF.js} +3 -3
  10. package/dist/{chunk-SLLTEMIL.js → chunk-FNAP6CCS.js} +2 -2
  11. package/dist/{chunk-6RO2AOE5.js → chunk-GHKJBZW5.js} +2 -2
  12. package/dist/{chunk-YNKVGJE5.js → chunk-IYX53WZY.js} +5 -5
  13. package/dist/{chunk-AX7SUDTC.js → chunk-JZKNRDKF.js} +23 -23
  14. package/dist/{chunk-4TTTEKNV.js → chunk-MB3GOWB3.js} +2 -2
  15. package/dist/{chunk-6N4W2MJ2.js → chunk-MHRU743Z.js} +7 -7
  16. package/dist/{chunk-GUIJMZQG.js → chunk-NQHEEGTH.js} +1 -1
  17. package/dist/{chunk-D7US5R4H.js → chunk-O5WRVQFT.js} +1 -1
  18. package/dist/{chunk-JX3OWNOT.js → chunk-QTDCPMOW.js} +1 -1
  19. package/dist/{chunk-4HELMBYR.js → chunk-TD76ORBJ.js} +2 -2
  20. package/dist/{chunk-WO7VF4FG.js → chunk-YFPSTG52.js} +5 -5
  21. package/dist/{chunk-G3UV3GXJ.js → chunk-Z54FI4VL.js} +2 -2
  22. package/dist/{conductor-H56XPSX4.js → conductor-DUHRZUQY.js} +5 -5
  23. package/dist/{coordinator-prompt-2YQGOA6Y.js → coordinator-prompt-OX6A4MDA.js} +4 -4
  24. package/dist/{global-workspace-YRPM6JLZ.js → global-workspace-6GGS3DWU.js} +4 -4
  25. package/dist/index.cjs +228 -0
  26. package/dist/index.d.cts +35 -2
  27. package/dist/index.d.ts +35 -2
  28. package/dist/index.js +230 -21
  29. package/dist/{linear-UXMDJAD4.js → linear-WYI64BMX.js} +2 -2
  30. package/dist/{linear-list-KDLU7QWX.js → linear-list-CGUCPWTV.js} +1 -1
  31. package/dist/{optional-cli-RUUCLNSM.js → optional-cli-YHLVTVRK.js} +4 -4
  32. package/dist/{orchestrator-DGH2UMPW.js → orchestrator-POMFVZLB.js} +10 -10
  33. package/dist/{thread-store-ILM2ZJCB.js → thread-store-V5IDUJ4L.js} +2 -2
  34. package/dist/{workspaces-SSYKQUAU.js → workspaces-DTMPNDPW.js} +4 -4
  35. package/dist/{worktree-QBVLKACU.js → worktree-FX5FT6BI.js} +3 -3
  36. package/package.json +1 -1
@@ -32,11 +32,11 @@ import {
32
32
  tryReservePort,
33
33
  tryReservePorts,
34
34
  worktreeRunPortsPath
35
- } from "./chunk-YNKVGJE5.js";
35
+ } from "./chunk-IYX53WZY.js";
36
36
  import "./chunk-BIM24I3O.js";
37
- import "./chunk-HRHF6N6S.js";
38
- import "./chunk-G3UV3GXJ.js";
39
- import "./chunk-JX3OWNOT.js";
37
+ import "./chunk-4YGVJRXY.js";
38
+ import "./chunk-Z54FI4VL.js";
39
+ import "./chunk-QTDCPMOW.js";
40
40
  import "./chunk-BMRJNRQK.js";
41
41
  import "./chunk-NJV5YEKI.js";
42
42
  import "./chunk-N6ZF3XRP.js";
@@ -44,7 +44,7 @@ import "./chunk-OPXEJJBM.js";
44
44
  import "./chunk-6K64FJDD.js";
45
45
  import "./chunk-LG6RJBIY.js";
46
46
  import "./chunk-R4W4VQJZ.js";
47
- import "./chunk-TKEYXNXY.js";
47
+ import "./chunk-4PHOJMZI.js";
48
48
  import {
49
49
  stripNestedElectronEnv
50
50
  } from "./chunk-4TR3HZFT.js";
@@ -7,15 +7,15 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-HRHF6N6S.js";
11
- import "./chunk-G3UV3GXJ.js";
12
- import "./chunk-JX3OWNOT.js";
10
+ } from "./chunk-4YGVJRXY.js";
11
+ import "./chunk-Z54FI4VL.js";
12
+ import "./chunk-QTDCPMOW.js";
13
13
  import "./chunk-BMRJNRQK.js";
14
14
  import "./chunk-N6ZF3XRP.js";
15
15
  import "./chunk-6K64FJDD.js";
16
16
  import "./chunk-LG6RJBIY.js";
17
17
  import "./chunk-R4W4VQJZ.js";
18
- import "./chunk-TKEYXNXY.js";
18
+ import "./chunk-4PHOJMZI.js";
19
19
  import "./chunk-4TR3HZFT.js";
20
20
  import "./chunk-WDRMZKVB.js";
21
21
  import "./chunk-KI45T4DI.js";
@@ -18,15 +18,15 @@ import {
18
18
  remoteCoordinatorSourceRef,
19
19
  slackCoordinatorSourceRef,
20
20
  takenTeamSlugsForOrchestration
21
- } from "./chunk-HRHF6N6S.js";
22
- import "./chunk-G3UV3GXJ.js";
23
- import "./chunk-JX3OWNOT.js";
21
+ } from "./chunk-4YGVJRXY.js";
22
+ import "./chunk-Z54FI4VL.js";
23
+ import "./chunk-QTDCPMOW.js";
24
24
  import "./chunk-BMRJNRQK.js";
25
25
  import "./chunk-N6ZF3XRP.js";
26
26
  import "./chunk-6K64FJDD.js";
27
27
  import "./chunk-LG6RJBIY.js";
28
28
  import "./chunk-R4W4VQJZ.js";
29
- import "./chunk-TKEYXNXY.js";
29
+ import "./chunk-4PHOJMZI.js";
30
30
  import "./chunk-4TR3HZFT.js";
31
31
  import "./chunk-WDRMZKVB.js";
32
32
  import "./chunk-KI45T4DI.js";
package/dist/index.cjs CHANGED
@@ -1310,6 +1310,21 @@ function parseRemoteClientMessage(raw) {
1310
1310
  const sessionTokens = raw2.filter((item) => typeof item === "string" && item.trim().length > 0).map((item) => item.trim()).slice(0, 32);
1311
1311
  return { type: "list_hosts", sessionTokens };
1312
1312
  }
1313
+ if (msg.type === "push_register") {
1314
+ const token = str(parsed.token);
1315
+ if (!/^(?:Exponent|Expo)PushToken\[[A-Za-z0-9_-]{8,140}\]$/.test(token)) return null;
1316
+ const raw2 = parsed.sessionTokens;
1317
+ if (!Array.isArray(raw2)) return null;
1318
+ const sessionTokens = raw2.filter((item) => typeof item === "string" && item.trim().length > 0).map((item) => item.trim()).slice(0, 32);
1319
+ return { type: "push_register", token, sessionTokens };
1320
+ }
1321
+ if (msg.type === "push_notify") {
1322
+ const chatId = str(parsed.chatId);
1323
+ const kind = parsed.kind;
1324
+ if (!/^[A-Za-z0-9_-]{8,80}$/.test(chatId)) return null;
1325
+ if (kind !== "needs_you" && kind !== "finished" && kind !== "failed") return null;
1326
+ return { type: "push_notify", chatId, kind };
1327
+ }
1313
1328
  if (msg.type === "prompt") {
1314
1329
  const text7 = str(parsed.text);
1315
1330
  if (!text7) return null;
@@ -42799,6 +42814,131 @@ function startPhoneBoardSync(opts) {
42799
42814
  };
42800
42815
  }
42801
42816
 
42817
+ // src/remote/phone-push-watch.ts
42818
+ init_orchestrator();
42819
+
42820
+ // src/remote/push.ts
42821
+ init_protocol();
42822
+ var EXPO_PUSH_URL = "https://exp.host/--/api/v2/push/send";
42823
+ function hostedPushRelay(url) {
42824
+ try {
42825
+ return new URL(url).hostname === new URL(BAKED_REMOTE_RELAY_URL).hostname;
42826
+ } catch {
42827
+ return false;
42828
+ }
42829
+ }
42830
+ function pushBody(kind) {
42831
+ if (kind === "needs_you") return "A chat needs you";
42832
+ if (kind === "failed") return "A chat failed";
42833
+ return "A turn finished";
42834
+ }
42835
+ function expoPushMessage(input) {
42836
+ return {
42837
+ to: input.to,
42838
+ title: input.deviceLabel,
42839
+ body: pushBody(input.kind),
42840
+ data: { deviceId: input.deviceId, chatId: input.chatId, kind: input.kind },
42841
+ sound: "default",
42842
+ priority: "high"
42843
+ };
42844
+ }
42845
+ function pushNotes(input) {
42846
+ const notes = [];
42847
+ const fresh = /* @__PURE__ */ new Set();
42848
+ for (const id of input.after) {
42849
+ if (input.before.has(id)) continue;
42850
+ fresh.add(id);
42851
+ notes.push({ chatId: id, kind: "needs_you" });
42852
+ }
42853
+ const event = input.event;
42854
+ if (!event || event.type !== "turn_finished" && event.type !== "error") return notes;
42855
+ if (fresh.has(event.threadId)) return notes;
42856
+ const finished = event.type === "turn_finished" && (event.exitCode === 0 || event.exitCode == null);
42857
+ notes.push({ chatId: event.threadId, kind: finished ? "finished" : "failed" });
42858
+ return notes;
42859
+ }
42860
+ var MemoryPushTokens = class {
42861
+ rows = /* @__PURE__ */ new Map();
42862
+ replace(token, deviceIds) {
42863
+ const ids = new Set(deviceIds.filter(Boolean));
42864
+ if (ids.size === 0) this.rows.delete(token);
42865
+ else this.rows.set(token, ids);
42866
+ }
42867
+ tokens(deviceId) {
42868
+ const out = [];
42869
+ for (const [token, ids] of this.rows) {
42870
+ if (ids.has(deviceId)) out.push(token);
42871
+ }
42872
+ return out;
42873
+ }
42874
+ };
42875
+ async function sendExpoPushes(messages, fetchImpl = fetch) {
42876
+ if (messages.length === 0) return;
42877
+ const res = await fetchImpl(EXPO_PUSH_URL, {
42878
+ method: "POST",
42879
+ headers: { "content-type": "application/json", accept: "application/json" },
42880
+ body: JSON.stringify(messages)
42881
+ });
42882
+ if (!res.ok) throw new Error(`Expo push HTTP ${res.status}`);
42883
+ const body = await res.json().catch(() => null);
42884
+ const failed = body?.data?.find((row2) => row2.status === "error");
42885
+ if (failed) throw new Error(failed.message || "Expo push rejected");
42886
+ }
42887
+
42888
+ // src/remote/phone-push-watch.ts
42889
+ function needingChatIds(sidebar) {
42890
+ const ids = [];
42891
+ for (const chat of sidebar.orchestration) {
42892
+ if (chat.needsYou && chat.id) ids.push(chat.id);
42893
+ }
42894
+ for (const project of sidebar.projects) {
42895
+ for (const worktree of project.worktrees) {
42896
+ for (const chat of worktree.chats) {
42897
+ if (chat.needsYou && chat.id) ids.push(chat.id);
42898
+ }
42899
+ }
42900
+ }
42901
+ return ids;
42902
+ }
42903
+ function startPhonePushWatch(opts) {
42904
+ const needsYou = opts.needsYou ?? (() => needingChatIds(listPhoneSidebar()));
42905
+ const read = () => new Set(needsYou());
42906
+ let needing = read();
42907
+ let timer2 = null;
42908
+ const flush2 = (event) => {
42909
+ const after = read();
42910
+ if (!opts.enabled()) {
42911
+ needing = after;
42912
+ return;
42913
+ }
42914
+ for (const note of pushNotes({ event, before: needing, after })) opts.send(note);
42915
+ needing = after;
42916
+ };
42917
+ const schedule = () => {
42918
+ if (timer2) return;
42919
+ timer2 = setTimeout(() => {
42920
+ timer2 = null;
42921
+ flush2(null);
42922
+ }, opts.debounceMs ?? 300);
42923
+ };
42924
+ const onEvent = (event) => {
42925
+ if (event.type === "turn_finished" || event.type === "error") {
42926
+ if (timer2) clearTimeout(timer2);
42927
+ timer2 = null;
42928
+ flush2(event);
42929
+ return;
42930
+ }
42931
+ if (isPhoneBoardEvent(event)) schedule();
42932
+ };
42933
+ const offEvents = (opts.events ?? ((listener) => getOrchestrator().on(listener)))(onEvent);
42934
+ const offFiles = (opts.subscribe ?? subscribePhoneBoard)(() => schedule());
42935
+ return () => {
42936
+ if (timer2) clearTimeout(timer2);
42937
+ offEvents();
42938
+ offFiles();
42939
+ };
42940
+ }
42941
+
42802
42942
  // src/remote/client.ts
42803
42943
  init_protocol();
42804
42944
  var BACKOFF_START_MS = 1e3;
@@ -43084,6 +43224,11 @@ function runRemoteHost(opts) {
43084
43224
  if (getPhoneOpenChat() !== chatId) return;
43085
43225
  emitControl({ onOutbound: emit }, { op: "permission", chatId, prompt });
43086
43226
  });
43227
+ const stopPush = hostedPushRelay(opts.url) ? startPhonePushWatch({
43228
+ enabled: () => Boolean(socket && socket.readyState === socket.OPEN),
43229
+ send: (note) => send3({ type: "push_notify", chatId: note.chatId, kind: note.kind })
43230
+ }) : null;
43231
+ opts.signal?.addEventListener("abort", () => stopPush?.(), { once: true });
43087
43232
  void loop();
43088
43233
  return {
43089
43234
  requestPairingCode() {
@@ -45187,6 +45332,7 @@ function newCode() {
45187
45332
  var RemoteHub = class {
45188
45333
  constructor(opts = {}) {
45189
45334
  this.opts = opts;
45335
+ this.pushTokens = opts.pushTokens ?? new MemoryPushTokens();
45190
45336
  }
45191
45337
  opts;
45192
45338
  hosts = /* @__PURE__ */ new Map();
@@ -45194,6 +45340,8 @@ var RemoteHub = class {
45194
45340
  bySocket = /* @__PURE__ */ new Map();
45195
45341
  codes = /* @__PURE__ */ new Map();
45196
45342
  phonesByToken = /* @__PURE__ */ new Map();
45343
+ pushTokens;
45344
+ pushTokenBySocket = /* @__PURE__ */ new Map();
45197
45345
  handleClientMessage(socket, raw) {
45198
45346
  const msg = parseRemoteClientMessage(raw);
45199
45347
  if (!msg) {
@@ -45222,6 +45370,7 @@ var RemoteHub = class {
45222
45370
  }
45223
45371
  if (bound.role === "phone" && host.phone === socket) {
45224
45372
  host.phone = null;
45373
+ this.pushTokenBySocket.delete(socket);
45225
45374
  send(host.socket, { type: "phone_left" });
45226
45375
  }
45227
45376
  }
@@ -45250,6 +45399,14 @@ var RemoteHub = class {
45250
45399
  this.listHosts(socket, msg.sessionTokens);
45251
45400
  return;
45252
45401
  }
45402
+ if (msg.type === "push_register") {
45403
+ this.registerPush(socket, msg.token, msg.sessionTokens);
45404
+ return;
45405
+ }
45406
+ if (msg.type === "push_notify") {
45407
+ this.notifyPush(socket, msg.chatId, msg.kind);
45408
+ return;
45409
+ }
45253
45410
  if (msg.type === "prompt" || msg.type === "stop") {
45254
45411
  this.fromPhone(socket, msg);
45255
45412
  return;
@@ -45307,6 +45464,7 @@ var RemoteHub = class {
45307
45464
  }
45308
45465
  if (existing.phone) {
45309
45466
  send(existing.phone, { type: "host_offline" });
45467
+ this.pushTokenBySocket.delete(existing.phone);
45310
45468
  this.bySocket.delete(existing.phone);
45311
45469
  }
45312
45470
  }
@@ -45432,6 +45590,7 @@ var RemoteHub = class {
45432
45590
  this.bySocket.delete(socket);
45433
45591
  if (prev?.phone === socket) {
45434
45592
  prev.phone = null;
45593
+ this.pushTokenBySocket.delete(socket);
45435
45594
  send(prev.socket, { type: "phone_left" });
45436
45595
  }
45437
45596
  }
@@ -45442,6 +45601,7 @@ var RemoteHub = class {
45442
45601
  }
45443
45602
  const already = host.phone === socket;
45444
45603
  if (host.phone && host.phone !== socket) {
45604
+ this.pushTokenBySocket.delete(host.phone);
45445
45605
  this.bySocket.delete(host.phone);
45446
45606
  try {
45447
45607
  host.phone.close();
@@ -45497,6 +45657,31 @@ var RemoteHub = class {
45497
45657
  }
45498
45658
  send(host.phone, { type: "ask_user", text: msg.text, questions: msg.questions });
45499
45659
  }
45660
+ registerPush(socket, token, sessionTokens) {
45661
+ const deviceIds = [];
45662
+ for (const sessionToken of sessionTokens) {
45663
+ const known = this.knownSession(sessionToken);
45664
+ if (known && !deviceIds.includes(known.deviceId)) deviceIds.push(known.deviceId);
45665
+ }
45666
+ this.pushTokens.replace(token, deviceIds);
45667
+ this.pushTokenBySocket.set(socket, token);
45668
+ }
45669
+ notifyPush(socket, chatId, kind) {
45670
+ const bound = this.bySocket.get(socket);
45671
+ const host = bound?.role === "host" ? this.hosts.get(bound.deviceId) : null;
45672
+ if (!host || host.socket !== socket) return;
45673
+ const connected = host.phone ? this.pushTokenBySocket.get(host.phone) : void 0;
45674
+ const messages = this.pushTokens.tokens(host.deviceId).filter((token) => token !== connected).map(
45675
+ (to) => expoPushMessage({
45676
+ to,
45677
+ deviceLabel: host.deviceLabel,
45678
+ deviceId: host.deviceId,
45679
+ chatId,
45680
+ kind
45681
+ })
45682
+ );
45683
+ if (messages.length > 0) this.opts.onPush?.(messages);
45684
+ }
45500
45685
  };
45501
45686
 
45502
45687
  // src/relay/server.ts
@@ -45597,6 +45782,15 @@ var RelayAccountStore = class {
45597
45782
  this.db.exec("ALTER TABLE devices ADD COLUMN session_token_hash TEXT");
45598
45783
  }
45599
45784
  this.db.exec("CREATE INDEX IF NOT EXISTS devices_session ON devices(session_token_hash)");
45785
+ this.db.exec(`
45786
+ CREATE TABLE IF NOT EXISTS push_tokens (
45787
+ token TEXT NOT NULL,
45788
+ device_id TEXT NOT NULL,
45789
+ updated_at INTEGER NOT NULL,
45790
+ PRIMARY KEY (token, device_id)
45791
+ );
45792
+ CREATE INDEX IF NOT EXISTS push_tokens_device ON push_tokens(device_id);
45793
+ `);
45600
45794
  }
45601
45795
  close() {
45602
45796
  this.db.close();
@@ -45732,6 +45926,31 @@ var RelayAccountStore = class {
45732
45926
  if (!id || !token) return;
45733
45927
  this.db.prepare("UPDATE devices SET session_token_hash = ? WHERE device_id = ?").run(sha2563(token), id);
45734
45928
  }
45929
+ /** Replace every Mac this Expo token should reach. An empty list forgets it. */
45930
+ replacePushToken(token, deviceIds) {
45931
+ const id = token.trim();
45932
+ if (!id) return;
45933
+ const ids = [...new Set(deviceIds.map((row2) => row2.trim()).filter(Boolean))];
45934
+ const now = Date.now();
45935
+ this.db.exec("BEGIN");
45936
+ try {
45937
+ this.db.prepare("DELETE FROM push_tokens WHERE token = ?").run(id);
45938
+ const insert = this.db.prepare(
45939
+ "INSERT INTO push_tokens (token, device_id, updated_at) VALUES (?, ?, ?)"
45940
+ );
45941
+ for (const deviceId of ids) insert.run(id, deviceId, now);
45942
+ this.db.exec("COMMIT");
45943
+ } catch (err) {
45944
+ this.db.exec("ROLLBACK");
45945
+ throw err;
45946
+ }
45947
+ }
45948
+ pushTokensFor(deviceId) {
45949
+ const id = deviceId.trim();
45950
+ if (!id) return [];
45951
+ const rows = this.db.prepare("SELECT token FROM push_tokens WHERE device_id = ? ORDER BY updated_at").all(id);
45952
+ return rows.map((row2) => row2.token);
45953
+ }
45735
45954
  findPhoneSession(sessionToken) {
45736
45955
  const token = sessionToken.trim();
45737
45956
  if (!token) return null;
@@ -46334,6 +46553,15 @@ async function startRelayServer(opts) {
46334
46553
  find: (sessionToken) => accountStore.findPhoneSession(sessionToken),
46335
46554
  save: (deviceId, sessionToken) => accountStore.savePhoneSession(deviceId, sessionToken)
46336
46555
  } : void 0,
46556
+ pushTokens: accountStore ? {
46557
+ replace: (token, deviceIds) => accountStore.replacePushToken(token, deviceIds),
46558
+ tokens: (deviceId) => accountStore.pushTokensFor(deviceId)
46559
+ } : void 0,
46560
+ onPush: (messages) => {
46561
+ void sendExpoPushes(messages, opts.fetchImpl ?? fetch).catch((err) => {
46562
+ log(`push: ${err instanceof Error ? err.message : err}`);
46563
+ });
46564
+ },
46337
46565
  onAuthorized: (socket) => authMarks.get(socket)?.()
46338
46566
  });
46339
46567
  const publicOrigin = () => opts.relayPublicOrigin?.trim() || process.env.SIDEBOARD_RELAY_PUBLIC_ORIGIN?.trim() || `http://127.0.0.1:${boundPort}`;
package/dist/index.d.cts CHANGED
@@ -7717,8 +7717,8 @@ interface IpcApi extends McpUiIpc, GitHostIpcApi, SlackOrgIpc, OrderIpc {
7717
7717
  removeManagedAccount(id: string): Promise<PublicAppSettings>;
7718
7718
  renameManagedAccount(id: string, label: string): Promise<PublicAppSettings>;
7719
7719
  loginManagedAccount(id: string): Promise<AgentSetupActionResult>;
7720
- /** macOS Dock unread count (empty string when 0). */
7721
- setDockBadge(count: number): Promise<void>;
7720
+ /** macOS Dock unread count. The open chat rides along so a focused window can skip that chat's banner. */
7721
+ setDockBadge(count: number, visibleThreadId?: string | null): Promise<void>;
7722
7722
  /** Brightsy login + connected teams (shared by CLI, Brightsy agent, and Claude MCP). */
7723
7723
  getBrightsySession(): Promise<BrightsySession>;
7724
7724
  /**
@@ -8893,6 +8893,32 @@ declare function resolveSlackListenMode(opts?: {
8893
8893
  relayUrl?: string | null;
8894
8894
  }): 'relay' | null;
8895
8895
 
8896
+ type PushKind = 'needs_you' | 'finished' | 'failed';
8897
+ type ExpoPushMessage = {
8898
+ to: string;
8899
+ title: string;
8900
+ body: string;
8901
+ data: {
8902
+ deviceId: string;
8903
+ chatId: string;
8904
+ kind: PushKind;
8905
+ };
8906
+ sound: 'default';
8907
+ priority: 'high';
8908
+ };
8909
+ /** Alert text is a fixed sentence plus the Mac's name. No chat message is included. */
8910
+ declare function expoPushMessage(input: {
8911
+ to: string;
8912
+ deviceLabel: string;
8913
+ deviceId: string;
8914
+ chatId: string;
8915
+ kind: PushKind;
8916
+ }): ExpoPushMessage;
8917
+ interface PushTokenStore {
8918
+ replace(token: string, deviceIds: string[]): void;
8919
+ tokens(deviceId: string): string[];
8920
+ }
8921
+
8896
8922
  interface RemoteSocket {
8897
8923
  send(data: string): void;
8898
8924
  close(code?: number, reason?: string): void;
@@ -8920,6 +8946,7 @@ type RemotePhoneSessions = {
8920
8946
  find(sessionToken: string): RemotePhoneSession | null;
8921
8947
  save(deviceId: string, sessionToken: string): void;
8922
8948
  };
8949
+
8923
8950
  /**
8924
8951
  * In-memory phone ↔ Mac registry. One active phone socket per Mac.
8925
8952
  * A phone may hold session tokens for several Macs and attaches to one at a time.
@@ -8934,9 +8961,13 @@ declare class RemoteHub {
8934
8961
  private readonly bySocket;
8935
8962
  private readonly codes;
8936
8963
  private readonly phonesByToken;
8964
+ private readonly pushTokens;
8965
+ private readonly pushTokenBySocket;
8937
8966
  constructor(opts?: {
8938
8967
  authorizeHost?: RemoteHostAuthorizer;
8939
8968
  phoneSessions?: RemotePhoneSessions;
8969
+ pushTokens?: PushTokenStore;
8970
+ onPush?: (messages: ReturnType<typeof expoPushMessage>[]) => void;
8940
8971
  onAuthorized?: (socket: RemoteSocket) => void;
8941
8972
  });
8942
8973
  handleClientMessage(socket: RemoteSocket, raw: string): void;
@@ -8958,6 +8989,8 @@ declare class RemoteHub {
8958
8989
  private attachPhone;
8959
8990
  private fromPhone;
8960
8991
  private fromHost;
8992
+ private registerPush;
8993
+ private notifyPush;
8961
8994
  }
8962
8995
 
8963
8996
  type PhoneOpenArtifactRequest = {
package/dist/index.d.ts CHANGED
@@ -7717,8 +7717,8 @@ interface IpcApi extends McpUiIpc, GitHostIpcApi, SlackOrgIpc, OrderIpc {
7717
7717
  removeManagedAccount(id: string): Promise<PublicAppSettings>;
7718
7718
  renameManagedAccount(id: string, label: string): Promise<PublicAppSettings>;
7719
7719
  loginManagedAccount(id: string): Promise<AgentSetupActionResult>;
7720
- /** macOS Dock unread count (empty string when 0). */
7721
- setDockBadge(count: number): Promise<void>;
7720
+ /** macOS Dock unread count. The open chat rides along so a focused window can skip that chat's banner. */
7721
+ setDockBadge(count: number, visibleThreadId?: string | null): Promise<void>;
7722
7722
  /** Brightsy login + connected teams (shared by CLI, Brightsy agent, and Claude MCP). */
7723
7723
  getBrightsySession(): Promise<BrightsySession>;
7724
7724
  /**
@@ -8893,6 +8893,32 @@ declare function resolveSlackListenMode(opts?: {
8893
8893
  relayUrl?: string | null;
8894
8894
  }): 'relay' | null;
8895
8895
 
8896
+ type PushKind = 'needs_you' | 'finished' | 'failed';
8897
+ type ExpoPushMessage = {
8898
+ to: string;
8899
+ title: string;
8900
+ body: string;
8901
+ data: {
8902
+ deviceId: string;
8903
+ chatId: string;
8904
+ kind: PushKind;
8905
+ };
8906
+ sound: 'default';
8907
+ priority: 'high';
8908
+ };
8909
+ /** Alert text is a fixed sentence plus the Mac's name. No chat message is included. */
8910
+ declare function expoPushMessage(input: {
8911
+ to: string;
8912
+ deviceLabel: string;
8913
+ deviceId: string;
8914
+ chatId: string;
8915
+ kind: PushKind;
8916
+ }): ExpoPushMessage;
8917
+ interface PushTokenStore {
8918
+ replace(token: string, deviceIds: string[]): void;
8919
+ tokens(deviceId: string): string[];
8920
+ }
8921
+
8896
8922
  interface RemoteSocket {
8897
8923
  send(data: string): void;
8898
8924
  close(code?: number, reason?: string): void;
@@ -8920,6 +8946,7 @@ type RemotePhoneSessions = {
8920
8946
  find(sessionToken: string): RemotePhoneSession | null;
8921
8947
  save(deviceId: string, sessionToken: string): void;
8922
8948
  };
8949
+
8923
8950
  /**
8924
8951
  * In-memory phone ↔ Mac registry. One active phone socket per Mac.
8925
8952
  * A phone may hold session tokens for several Macs and attaches to one at a time.
@@ -8934,9 +8961,13 @@ declare class RemoteHub {
8934
8961
  private readonly bySocket;
8935
8962
  private readonly codes;
8936
8963
  private readonly phonesByToken;
8964
+ private readonly pushTokens;
8965
+ private readonly pushTokenBySocket;
8937
8966
  constructor(opts?: {
8938
8967
  authorizeHost?: RemoteHostAuthorizer;
8939
8968
  phoneSessions?: RemotePhoneSessions;
8969
+ pushTokens?: PushTokenStore;
8970
+ onPush?: (messages: ReturnType<typeof expoPushMessage>[]) => void;
8940
8971
  onAuthorized?: (socket: RemoteSocket) => void;
8941
8972
  });
8942
8973
  handleClientMessage(socket: RemoteSocket, raw: string): void;
@@ -8958,6 +8989,8 @@ declare class RemoteHub {
8958
8989
  private attachPhone;
8959
8990
  private fromPhone;
8960
8991
  private fromHost;
8992
+ private registerPush;
8993
+ private notifyPush;
8961
8994
  }
8962
8995
 
8963
8996
  type PhoneOpenArtifactRequest = {