@xopcai/xopc 0.0.485 → 0.0.486

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 (167) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/server/chunks.bin +982 -949
  4. package/dist/gateway/server/chunks.json +1 -1
  5. package/dist/gateway/static/root/assets/agent-run-error-parser-DsXmcKt-.js +1 -0
  6. package/dist/gateway/static/root/assets/{api-CGs641OT.js → api-CGrHK9ij.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-CH9wENBj.js → apps-page-6xeWvMpF.js} +1 -1
  8. package/dist/gateway/static/root/assets/{automations-page-uY_wmZY1.js → automations-page-BLFBqaPX.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-workspace-DyQq55Rh.js → automations-workspace-DiO3Iyuj.js} +2 -2
  10. package/dist/gateway/static/root/assets/{capabilities-abgigXV1.js → capabilities-CW-vdkz6.js} +1 -1
  11. package/dist/gateway/static/root/assets/{capabilities-BaKHutgZ.js → capabilities-DZrjA95P.js} +1 -1
  12. package/dist/gateway/static/root/assets/capabilities-page-DQrfkrBA.js +2 -0
  13. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BOwbZn9X.js → capabilities-settings-panel-DIT2dvtc.js} +1 -1
  14. package/dist/gateway/static/root/assets/{channels-DlnXbcOj.js → channels-Dcr5dgqw.js} +1 -1
  15. package/dist/gateway/static/root/assets/{chat-page-3fVhP77N.js → chat-page-DWZCzxY7.js} +31 -31
  16. package/dist/gateway/static/root/assets/{chat-terminal-dock-DE8j-K9d.js → chat-terminal-dock-DCUuwiTt.js} +1 -1
  17. package/dist/gateway/static/root/assets/composer-payload-handoff-a0quQ25p.js +1 -0
  18. package/dist/gateway/static/root/assets/connected-providers-grid-BJKEp0SE.js +1 -0
  19. package/dist/gateway/static/root/assets/{connectors-page-BJm1jjct.js → connectors-page-BteRI1XM.js} +1 -1
  20. package/dist/gateway/static/root/assets/{extension-debug-page-D3X7SlzG.js → extension-debug-page-4jJ1uVQJ.js} +1 -1
  21. package/dist/gateway/static/root/assets/{extension-iframe-host-CIAq7PSn.js → extension-iframe-host-CJV5JETm.js} +1 -1
  22. package/dist/gateway/static/root/assets/{extension-message-router-B2wbucV7.js → extension-message-router-B4I-Y6qs.js} +1 -1
  23. package/dist/gateway/static/root/assets/{extension-page-qwY7r1_p.js → extension-page-lc7a84nG.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-provider-DFcRbTHI.js → extension-provider-D8_mIBI0.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-settings-page-Cpnh9lcZ.js → extension-settings-page-Uw2lfWRh.js} +1 -1
  26. package/dist/gateway/static/root/assets/{home-page-BusNFHe-.js → home-page-mSRCU81k.js} +4 -4
  27. package/dist/gateway/static/root/assets/{home-task-actions-C8Fi6GBq.js → home-task-actions-_ZAc57Y7.js} +1 -1
  28. package/dist/gateway/static/root/assets/{index-790PGhZb.js → index-CJAEAcZV.js} +7 -7
  29. package/dist/gateway/static/root/assets/{local-app-workbench-page-B9uSL1Mi.js → local-app-workbench-page-C3Lqi8E1.js} +1 -1
  30. package/dist/gateway/static/root/assets/{note-detail-panel-Bwm_aehq.js → note-detail-panel-uc-5k3a2.js} +3 -3
  31. package/dist/gateway/static/root/assets/{notes-page-DkZWV3Ds.js → notes-page-RPfvHnl6.js} +1 -1
  32. package/dist/gateway/static/root/assets/{page-context-capture-button-BXSBeGms.js → page-context-capture-button-CVHz9b6c.js} +1 -1
  33. package/dist/gateway/static/root/assets/{personal-page-cauym9hr.js → personal-page-Dt1d3tQT.js} +1 -1
  34. package/dist/gateway/static/root/assets/{personal-profile-settings-TcI0Zfwr.js → personal-profile-settings-XiT1MgTK.js} +1 -1
  35. package/dist/gateway/static/root/assets/{personal-settings-panel-BJ46T7ZO.js → personal-settings-panel-bcw04REt.js} +1 -1
  36. package/dist/gateway/static/root/assets/{preview-runtime-C1U57WSM.js → preview-runtime-FtWOW5i4.js} +1 -1
  37. package/dist/gateway/static/root/assets/{product-automation-feedback-GA_YPLkr.js → product-automation-feedback-DdFoCDzG.js} +1 -1
  38. package/dist/gateway/static/root/assets/product-preview-content-B3mzl6-f.js +1 -0
  39. package/dist/gateway/static/root/assets/product-preview-modal-5kTp_7Qk.js +2 -0
  40. package/dist/gateway/static/root/assets/project-detail-page-DGPfKx5M.js +7 -0
  41. package/dist/gateway/static/root/assets/{projects-page-BHQxQGTd.js → projects-page-C-9x23LR.js} +1 -1
  42. package/dist/gateway/static/root/assets/route-preload-CzorjVc9.js +2 -0
  43. package/dist/gateway/static/root/assets/routine-panel-n4IstC8Y.js +2 -0
  44. package/dist/gateway/static/root/assets/session-manager-C2MCS4C5.js +28 -0
  45. package/dist/gateway/static/root/assets/{settings-page-Cd9WZ-Ac.js → settings-page-DsM_f07M.js} +1 -1
  46. package/dist/gateway/static/root/assets/{share-preview-page-Di5_ukH8.js → share-preview-page-C32Mq-BY.js} +1 -1
  47. package/dist/gateway/static/root/assets/{shares-settings-CirGM67m.js → shares-settings-BDGbs8wz.js} +1 -1
  48. package/dist/gateway/static/root/assets/space-page-DwyuUvI3.js +2 -0
  49. package/dist/gateway/static/root/assets/task-copy-CtcqCQ78.js +1 -0
  50. package/dist/gateway/static/root/assets/task-detail-page-DdCpNW8K.js +3 -0
  51. package/dist/gateway/static/root/assets/{task-header-title-qzNctGl5.js → task-header-title-CLt_lmjb.js} +1 -1
  52. package/dist/gateway/static/root/assets/task-result-presentation-CgvcqEMD.js +1 -0
  53. package/dist/gateway/static/root/assets/task-run-issue-notice-8FX876PP.js +1 -0
  54. package/dist/gateway/static/root/assets/tasks-CvOAtEHv.js +1 -0
  55. package/dist/gateway/static/root/assets/turn-outcome-Dtw6OgwL.js +1 -0
  56. package/dist/gateway/static/root/assets/{use-composer-attachments-DJsIzJ1c.js → use-composer-attachments-BEuyorVm.js} +1 -1
  57. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BFF2vXm5.js → use-file-preview-expanded-Cehu0745.js} +1 -1
  58. package/dist/gateway/static/root/assets/use-personal-work-B25WRGHj.js +1 -0
  59. package/dist/gateway/static/root/assets/{use-realtime-voice-9OvLwHzk.js → use-realtime-voice-CV3GIt_T.js} +1 -1
  60. package/dist/gateway/static/root/assets/{use-workspace-tree-LCIT1H-D.js → use-workspace-tree-C0C861cb.js} +1 -1
  61. package/dist/gateway/static/root/assets/{voice-settings-j8o-hGTm.js → voice-settings-JpPo3BvX.js} +1 -1
  62. package/dist/gateway/static/root/assets/workspace-api-CQOuWbVv.js +2 -0
  63. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-DwVWTehC.js → workspace-file-preview-dialog-CmMueTmW.js} +1 -1
  64. package/dist/gateway/static/root/index.html +29 -27
  65. package/dist/package.js +1 -1
  66. package/dist/packages/gateway-contract/src/index.js +3 -1
  67. package/dist/packages/gateway-contract/src/notifications.js +1 -8
  68. package/dist/packages/gateway-contract/src/task-display.js +9 -2
  69. package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
  70. package/dist/packages/gateway-contract/src/task-research-result.js +2 -1
  71. package/dist/packages/gateway-contract/src/tasks.js +6 -1
  72. package/dist/packages/gateway-contract/src/user-message-text.js +64 -0
  73. package/dist/src/agent/embedded/run-for-session.js +27 -28
  74. package/dist/src/agent/embedded/session-runner.js +14 -1
  75. package/dist/src/agent/fallback/candidates.d.ts +1 -0
  76. package/dist/src/agent/fallback/candidates.js +1 -1
  77. package/dist/src/agent/image/generation/provider-registry.js +3 -1
  78. package/dist/src/agent/models/manager.d.ts +1 -1
  79. package/dist/src/agent/models/manager.js +2 -1
  80. package/dist/src/agent/models/turn-candidates.d.ts +16 -0
  81. package/dist/src/agent/models/turn-candidates.js +55 -0
  82. package/dist/src/agent/service.d.ts +1 -0
  83. package/dist/src/agent/service.js +12 -0
  84. package/dist/src/agent/skills/installer.js +2 -2
  85. package/dist/src/auth/credentials.js +3 -1
  86. package/dist/src/auth/oauth/index.d.ts +0 -1
  87. package/dist/src/auth/oauth/index.js +1 -4
  88. package/dist/src/auth/oauth/registry.js +0 -4
  89. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  90. package/dist/src/cli/command-manifest.js +1 -1
  91. package/dist/src/cli/commands/auth.js +4 -2
  92. package/dist/src/cli/commands/models.js +12 -10
  93. package/dist/src/config/models-json.js +1 -2
  94. package/dist/src/gateway/agent-reactions/reaction.d.ts +1 -2
  95. package/dist/src/gateway/agent-reactions/reaction.js +10 -21
  96. package/dist/src/gateway/custom-image-providers.js +4 -1
  97. package/dist/src/gateway/hono/oauth.js +3 -0
  98. package/dist/src/gateway/hono/routes/device-push.js +55 -15
  99. package/dist/src/gateway/hono/routes/home.js +1 -1
  100. package/dist/src/gateway/hono/routes/mobile-mcp-setup.js +49 -29
  101. package/dist/src/gateway/hono/routes/notifications.js +12 -1
  102. package/dist/src/gateway/hono/routes/sessions.js +1 -13
  103. package/dist/src/gateway/security/gateway-scopes.js +1 -0
  104. package/dist/src/gateway/service/run-gateway-agent.js +2 -13
  105. package/dist/src/gateway/service.js +84 -64
  106. package/dist/src/home-intelligence/host.js +5 -5
  107. package/dist/src/local-apps/capabilities/projections.d.ts +5 -5
  108. package/dist/src/notifications/device-store.d.ts +3 -0
  109. package/dist/src/notifications/device-store.js +14 -1
  110. package/dist/src/notifications/platform-push.d.ts +17 -0
  111. package/dist/src/notifications/platform-push.js +58 -0
  112. package/dist/src/notifications/service.d.ts +2 -2
  113. package/dist/src/notifications/service.js +26 -12
  114. package/dist/src/notifications/store.d.ts +1 -1
  115. package/dist/src/notifications/store.js +3 -2
  116. package/dist/src/providers/env-keys.js +0 -1
  117. package/dist/src/providers/index.js +1 -7
  118. package/dist/src/providers/model-catalog-sync-service.js +3 -1
  119. package/dist/src/providers/model-registry.js +6 -2
  120. package/dist/src/providers/presentation.js +1 -2
  121. package/dist/src/providers/provider-policy.js +2 -1
  122. package/dist/src/session/client-history.js +3 -3
  123. package/dist/src/session/user-message-display.js +3 -2
  124. package/dist/src/storage/sqlite/agent-reaction-repository.d.ts +2 -4
  125. package/dist/src/storage/sqlite/agent-reaction-repository.js +18 -13
  126. package/dist/src/storage/sqlite/device-access-repository.js +2 -1
  127. package/dist/src/tasks/capabilities/write.d.ts +2 -0
  128. package/dist/src/tasks/home-query-service.js +2 -1
  129. package/dist/src/tasks/task-contract-planner.js +1 -0
  130. package/dist/src/tasks/task-conversation-summary.d.ts +1 -1
  131. package/dist/src/tasks/task-delivery-checks.d.ts +12 -0
  132. package/dist/src/tasks/task-delivery-checks.js +91 -0
  133. package/dist/src/tasks/task-final-reply.d.ts +3 -1
  134. package/dist/src/tasks/task-final-reply.js +17 -4
  135. package/dist/src/tasks/task-model-call.js +4 -2
  136. package/dist/src/tasks/task-origin-repository.d.ts +1 -1
  137. package/dist/src/tasks/task-read-model-projector.js +24 -7
  138. package/dist/src/tasks/task-research-result.js +12 -27
  139. package/dist/src/tasks/task-result-delivery-repository.js +3 -2
  140. package/dist/src/tasks/task-retry-service.js +2 -1
  141. package/dist/src/tasks/task-run-coordinator.js +14 -4
  142. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  143. package/dist/src/tasks/task-run-dispatcher.js +78 -48
  144. package/dist/src/tasks/task-run-repository.js +1 -1
  145. package/package.json +1 -1
  146. package/dist/gateway/static/root/assets/capabilities-page-WCl7Fdce.js +0 -2
  147. package/dist/gateway/static/root/assets/composer-payload-handoff-ClWsunJ2.js +0 -1
  148. package/dist/gateway/static/root/assets/connected-providers-grid-BgW-ioIt.js +0 -1
  149. package/dist/gateway/static/root/assets/product-preview-content-BOq3gtSJ.js +0 -1
  150. package/dist/gateway/static/root/assets/product-preview-modal-DIh_CsXp.js +0 -2
  151. package/dist/gateway/static/root/assets/project-detail-page-D9WKZe3z.js +0 -7
  152. package/dist/gateway/static/root/assets/route-preload-DF8LOfKW.js +0 -2
  153. package/dist/gateway/static/root/assets/routine-panel-Bfbiz0IN.js +0 -2
  154. package/dist/gateway/static/root/assets/session-manager-DUWeBdeG.js +0 -28
  155. package/dist/gateway/static/root/assets/space-page-DlJB7GT1.js +0 -2
  156. package/dist/gateway/static/root/assets/task-detail-page-BFa0Px-B.js +0 -3
  157. package/dist/gateway/static/root/assets/task-run-issue-notice-CGrUMy0s.js +0 -1
  158. package/dist/gateway/static/root/assets/tasks-CwyNaa-j.js +0 -1
  159. package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +0 -1
  160. package/dist/gateway/static/root/assets/use-personal-work-B1DWeBnm.js +0 -1
  161. package/dist/gateway/static/root/assets/workspace-api-BuNWyNvA.js +0 -2
  162. package/dist/src/auth/oauth/google-antigravity.d.ts +0 -4
  163. package/dist/src/auth/oauth/google-antigravity.js +0 -9
  164. package/dist/src/auth/oauth/google-oauth/google-antigravity.d.ts +0 -25
  165. package/dist/src/auth/oauth/google-oauth/google-antigravity.js +0 -309
  166. package/dist/src/notifications/harmony-push.d.ts +0 -27
  167. package/dist/src/notifications/harmony-push.js +0 -96
@@ -38,6 +38,7 @@ const authSchema = z.enum([
38
38
  "auto",
39
39
  "none",
40
40
  "bearer",
41
+ "apiKey",
41
42
  "headers",
42
43
  "oauth"
43
44
  ]);
@@ -385,19 +386,8 @@ function entry(t, options = {}) {
385
386
  label: t("认证方式", "Authentication"),
386
387
  type: "select",
387
388
  value: options.method ?? "auto",
388
- advanced: true,
389
389
  visibleWhen: link,
390
- options: [
391
- {
392
- id: "auto",
393
- label: t("自动识别", "Detect automatically")
394
- },
395
- {
396
- id: "none",
397
- label: t("无需认证", "No authentication")
398
- },
399
- ...authOptions(t)
400
- ]
390
+ options: authOptions(t)
401
391
  },
402
392
  {
403
393
  id: "commandName",
@@ -449,17 +439,29 @@ function entry(t, options = {}) {
449
439
  }
450
440
  function authOptions(t) {
451
441
  return [
442
+ {
443
+ id: "auto",
444
+ label: t("自动探测", "Detect automatically")
445
+ },
446
+ {
447
+ id: "oauth",
448
+ label: t("OAuth 浏览器授权", "OAuth in browser")
449
+ },
452
450
  {
453
451
  id: "bearer",
454
452
  label: "Bearer Token"
455
453
  },
454
+ {
455
+ id: "apiKey",
456
+ label: "API Key"
457
+ },
456
458
  {
457
459
  id: "headers",
458
460
  label: t("自定义请求头", "Custom request headers")
459
461
  },
460
462
  {
461
- id: "oauth",
462
- label: t("OAuth 浏览器授权", "OAuth in browser")
463
+ id: "none",
464
+ label: t("无需认证", "No authentication")
463
465
  }
464
466
  ];
465
467
  }
@@ -546,7 +548,12 @@ function createMobileMcpSetup(drafts, readHost, publish) {
546
548
  }
547
549
  function needsAuth(flow, t, message) {
548
550
  flow.phase = "auth";
549
- const initial = flow.method === "bearer" || flow.method === "headers" ? flow.method : flow.rejectedHeaders ? "headers" : "";
551
+ const initial = flow.method && flow.method !== "auto" && flow.method !== "oauth" ? flow.method : flow.rejectedHeaders ? "headers" : "";
552
+ const apiKey = {
553
+ field: "method",
554
+ value: "apiKey"
555
+ };
556
+ const previousKeyHeader = flow.method === "apiKey" ? Object.keys(flow.candidate?.server.headers ?? {})[0] : void 0;
550
557
  return {
551
558
  flow: flow.id,
552
559
  ...reviewSummary(flow.candidate, t),
@@ -571,6 +578,20 @@ function createMobileMcpSetup(drafts, readHost, publish) {
571
578
  value: "bearer"
572
579
  }
573
580
  },
581
+ {
582
+ id: "apiKeyHeader",
583
+ label: t("API Key 请求头名称", "API Key header name"),
584
+ type: "text",
585
+ value: previousKeyHeader ?? "X-API-Key",
586
+ hint: "X-API-Key",
587
+ visibleWhen: apiKey
588
+ },
589
+ {
590
+ id: "apiKey",
591
+ label: "API Key",
592
+ type: "secret",
593
+ visibleWhen: apiKey
594
+ },
574
595
  {
575
596
  id: "requestHeaders",
576
597
  label: t("请求头", "Request headers"),
@@ -583,7 +604,7 @@ function createMobileMcpSetup(drafts, readHost, publish) {
583
604
  ],
584
605
  actions: [{
585
606
  id: "verify",
586
- label: t("继续认证", "Continue authentication")
607
+ label: t("检查连接", "Check connection")
587
608
  }, backAction(t)]
588
609
  };
589
610
  }
@@ -661,10 +682,11 @@ function createMobileMcpSetup(drafts, readHost, publish) {
661
682
  if (flow.candidate?.server.type === "stdio") assertMobileStdioAllowed(readHost().allowStdio, t);
662
683
  const result = await drafts.probe(flow.owner, flow.draftId);
663
684
  if (result.state === "connected") return verified(flow, t, result.toolCount ?? 0);
664
- if (result.state === "oauth_required") return oauthReady(flow, t);
665
- if (result.state === "token_required" || result.state === "auth_unknown") {
666
- flow.rejectedHeaders = result.state === "token_required" && Boolean(flow.candidate?.server.headers);
667
- return needsAuth(flow, t, result.state === "token_required" ? t("服务未接受这些凭据,请核对后重试。", "The service did not accept these credentials. Check them and try again.") : t("此服务要求认证。请根据服务商的说明选择认证方式。", "This service requires authentication. Choose the method specified by the provider."));
685
+ if (result.state === "oauth_required" && flow.method !== "none") return oauthReady(flow, t);
686
+ if (result.state === "oauth_required" || result.state === "token_required" || result.state === "auth_unknown" || flow.candidate?.server.url && result.errorCode === "access_denied") {
687
+ const hasCredentials = Object.keys(flow.candidate?.server.headers ?? {}).length > 0;
688
+ flow.rejectedHeaders = hasCredentials;
689
+ return needsAuth(flow, t, hasCredentials ? t("服务拒绝了访问。请检查凭据和权限,或切换认证方式。", "Access was denied. Check your credentials and permissions, or choose another authentication method.") : t("此服务要求认证。请根据服务商的说明选择认证方式。", "This service requires authentication. Choose the method specified by the provider."));
668
690
  }
669
691
  return retry(flow, t, result);
670
692
  }
@@ -678,7 +700,7 @@ function createMobileMcpSetup(drafts, readHost, publish) {
678
700
  }
679
701
  async function connect(flow, t) {
680
702
  const method = flow.method;
681
- if (method === "headers" || method === "bearer" && !flow.candidate?.server.headers) return needsAuth(flow, t);
703
+ if (method === "apiKey" || method === "headers" || method === "bearer" && !flow.candidate?.server.headers) return needsAuth(flow, t);
682
704
  return testDraft(flow, t);
683
705
  }
684
706
  async function testDraft(flow, t) {
@@ -847,22 +869,20 @@ function createMobileMcpSetup(drafts, readHost, publish) {
847
869
  return await connect(flow, t);
848
870
  }
849
871
  if (action === "verify" && flow.phase === "auth" && flow.candidate) {
850
- const method = z.enum([
851
- "bearer",
852
- "headers",
853
- "oauth"
854
- ]).safeParse(values.method);
872
+ const method = authSchema.safeParse(values.method);
855
873
  if (!method.success) throw new McpDraftError(400, t("请选择认证方式。", "Choose an authentication method."));
856
874
  const server = { ...flow.candidate.server };
857
- if (method.data === "bearer" || method.data === "oauth") server.headers = Object.fromEntries(Object.entries(server.headers ?? {}).filter(([name]) => name.toLowerCase() !== AUTHORIZATION_HEADER));
858
- if (method.data === "bearer") Object.assign(server.headers, bearerHeaders(values.token, t));
859
- if (method.data === "headers") server.headers = headerMap(keyValueRows(values.requestHeaders, t).filter(([name, value]) => name.trim() || value.trim()), t);
875
+ if (method.data !== "oauth" || flow.method !== "oauth") server.headers = void 0;
876
+ if (method.data === "bearer") server.headers = bearerHeaders(values.token, t);
877
+ else if (method.data === "apiKey") server.headers = headerMap([[values.apiKeyHeader ?? "X-API-Key", values.apiKey ?? ""]], t);
878
+ else if (method.data === "headers") server.headers = headerMap(keyValueRows(values.requestHeaders, t).filter(([name, value]) => name.trim() || value.trim()), t);
860
879
  if (method.data !== "oauth") server.oauth = void 0;
861
880
  flow.candidate = {
862
881
  ...flow.candidate,
863
882
  server
864
883
  };
865
884
  flow.method = method.data;
885
+ flow.rejectedHeaders = false;
866
886
  return await testDraft(flow, t);
867
887
  }
868
888
  if (action === "change-auth" && flow.phase === "oauth") return needsAuth(flow, t);
@@ -1,4 +1,6 @@
1
+ import { getDevice } from "../../../storage/sqlite/device-access-repository.js";
1
2
  import { acknowledgeNotification, listNotificationEvents, notificationDeliveryMetrics } from "../../../notifications/store.js";
3
+ import { getGatewayPrincipal } from "../../security/gateway-principal.js";
2
4
  //#region src/gateway/hono/routes/notifications.ts
3
5
  function integerQuery(value, min, max) {
4
6
  if (!value) return void 0;
@@ -28,7 +30,16 @@ function registerNotificationRoutes(authenticated, _deps) {
28
30
  ok: false,
29
31
  error: "Invalid notification acknowledgement"
30
32
  }, 400);
31
- if (!acknowledgeNotification(c.req.param("id"), consumerId, surface)) return c.json({
33
+ const principal = getGatewayPrincipal(c);
34
+ const deviceId = principal.kind === "device" ? principal.deviceId : void 0;
35
+ if (principal.kind === "device") {
36
+ const device = deviceId && getDevice(deviceId);
37
+ if (!device || surface !== "mobile" || consumerId !== `${device.platform}:${deviceId}`) return c.json({
38
+ ok: false,
39
+ error: "Invalid device acknowledgement"
40
+ }, 403);
41
+ }
42
+ if (!acknowledgeNotification(c.req.param("id"), consumerId, surface, deviceId)) return c.json({
32
43
  ok: false,
33
44
  error: "Notification not found"
34
45
  }, 404);
@@ -9,7 +9,7 @@ import { messagesToClientHistory } from "../../../session/client-history.js";
9
9
  import { SessionEnvironmentService } from "../../../execution-environments/session-environment-service.js";
10
10
  import { evictEmbeddedSessionRunner } from "../../../agent/embedded/session-runner.js";
11
11
  import { deleteMediaUrisNoLongerReferenced } from "../../../media/session-references.js";
12
- import { DEFAULT_AGENT_REACTION, readAgentReactions } from "../../../storage/sqlite/agent-reaction-repository.js";
12
+ import { readAgentReactions } from "../../../storage/sqlite/agent-reaction-repository.js";
13
13
  import { getGatewayPrincipal } from "../../security/gateway-principal.js";
14
14
  import { createGatewayRouteLogger, logRouteError } from "../lib/route-logger.js";
15
15
  import { patchChatModelConfig } from "./chat-model-config.js";
@@ -471,23 +471,11 @@ function registerSessionsRoutes(authenticated, deps) {
471
471
  const messages = result.session.messages;
472
472
  const entries = messages.flatMap((row) => row.role === "user" && row.transcriptEntryId ? [row.transcriptEntryId] : []);
473
473
  const reactions = new Map(readAgentReactions(key, transcriptId, entries, actor.displayName).map((reaction) => [reaction.entryId, reaction]));
474
- const activeRunId = service.getActiveWebchatRunId(key);
475
474
  for (const row of messages) {
476
475
  const entryId = row.transcriptEntryId;
477
476
  if (row.role !== "user" || !entryId) continue;
478
477
  const saved = reactions.get(entryId);
479
478
  if (saved) row.agentReaction = saved;
480
- else if (!activeRunId || row.turnId !== activeRunId || row.metadata?.steered) row.agentReaction = {
481
- conversationId: key,
482
- transcriptId,
483
- clientMessageId: row.metadata?.clientMessageId ?? entryId,
484
- entryId,
485
- actorAgentId: actor.agentId,
486
- actorName: actor.displayName,
487
- runId: row.turnId ?? entryId,
488
- emoji: DEFAULT_AGENT_REACTION,
489
- createdAtMs: row.timestamp ?? 0
490
- };
491
479
  }
492
480
  }
493
481
  }
@@ -34,6 +34,7 @@ function requiredGatewayScope(method, path) {
34
34
  if (path === "/api/realtime/tickets" || path.startsWith("/api/status")) return "gateway.status";
35
35
  if (path === "/api/device-auth/refresh" || path === "/api/devices/me") return "device.self";
36
36
  if (path.startsWith("/api/devices/me/push")) return "notifications.self";
37
+ if (method === "POST" && /^\/api\/notifications\/[^/]+\/ack$/.test(path)) return "notifications.self";
37
38
  if (method === "POST" && path === "/api/endpoint-tools/devices/revoke") return "gateway.admin";
38
39
  if (/^\/api\/phone\/conversations\/[^/]+\/summary$/.test(path) && method === "GET") return "sessions.read";
39
40
  if (/^\/api\/phone\/conversations\/[^/]+$/.test(path) && method === "GET") return "phone.view";
@@ -44,8 +44,6 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
44
44
  const inputReceivedAtMs = runOptions?.inputReceivedAtMs ?? runStartedAtMs;
45
45
  let firstTextSeen = false;
46
46
  let reactionWindow;
47
- let reactionPending = false;
48
- let publishReactionFallback;
49
47
  const cappedAttachments = attachments && attachments.length > 10 ? attachments.slice(0, 10) : attachments;
50
48
  if (attachments && cappedAttachments && attachments.length > cappedAttachments.length) log.debug({
51
49
  dropped: attachments.length - cappedAttachments.length,
@@ -144,8 +142,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
144
142
  const emitAndYield = function* (events) {
145
143
  for (const event of events) {
146
144
  const firstText = !firstTextSeen && event.type === "assistant_delta" && Boolean(event.payload.delta.trim());
147
- const reactionClosed = firstText || event.type === "clarify_request" || event.type === "review" || event.type === "error" || event.type === "run_end";
148
- if (reactionClosed) reactionWindow?.abort();
145
+ if (firstText || event.type === "clarify_request" || event.type === "review" || event.type === "error" || event.type === "run_end") reactionWindow?.abort();
149
146
  if (firstText) {
150
147
  firstTextSeen = true;
151
148
  const latencyMs = performance.now() - runStartedMonotonic;
@@ -170,7 +167,6 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
170
167
  }
171
168
  if (taskRun) captureTaskEvent(event);
172
169
  if (channel === "webchat") publishRealtime(runTopic, event.type, event);
173
- if (reactionClosed || event.type === "user_message" && !reactionPending) publishReactionFallback?.();
174
170
  yield event;
175
171
  }
176
172
  };
@@ -215,12 +211,9 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
215
211
  actorAgentId: webchatMetadata.agentId
216
212
  };
217
213
  const publish = (reaction) => {
218
- publishReactionFallback = void 0;
219
214
  publishRealtime("sessions", "session.agent-reaction", reaction);
220
215
  };
221
- publishReactionFallback = () => reactions.publishFallback(target, deps.getConfig(), publish);
222
216
  reactionWindow = new AbortController();
223
- reactionPending = true;
224
217
  reactions.consider({
225
218
  target,
226
219
  text: message,
@@ -228,10 +221,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
228
221
  signal: AbortSignal.any([mergedSignal, reactionWindow.signal]),
229
222
  eligible: reactionsEnabled,
230
223
  publish
231
- }).catch(() => {}).finally(() => {
232
- reactionPending = false;
233
- publishReactionFallback?.();
234
- });
224
+ }).catch(() => {});
235
225
  }
236
226
  }
237
227
  let streamError;
@@ -315,7 +305,6 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
315
305
  };
316
306
  } finally {
317
307
  reactionWindow?.abort();
318
- publishReactionFallback?.();
319
308
  if (mergedSignal.aborted) {
320
309
  terminalStatus = "cancelled";
321
310
  taskRunStatus = "cancelled";
@@ -6,7 +6,7 @@ import { getRuntimeLogStats } from "../utils/logger/stats.js";
6
6
  import { createLogger } from "../utils/logger/index.js";
7
7
  import { init_logger } from "../utils/logger.js";
8
8
  import { closeXopcDatabase } from "../storage/sqlite/connection.js";
9
- import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
9
+ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
10
10
  import { getBrowserTabBindingById } from "../storage/sqlite/browser-tab-binding-repository.js";
11
11
  import { buckets } from "./rate-limit/buckets.js";
12
12
  import { resolveEffectiveGatewayPort } from "./host.js";
@@ -106,10 +106,6 @@ import { DiscussionSealer } from "../discussions/sealer.js";
106
106
  import "../discussions/index.js";
107
107
  import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
108
108
  import "../endpoint-tools/index.js";
109
- import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
110
- import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
111
- import { HomeIntelligenceHost } from "../home-intelligence/host.js";
112
- import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
113
109
  import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
114
110
  import { prepareAutomationAgentSession } from "./automation-agent-session.js";
115
111
  import { deliverAutomationCompletion } from "./automation-completion-delivery.js";
@@ -179,6 +175,10 @@ import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decisio
179
175
  import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
180
176
  import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
181
177
  import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
178
+ import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
179
+ import { HomeIntelligenceHost } from "../home-intelligence/host.js";
180
+ import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
181
+ import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
182
182
  import crypto from "node:crypto";
183
183
  //#region src/gateway/service.ts
184
184
  init_session_repository();
@@ -899,6 +899,7 @@ var GatewayService = class {
899
899
  requestedAgentId
900
900
  })).conversationId;
901
901
  },
902
+ preflightModel: (conversationId) => this.agentService.preflightTaskModel(conversationId),
902
903
  validateExecutor: (taskId, agentId) => {
903
904
  const allocation = new TaskAllocationRepository().get(taskId);
904
905
  if (!allocation || !agentId) return;
@@ -1098,75 +1099,94 @@ var GatewayService = class {
1098
1099
  this.taskMainUpdateDispatch();
1099
1100
  }
1100
1101
  async ensureTaskConversation(taskId, options = {}) {
1101
- const task = new TaskRepository().require(taskId);
1102
- const conversations = new TaskConversationRepository();
1103
- const active = conversations.getActiveSession(task.id);
1104
- const allocation = new TaskAllocationRepository().get(taskId);
1105
- if (!active && !options.runId && allocation && allocation.status !== "assigned") throw new Error("Task executor has not been assigned");
1106
- const agentId = resolveProjectAgentId({
1107
- config: this.config,
1108
- projects: this.projects,
1109
- explicitAgentId: options.requestedAgentId ?? task.delegateAgentId,
1110
- projectId: task.projectId
1111
- });
1112
- if (active && (!active.agentId || active.agentId === agentId)) {
1113
- const conversation = conversations.activateExecutionSession({
1114
- taskId: task.id,
1102
+ return runSqliteWriteTransaction(() => {
1103
+ const task = new TaskRepository().require(taskId);
1104
+ const conversations = new TaskConversationRepository();
1105
+ const active = conversations.getActiveSession(task.id);
1106
+ const allocation = new TaskAllocationRepository().get(taskId);
1107
+ const runs = new TaskRunRepository();
1108
+ const run = runs.getActiveRoot(taskId);
1109
+ const runAgentId = run?.executorKind === "agent" && typeof run.executorRef.agentId === "string" ? run.executorRef.agentId : void 0;
1110
+ if (options.runId && (run?.id !== options.runId || !runAgentId)) throw new Error("Task run is no longer active");
1111
+ if (allocation && allocation.status !== "assigned" && !active && !runAgentId) throw new Error("Task executor has not been assigned");
1112
+ const activeAgentId = active ? getSessionMetadata(active.conversationId)?.agentId : void 0;
1113
+ if (active && activeAgentId && !runAgentId && !options.requestedAgentId) return {
1115
1114
  conversationId: active.conversationId,
1116
- agentId,
1117
- runId: options.runId
1118
- });
1119
- return {
1120
- conversationId: active.conversationId,
1121
- agentId,
1115
+ agentId: activeAgentId,
1122
1116
  created: false,
1123
- conversation
1117
+ conversation: conversations.requireState(taskId)
1124
1118
  };
1125
- }
1126
- if (active) {
1127
- const run = new TaskRunRepository().getActiveRoot(taskId);
1128
- if (active.runId || !options.runId || run?.id !== options.runId || run.status !== "queued" || run.executorKind !== "agent" || run.executorRef.agentId !== agentId || allocation?.status !== "assigned" || allocation.selected_agent_id !== agentId || task.delegateAgentId !== agentId) throw new Error("Task executor differs from the active conversation");
1129
- const inputState = getSessionInputState(active.conversationId);
1130
- if (inputState.activeRunId || inputState.inputs.length) throw new Error("Task executor differs from the active conversation");
1131
- }
1132
- const peerId = `task-${sanitizeSegment(task.id) || Date.now()}${options.runId ? `-${sanitizeSegment(options.runId)}` : ""}`;
1133
- const conversationId = resolveConversationId({
1134
- agentId,
1135
- source: "webchat",
1136
- accountId: "default",
1137
- peerKind: "direct",
1138
- peerId
1139
- });
1140
- patchSessionMetadata(conversationId, {
1141
- sourceChannel: "webchat",
1142
- sourceChatId: `default:direct:${peerId}`,
1143
- sessionType: "chat",
1144
- routing: {
1119
+ const agentId = resolveProjectAgentId({
1120
+ config: this.config,
1121
+ projects: this.projects,
1122
+ explicitAgentId: runAgentId ?? options.requestedAgentId ?? task.delegateAgentId,
1123
+ projectId: task.projectId
1124
+ });
1125
+ const runId = runAgentId ? run?.id : void 0;
1126
+ const boundConversationId = runAgentId ? run?.conversationId : void 0;
1127
+ if (active && (!boundConversationId || boundConversationId === active.conversationId) && activeAgentId === agentId && (!active.agentId || active.agentId === agentId)) {
1128
+ const conversation = conversations.activateExecutionSession({
1129
+ taskId,
1130
+ conversationId: active.conversationId,
1131
+ agentId,
1132
+ runId
1133
+ });
1134
+ return {
1135
+ conversationId: active.conversationId,
1136
+ agentId,
1137
+ created: false,
1138
+ conversation
1139
+ };
1140
+ }
1141
+ if (boundConversationId) throw new Error("Task run differs from its bound execution conversation");
1142
+ if (active) {
1143
+ const previousRun = active.runId ? runs.get(active.runId) : void 0;
1144
+ const inputState = getSessionInputState(active.conversationId);
1145
+ if (!runAgentId || run?.status !== "queued" || previousRun && ![
1146
+ "succeeded",
1147
+ "failed",
1148
+ "cancelled"
1149
+ ].includes(previousRun.status) || inputState.activeRunId || inputState.inputs.length) throw new Error("Task executor differs from the active conversation");
1150
+ }
1151
+ const peerId = `task-${sanitizeSegment(task.id) || Date.now()}${runId ? `-${sanitizeSegment(runId)}` : ""}`;
1152
+ const conversationId = resolveConversationId({
1145
1153
  agentId,
1146
1154
  source: "webchat",
1147
1155
  accountId: "default",
1148
1156
  peerKind: "direct",
1149
1157
  peerId
1150
- },
1151
- projectId: task.projectId,
1152
- customData: {
1153
- origin: "task",
1154
- triggerKind: "user",
1155
- ...options.runId ? { taskRunId: options.runId } : {}
1156
- }
1157
- });
1158
- if (task.projectId) this.projects.attachSession(conversationId, task.projectId);
1159
- return {
1160
- conversationId,
1161
- agentId,
1162
- created: true,
1163
- conversation: conversations.activateExecutionSession({
1164
- taskId: task.id,
1158
+ });
1159
+ patchSessionMetadata(conversationId, {
1160
+ sourceChannel: "webchat",
1161
+ sourceChatId: `default:direct:${peerId}`,
1162
+ sessionType: "chat",
1163
+ routing: {
1164
+ agentId,
1165
+ source: "webchat",
1166
+ accountId: "default",
1167
+ peerKind: "direct",
1168
+ peerId
1169
+ },
1170
+ projectId: task.projectId,
1171
+ customData: {
1172
+ origin: "task",
1173
+ triggerKind: "user",
1174
+ ...runId ? { taskRunId: runId } : {}
1175
+ }
1176
+ });
1177
+ if (task.projectId) this.projects.attachSession(conversationId, task.projectId);
1178
+ return {
1165
1179
  conversationId,
1166
1180
  agentId,
1167
- runId: options.runId
1168
- })
1169
- };
1181
+ created: true,
1182
+ conversation: conversations.activateExecutionSession({
1183
+ taskId,
1184
+ conversationId,
1185
+ agentId,
1186
+ runId
1187
+ })
1188
+ };
1189
+ });
1170
1190
  }
1171
1191
  dispatchTaskEvents() {
1172
1192
  new DomainOutboxDispatcher().drain();
@@ -7,14 +7,14 @@ import { TaskRepository, init_task_repository } from "../tasks/task-repository.j
7
7
  import { appendTranscriptEntry } from "../storage/sqlite/transcript-repository.js";
8
8
  import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
9
9
  import { TaskApplicationService } from "../tasks/task-application-service.js";
10
- import { homePatternKey } from "./strategy.js";
11
- import { HomeIntelligenceRepository } from "./repository.js";
12
- import { HomeOpportunityApplicationService } from "./application-service.js";
13
- import { HomeAdvicePolicy } from "./policy.js";
14
10
  import { HomeObservation, ObservationConflictError } from "./observation.js";
15
11
  import { HomeFollowUps } from "./follow-ups.js";
16
- import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
17
12
  import { observationStarters } from "./observation-starters.js";
13
+ import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
14
+ import { homePatternKey } from "./strategy.js";
15
+ import { HomeAdvicePolicy } from "./policy.js";
16
+ import { HomeIntelligenceRepository } from "./repository.js";
17
+ import { HomeOpportunityApplicationService } from "./application-service.js";
18
18
  import { buildHomeOpportunityNotification } from "./notification.js";
19
19
  import { ObservationRoutines } from "./routines.js";
20
20
  import { createHash } from "node:crypto";
@@ -292,9 +292,9 @@ export declare const LocalAppAutomationRunSchema: z.ZodObject<{
292
292
  cancelConfirmedAtMs: z.ZodOptional<z.ZodNumber>;
293
293
  summary: z.ZodOptional<z.ZodString>;
294
294
  failureCode: z.ZodOptional<z.ZodEnum<{
295
+ execution_failed: "execution_failed";
295
296
  budget_exhausted: "budget_exhausted";
296
297
  authorization_ended: "authorization_ended";
297
- execution_failed: "execution_failed";
298
298
  }>>;
299
299
  }, z.core.$strip>;
300
300
  export declare function projectLocalAppRun<T extends {
@@ -303,7 +303,7 @@ export declare function projectLocalAppRun<T extends {
303
303
  status: string;
304
304
  }>(run: T): T & {
305
305
  summary: string;
306
- failureCode: "budget_exhausted" | "authorization_ended" | "execution_failed";
306
+ failureCode: "execution_failed" | "budget_exhausted" | "authorization_ended";
307
307
  };
308
308
  export declare const LocalAppAutomationRunOutputSchema: z.ZodObject<{
309
309
  ok: z.ZodLiteral<true>;
@@ -333,9 +333,9 @@ export declare const LocalAppAutomationRunOutputSchema: z.ZodObject<{
333
333
  cancelConfirmedAtMs: z.ZodOptional<z.ZodNumber>;
334
334
  summary: z.ZodOptional<z.ZodString>;
335
335
  failureCode: z.ZodOptional<z.ZodEnum<{
336
+ execution_failed: "execution_failed";
336
337
  budget_exhausted: "budget_exhausted";
337
338
  authorization_ended: "authorization_ended";
338
- execution_failed: "execution_failed";
339
339
  }>>;
340
340
  }, z.core.$strip>;
341
341
  }, z.core.$strip>;
@@ -375,9 +375,9 @@ export declare const LocalAppAutomationSubmitSchema: z.ZodObject<{
375
375
  cancelConfirmedAtMs: z.ZodOptional<z.ZodNumber>;
376
376
  summary: z.ZodOptional<z.ZodString>;
377
377
  failureCode: z.ZodOptional<z.ZodEnum<{
378
+ execution_failed: "execution_failed";
378
379
  budget_exhausted: "budget_exhausted";
379
380
  authorization_ended: "authorization_ended";
380
- execution_failed: "execution_failed";
381
381
  }>>;
382
382
  }, z.core.$strip>;
383
383
  }, z.core.$strip>;
@@ -409,9 +409,9 @@ export declare const LocalAppAutomationHistorySchema: z.ZodObject<{
409
409
  cancelConfirmedAtMs: z.ZodOptional<z.ZodNumber>;
410
410
  summary: z.ZodOptional<z.ZodString>;
411
411
  failureCode: z.ZodOptional<z.ZodEnum<{
412
+ execution_failed: "execution_failed";
412
413
  budget_exhausted: "budget_exhausted";
413
414
  authorization_ended: "authorization_ended";
414
- execution_failed: "execution_failed";
415
415
  }>>;
416
416
  }, z.core.$strip>>;
417
417
  hasMore: z.ZodBoolean;
@@ -9,7 +9,10 @@ export type RegisterNotificationDeviceInput = {
9
9
  appVersion?: string;
10
10
  };
11
11
  export declare function registerNotificationDevice(input: RegisterNotificationDeviceInput): NotificationDevice;
12
+ export declare function replaceNotificationPushReference(deviceId: string, previous: string, next: string): boolean;
12
13
  export declare function getNotificationDevice(deviceId: string): NotificationDevice | null;
13
14
  export declare function listDeliverableNotificationDevices(now?: number): NotificationDevice[];
14
15
  export declare function updateNotificationDevicePreferences(deviceId: string, patch: Partial<NotificationPreferences>): NotificationDevice | null;
16
+ export declare function listRevokedPlatformPushDevices(now: number): NotificationDevice[];
17
+ export declare function disableNotificationDevice(deviceId: string): void;
15
18
  export declare function removeNotificationDevice(deviceId: string): boolean;
@@ -65,6 +65,9 @@ function registerNotificationDevice(input) {
65
65
  });
66
66
  return getNotificationDevice(input.deviceId);
67
67
  }
68
+ function replaceNotificationPushReference(deviceId, previous, next) {
69
+ return runSqliteWriteTransaction((db) => db.prepare("UPDATE device_push_endpoints SET push_token = ?, updated_at = ? WHERE device_id = ? AND push_token = ? AND enabled = 1").run(next, Date.now(), deviceId, previous).changes > 0);
70
+ }
68
71
  function getNotificationDevice(deviceId) {
69
72
  const row = getSqliteDatabase().prepare("SELECT * FROM device_push_endpoints WHERE device_id = ?").get(deviceId);
70
73
  return row ? deviceFromRow(row) : null;
@@ -86,8 +89,18 @@ function updateNotificationDevicePreferences(deviceId, patch) {
86
89
  });
87
90
  return getNotificationDevice(deviceId);
88
91
  }
92
+ function listRevokedPlatformPushDevices(now) {
93
+ return getSqliteDatabase().prepare(`
94
+ SELECT n.* FROM device_push_endpoints n JOIN devices d ON n.device_id = d.device_id
95
+ WHERE d.revoked_at IS NOT NULL AND n.enabled = 0 AND n.push_token LIKE 'platform-push:%'
96
+ AND n.lease_expires_at > ? ORDER BY n.updated_at LIMIT 20
97
+ `).all(now).map(deviceFromRow);
98
+ }
99
+ function disableNotificationDevice(deviceId) {
100
+ runSqliteWriteTransaction((db) => db.prepare("UPDATE device_push_endpoints SET enabled = 0 WHERE device_id = ?").run(deviceId));
101
+ }
89
102
  function removeNotificationDevice(deviceId) {
90
103
  return runSqliteWriteTransaction((db) => db.prepare("DELETE FROM device_push_endpoints WHERE device_id = ?").run(deviceId).changes > 0);
91
104
  }
92
105
  //#endregion
93
- export { getNotificationDevice, listDeliverableNotificationDevices, registerNotificationDevice, removeNotificationDevice, updateNotificationDevicePreferences };
106
+ export { disableNotificationDevice, getNotificationDevice, listDeliverableNotificationDevices, listRevokedPlatformPushDevices, registerNotificationDevice, removeNotificationDevice, replaceNotificationPushReference, updateNotificationDevicePreferences };
@@ -0,0 +1,17 @@
1
+ import type { NotificationTarget } from '@xopcai/gateway-contract';
2
+ export declare class PlatformPushError extends Error {
3
+ readonly status: number;
4
+ readonly code: string;
5
+ constructor(status: number, code: string);
6
+ }
7
+ export declare function platformPushEndpoint(value: string): string | undefined;
8
+ export declare function registerPlatformPushDevice(gatewayId: string, deviceId: string, pushToken: string): Promise<string>;
9
+ export declare function removePlatformPushDevice(reference: string): Promise<void>;
10
+ export type PlatformPushDelivery = {
11
+ endpointId: string;
12
+ eventId: string;
13
+ locale: 'en' | 'zh';
14
+ target: NotificationTarget;
15
+ expiresAt: number;
16
+ };
17
+ export declare function sendPlatformPush(message: PlatformPushDelivery, fetchImpl?: typeof fetch): Promise<string>;