Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(push): forward the mirror inbox event id in push payloads
reviewaee306dd0a33
diff --git a/src/core/push-notify.test.ts b/src/core/push-notify.test.tsindex 7e4bf7a82..b6c4dc441 100644--- a/src/core/push-notify.test.ts+++ b/src/core/push-notify.test.ts@@ -244,6 +244,7 @@ describe('createPushNotify', () => {expect(body.hostLabel).toBe('niova')expect(body.events[0]).toEqual({kind: 'approval',+ eventId: 'id', // the mirror InboxEvent.id, renamed — the raw `id` key itself stays outtitle: 'Approve write to /etc/hosts',detail: 'Edit needs sudo',nodeId: 'node-9',@@ -257,6 +258,27 @@ describe('createPushNotify', () => {h.stop()})+ it('forwards the mirror inbox event id as eventId on an immediate send', async () => {+ const em = makeEmitter()+ const h = createPushNotify(baseDeps({ subscribe: em.subscribe }))+ em.emit(iev({ nodeId: 'a', id: '1789-7', title: 'A' }))+ await vi.advanceTimersByTimeAsync(2000)+ expect(fetchMock).toHaveBeenCalledTimes(1)+ expect(bodyOf().events[0].eventId).toBe('1789-7')+ h.stop()+ })++ it('batched events each carry their OWN eventId, in order', async () => {+ const em = makeEmitter()+ const h = createPushNotify(baseDeps({ subscribe: em.subscribe }))+ em.emit(iev({ nodeId: 'a', id: '1000-1', title: 'A' }))+ em.emit(iev({ nodeId: 'b', id: '1000-2', kind: 'done', title: 'B' }))+ await vi.advanceTimersByTimeAsync(2000)+ expect(fetchMock).toHaveBeenCalledTimes(1)+ expect(bodyOf().events.map((e) => e.eventId)).toEqual(['1000-1', '1000-2'])+ h.stop()+ })+it('honors NODETERM_API_BASE override', async () => {const em = makeEmitter()const h = createPushNotify(@@ -512,6 +534,19 @@ describe('createPushNotify', () => {h.stop()})+ it('grant-mode POSTs carry the same eventId as host mode', async () => {+ const em = makeEmitter()+ const h = createPushNotify(grantDeps({ subscribe: em.subscribe }))+ em.emit(iev({ nodeId: 'a', id: '2000-3', title: 'A' }))+ await vi.advanceTimersByTimeAsync(2000)+ expect(fetchMock).toHaveBeenCalledTimes(2)+ for (const c of fetchMock.mock.calls) {+ expect(c[1].headers.authorization).toMatch(/^Bearer /)+ expect(JSON.parse(c[1].body).events[0].eventId).toBe('2000-3')+ }+ h.stop()+ })+it('marks a grant dead on a 401/403 (only the failing one)', async () => {const dead: string[] = []// tok-A → 403, tok-B → 200 (keyed on the Bearer header).@@ -805,6 +840,23 @@ describe('createPushNotify', () => {h.stop()})+ it('a held event flushed on the away edge still carries its eventId', async () => {+ const em = makeEmitter()+ const pres = presenceEmitter()+ const h = createPushNotify(+ baseDeps({ subscribe: em.subscribe, isUserPresent: () => true, subscribePresence: pres.subscribe })+ )+ em.emit(iev({ nodeId: 'a', id: '3000-1', title: 'A' }))+ em.emit(iev({ nodeId: 'b', id: '3000-2', title: 'B' }))+ await vi.advanceTimersByTimeAsync(2000)+ expect(fetchMock).not.toHaveBeenCalled() // held while present+ pres.away()+ await vi.advanceTimersByTimeAsync(2000)+ expect(fetchMock).toHaveBeenCalledTimes(1)+ expect(bodyOf().events.map((e) => e.eventId)).toEqual(['3000-1', '3000-2'])+ h.stop()+ })+it('on the away flush, DROPS held events resolved in the mirror and sends the rest', async () => {const em = makeEmitter()const pres = presenceEmitter()diff --git a/src/core/push-notify.ts b/src/core/push-notify.tsindex c137c3d4e..33e01b3ff 100644--- a/src/core/push-notify.ts+++ b/src/core/push-notify.ts@@ -50,6 +50,9 @@ export interface PushHostIdentity {/** The per-event body the backend `/v1/push/notify` expects (a subset of InboxEvent). */export interface PushNotifyEvent {kind: 'approval' | 'question' | 'done'+ /** The mirror inbox event id (`InboxEvent.id`, `${ts}-${seq}`), so a phone can claim the exact+ * Inbox card. The backend forwards it to FCM only; the APNs payload never carries it. */+ eventId?: stringtitle: stringdetail?: stringnodeId: string@@ -580,6 +583,7 @@ export function createPushNotify(deps: PushNotifyDeps): PushNotifyHandle {}const payload: PushNotifyEvent = {kind: e.kind,+ eventId: e.id,title: e.title,...(e.detail ? { detail: e.detail } : {}),nodeId: e.nodeId,