@xopcai/xopc 0.0.373 → 0.0.375

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 (323) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear--kDkSTqC.js → agent-avatar-dicebear-B2Popl59.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-z4_2-Kn2.js → agent-defaults-settings-panel-BnF3HrHY.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BYndK83K.js → agent-plugin-dialog-CwP6OrUs.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agents-CVo96cx1.js → agents-n3IremKl.js} +3 -3
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-D9oOJKiH.js → app-management-settings-panel-DNkXIPxK.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-B0-8Cdyv.js → appearance-settings-p1_NpH8a.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-DasVc6i4.js → apps-page-CP2u5iEh.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-BlCNqy2i.js → automations-page-CjYiGOov.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-workspace-C8ipDP05.js → automations-workspace-BAHiUQbe.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-Cktlez6g.js → block-editor-DiOou1HO.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-automations-page-KRfDl8ej.js → browser-automations-page-nArl2uwX.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-settings-page-BraQ4wnh.js → browser-settings-page-Bd8tF-gg.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capabilities-page-B3m8xGzd.js → capabilities-page-Cx4cdgse.js} +2 -2
  17. package/dist/gateway/static/root/assets/{capabilities-settings-panel-VQ4fHuBV.js → capabilities-settings-panel-DpWceNd0.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-header-actions-f5Ido4Eg.js → capability-header-actions-AeBubNQK.js} +1 -1
  19. package/dist/gateway/static/root/assets/{channels-N4Vc2nEG.js → channels-Cd1Rf0Vk.js} +1 -1
  20. package/dist/gateway/static/root/assets/{chat-terminal-dock-BwvTKwsn.js → chat-terminal-dock-DrVlbq_P.js} +1 -1
  21. package/dist/gateway/static/root/assets/{computer-settings-page-CAwUsKpw.js → computer-settings-page-TUzZnurj.js} +1 -1
  22. package/dist/gateway/static/root/assets/{connector-service-page-C0HuAMuH.js → connector-service-page-BlpwjGW7.js} +1 -1
  23. package/dist/gateway/static/root/assets/{connectors-page-BcBmW8JT.js → connectors-page-j8VFMD4o.js} +1 -1
  24. package/dist/gateway/static/root/assets/{date-picker-DiQxRpe-.js → date-picker-CjKRpA8X.js} +1 -1
  25. package/dist/gateway/static/root/assets/{dependency-picker-Ds0_BJbN.js → dependency-picker-J9_0obij.js} +1 -1
  26. package/dist/gateway/static/root/assets/{desktop-pet-ZMEOYwrR.js → desktop-pet-DySwgreF.js} +1 -1
  27. package/dist/gateway/static/root/assets/{desktop-pet-settings-DkyTqD07.js → desktop-pet-settings-B1-oyKBG.js} +1 -1
  28. package/dist/gateway/static/root/assets/{device-pairing-wizard-CvaI5ZJZ.js → device-pairing-wizard-C5rjPAyc.js} +1 -1
  29. package/dist/gateway/static/root/assets/{directory-picker-path-field-Bfv93eK1.js → directory-picker-path-field-BY7MwiZd.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-page-JXKGtIdM.js → extension-page-JoSFhfb6.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-settings-page-lsQ2xvbr.js → extension-settings-page-B7LtTNx7.js} +1 -1
  32. package/dist/gateway/static/root/assets/{fallback-models-7bG0AND1.js → fallback-models-DKSWcBt_.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-settings-BpbcoPx9.js → gateway-settings-CGm-lbsX.js} +1 -1
  34. package/dist/gateway/static/root/assets/{home-page-BxctC0aJ.js → home-page-CX3uWkyH.js} +1 -1
  35. package/dist/gateway/static/root/assets/{imports-page-Bq8CazCb.js → imports-page-DS_RFtWf.js} +1 -1
  36. package/dist/gateway/static/root/assets/{index-B40-KDN8.js → index-CgvOIDy_.js} +6 -6
  37. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-kkAevkl2.js → keyboard-shortcuts-settings-BxwXR2qA.js} +1 -1
  38. package/dist/gateway/static/root/assets/{local-app-workbench-page-abLaf1hW.js → local-app-workbench-page-BWd4RMBE.js} +1 -1
  39. package/dist/gateway/static/root/assets/{local-apps-page-nwsnwYjK.js → local-apps-page-BsgcA6-N.js} +1 -1
  40. package/dist/gateway/static/root/assets/{logs-page-BEgYS-Xg.js → logs-page-CLP5pu2j.js} +1 -1
  41. package/dist/gateway/static/root/assets/management-settings-CZAZwCpE.js +1 -0
  42. package/dist/gateway/static/root/assets/{note-detail-panel-CCnfurBR.js → note-detail-panel-BeAHgdtw.js} +3 -3
  43. package/dist/gateway/static/root/assets/{notes-page-D9u_znxM.js → notes-page-MP21Zf_R.js} +1 -1
  44. package/dist/gateway/static/root/assets/{page-context-capture-button-BO3FoRej.js → page-context-capture-button-BZADmKcV.js} +1 -1
  45. package/dist/gateway/static/root/assets/personal-page-BbaTGmE-.js +1 -0
  46. package/dist/gateway/static/root/assets/{product-open-page-Dso2_hyl.js → product-open-page-CBnKsW4p.js} +1 -1
  47. package/dist/gateway/static/root/assets/{product-preview-content-CkvVb3EA.js → product-preview-content-B0gGexdG.js} +1 -1
  48. package/dist/gateway/static/root/assets/{project-detail-page-UjrrzE3H.js → project-detail-page-ZjQSv_NG.js} +1 -1
  49. package/dist/gateway/static/root/assets/{projects-page-C1h63P2M.js → projects-page-Bf7Sd_Ck.js} +1 -1
  50. package/dist/gateway/static/root/assets/{remote-access-hub-BJifH8AB.js → remote-access-hub-Bl8aPuXU.js} +1 -1
  51. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-vG1wqcEb.js → runtime-tools-settings-panel-CQZ1c-re.js} +1 -1
  52. package/dist/gateway/static/root/assets/{scenes-page-CwoAoYMX.js → scenes-page-1xGRBOJO.js} +1 -1
  53. package/dist/gateway/static/root/assets/{schema-form-BIsHdyz7.js → schema-form-BYqugMox.js} +1 -1
  54. package/dist/gateway/static/root/assets/{sessions-page-BcCLp3yU.js → sessions-page-DjMSVXU3.js} +1 -1
  55. package/dist/gateway/static/root/assets/settings-advanced-gate-BJuMTtyI.js +1 -0
  56. package/dist/gateway/static/root/assets/{settings-page-z9Jlk0BL.js → settings-page-CSqi5fmN.js} +1 -1
  57. package/dist/gateway/static/root/assets/{setup-status-panel-CrpXECqe.js → setup-status-panel-D5bM0TvA.js} +1 -1
  58. package/dist/gateway/static/root/assets/{shares-settings-D9XpTJXP.js → shares-settings-C-V9WllF.js} +1 -1
  59. package/dist/gateway/static/root/assets/{skill-api-DtPOf1aW.js → skill-api-CFtEHy5e.js} +1 -1
  60. package/dist/gateway/static/root/assets/{skills-page-Bq9-2b9U.js → skills-page-B-olXUVH.js} +1 -1
  61. package/dist/gateway/static/root/assets/{system-settings-panel-P7T729uD.js → system-settings-panel-DBMR9ks_.js} +1 -1
  62. package/dist/gateway/static/root/assets/{task-detail-page-CsB9AFx6.js → task-detail-page-CGe34vxR.js} +1 -1
  63. package/dist/gateway/static/root/assets/{tunnel-api-CuowqIZ7.js → tunnel-api-CzNIlgdJ.js} +1 -1
  64. package/dist/gateway/static/root/assets/{usage-page-avX3msoZ.js → usage-page-O3abwewp.js} +1 -1
  65. package/dist/gateway/static/root/assets/user-model-page-Bx2JlCpj.js +2 -0
  66. package/dist/gateway/static/root/assets/{work-discovery-overlay-BgJNz2tH.js → work-discovery-overlay-D967-fVj.js} +1 -1
  67. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-1I2q2J_U.js → workflow-run-setup-panel-BJ945m7G.js} +1 -1
  68. package/dist/gateway/static/root/assets/{workflows-page-DhJl9pnO.js → workflows-page-DUpVeIuw.js} +1 -1
  69. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CnPBP1V_.js → xopc-cloud-account-card-Bq9ubffP.js} +1 -1
  70. package/dist/gateway/static/root/index.html +1 -1
  71. package/dist/package.js +1 -1
  72. package/dist/packages/realtime-protocol/src/voice.js +11 -0
  73. package/dist/src/agent/agent-manager.d.ts +2 -7
  74. package/dist/src/agent/agent-manager.js +21 -50
  75. package/dist/src/agent/background-review/coordinator.js +1 -1
  76. package/dist/src/agent/background-review/prompts.d.ts +6 -0
  77. package/dist/src/agent/background-review/prompts.js +7 -1
  78. package/dist/src/agent/background-review/run-background-review.d.ts +3 -0
  79. package/dist/src/agent/background-review/run-background-review.js +185 -17
  80. package/dist/src/agent/context/coordinator.d.ts +1 -0
  81. package/dist/src/agent/context/coordinator.js +11 -2
  82. package/dist/src/agent/context/execution-context.js +40 -4
  83. package/dist/src/agent/context/project-context.js +11 -3
  84. package/dist/src/agent/embedded/run-for-session.js +2 -2
  85. package/dist/src/agent/embedded/run-turn.js +4 -4
  86. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  87. package/dist/src/agent/image/tool-model-config.js +1 -1
  88. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  89. package/dist/src/agent/memory/compaction-promotion.d.ts +2 -0
  90. package/dist/src/agent/memory/compaction-promotion.js +33 -2
  91. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  92. package/dist/src/agent/service.js +5 -5
  93. package/dist/src/agent/session/session-inspector.js +1 -1
  94. package/dist/src/agent/skills/index.js +1 -1
  95. package/dist/src/agent/skills/managed-store.js +1 -1
  96. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  97. package/dist/src/agent/tasks/task-judge-service.js +2 -2
  98. package/dist/src/agent/tools/factory.js +1 -1
  99. package/dist/src/agent/tools/knowledge-memory-tool.js +14 -6
  100. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  101. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  102. package/dist/src/agent-catalog/capabilities.js +2 -2
  103. package/dist/src/agent-config/schema.d.ts +9 -0
  104. package/dist/src/agent-config/schema.js +1 -0
  105. package/dist/src/ai-assist/text-assist.js +1 -1
  106. package/dist/src/auth/sync-provider-auth.js +1 -1
  107. package/dist/src/automations/capabilities/drafts.js +1 -1
  108. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  109. package/dist/src/automations/service/action-executor.js +1 -1
  110. package/dist/src/bootstrap/application-state.js +2 -2
  111. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  112. package/dist/src/capabilities/runtime/product.js +1 -1
  113. package/dist/src/chat-commands/agent-edit.js +1 -1
  114. package/dist/src/chat-commands/context.js +1 -1
  115. package/dist/src/cli/commands/agent.js +2 -2
  116. package/dist/src/cli/commands/agents.js +1 -1
  117. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  118. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  119. package/dist/src/cli/commands/gateway/shared.js +2 -1
  120. package/dist/src/cli/commands/models.js +1 -1
  121. package/dist/src/cli/commands/onboard/model.js +1 -1
  122. package/dist/src/cli/extension-cli-register.js +1 -1
  123. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  124. package/dist/src/computer/runtime.js +1 -1
  125. package/dist/src/config/agent-model-intents.js +1 -1
  126. package/dist/src/config/agent-profile.js +2 -2
  127. package/dist/src/config/gateway-bind.js +2 -1
  128. package/dist/src/config/index.js +4 -4
  129. package/dist/src/config/loader.js +1 -1
  130. package/dist/src/config/models-json.d.ts +8 -8
  131. package/dist/src/config/models-json.js +1 -1
  132. package/dist/src/config/schema.d.ts +18 -12
  133. package/dist/src/config/schema.js +12 -8
  134. package/dist/src/connectors/connected-source-ingestion.js +45 -7
  135. package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
  136. package/dist/src/connectors/connected-source-understanding.js +59 -67
  137. package/dist/src/connectors/content-enrichment.js +1 -1
  138. package/dist/src/connectors/learning-coordinator.js +2 -2
  139. package/dist/src/daemon/constants.js +14 -9
  140. package/dist/src/daemon/index.js +4 -1
  141. package/dist/src/daemon/install-plan.js +2 -1
  142. package/dist/src/daemon/launchd.js +2 -1
  143. package/dist/src/daemon/schtasks.js +2 -1
  144. package/dist/src/daemon/service-audit.js +2 -1
  145. package/dist/src/daemon/service.js +2 -1
  146. package/dist/src/daemon/systemd.js +2 -1
  147. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  148. package/dist/src/gateway/agents-admin.js +2 -2
  149. package/dist/src/gateway/client-ip.js +2 -1
  150. package/dist/src/gateway/file-path-classifier.js +1 -1
  151. package/dist/src/gateway/hono/app.js +2 -1
  152. package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -0
  153. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  154. package/dist/src/gateway/hono/middleware/auth.d.ts +3 -5
  155. package/dist/src/gateway/hono/middleware/auth.js +56 -14
  156. package/dist/src/gateway/hono/middleware/logger.js +2 -1
  157. package/dist/src/gateway/hono/middleware/public-device-rate-limit.d.ts +16 -0
  158. package/dist/src/gateway/hono/middleware/public-device-rate-limit.js +43 -0
  159. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +3 -2
  160. package/dist/src/gateway/hono/oauth-async.js +2 -1
  161. package/dist/src/gateway/hono/routes/browser.js +2 -1
  162. package/dist/src/gateway/hono/routes/config-patch/misc.js +5 -5
  163. package/dist/src/gateway/hono/routes/config.js +2 -1
  164. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  165. package/dist/src/gateway/hono/routes/context-sources.js +2 -2
  166. package/dist/src/gateway/hono/routes/device-pairing-approval.d.ts +3 -8
  167. package/dist/src/gateway/hono/routes/device-pairing-approval.js +5 -20
  168. package/dist/src/gateway/hono/routes/devices.js +25 -9
  169. package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -0
  170. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -0
  171. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  172. package/dist/src/gateway/hono/routes/memory-learning.d.ts +3 -0
  173. package/dist/src/gateway/hono/routes/memory-learning.js +76 -0
  174. package/dist/src/gateway/hono/routes/models.js +1 -1
  175. package/dist/src/gateway/hono/routes/notes.js +2 -2
  176. package/dist/src/gateway/hono/routes/personal-agent.js +3 -2
  177. package/dist/src/gateway/hono/routes/projects.js +3 -3
  178. package/dist/src/gateway/hono/routes/public-gateway.js +6 -6
  179. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  180. package/dist/src/gateway/hono/routes/shares.js +2 -1
  181. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  182. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  183. package/dist/src/gateway/hono/routes/user-model.js +5 -3
  184. package/dist/src/gateway/hono/routes/voice.js +1 -0
  185. package/dist/src/gateway/host.js +9 -4
  186. package/dist/src/gateway/image-generation-setup.js +2 -2
  187. package/dist/src/gateway/index.js +8 -4
  188. package/dist/src/gateway/listen.js +2 -1
  189. package/dist/src/gateway/lock.js +1 -1
  190. package/dist/src/gateway/rate-limit/auth-policy.js +7 -11
  191. package/dist/src/gateway/rate-limit/buckets.d.ts +6 -0
  192. package/dist/src/gateway/rate-limit/buckets.js +211 -189
  193. package/dist/src/gateway/rate-limit/env-flags.js +4 -1
  194. package/dist/src/gateway/rate-limit/index.js +13 -4
  195. package/dist/src/gateway/runtime-config.js +5 -3
  196. package/dist/src/gateway/security/audit.js +3 -2
  197. package/dist/src/gateway/security/browser-session.js +2 -1
  198. package/dist/src/gateway/security/device-request-proof.d.ts +28 -0
  199. package/dist/src/gateway/security/device-request-proof.js +122 -0
  200. package/dist/src/gateway/security/loopback.js +7 -6
  201. package/dist/src/gateway/service/session-command-service.js +1 -1
  202. package/dist/src/gateway/service.js +18 -16
  203. package/dist/src/gateway/tailscale-auth.js +2 -1
  204. package/dist/src/gateway/ws-security.js +2 -1
  205. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  206. package/dist/src/home-intelligence/generator.js +2 -2
  207. package/dist/src/home-intelligence/host.js +2 -2
  208. package/dist/src/imports/inventory.js +1 -1
  209. package/dist/src/infra/rate-limit/failure-limiter.js +78 -90
  210. package/dist/src/infra/rate-limit/index.js +11 -3
  211. package/dist/src/infra/rate-limit/keyed-store.js +52 -47
  212. package/dist/src/infra/rate-limit/rate-limiter.js +55 -58
  213. package/dist/src/infra/update-service-refresh.js +2 -1
  214. package/dist/src/knowledge/chunks.d.ts +10 -0
  215. package/dist/src/knowledge/chunks.js +28 -0
  216. package/dist/src/knowledge/connected-knowledge-pipeline.js +67 -33
  217. package/dist/src/knowledge/index.js +1 -1
  218. package/dist/src/knowledge/ingestion-service.js +5 -1
  219. package/dist/src/knowledge/local-folder-adapter.d.ts +2 -1
  220. package/dist/src/knowledge/local-folder-adapter.js +22 -13
  221. package/dist/src/knowledge-memory/domain.d.ts +4 -0
  222. package/dist/src/knowledge-memory/index.d.ts +1 -0
  223. package/dist/src/knowledge-memory/index.js +2 -1
  224. package/dist/src/knowledge-memory/repair-evidence.d.ts +2 -0
  225. package/dist/src/knowledge-memory/repair-evidence.js +57 -0
  226. package/dist/src/knowledge-memory/repository.d.ts +8 -0
  227. package/dist/src/knowledge-memory/repository.js +48 -27
  228. package/dist/src/knowledge-memory/search-text.d.ts +3 -0
  229. package/dist/src/knowledge-memory/search-text.js +32 -0
  230. package/dist/src/knowledge-memory/usage-policy.d.ts +6 -0
  231. package/dist/src/knowledge-memory/usage-policy.js +61 -0
  232. package/dist/src/local-apps/service.js +1 -1
  233. package/dist/src/memory-learning/repository.d.ts +24 -0
  234. package/dist/src/memory-learning/repository.js +96 -0
  235. package/dist/src/memory-learning/service.d.ts +17 -0
  236. package/dist/src/memory-learning/service.js +105 -0
  237. package/dist/src/memory-learning/source-learning.d.ts +7 -0
  238. package/dist/src/memory-learning/source-learning.js +235 -0
  239. package/dist/src/memory-learning/task-receipts.d.ts +3 -0
  240. package/dist/src/memory-learning/task-receipts.js +95 -0
  241. package/dist/src/memory-learning/work-capture.d.ts +51 -0
  242. package/dist/src/memory-learning/work-capture.js +140 -0
  243. package/dist/src/memory-maintenance/service.js +5 -5
  244. package/dist/src/personal-agent/proactivity/service.js +2 -2
  245. package/dist/src/personal-agent/prompt-context.js +4 -4
  246. package/dist/src/personal-agent/reply-composer.js +1 -1
  247. package/dist/src/personal-agent/repository.d.ts +3 -0
  248. package/dist/src/personal-agent/repository.js +1 -0
  249. package/dist/src/personal-agent/service.d.ts +6 -2
  250. package/dist/src/personal-agent/service.js +6 -5
  251. package/dist/src/platform/client.d.ts +1 -1
  252. package/dist/src/platform/contracts.d.ts +1 -1
  253. package/dist/src/providers/local-model.d.ts +2 -0
  254. package/dist/src/providers/local-model.js +16 -0
  255. package/dist/src/providers/model-catalog-persistence.js +1 -1
  256. package/dist/src/realtime/runtime.js +6 -0
  257. package/dist/src/realtime/tickets.d.ts +1 -0
  258. package/dist/src/realtime/tickets.js +4 -0
  259. package/dist/src/remote-access/exposure-guards.js +2 -1
  260. package/dist/src/routing/resolve-route.js +1 -1
  261. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  262. package/dist/src/scenes/taskFollowUp/service.js +1 -1
  263. package/dist/src/session/session-title.js +1 -1
  264. package/dist/src/session/store.js +2 -1
  265. package/dist/src/share/share-rate-limit.js +2 -1
  266. package/dist/src/share/share-url.js +2 -1
  267. package/dist/src/share/site-share-router.js +2 -1
  268. package/dist/src/storage/sqlite/device-access-repository.d.ts +7 -0
  269. package/dist/src/storage/sqlite/device-access-repository.js +22 -4
  270. package/dist/src/storage/sqlite/knowledge-repository.js +6 -0
  271. package/dist/src/storage/sqlite/migrations/243_voice_opening_greetings.sql +12 -0
  272. package/dist/src/storage/sqlite/migrations/244_device_request_proofs.sql +8 -0
  273. package/dist/src/storage/sqlite/migrations/245_memory_learning.sql +125 -0
  274. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  275. package/dist/src/storage/sqlite/migrations/runner.js +6 -3
  276. package/dist/src/storage/sqlite/schema.js +1 -1
  277. package/dist/src/tasks/capabilities/read.js +2 -2
  278. package/dist/src/tasks/task-handoff-service.js +1 -1
  279. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  280. package/dist/src/tui/backends/embedded-backend.js +4 -4
  281. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  282. package/dist/src/tui/tui-commands.js +1 -1
  283. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  284. package/dist/src/tui/tui-startup-resources.js +2 -2
  285. package/dist/src/tui/tui.js +2 -2
  286. package/dist/src/tunnel/broker-client.js +2 -0
  287. package/dist/src/tunnel/tunnel-config.js +2 -2
  288. package/dist/src/tunnel/tunnel-rate-limit.js +2 -1
  289. package/dist/src/user-context/access-policy.js +2 -1
  290. package/dist/src/user-context/config.d.ts +10 -0
  291. package/dist/src/user-context/config.js +5 -0
  292. package/dist/src/user-context/extraction/registry.d.ts +1 -1
  293. package/dist/src/user-context/extraction/registry.js +10 -0
  294. package/dist/src/user-context/identity-bindings.d.ts +10 -0
  295. package/dist/src/user-context/identity-bindings.js +24 -0
  296. package/dist/src/user-context/sources/consent-fields.d.ts +2 -0
  297. package/dist/src/user-context/sources/consent-fields.js +66 -0
  298. package/dist/src/user-model/bootstrap.js +1 -1
  299. package/dist/src/user-model/capture/executor.js +1 -1
  300. package/dist/src/user-model/capture/semantic.d.ts +3 -1
  301. package/dist/src/user-model/capture/semantic.js +14 -6
  302. package/dist/src/user-model/index.js +1 -1
  303. package/dist/src/user-model/usage-policy.js +34 -0
  304. package/dist/src/utils/logger/redact.js +4 -1
  305. package/dist/src/voice/platform-streams.d.ts +6 -0
  306. package/dist/src/voice/platform-streams.js +44 -4
  307. package/dist/src/voice/realtime/agentEngine.js +138 -83
  308. package/dist/src/voice/realtime/engine.d.ts +6 -0
  309. package/dist/src/voice/realtime/memory-context.js +19 -5
  310. package/dist/src/voice/realtime/opening-greeting.d.ts +12 -0
  311. package/dist/src/voice/realtime/opening-greeting.js +22 -0
  312. package/dist/src/voice/realtime/persona-context.js +1 -1
  313. package/dist/src/voice/realtime/runtime.js +90 -1
  314. package/dist/src/voice/realtime/runtime.types.d.ts +4 -0
  315. package/dist/src/work-discovery/incremental-repository.js +1 -1
  316. package/dist/src/work-discovery/service.js +6 -6
  317. package/dist/src/workflows/service/workflow-run-service.js +2 -2
  318. package/dist/src/workflows/service/workflow-session-bridge.js +38 -10
  319. package/package.json +3 -3
  320. package/dist/gateway/static/root/assets/management-settings-D_JQ6_X0.js +0 -1
  321. package/dist/gateway/static/root/assets/personal-page-BJn6UHAF.js +0 -1
  322. package/dist/gateway/static/root/assets/settings-advanced-gate-D114UdRI.js +0 -1
  323. package/dist/gateway/static/root/assets/user-model-page-DGDBWw7P.js +0 -2
@@ -1,10 +1,12 @@
1
1
  import { init_transaction, runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
2
2
  import { createCollaborationRule, getCollaborationRule, init_collaboration_rule_repository, listCollaborationRules, setCollaborationRuleStatus } from "../../../storage/sqlite/collaboration-rule-repository.js";
3
+ import { getActiveUnderstandingConsent } from "../../../user-context/sources/consent-repository.js";
4
+ import { listUnderstandingSourceGrants } from "../../../user-context/sources/repository.js";
3
5
  import { KnowledgeReviewConflictError, deleteKnowledgeItem, getKnowledgeItem, listKnowledgeItems, reviewKnowledgeItem, searchKnowledgeItems } from "../../../knowledge-memory/repository.js";
4
6
  import "../../../knowledge-memory/index.js";
7
+ import { createPriorityWindow, createUserGoal, listPriorityWindows, listUserGoals, setUserGoalStatus, updatePriorityWindow, updateUserGoal } from "../../../user-model/goals.js";
5
8
  import { deleteUserAssertion, getAssertionSlot, getUserAssertion, listUserAssertionSources, listUserAssertions, reconcileAssertion, setAssertionStatus, setUserAssertionScope } from "../../../user-model/repository.js";
6
9
  import { listActionRuleSuggestions } from "../../../user-model/action-rule-suggestions.js";
7
- import { createPriorityWindow, createUserGoal, listPriorityWindows, listUserGoals, setUserGoalStatus, updatePriorityWindow, updateUserGoal } from "../../../user-model/goals.js";
8
10
  import { listUserAssertionEdges, listUserModelObservations } from "../../../user-model/observation-repository.js";
9
11
  import { applyUserProfilePatch, getUserProfileSnapshot } from "../../../user-model/profile.js";
10
12
  import { bootstrapUserModel } from "../../../user-model/bootstrap.js";
@@ -13,8 +15,7 @@ import "../../../user-model/index.js";
13
15
  import { listMemoryMaintenanceRuns } from "../../../memory-maintenance/service.js";
14
16
  import "../../../memory-maintenance/index.js";
15
17
  import { getExecutionContextAudit, recordExecutionContextFeedback } from "../../../agent/context/audit.js";
16
- import { getActiveUnderstandingConsent } from "../../../user-context/sources/consent-repository.js";
17
- import { listUnderstandingSourceGrants } from "../../../user-context/sources/repository.js";
18
+ import { registerMemoryLearningRoutes } from "./memory-learning.js";
18
19
  import { userInfo } from "node:os";
19
20
  //#region src/gateway/hono/routes/user-model.ts
20
21
  init_transaction();
@@ -209,6 +210,7 @@ function decodeMobileCursor(value) {
209
210
  }
210
211
  }
211
212
  function registerUserModelRoutes(authenticated, deps) {
213
+ registerMemoryLearningRoutes(authenticated, deps);
212
214
  const write = deps.strictRateLimitMiddleware;
213
215
  const userContextConfig = () => deps.service.currentConfig.userContext;
214
216
  const memorySettings = () => {
@@ -184,6 +184,7 @@ function registerVoiceRoutes(authenticated, deps) {
184
184
  ok: true,
185
185
  payload: {
186
186
  enabled,
187
+ openingGreeting: true,
187
188
  capabilities: {
188
189
  dictation: availability(Boolean(stt)),
189
190
  assistant: availability(Boolean(stt && tts)),
@@ -1,4 +1,5 @@
1
- import "../daemon/constants.js";
1
+ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
+ import { init_constants } from "../daemon/constants.js";
2
3
  import { networkInterfaces } from "node:os";
3
4
  //#region src/gateway/host.ts
4
5
  /** True when the bind address is local-only (127.x, localhost, ::1). */
@@ -13,8 +14,6 @@ function isAllInterfacesHost(host) {
13
14
  const normalized = host.trim();
14
15
  return normalized === "0.0.0.0" || normalized === "::" || normalized === "*";
15
16
  }
16
- /** Vite dev server origins for the gateway console (`web/` defaults to port 3000). */
17
- const GATEWAY_DEV_CONSOLE_ORIGINS = ["http://localhost:3000", "http://127.0.0.1:3000"];
18
17
  /** Non-internal IPv4 addresses that can serve this gateway on the local network. */
19
18
  function enumerateLanGatewayCandidates(port) {
20
19
  const seen = /* @__PURE__ */ new Set();
@@ -86,5 +85,11 @@ function resolveAllowedBrowserOrigins(params) {
86
85
  if (reverseProxyOrigin && !origins.includes(reverseProxyOrigin)) origins.push(reverseProxyOrigin);
87
86
  return origins;
88
87
  }
88
+ var GATEWAY_DEV_CONSOLE_ORIGINS;
89
+ var init_host = __esmMin((() => {
90
+ init_constants();
91
+ GATEWAY_DEV_CONSOLE_ORIGINS = ["http://localhost:3000", "http://127.0.0.1:3000"];
92
+ }));
89
93
  //#endregion
90
- export { GATEWAY_DEV_CONSOLE_ORIGINS, buildDefaultCorsOrigins, enumerateLanGatewayCandidates, isAllInterfacesHost, isLoopbackHost, originFromGatewayPublicUrl, resolveAllowedBrowserOrigins, resolveEffectiveGatewayPort, resolveGatewayCorsOrigins, resolveGatewayServiceListenPort };
94
+ init_host();
95
+ export { GATEWAY_DEV_CONSOLE_ORIGINS, buildDefaultCorsOrigins, enumerateLanGatewayCandidates, init_host, isAllInterfacesHost, isLoopbackHost, originFromGatewayPublicUrl, resolveAllowedBrowserOrigins, resolveEffectiveGatewayPort, resolveGatewayCorsOrigins, resolveGatewayServiceListenPort };
@@ -1,11 +1,11 @@
1
1
  import { normalizeAgentId } from "../agent-catalog/id.js";
2
2
  import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
3
3
  import { init_agent_scope } from "../agent/agent-scope.js";
4
- import { AgentCatalogService } from "../agent-catalog/service.js";
5
- import { ConfigSchema, init_schema } from "../config/schema.js";
6
4
  import { resolveEffectiveAgentConfigForAgent } from "../config/agent-profile.js";
5
+ import { ConfigSchema, init_schema } from "../config/schema.js";
7
6
  import { fetchWithTimeoutGuarded } from "../media-shared/http/provider-http.js";
8
7
  import "../media-shared/http/index.js";
8
+ import { AgentCatalogService } from "../agent-catalog/service.js";
9
9
  import { getImageGenerationProvider, listImageGenerationProvidersSummary } from "../agent/image/generation/provider-registry.js";
10
10
  //#region src/gateway/image-generation-setup.ts
11
11
  init_repository();
@@ -1,11 +1,11 @@
1
- import { buildDefaultCorsOrigins, isAllInterfacesHost, isLoopbackHost, resolveEffectiveGatewayPort, resolveGatewayServiceListenPort } from "./host.js";
1
+ import { buckets } from "./rate-limit/buckets.js";
2
+ import { buildDefaultCorsOrigins, init_host, isAllInterfacesHost, isLoopbackHost, resolveEffectiveGatewayPort, resolveGatewayServiceListenPort } from "./host.js";
3
+ import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
4
+ import { init_rate_limit } from "./rate-limit/index.js";
2
5
  import { defaultGatewayBindMode, isContainerEnvironment, resolveGatewayBindHost, resolveGatewayBindHostSync, resolveGatewayBindMode, resolveGatewayEffectiveHost } from "../config/gateway-bind.js";
3
6
  import { GatewayLockError, acquireGatewayLock } from "./lock.js";
4
7
  import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
5
8
  import { resolveGatewayListenHost, resolveGatewayListenPlan } from "./listen.js";
6
- import { buckets } from "./rate-limit/buckets.js";
7
- import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
8
- import "./rate-limit/index.js";
9
9
  import { assertGatewayRuntimeConfig } from "./runtime-config.js";
10
10
  import { restartGatewayProcessWithFreshPid } from "./respawn.js";
11
11
  import { GatewayService } from "./service.js";
@@ -16,4 +16,8 @@ import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofO
16
16
  import { apiError, apiOk } from "./protocol.js";
17
17
  import "./hono/index.js";
18
18
  import { assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, isInsecurePrivateWsAllowed, isSecureWebSocketUrl } from "./ws-security.js";
19
+ //#region src/gateway/index.ts
20
+ init_host();
21
+ init_rate_limit();
22
+ //#endregion
19
23
  export { GatewayLockError, GatewayServer, GatewayService, acquireGatewayLock, apiError, apiOk, assertGatewayAuthConfigured, assertGatewayRuntimeConfig, assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, buckets, buildDefaultCorsOrigins, checkPortAvailable, createHonoApp, defaultGatewayBindMode, extractToken, forceFreePortAndWait, isAllInterfacesHost, isContainerEnvironment, isGatewayStrictSecurityEnabled, isInsecurePrivateWsAllowed, isLoopbackHost, isSecureWebSocketUrl, listPortListeners, parseLsofOutput, resolveEffectiveGatewayPort, resolveGatewayAuth, resolveGatewayBindHost, resolveGatewayBindHostSync, resolveGatewayBindMode, resolveGatewayEffectiveHost, resolveGatewayListenHost, resolveGatewayListenPlan, resolveGatewayServiceListenPort, restartGatewayProcessWithFreshPid, runGatewayLoop, validateToken };
@@ -1,6 +1,7 @@
1
- import { buildDefaultCorsOrigins, isAllInterfacesHost, isLoopbackHost } from "./host.js";
1
+ import { buildDefaultCorsOrigins, init_host, isAllInterfacesHost, isLoopbackHost } from "./host.js";
2
2
  import { resolveGatewayBindHostSync, resolveGatewayBindMode, resolveGatewayCustomBindHost } from "../config/gateway-bind.js";
3
3
  //#region src/gateway/listen.ts
4
+ init_host();
4
5
  /** Resolve the effective HTTP listen host (CLI bind override > config bind). */
5
6
  function resolveGatewayListenHost(params) {
6
7
  return resolveGatewayBindHostSync({
@@ -1,8 +1,8 @@
1
1
  import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  import { createHash } from "node:crypto";
4
- import fs$1 from "node:fs/promises";
5
4
  import net from "node:net";
5
+ import fs$1 from "node:fs/promises";
6
6
  import { homedir } from "os";
7
7
  //#region src/gateway/lock.ts
8
8
  /**
@@ -1,15 +1,7 @@
1
- import { isLoopbackClientIp, isLoopbackEmbeddedBrowserClient } from "../security/loopback.js";
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { init_loopback, isLoopbackClientIp, isLoopbackEmbeddedBrowserClient } from "../security/loopback.js";
2
3
  //#region src/gateway/rate-limit/auth-policy.ts
3
4
  /**
4
- * Auth-failure rate-limit policy: how to derive a tracking key from a request,
5
- * and whether a given client should be exempted before counting.
6
- *
7
- * The {@link FailureLimiter} primitive is intentionally policy-free — this
8
- * module is the only place that knows about IPs, browser origins, and the
9
- * loopback exemption. Adding a new exemption rule (e.g. private CIDRs) means
10
- * editing this file alone; the limiter primitive does not change.
11
- */
12
- /**
13
5
  * Decide whether to track this client and, if so, what key identifies them.
14
6
  * Browser clients are tracked separately (origin + IP) so a rogue `<iframe>`
15
7
  * cannot piggyback on a CLI client's bucket and DoS it.
@@ -43,5 +35,9 @@ function resolveAuthTracking(params) {
43
35
  function buildBrowserOriginKey(origin, clientIp) {
44
36
  return `browser-origin:${origin.trim().toLowerCase()}|${clientIp.trim()}`;
45
37
  }
38
+ var init_auth_policy = __esmMin((() => {
39
+ init_loopback();
40
+ }));
46
41
  //#endregion
47
- export { buildBrowserOriginKey, resolveAuthTracking };
42
+ init_auth_policy();
43
+ export { buildBrowserOriginKey, init_auth_policy, resolveAuthTracking };
@@ -35,6 +35,9 @@ declare class BucketRegistry {
35
35
  private authFailureLimiter?;
36
36
  private authFailureSignature?;
37
37
  private identityChallengeLimiter?;
38
+ private publicDeviceGlobalLimiter?;
39
+ private publicDeviceSourceLimiter?;
40
+ private deviceRefreshLimiter?;
38
41
  private strictApiLimiter?;
39
42
  private chatApiLimiter?;
40
43
  private mediaApiLimiter?;
@@ -51,6 +54,9 @@ declare class BucketRegistry {
51
54
  * config read.
52
55
  */
53
56
  authFailure(cfg: ResolvedAuthRateLimitConfig): FailureLimiter;
57
+ publicDeviceGlobal(): RateLimiter;
58
+ publicDeviceSource(): RateLimiter;
59
+ deviceRefresh(): RateLimiter;
54
60
  /** Global pre-authentication signing budget; independent of authenticated traffic. */
55
61
  identityChallenge(): RateLimiter;
56
62
  /** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
@@ -1,30 +1,8 @@
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
1
2
  import { RateLimiter } from "../../infra/rate-limit/rate-limiter.js";
2
3
  import { FailureLimiter } from "../../infra/rate-limit/failure-limiter.js";
4
+ import { init_rate_limit } from "../../infra/rate-limit/index.js";
3
5
  //#region src/gateway/rate-limit/buckets.ts
4
- /**
5
- * Named rate-limit buckets used across the gateway. Each is a thin wrapper
6
- * over a primitive limiter ({@link RateLimiter} or {@link FailureLimiter})
7
- * that hard-codes its config and exposes a small surface.
8
- *
9
- * All buckets are owned by a process-level singleton {@link BucketRegistry}
10
- * so that:
11
- * - lifecycle (cleanup timers) is centralized — `destroyAll()` on shutdown,
12
- * - tests get one obvious reset entry point (`resetAllForTests`),
13
- * - new buckets are added in exactly one place.
14
- *
15
- * Tuning policy:
16
- * - `auth_failure` is read from runtime config because users tune it per
17
- * deployment. Other buckets keep static defaults until a real need
18
- * emerges to expose them. (YAGNI > premature configurability.)
19
- */
20
- const DEFAULT_AUTH_RATE_LIMIT = {
21
- enabled: true,
22
- maxFailures: 5,
23
- windowMs: 900 * 1e3,
24
- blockDurationMs: 300 * 1e3,
25
- burstCoalesceMs: 1e3,
26
- exemptLoopback: true
27
- };
28
6
  function resolveAuthRateLimit(input) {
29
7
  if (!input) return { ...DEFAULT_AUTH_RATE_LIMIT };
30
8
  const blockDurationMs = input.blockDurationMs ?? input.lockoutMs ?? DEFAULT_AUTH_RATE_LIMIT.blockDurationMs;
@@ -43,170 +21,214 @@ function authPolicyConfig(cfg) {
43
21
  exemptLoopback: cfg.exemptLoopback
44
22
  };
45
23
  }
46
- var BucketRegistry = class {
47
- authFailureLimiter;
48
- authFailureSignature;
49
- identityChallengeLimiter;
50
- strictApiLimiter;
51
- chatApiLimiter;
52
- mediaApiLimiter;
53
- taskApiLimiter;
54
- xopcCloudPollLimiter;
55
- channelApiLimiter;
56
- tunnelMutateLimiter;
57
- pairingExchangeLimiter;
58
- sharePublicShortLimiter;
59
- sharePublicLongLimiter;
60
- /**
61
- * Reconfigured on the fly when `gateway.auth.rateLimit` is reloaded —
62
- * compares a stable signature to avoid swapping out a hot bucket on every
63
- * config read.
64
- */
65
- authFailure(cfg) {
66
- const sig = `${cfg.maxFailures}|${cfg.windowMs}|${cfg.blockDurationMs}|${cfg.burstCoalesceMs}`;
67
- if (!this.authFailureLimiter || this.authFailureSignature !== sig) {
68
- this.authFailureLimiter?.destroy();
69
- this.authFailureLimiter = new FailureLimiter({
70
- maxFailures: cfg.maxFailures,
71
- windowMs: cfg.windowMs,
72
- blockDurationMs: cfg.blockDurationMs,
73
- burstCoalesceMs: cfg.burstCoalesceMs
24
+ var DEFAULT_AUTH_RATE_LIMIT, BucketRegistry, buckets;
25
+ var init_buckets = __esmMin((() => {
26
+ init_rate_limit();
27
+ DEFAULT_AUTH_RATE_LIMIT = {
28
+ enabled: true,
29
+ maxFailures: 5,
30
+ windowMs: 900 * 1e3,
31
+ blockDurationMs: 300 * 1e3,
32
+ burstCoalesceMs: 1e3,
33
+ exemptLoopback: true
34
+ };
35
+ BucketRegistry = class {
36
+ authFailureLimiter;
37
+ authFailureSignature;
38
+ identityChallengeLimiter;
39
+ publicDeviceGlobalLimiter;
40
+ publicDeviceSourceLimiter;
41
+ deviceRefreshLimiter;
42
+ strictApiLimiter;
43
+ chatApiLimiter;
44
+ mediaApiLimiter;
45
+ taskApiLimiter;
46
+ xopcCloudPollLimiter;
47
+ channelApiLimiter;
48
+ tunnelMutateLimiter;
49
+ pairingExchangeLimiter;
50
+ sharePublicShortLimiter;
51
+ sharePublicLongLimiter;
52
+ /**
53
+ * Reconfigured on the fly when `gateway.auth.rateLimit` is reloaded —
54
+ * compares a stable signature to avoid swapping out a hot bucket on every
55
+ * config read.
56
+ */
57
+ authFailure(cfg) {
58
+ const sig = `${cfg.maxFailures}|${cfg.windowMs}|${cfg.blockDurationMs}|${cfg.burstCoalesceMs}`;
59
+ if (!this.authFailureLimiter || this.authFailureSignature !== sig) {
60
+ this.authFailureLimiter?.destroy();
61
+ this.authFailureLimiter = new FailureLimiter({
62
+ maxFailures: cfg.maxFailures,
63
+ windowMs: cfg.windowMs,
64
+ blockDurationMs: cfg.blockDurationMs,
65
+ burstCoalesceMs: cfg.burstCoalesceMs
66
+ });
67
+ this.authFailureSignature = sig;
68
+ }
69
+ return this.authFailureLimiter;
70
+ }
71
+ publicDeviceGlobal() {
72
+ return this.publicDeviceGlobalLimiter ??= new RateLimiter({
73
+ maxRequests: 1200,
74
+ windowMs: 6e4
75
+ });
76
+ }
77
+ publicDeviceSource() {
78
+ return this.publicDeviceSourceLimiter ??= new RateLimiter({
79
+ maxRequests: 300,
80
+ windowMs: 6e4
81
+ });
82
+ }
83
+ deviceRefresh() {
84
+ return this.deviceRefreshLimiter ??= new RateLimiter({
85
+ maxRequests: 30,
86
+ windowMs: 6e4
87
+ });
88
+ }
89
+ /** Global pre-authentication signing budget; independent of authenticated traffic. */
90
+ identityChallenge() {
91
+ return this.identityChallengeLimiter ??= new RateLimiter({
92
+ maxRequests: 300,
93
+ windowMs: 6e4
94
+ });
95
+ }
96
+ /** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
97
+ strictApi() {
98
+ if (!this.strictApiLimiter) this.strictApiLimiter = new RateLimiter({
99
+ maxRequests: 150,
100
+ windowMs: 6e4
101
+ });
102
+ return this.strictApiLimiter;
103
+ }
104
+ /** Interactive chat actions — 180 req / 60 s per client IP. */
105
+ chatApi() {
106
+ if (!this.chatApiLimiter) this.chatApiLimiter = new RateLimiter({
107
+ maxRequests: 180,
108
+ windowMs: 6e4
109
+ });
110
+ return this.chatApiLimiter;
111
+ }
112
+ /** Durable media chunk uploads — 300 req / 60 s per client IP. */
113
+ mediaApi() {
114
+ if (!this.mediaApiLimiter) this.mediaApiLimiter = new RateLimiter({
115
+ maxRequests: 300,
116
+ windowMs: 6e4
117
+ });
118
+ return this.mediaApiLimiter;
119
+ }
120
+ /** Interactive task and board mutations — 300 req / 60 s per client IP. */
121
+ taskApi() {
122
+ if (!this.taskApiLimiter) this.taskApiLimiter = new RateLimiter({
123
+ maxRequests: 300,
124
+ windowMs: 6e4
74
125
  });
75
- this.authFailureSignature = sig;
76
- }
77
- return this.authFailureLimiter;
78
- }
79
- /** Global pre-authentication signing budget; independent of authenticated traffic. */
80
- identityChallenge() {
81
- return this.identityChallengeLimiter ??= new RateLimiter({
82
- maxRequests: 300,
83
- windowMs: 6e4
84
- });
85
- }
86
- /** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
87
- strictApi() {
88
- if (!this.strictApiLimiter) this.strictApiLimiter = new RateLimiter({
89
- maxRequests: 150,
90
- windowMs: 6e4
91
- });
92
- return this.strictApiLimiter;
93
- }
94
- /** Interactive chat actions — 180 req / 60 s per client IP. */
95
- chatApi() {
96
- if (!this.chatApiLimiter) this.chatApiLimiter = new RateLimiter({
97
- maxRequests: 180,
98
- windowMs: 6e4
99
- });
100
- return this.chatApiLimiter;
101
- }
102
- /** Durable media chunk uploads — 300 req / 60 s per client IP. */
103
- mediaApi() {
104
- if (!this.mediaApiLimiter) this.mediaApiLimiter = new RateLimiter({
105
- maxRequests: 300,
106
- windowMs: 6e4
107
- });
108
- return this.mediaApiLimiter;
109
- }
110
- /** Interactive task and board mutations — 300 req / 60 s per client IP. */
111
- taskApi() {
112
- if (!this.taskApiLimiter) this.taskApiLimiter = new RateLimiter({
113
- maxRequests: 300,
114
- windowMs: 6e4
115
- });
116
- return this.taskApiLimiter;
117
- }
118
- /** XOPC Cloud authorization polling — 60 req / 60 s per client IP. */
119
- xopcCloudPoll() {
120
- if (!this.xopcCloudPollLimiter) this.xopcCloudPollLimiter = new RateLimiter({
121
- maxRequests: 60,
122
- windowMs: 6e4
123
- });
124
- return this.xopcCloudPollLimiter;
125
- }
126
- /** Channel mutation/action endpoints — 20 req / 60 s per client IP. */
127
- channelApi() {
128
- if (!this.channelApiLimiter) this.channelApiLimiter = new RateLimiter({
129
- maxRequests: 20,
130
- windowMs: 6e4
131
- });
132
- return this.channelApiLimiter;
133
- }
134
- /** Tunnel mutation calls — 12 req / 5 min per gateway-token fingerprint. */
135
- tunnelMutate() {
136
- if (!this.tunnelMutateLimiter) this.tunnelMutateLimiter = new RateLimiter({
137
- maxRequests: 12,
138
- windowMs: 5 * 6e4
139
- });
140
- return this.tunnelMutateLimiter;
141
- }
142
- /** Failed pairing-exchange attempts — 30 failures / 5 min per client IP. */
143
- pairingExchange() {
144
- if (!this.pairingExchangeLimiter) this.pairingExchangeLimiter = new FailureLimiter({
145
- maxFailures: 30,
146
- windowMs: 5 * 6e4,
147
- blockDurationMs: 5 * 6e4,
148
- burstCoalesceMs: 0
149
- });
150
- return this.pairingExchangeLimiter;
151
- }
152
- /** Public share download short window — 60 req / min per client IP. */
153
- sharePublicShort() {
154
- if (!this.sharePublicShortLimiter) this.sharePublicShortLimiter = new RateLimiter({
155
- maxRequests: 60,
156
- windowMs: 6e4
157
- });
158
- return this.sharePublicShortLimiter;
159
- }
160
- /** Public share download long window — 300 req / 15 min per client IP. */
161
- sharePublicLong() {
162
- if (!this.sharePublicLongLimiter) this.sharePublicLongLimiter = new RateLimiter({
163
- maxRequests: 300,
164
- windowMs: 15 * 6e4
165
- });
166
- return this.sharePublicLongLimiter;
167
- }
168
- destroyAll() {
169
- this.authFailureLimiter?.destroy();
170
- this.identityChallengeLimiter?.destroy();
171
- this.strictApiLimiter?.destroy();
172
- this.chatApiLimiter?.destroy();
173
- this.mediaApiLimiter?.destroy();
174
- this.taskApiLimiter?.destroy();
175
- this.xopcCloudPollLimiter?.destroy();
176
- this.channelApiLimiter?.destroy();
177
- this.tunnelMutateLimiter?.destroy();
178
- this.pairingExchangeLimiter?.destroy();
179
- this.sharePublicShortLimiter?.destroy();
180
- this.sharePublicLongLimiter?.destroy();
181
- this.authFailureLimiter = void 0;
182
- this.identityChallengeLimiter = void 0;
183
- this.strictApiLimiter = void 0;
184
- this.chatApiLimiter = void 0;
185
- this.mediaApiLimiter = void 0;
186
- this.taskApiLimiter = void 0;
187
- this.xopcCloudPollLimiter = void 0;
188
- this.channelApiLimiter = void 0;
189
- this.tunnelMutateLimiter = void 0;
190
- this.pairingExchangeLimiter = void 0;
191
- this.sharePublicShortLimiter = void 0;
192
- this.sharePublicLongLimiter = void 0;
193
- this.authFailureSignature = void 0;
194
- }
195
- /** @internal */
196
- resetAllForTests() {
197
- this.authFailureLimiter?.resetForTests();
198
- this.strictApiLimiter?.resetForTests();
199
- this.chatApiLimiter?.resetForTests();
200
- this.mediaApiLimiter?.resetForTests();
201
- this.taskApiLimiter?.resetForTests();
202
- this.xopcCloudPollLimiter?.resetForTests();
203
- this.channelApiLimiter?.resetForTests();
204
- this.tunnelMutateLimiter?.resetForTests();
205
- this.pairingExchangeLimiter?.resetForTests();
206
- this.sharePublicShortLimiter?.resetForTests();
207
- this.sharePublicLongLimiter?.resetForTests();
208
- }
209
- };
210
- const buckets = new BucketRegistry();
126
+ return this.taskApiLimiter;
127
+ }
128
+ /** XOPC Cloud authorization polling — 60 req / 60 s per client IP. */
129
+ xopcCloudPoll() {
130
+ if (!this.xopcCloudPollLimiter) this.xopcCloudPollLimiter = new RateLimiter({
131
+ maxRequests: 60,
132
+ windowMs: 6e4
133
+ });
134
+ return this.xopcCloudPollLimiter;
135
+ }
136
+ /** Channel mutation/action endpoints — 20 req / 60 s per client IP. */
137
+ channelApi() {
138
+ if (!this.channelApiLimiter) this.channelApiLimiter = new RateLimiter({
139
+ maxRequests: 20,
140
+ windowMs: 6e4
141
+ });
142
+ return this.channelApiLimiter;
143
+ }
144
+ /** Tunnel mutation calls — 12 req / 5 min per gateway-token fingerprint. */
145
+ tunnelMutate() {
146
+ if (!this.tunnelMutateLimiter) this.tunnelMutateLimiter = new RateLimiter({
147
+ maxRequests: 12,
148
+ windowMs: 5 * 6e4
149
+ });
150
+ return this.tunnelMutateLimiter;
151
+ }
152
+ /** Failed pairing-exchange attempts — 30 failures / 5 min per client IP. */
153
+ pairingExchange() {
154
+ if (!this.pairingExchangeLimiter) this.pairingExchangeLimiter = new FailureLimiter({
155
+ maxFailures: 30,
156
+ windowMs: 5 * 6e4,
157
+ blockDurationMs: 5 * 6e4,
158
+ burstCoalesceMs: 0
159
+ });
160
+ return this.pairingExchangeLimiter;
161
+ }
162
+ /** Public share download short window — 60 req / min per client IP. */
163
+ sharePublicShort() {
164
+ if (!this.sharePublicShortLimiter) this.sharePublicShortLimiter = new RateLimiter({
165
+ maxRequests: 60,
166
+ windowMs: 6e4
167
+ });
168
+ return this.sharePublicShortLimiter;
169
+ }
170
+ /** Public share download long window — 300 req / 15 min per client IP. */
171
+ sharePublicLong() {
172
+ if (!this.sharePublicLongLimiter) this.sharePublicLongLimiter = new RateLimiter({
173
+ maxRequests: 300,
174
+ windowMs: 15 * 6e4
175
+ });
176
+ return this.sharePublicLongLimiter;
177
+ }
178
+ destroyAll() {
179
+ this.authFailureLimiter?.destroy();
180
+ this.identityChallengeLimiter?.destroy();
181
+ this.publicDeviceGlobalLimiter?.destroy();
182
+ this.publicDeviceSourceLimiter?.destroy();
183
+ this.deviceRefreshLimiter?.destroy();
184
+ this.strictApiLimiter?.destroy();
185
+ this.chatApiLimiter?.destroy();
186
+ this.mediaApiLimiter?.destroy();
187
+ this.taskApiLimiter?.destroy();
188
+ this.xopcCloudPollLimiter?.destroy();
189
+ this.channelApiLimiter?.destroy();
190
+ this.tunnelMutateLimiter?.destroy();
191
+ this.pairingExchangeLimiter?.destroy();
192
+ this.sharePublicShortLimiter?.destroy();
193
+ this.sharePublicLongLimiter?.destroy();
194
+ this.authFailureLimiter = void 0;
195
+ this.identityChallengeLimiter = void 0;
196
+ this.publicDeviceGlobalLimiter = void 0;
197
+ this.publicDeviceSourceLimiter = void 0;
198
+ this.deviceRefreshLimiter = void 0;
199
+ this.strictApiLimiter = void 0;
200
+ this.chatApiLimiter = void 0;
201
+ this.mediaApiLimiter = void 0;
202
+ this.taskApiLimiter = void 0;
203
+ this.xopcCloudPollLimiter = void 0;
204
+ this.channelApiLimiter = void 0;
205
+ this.tunnelMutateLimiter = void 0;
206
+ this.pairingExchangeLimiter = void 0;
207
+ this.sharePublicShortLimiter = void 0;
208
+ this.sharePublicLongLimiter = void 0;
209
+ this.authFailureSignature = void 0;
210
+ }
211
+ /** @internal */
212
+ resetAllForTests() {
213
+ this.authFailureLimiter?.resetForTests();
214
+ this.identityChallengeLimiter?.resetForTests();
215
+ this.publicDeviceGlobalLimiter?.resetForTests();
216
+ this.publicDeviceSourceLimiter?.resetForTests();
217
+ this.deviceRefreshLimiter?.resetForTests();
218
+ this.strictApiLimiter?.resetForTests();
219
+ this.chatApiLimiter?.resetForTests();
220
+ this.mediaApiLimiter?.resetForTests();
221
+ this.taskApiLimiter?.resetForTests();
222
+ this.xopcCloudPollLimiter?.resetForTests();
223
+ this.channelApiLimiter?.resetForTests();
224
+ this.tunnelMutateLimiter?.resetForTests();
225
+ this.pairingExchangeLimiter?.resetForTests();
226
+ this.sharePublicShortLimiter?.resetForTests();
227
+ this.sharePublicLongLimiter?.resetForTests();
228
+ }
229
+ };
230
+ buckets = new BucketRegistry();
231
+ }));
211
232
  //#endregion
212
- export { authPolicyConfig, buckets, resolveAuthRateLimit };
233
+ init_buckets();
234
+ export { authPolicyConfig, buckets, init_buckets, resolveAuthRateLimit };
@@ -1,3 +1,4 @@
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
1
2
  //#region src/gateway/rate-limit/env-flags.ts
2
3
  /**
3
4
  * Process-level env-var feature flags that influence rate-limit and gateway
@@ -10,5 +11,7 @@ function isAuthRateLimitGloballyDisabled() {
10
11
  function isGatewayStrictSecurityEnabled(cfg) {
11
12
  return cfg?.gateway?.security?.strict === true || process.env.XOPC_GATEWAY_STRICT_SECURITY === "1";
12
13
  }
14
+ var init_env_flags = __esmMin((() => {}));
13
15
  //#endregion
14
- export { isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled };
16
+ init_env_flags();
17
+ export { init_env_flags, isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled };
@@ -1,4 +1,13 @@
1
- import { authPolicyConfig, buckets, resolveAuthRateLimit } from "./buckets.js";
2
- import { buildBrowserOriginKey, resolveAuthTracking } from "./auth-policy.js";
3
- import { isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled } from "./env-flags.js";
4
- export { authPolicyConfig, buckets, buildBrowserOriginKey, isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled, resolveAuthRateLimit, resolveAuthTracking };
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { authPolicyConfig, buckets, init_buckets, resolveAuthRateLimit } from "./buckets.js";
3
+ import { buildBrowserOriginKey, init_auth_policy, resolveAuthTracking } from "./auth-policy.js";
4
+ import { init_env_flags, isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled } from "./env-flags.js";
5
+ //#region src/gateway/rate-limit/index.ts
6
+ var init_rate_limit = __esmMin((() => {
7
+ init_buckets();
8
+ init_auth_policy();
9
+ init_env_flags();
10
+ }));
11
+ //#endregion
12
+ init_rate_limit();
13
+ export { authPolicyConfig, buckets, buildBrowserOriginKey, init_rate_limit, isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled, resolveAuthRateLimit, resolveAuthTracking };
@@ -1,10 +1,12 @@
1
- import { isAllInterfacesHost, isLoopbackHost, resolveGatewayCorsOrigins } from "./host.js";
1
+ import { init_host, isAllInterfacesHost, isLoopbackHost, resolveGatewayCorsOrigins } from "./host.js";
2
+ import { isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
3
+ import { init_rate_limit } from "./rate-limit/index.js";
2
4
  import { resolveGatewayListenPlan } from "./listen.js";
3
5
  import { assertTailscaleExposureCompatible } from "./tailscale-lifecycle.js";
4
6
  import { requireTunnelGatewayToken } from "../tunnel/auth-policy.js";
5
- import { isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
6
- import "./rate-limit/index.js";
7
7
  //#region src/gateway/runtime-config.ts
8
+ init_rate_limit();
9
+ init_host();
8
10
  function hasSharedSecret(auth) {
9
11
  if (auth.mode === "trusted-proxy") return true;
10
12
  if (auth.mode === "token") return typeof auth.token === "string" && auth.token.trim().length > 0;