@sideboard-ai/core 0.1.343 → 0.1.345

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 (48) 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-LNZ465IM.js → agents-7CHZO3K3.js} +2 -2
  5. package/dist/{agents-7DCNOMFP.js → agents-AQM7NLXD.js} +7 -7
  6. package/dist/{app-settings-FS7TM55D.js → app-settings-A6JUT2SF.js} +1 -1
  7. package/dist/{chunk-TKEYXNXY.js → chunk-4PHOJMZI.js} +15 -0
  8. package/dist/{chunk-A4ZI7SA3.js → chunk-4SNEW63T.js} +3 -3
  9. package/dist/{chunk-2BLJ726H.js → chunk-4YGVJRXY.js} +4 -3
  10. package/dist/{chunk-KCZM7WZ3.js → chunk-5IMXA563.js} +10 -10
  11. package/dist/{chunk-O2IRQAFB.js → chunk-AG2RM3DF.js} +3 -3
  12. package/dist/{chunk-DEQLDEYR.js → chunk-BD7KUYJA.js} +2 -2
  13. package/dist/{chunk-SLLTEMIL.js → chunk-FNAP6CCS.js} +2 -2
  14. package/dist/{chunk-6RO2AOE5.js → chunk-GHKJBZW5.js} +2 -2
  15. package/dist/{chunk-NGIGRAZB.js → chunk-IYX53WZY.js} +5 -5
  16. package/dist/{chunk-5BFEHSHO.js → chunk-J3BQHHDZ.js} +1 -0
  17. package/dist/{chunk-EDEYEYU6.js → chunk-JZKNRDKF.js} +24 -24
  18. package/dist/{chunk-4TTTEKNV.js → chunk-MB3GOWB3.js} +2 -2
  19. package/dist/{chunk-LDJT3TLN.js → chunk-MHRU743Z.js} +7 -7
  20. package/dist/{chunk-GUIJMZQG.js → chunk-NQHEEGTH.js} +1 -1
  21. package/dist/{chunk-D7US5R4H.js → chunk-O5WRVQFT.js} +1 -1
  22. package/dist/{chunk-JX3OWNOT.js → chunk-QTDCPMOW.js} +1 -1
  23. package/dist/{chunk-4HELMBYR.js → chunk-TD76ORBJ.js} +2 -2
  24. package/dist/{chunk-S3DTEGMK.js → chunk-TW63CYUA.js} +2 -2
  25. package/dist/{chunk-WO7VF4FG.js → chunk-YFPSTG52.js} +5 -5
  26. package/dist/{chunk-G3UV3GXJ.js → chunk-Z54FI4VL.js} +2 -2
  27. package/dist/{conductor-4SWJM5FS.js → conductor-3A2TNWUW.js} +2 -2
  28. package/dist/{conductor-Q433HU77.js → conductor-DUHRZUQY.js} +5 -5
  29. package/dist/{coordinator-prompt-Z7PPP45X.js → coordinator-prompt-7QALNDIV.js} +1 -1
  30. package/dist/{coordinator-prompt-5QHWCO7V.js → coordinator-prompt-OX6A4MDA.js} +4 -4
  31. package/dist/{global-workspace-VDCZMFCZ.js → global-workspace-6GGS3DWU.js} +4 -4
  32. package/dist/{global-workspace-DL4K4K7O.js → global-workspace-HM2RKBCT.js} +1 -1
  33. package/dist/index.cjs +230 -1
  34. package/dist/index.d.cts +33 -0
  35. package/dist/index.d.ts +33 -0
  36. package/dist/index.js +230 -21
  37. package/dist/{linear-UXMDJAD4.js → linear-WYI64BMX.js} +2 -2
  38. package/dist/{linear-list-KDLU7QWX.js → linear-list-CGUCPWTV.js} +1 -1
  39. package/dist/mcp/run-stdio.cjs +2 -1
  40. package/dist/mcp/run-stdio.js +4 -4
  41. package/dist/{optional-cli-RUUCLNSM.js → optional-cli-YHLVTVRK.js} +4 -4
  42. package/dist/{orchestrator-RLFBFRAG.js → orchestrator-OWO6LQ5U.js} +4 -4
  43. package/dist/{orchestrator-Y5JCAJGV.js → orchestrator-POMFVZLB.js} +10 -10
  44. package/dist/{thread-store-ILM2ZJCB.js → thread-store-V5IDUJ4L.js} +2 -2
  45. package/dist/{workspaces-MX4W4SSB.js → workspaces-DTMPNDPW.js} +4 -4
  46. package/dist/{workspaces-EIIHHH4S.js → workspaces-V6IIBSKA.js} +1 -1
  47. package/dist/{worktree-QBVLKACU.js → worktree-FX5FT6BI.js} +3 -3
  48. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -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
@@ -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.js CHANGED
@@ -17,13 +17,13 @@ import {
17
17
  toAbleTimeIssueInfo,
18
18
  updateAbleTimeTask,
19
19
  verifyAbleTimeConnection
20
- } from "./chunk-A4ZI7SA3.js";
20
+ } from "./chunk-4SNEW63T.js";
21
21
  import {
22
22
  clearOptionalCliPresenceCache,
23
23
  detectOptionalServiceClis,
24
24
  installOptionalServiceCli,
25
25
  optionalCliPresence
26
- } from "./chunk-SLLTEMIL.js";
26
+ } from "./chunk-FNAP6CCS.js";
27
27
  import {
28
28
  AGENT_GIT_ACTIONS,
29
29
  BOARD_COLUMN_DEFS,
@@ -222,7 +222,7 @@ import {
222
222
  worktreeCleanupSettings,
223
223
  writeAgentBlock,
224
224
  writeWorktreeFile
225
- } from "./chunk-EDEYEYU6.js";
225
+ } from "./chunk-JZKNRDKF.js";
226
226
  import {
227
227
  OPTIONAL_SERVICES,
228
228
  OPTIONAL_SERVICE_IDS,
@@ -238,7 +238,7 @@ import {
238
238
  optionalServiceConnected,
239
239
  optionalServiceSpec,
240
240
  verifyOptionalService
241
- } from "./chunk-4TTTEKNV.js";
241
+ } from "./chunk-MB3GOWB3.js";
242
242
  import {
243
243
  LEGACY_PLAN_FILE_REL,
244
244
  PLAN_FILE_NAME,
@@ -295,7 +295,7 @@ import {
295
295
  startLinearOAuth,
296
296
  updateLinearIssue,
297
297
  validateLinearApiKey
298
- } from "./chunk-GUIJMZQG.js";
298
+ } from "./chunk-NQHEEGTH.js";
299
299
  import {
300
300
  downloadAuthenticatedFile,
301
301
  extractHttpUrls,
@@ -383,7 +383,7 @@ import {
383
383
  userMcpNamesToDisable,
384
384
  worktreeMcpToolNames,
385
385
  writeInjectedMcpConfig
386
- } from "./chunk-LDJT3TLN.js";
386
+ } from "./chunk-MHRU743Z.js";
387
387
  import {
388
388
  getAgentSetupInfo,
389
389
  installAgent,
@@ -395,7 +395,7 @@ import {
395
395
  prepareTerminalCommand,
396
396
  resolveLoginCommand,
397
397
  whichOnPath
398
- } from "./chunk-6RO2AOE5.js";
398
+ } from "./chunk-GHKJBZW5.js";
399
399
  import {
400
400
  brightsyMcpServerName,
401
401
  connectBrightsyTeam,
@@ -406,7 +406,7 @@ import {
406
406
  listConnectedBrightsyTeams,
407
407
  switchBrightsyAccount
408
408
  } from "./chunk-XOEKCE6L.js";
409
- import "./chunk-D7US5R4H.js";
409
+ import "./chunk-O5WRVQFT.js";
410
410
  import {
411
411
  BRIGHTSY_SUMMARIZE_CONTEXT_TOOL,
412
412
  CHARS_PER_CONTEXT_TOKEN,
@@ -517,7 +517,7 @@ import {
517
517
  workspaceAgentChatSummaries,
518
518
  worktreeRunPortsPath,
519
519
  wrapReviewSkillMarkdown
520
- } from "./chunk-NGIGRAZB.js";
520
+ } from "./chunk-IYX53WZY.js";
521
521
  import {
522
522
  STDERR_EVENT_MAX_CHARS,
523
523
  STDOUT_EVENT_MAX_CHARS,
@@ -583,10 +583,10 @@ import {
583
583
  parseAbleTimeOAuthCallbackUrl,
584
584
  resolveAbleTimeOAuthHost,
585
585
  startAbleTimeOAuth
586
- } from "./chunk-O2IRQAFB.js";
586
+ } from "./chunk-AG2RM3DF.js";
587
587
  import {
588
588
  looksLikeAbleTimeUlid
589
- } from "./chunk-4HELMBYR.js";
589
+ } from "./chunk-TD76ORBJ.js";
590
590
  import {
591
591
  ABLETIME_MCP_PATH,
592
592
  ABLETIME_MCP_PM_PATH,
@@ -607,7 +607,7 @@ import {
607
607
  normalizeAbleTimeCredential,
608
608
  normalizeAbleTimeHost,
609
609
  rewriteAbleTimeError
610
- } from "./chunk-WO7VF4FG.js";
610
+ } from "./chunk-YFPSTG52.js";
611
611
  import {
612
612
  CLOUD_COORDINATOR_BUSY_REPLY,
613
613
  CLOUD_COORDINATOR_CANCELED_REPLY,
@@ -660,7 +660,7 @@ import {
660
660
  stageBuffersAsAttachments,
661
661
  syncWorkspacesFromThreads,
662
662
  takenTeamSlugsForOrchestration
663
- } from "./chunk-2BLJ726H.js";
663
+ } from "./chunk-4YGVJRXY.js";
664
664
  import {
665
665
  GITHUB_PR_BODY_MAX_CHARS,
666
666
  GITHUB_PR_BODY_SAFE_CHARS,
@@ -750,7 +750,7 @@ import {
750
750
  suggestSlug,
751
751
  switchWorktreeBranch,
752
752
  warmGithubAgentAuth
753
- } from "./chunk-G3UV3GXJ.js";
753
+ } from "./chunk-Z54FI4VL.js";
754
754
  import {
755
755
  FAMOUS_SOCCER_TEAMS,
756
756
  SCHEDULE_RUN_HISTORY_LIMIT,
@@ -807,7 +807,7 @@ import {
807
807
  worktreeNameFromPath,
808
808
  worktreeSlugForTicket,
809
809
  writeThread
810
- } from "./chunk-JX3OWNOT.js";
810
+ } from "./chunk-QTDCPMOW.js";
811
811
  import "./chunk-BMRJNRQK.js";
812
812
  import {
813
813
  BRIGHTSY_OAUTH_CLIENT_ID,
@@ -1099,7 +1099,7 @@ import {
1099
1099
  withTurnScopedCost,
1100
1100
  writeSecureJson,
1101
1101
  writeViewerContext
1102
- } from "./chunk-TKEYXNXY.js";
1102
+ } from "./chunk-4PHOJMZI.js";
1103
1103
  import {
1104
1104
  stripNestedElectronEnv
1105
1105
  } from "./chunk-4TR3HZFT.js";
@@ -5931,6 +5931,127 @@ function startPhoneBoardSync(opts) {
5931
5931
  };
5932
5932
  }
5933
5933
 
5934
+ // src/remote/push.ts
5935
+ var EXPO_PUSH_URL = "https://exp.host/--/api/v2/push/send";
5936
+ function hostedPushRelay(url) {
5937
+ try {
5938
+ return new URL(url).hostname === new URL(BAKED_REMOTE_RELAY_URL).hostname;
5939
+ } catch {
5940
+ return false;
5941
+ }
5942
+ }
5943
+ function pushBody(kind) {
5944
+ if (kind === "needs_you") return "A chat needs you";
5945
+ if (kind === "failed") return "A chat failed";
5946
+ return "A turn finished";
5947
+ }
5948
+ function expoPushMessage(input) {
5949
+ return {
5950
+ to: input.to,
5951
+ title: input.deviceLabel,
5952
+ body: pushBody(input.kind),
5953
+ data: { deviceId: input.deviceId, chatId: input.chatId, kind: input.kind },
5954
+ sound: "default",
5955
+ priority: "high"
5956
+ };
5957
+ }
5958
+ function pushNotes(input) {
5959
+ const notes = [];
5960
+ const fresh = /* @__PURE__ */ new Set();
5961
+ for (const id of input.after) {
5962
+ if (input.before.has(id)) continue;
5963
+ fresh.add(id);
5964
+ notes.push({ chatId: id, kind: "needs_you" });
5965
+ }
5966
+ const event = input.event;
5967
+ if (!event || event.type !== "turn_finished" && event.type !== "error") return notes;
5968
+ if (fresh.has(event.threadId)) return notes;
5969
+ const finished = event.type === "turn_finished" && (event.exitCode === 0 || event.exitCode == null);
5970
+ notes.push({ chatId: event.threadId, kind: finished ? "finished" : "failed" });
5971
+ return notes;
5972
+ }
5973
+ var MemoryPushTokens = class {
5974
+ rows = /* @__PURE__ */ new Map();
5975
+ replace(token, deviceIds) {
5976
+ const ids = new Set(deviceIds.filter(Boolean));
5977
+ if (ids.size === 0) this.rows.delete(token);
5978
+ else this.rows.set(token, ids);
5979
+ }
5980
+ tokens(deviceId) {
5981
+ const out = [];
5982
+ for (const [token, ids] of this.rows) {
5983
+ if (ids.has(deviceId)) out.push(token);
5984
+ }
5985
+ return out;
5986
+ }
5987
+ };
5988
+ async function sendExpoPushes(messages, fetchImpl = fetch) {
5989
+ if (messages.length === 0) return;
5990
+ const res = await fetchImpl(EXPO_PUSH_URL, {
5991
+ method: "POST",
5992
+ headers: { "content-type": "application/json", accept: "application/json" },
5993
+ body: JSON.stringify(messages)
5994
+ });
5995
+ if (!res.ok) throw new Error(`Expo push HTTP ${res.status}`);
5996
+ const body = await res.json().catch(() => null);
5997
+ const failed = body?.data?.find((row2) => row2.status === "error");
5998
+ if (failed) throw new Error(failed.message || "Expo push rejected");
5999
+ }
6000
+
6001
+ // src/remote/phone-push-watch.ts
6002
+ function needingChatIds(sidebar) {
6003
+ const ids = [];
6004
+ for (const chat of sidebar.orchestration) {
6005
+ if (chat.needsYou && chat.id) ids.push(chat.id);
6006
+ }
6007
+ for (const project of sidebar.projects) {
6008
+ for (const worktree of project.worktrees) {
6009
+ for (const chat of worktree.chats) {
6010
+ if (chat.needsYou && chat.id) ids.push(chat.id);
6011
+ }
6012
+ }
6013
+ }
6014
+ return ids;
6015
+ }
6016
+ function startPhonePushWatch(opts) {
6017
+ const needsYou = opts.needsYou ?? (() => needingChatIds(listPhoneSidebar()));
6018
+ const read = () => new Set(needsYou());
6019
+ let needing = read();
6020
+ let timer = null;
6021
+ const flush = (event) => {
6022
+ const after = read();
6023
+ if (!opts.enabled()) {
6024
+ needing = after;
6025
+ return;
6026
+ }
6027
+ for (const note of pushNotes({ event, before: needing, after })) opts.send(note);
6028
+ needing = after;
6029
+ };
6030
+ const schedule = () => {
6031
+ if (timer) return;
6032
+ timer = setTimeout(() => {
6033
+ timer = null;
6034
+ flush(null);
6035
+ }, opts.debounceMs ?? 300);
6036
+ };
6037
+ const onEvent = (event) => {
6038
+ if (event.type === "turn_finished" || event.type === "error") {
6039
+ if (timer) clearTimeout(timer);
6040
+ timer = null;
6041
+ flush(event);
6042
+ return;
6043
+ }
6044
+ if (isPhoneBoardEvent(event)) schedule();
6045
+ };
6046
+ const offEvents = (opts.events ?? ((listener) => getOrchestrator().on(listener)))(onEvent);
6047
+ const offFiles = (opts.subscribe ?? subscribePhoneBoard)(() => schedule());
6048
+ return () => {
6049
+ if (timer) clearTimeout(timer);
6050
+ offEvents();
6051
+ offFiles();
6052
+ };
6053
+ }
6054
+
5934
6055
  // src/remote/client.ts
5935
6056
  var BACKOFF_START_MS = 1e3;
5936
6057
  var BACKOFF_MAX_MS = 3e4;
@@ -6215,6 +6336,11 @@ function runRemoteHost(opts) {
6215
6336
  if (getPhoneOpenChat() !== chatId) return;
6216
6337
  emitControl({ onOutbound: emit }, { op: "permission", chatId, prompt });
6217
6338
  });
6339
+ const stopPush = hostedPushRelay(opts.url) ? startPhonePushWatch({
6340
+ enabled: () => Boolean(socket && socket.readyState === socket.OPEN),
6341
+ send: (note) => send3({ type: "push_notify", chatId: note.chatId, kind: note.kind })
6342
+ }) : null;
6343
+ opts.signal?.addEventListener("abort", () => stopPush?.(), { once: true });
6218
6344
  void loop();
6219
6345
  return {
6220
6346
  requestPairingCode() {
@@ -8309,6 +8435,7 @@ function newCode() {
8309
8435
  var RemoteHub = class {
8310
8436
  constructor(opts = {}) {
8311
8437
  this.opts = opts;
8438
+ this.pushTokens = opts.pushTokens ?? new MemoryPushTokens();
8312
8439
  }
8313
8440
  opts;
8314
8441
  hosts = /* @__PURE__ */ new Map();
@@ -8316,6 +8443,8 @@ var RemoteHub = class {
8316
8443
  bySocket = /* @__PURE__ */ new Map();
8317
8444
  codes = /* @__PURE__ */ new Map();
8318
8445
  phonesByToken = /* @__PURE__ */ new Map();
8446
+ pushTokens;
8447
+ pushTokenBySocket = /* @__PURE__ */ new Map();
8319
8448
  handleClientMessage(socket, raw) {
8320
8449
  const msg = parseRemoteClientMessage(raw);
8321
8450
  if (!msg) {
@@ -8344,6 +8473,7 @@ var RemoteHub = class {
8344
8473
  }
8345
8474
  if (bound.role === "phone" && host.phone === socket) {
8346
8475
  host.phone = null;
8476
+ this.pushTokenBySocket.delete(socket);
8347
8477
  send(host.socket, { type: "phone_left" });
8348
8478
  }
8349
8479
  }
@@ -8372,6 +8502,14 @@ var RemoteHub = class {
8372
8502
  this.listHosts(socket, msg.sessionTokens);
8373
8503
  return;
8374
8504
  }
8505
+ if (msg.type === "push_register") {
8506
+ this.registerPush(socket, msg.token, msg.sessionTokens);
8507
+ return;
8508
+ }
8509
+ if (msg.type === "push_notify") {
8510
+ this.notifyPush(socket, msg.chatId, msg.kind);
8511
+ return;
8512
+ }
8375
8513
  if (msg.type === "prompt" || msg.type === "stop") {
8376
8514
  this.fromPhone(socket, msg);
8377
8515
  return;
@@ -8429,6 +8567,7 @@ var RemoteHub = class {
8429
8567
  }
8430
8568
  if (existing.phone) {
8431
8569
  send(existing.phone, { type: "host_offline" });
8570
+ this.pushTokenBySocket.delete(existing.phone);
8432
8571
  this.bySocket.delete(existing.phone);
8433
8572
  }
8434
8573
  }
@@ -8554,6 +8693,7 @@ var RemoteHub = class {
8554
8693
  this.bySocket.delete(socket);
8555
8694
  if (prev?.phone === socket) {
8556
8695
  prev.phone = null;
8696
+ this.pushTokenBySocket.delete(socket);
8557
8697
  send(prev.socket, { type: "phone_left" });
8558
8698
  }
8559
8699
  }
@@ -8564,6 +8704,7 @@ var RemoteHub = class {
8564
8704
  }
8565
8705
  const already = host.phone === socket;
8566
8706
  if (host.phone && host.phone !== socket) {
8707
+ this.pushTokenBySocket.delete(host.phone);
8567
8708
  this.bySocket.delete(host.phone);
8568
8709
  try {
8569
8710
  host.phone.close();
@@ -8619,6 +8760,31 @@ var RemoteHub = class {
8619
8760
  }
8620
8761
  send(host.phone, { type: "ask_user", text: msg.text, questions: msg.questions });
8621
8762
  }
8763
+ registerPush(socket, token, sessionTokens) {
8764
+ const deviceIds = [];
8765
+ for (const sessionToken of sessionTokens) {
8766
+ const known = this.knownSession(sessionToken);
8767
+ if (known && !deviceIds.includes(known.deviceId)) deviceIds.push(known.deviceId);
8768
+ }
8769
+ this.pushTokens.replace(token, deviceIds);
8770
+ this.pushTokenBySocket.set(socket, token);
8771
+ }
8772
+ notifyPush(socket, chatId, kind) {
8773
+ const bound = this.bySocket.get(socket);
8774
+ const host = bound?.role === "host" ? this.hosts.get(bound.deviceId) : null;
8775
+ if (!host || host.socket !== socket) return;
8776
+ const connected = host.phone ? this.pushTokenBySocket.get(host.phone) : void 0;
8777
+ const messages = this.pushTokens.tokens(host.deviceId).filter((token) => token !== connected).map(
8778
+ (to) => expoPushMessage({
8779
+ to,
8780
+ deviceLabel: host.deviceLabel,
8781
+ deviceId: host.deviceId,
8782
+ chatId,
8783
+ kind
8784
+ })
8785
+ );
8786
+ if (messages.length > 0) this.opts.onPush?.(messages);
8787
+ }
8622
8788
  };
8623
8789
 
8624
8790
  // src/relay/accounts.ts
@@ -8716,6 +8882,15 @@ var RelayAccountStore = class {
8716
8882
  this.db.exec("ALTER TABLE devices ADD COLUMN session_token_hash TEXT");
8717
8883
  }
8718
8884
  this.db.exec("CREATE INDEX IF NOT EXISTS devices_session ON devices(session_token_hash)");
8885
+ this.db.exec(`
8886
+ CREATE TABLE IF NOT EXISTS push_tokens (
8887
+ token TEXT NOT NULL,
8888
+ device_id TEXT NOT NULL,
8889
+ updated_at INTEGER NOT NULL,
8890
+ PRIMARY KEY (token, device_id)
8891
+ );
8892
+ CREATE INDEX IF NOT EXISTS push_tokens_device ON push_tokens(device_id);
8893
+ `);
8719
8894
  }
8720
8895
  close() {
8721
8896
  this.db.close();
@@ -8851,6 +9026,31 @@ var RelayAccountStore = class {
8851
9026
  if (!id || !token) return;
8852
9027
  this.db.prepare("UPDATE devices SET session_token_hash = ? WHERE device_id = ?").run(sha2563(token), id);
8853
9028
  }
9029
+ /** Replace every Mac this Expo token should reach. An empty list forgets it. */
9030
+ replacePushToken(token, deviceIds) {
9031
+ const id = token.trim();
9032
+ if (!id) return;
9033
+ const ids = [...new Set(deviceIds.map((row2) => row2.trim()).filter(Boolean))];
9034
+ const now = Date.now();
9035
+ this.db.exec("BEGIN");
9036
+ try {
9037
+ this.db.prepare("DELETE FROM push_tokens WHERE token = ?").run(id);
9038
+ const insert = this.db.prepare(
9039
+ "INSERT INTO push_tokens (token, device_id, updated_at) VALUES (?, ?, ?)"
9040
+ );
9041
+ for (const deviceId of ids) insert.run(id, deviceId, now);
9042
+ this.db.exec("COMMIT");
9043
+ } catch (err) {
9044
+ this.db.exec("ROLLBACK");
9045
+ throw err;
9046
+ }
9047
+ }
9048
+ pushTokensFor(deviceId) {
9049
+ const id = deviceId.trim();
9050
+ if (!id) return [];
9051
+ const rows = this.db.prepare("SELECT token FROM push_tokens WHERE device_id = ? ORDER BY updated_at").all(id);
9052
+ return rows.map((row2) => row2.token);
9053
+ }
8854
9054
  findPhoneSession(sessionToken) {
8855
9055
  const token = sessionToken.trim();
8856
9056
  if (!token) return null;
@@ -9452,6 +9652,15 @@ async function startRelayServer(opts) {
9452
9652
  find: (sessionToken) => accountStore.findPhoneSession(sessionToken),
9453
9653
  save: (deviceId, sessionToken) => accountStore.savePhoneSession(deviceId, sessionToken)
9454
9654
  } : void 0,
9655
+ pushTokens: accountStore ? {
9656
+ replace: (token, deviceIds) => accountStore.replacePushToken(token, deviceIds),
9657
+ tokens: (deviceId) => accountStore.pushTokensFor(deviceId)
9658
+ } : void 0,
9659
+ onPush: (messages) => {
9660
+ void sendExpoPushes(messages, opts.fetchImpl ?? fetch).catch((err) => {
9661
+ log(`push: ${err instanceof Error ? err.message : err}`);
9662
+ });
9663
+ },
9455
9664
  onAuthorized: (socket) => authMarks.get(socket)?.()
9456
9665
  });
9457
9666
  const publicOrigin = () => opts.relayPublicOrigin?.trim() || process.env.SIDEBOARD_RELAY_PUBLIC_ORIGIN?.trim() || `http://127.0.0.1:${boundPort}`;
@@ -9746,7 +9955,7 @@ async function startHeadlessHost(opts) {
9746
9955
  };
9747
9956
  const refreshRunning = async () => {
9748
9957
  try {
9749
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5JCAJGV.js");
9958
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-POMFVZLB.js");
9750
9959
  agentsRunning = getOrchestrator2().getRuntime().running;
9751
9960
  } catch {
9752
9961
  agentsRunning = 0;
@@ -12202,7 +12411,7 @@ async function handleJobStop(params, _ctx) {
12202
12411
  return stopDetachedJob(jobCwd(rec), id, reason ? { reason } : void 0);
12203
12412
  }
12204
12413
  async function defaultTurnWait(ref, timeoutMs) {
12205
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5JCAJGV.js");
12414
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-POMFVZLB.js");
12206
12415
  const orch = getOrchestrator2();
12207
12416
  const thread = await orch.waitForTurn(ref, timeoutMs, {
12208
12417
  resolveIfStillRunning: true
@@ -12555,7 +12764,7 @@ async function startMcpServer() {
12555
12764
  );
12556
12765
  }
12557
12766
  try {
12558
- const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-FS7TM55D.js");
12767
+ const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-A6JUT2SF.js");
12559
12768
  orch.setMaxConcurrent(maxConcurrentAgents2());
12560
12769
  } catch {
12561
12770
  }
@@ -13134,7 +13343,7 @@ async function startMcpServer() {
13134
13343
  if (!worktreeProfile) {
13135
13344
  registerConnectedIssueVendorTools(server);
13136
13345
  const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await import("./caffeinate-hold-ZNUEZGHB.js");
13137
- const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-FS7TM55D.js");
13346
+ const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-A6JUT2SF.js");
13138
13347
  const accountDefaults = resolveThreadDefaults2();
13139
13348
  const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
13140
13349
  server.tool(
@@ -15776,7 +15985,7 @@ async function continueSourceThread(threadId, prompt) {
15776
15985
  await continueOnReply(threadId, prompt);
15777
15986
  return;
15778
15987
  }
15779
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5JCAJGV.js");
15988
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-POMFVZLB.js");
15780
15989
  await getOrchestrator2().send(threadId, prompt);
15781
15990
  } catch {
15782
15991
  }
@@ -25,12 +25,12 @@ import {
25
25
  rewriteLinearError,
26
26
  updateLinearIssue,
27
27
  validateLinearApiKey
28
- } from "./chunk-GUIJMZQG.js";
28
+ } from "./chunk-NQHEEGTH.js";
29
29
  import "./chunk-DBKHL7NC.js";
30
30
  import "./chunk-W3ZLE4PO.js";
31
31
  import "./chunk-JAT3JFOS.js";
32
32
  import "./chunk-6K64FJDD.js";
33
- import "./chunk-TKEYXNXY.js";
33
+ import "./chunk-4PHOJMZI.js";
34
34
  import "./chunk-4TR3HZFT.js";
35
35
  import "./chunk-WDRMZKVB.js";
36
36
  import "./chunk-KI45T4DI.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listAssignedLinearIssues
3
- } from "./chunk-D7US5R4H.js";
3
+ } from "./chunk-O5WRVQFT.js";
4
4
  export {
5
5
  listAssignedLinearIssues
6
6
  };
@@ -11264,6 +11264,7 @@ var init_coordinator_prompt = __esm({
11264
11264
  "- Recurring multi-item / fan-out: if the child worktree has `.claude/skills/graph-engineering/SKILL.md`, tell the worker to follow it (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch three threads.",
11265
11265
  "- Recurring shapes: have the worktree agent write `.claude/skills/<kebab-name>/SKILL.md` (commit it) so later threads and native Claude Code / attach see it. Merge-review sentences go in `.claude/skills/review/SKILL.md` when that skill already exists; otherwise `.context/review.md` (do not create a review skill). Do not use `.sideboard/skills/` (that folder only). Codex/OpenCode: one line in AGENTS.md pointing at that file.",
11266
11266
  "- One-offs: no guide. Same miss across threads: edit the existing skill or `.context/review.md`, then rerun the batch \u2014 do not patch three threads.",
11267
+ "- A miss that will recur (the worker made it twice, or a person told them the rule): if the worktree has `.claude/skills/skill-improver/SKILL.md`, tell the worker to follow it (`/skill-improver`) in that turn \u2014 one sentence in the skill that owns it, in the same change. The worker who heard it writes it down; no Sideboard tool hands that chat to a later run.",
11267
11268
  "Human-only (do not attempt): ready-for-review land (confirm_land), purge_chat.",
11268
11269
  "Chat links in replies: when mentioning a chat/thread for the user, include a markdown link `[Title](sideboard://chat/<id>)` using the full id (or the link field from create_workspace / list_chats). Sideboard renders these as clickable opens.",
11269
11270
  "Bash / Read / etc: allowed for (1) inspecting target worktrees / registered repo paths from MCP, and (2) greenfield setup under ~/sideboard/repos (git clone, gh repo create, git init+remote). Never git init/clone *inside* this synthetic home cwd \u2014 emptiness here is expected, not a bug."
@@ -29278,7 +29279,7 @@ function formatProcessGuideDirective(opts) {
29278
29279
  hasInstallSkill ? "- After merge-from-main / lockfile change, or a hung `pnpm install`: follow `.claude/skills/worktree-install/SKILL.md` (`/worktree-install`). Use the worktree-local store Sideboard already set; do not share `~/.pnpm-store` across concurrent worktrees." : null,
29279
29280
  "- If this same shape of work will happen again, write `.claude/skills/<kebab-name>/SKILL.md` in this worktree (Claude Code project skill; Sideboard `/name`, Claude Code, and `attach` all load it). Not under `.sideboard/skills/`. Point Codex/OpenCode at it from `AGENTS.md`.",
29280
29281
  hasReviewSkill ? "- Merge-readiness notes go in `.claude/skills/review/SKILL.md` (edit it; do not create another review skill)." : "- Merge-readiness notes go in `.context/review.md` (copied from `.sideboard/review.md` when that file exists). Do not create a review skill.",
29281
- "- Skip a guide for a one-off. If a matching skill exists, follow it. Same miss twice \u2192 edit the skill, do not patch around it."
29282
+ !!worktree && (0, import_node_fs66.existsSync)((0, import_node_path66.join)(worktree, ".claude/skills/skill-improver/SKILL.md")) ? "- Skip a guide for a one-off. If a matching skill exists, follow it. A miss that will recur (you made it twice, or a person told you the rule) \u2192 follow `.claude/skills/skill-improver/SKILL.md` (`/skill-improver`): one sentence in the skill that owns it, in this change. Do not patch around it." : "- Skip a guide for a one-off. If a matching skill exists, follow it. Same miss twice \u2192 edit the skill, do not patch around it."
29282
29283
  ].filter(Boolean).join("\n");
29283
29284
  }
29284
29285
  function formatLongRunningDirective(opts) {
@@ -45,7 +45,7 @@ import {
45
45
  syncBoardPins,
46
46
  workspaceTagTargetRef,
47
47
  writeAgentBlock
48
- } from "../chunk-KCZM7WZ3.js";
48
+ } from "../chunk-5IMXA563.js";
49
49
  import "../chunk-DC3VZXMA.js";
50
50
  import {
51
51
  SIDEBOARD_THREAD_ID_ENV,
@@ -55,7 +55,7 @@ import {
55
55
  shouldRegisterMcpWaitForTurn,
56
56
  sideboardMcpProfile,
57
57
  worktreeMcpToolNames
58
- } from "../chunk-S3DTEGMK.js";
58
+ } from "../chunk-TW63CYUA.js";
59
59
  import {
60
60
  mcpWaitForJobTimeoutMs,
61
61
  mcpWaitForTurnTimeoutMs,
@@ -66,7 +66,7 @@ import {
66
66
  waitForDetachedJob,
67
67
  waitForTurnToolResult,
68
68
  workspaceAgentChatSummaries
69
- } from "../chunk-DEQLDEYR.js";
69
+ } from "../chunk-BD7KUYJA.js";
70
70
  import {
71
71
  HUGE_TOOL_RESULT_SUMMARY,
72
72
  clipToolResultForStore,
@@ -106,7 +106,7 @@ import {
106
106
  isCloudCoordinatorThread,
107
107
  isGlobalThread,
108
108
  isOrchestratorThread
109
- } from "../chunk-5BFEHSHO.js";
109
+ } from "../chunk-J3BQHHDZ.js";
110
110
  import {
111
111
  canonicalizeRepoPath,
112
112
  formatGhLandError,