@circuitwall/jarela 2.3.0 → 2.5.0

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 (290) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +5 -5
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +4 -4
  5. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.html +14 -2
  13. package/.next/standalone/.next/server/app/_not-found.rsc +16 -4
  14. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +16 -4
  15. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +16 -4
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +7 -0
  19. package/.next/standalone/.next/server/app/api/v1/access/route.js +7 -0
  20. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +7 -0
  21. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +17 -5
  22. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +7 -0
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +17 -5
  24. package/.next/standalone/.next/server/app/api/v1/agents/route.js +7 -0
  25. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +7 -0
  26. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +7 -0
  27. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +7 -0
  28. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +26 -32
  29. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +18 -7
  31. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +18 -7
  32. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +26 -32
  33. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +27 -33
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +26 -32
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +28 -12
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +28 -12
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +26 -32
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +9 -2
  43. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +19 -7
  45. package/.next/standalone/.next/server/app/api/v1/bridges/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +17 -5
  47. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +7 -0
  48. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +1 -1
  49. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +7 -0
  50. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +7 -0
  51. package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +1 -1
  52. package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +1 -1
  53. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +7 -0
  54. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +7 -0
  55. package/.next/standalone/.next/server/app/api/v1/events/route.js +26 -32
  56. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +1 -1
  58. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +7 -0
  59. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +7 -0
  60. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +7 -0
  61. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +7 -0
  62. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +7 -0
  63. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +7 -0
  64. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +7 -0
  65. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +7 -0
  66. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +7 -0
  67. package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +1 -1
  68. package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +1 -1
  69. package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +1 -1
  70. package/.next/standalone/.next/server/app/api/v1/extensions/route.js +1 -1
  71. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +1 -1
  72. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +1 -1
  73. package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +1 -1
  74. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +7 -0
  75. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +7 -0
  76. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +7 -0
  77. package/.next/standalone/.next/server/app/api/v1/health/route.js +17 -5
  78. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +7 -0
  79. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +7 -0
  80. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +7 -0
  81. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +7 -0
  82. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +7 -0
  83. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +7 -0
  84. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +7 -0
  85. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +7 -0
  86. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +17 -5
  87. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +7 -0
  88. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +17 -5
  89. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +17 -5
  90. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +7 -0
  91. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +7 -0
  92. package/.next/standalone/.next/server/app/api/v1/memory/route.js +7 -0
  93. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +7 -0
  94. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +7 -0
  95. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +7 -0
  96. package/.next/standalone/.next/server/app/api/v1/models/route.js +7 -0
  97. package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +28 -4
  98. package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +28 -4
  99. package/.next/standalone/.next/server/app/api/v1/packages/route.js +28 -4
  100. package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +1 -1
  101. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +27 -12
  102. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +7 -0
  103. package/.next/standalone/.next/server/app/api/v1/profile/route.js +7 -0
  104. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +585 -58
  105. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +7 -0
  106. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +7 -0
  107. package/.next/standalone/.next/server/app/api/v1/providers/route.js +7 -0
  108. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +7 -0
  109. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +7 -0
  110. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +7 -0
  111. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +17 -5
  112. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +1 -1
  113. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +7 -0
  114. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +7 -0
  115. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +7 -0
  116. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +7 -0
  117. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +7 -0
  118. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +7 -0
  119. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +7 -0
  120. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +7 -0
  121. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +7 -0
  122. package/.next/standalone/.next/server/app/api/v1/skills/route.js +7 -0
  123. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +7 -0
  124. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +7 -0
  125. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +7 -0
  126. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +12 -6
  127. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +125 -26
  128. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +1 -2
  129. package/.next/standalone/.next/server/app/api/v1/threads/route.js +17 -5
  130. package/.next/standalone/.next/server/app/api/v1/tools/route.js +1 -1
  131. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  132. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +17 -5
  133. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +17 -5
  134. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +17 -5
  135. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +1 -1
  136. package/.next/standalone/.next/server/app/api/v1/watchers/route.js +1 -1
  137. package/.next/standalone/.next/server/app/page.js +27323 -27034
  138. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  139. package/.next/standalone/.next/server/app/setup/page.js +8 -0
  140. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  141. package/.next/standalone/.next/server/app-paths-manifest.json +5 -5
  142. package/.next/standalone/.next/server/chunks/1388.js +106 -36
  143. package/.next/standalone/.next/server/chunks/2068.js +47 -10
  144. package/.next/standalone/.next/server/chunks/210.js +6 -6
  145. package/.next/standalone/.next/server/chunks/2447.js +10 -5
  146. package/.next/standalone/.next/server/chunks/2653.js +80 -1
  147. package/.next/standalone/.next/server/chunks/3042.js +10 -8
  148. package/.next/standalone/.next/server/chunks/{4540.js → 309.js} +104 -38
  149. package/.next/standalone/.next/server/chunks/{2350.js → 3272.js} +104 -37
  150. package/.next/standalone/.next/server/chunks/3524.js +150 -67
  151. package/.next/standalone/.next/server/chunks/3566.js +1 -1
  152. package/.next/standalone/.next/server/chunks/4189.js +1 -1
  153. package/.next/standalone/.next/server/chunks/4596.js +28 -4
  154. package/.next/standalone/.next/server/chunks/46.js +91 -31
  155. package/.next/standalone/.next/server/chunks/466.js +53 -7
  156. package/.next/standalone/.next/server/chunks/4955.js +30 -3
  157. package/.next/standalone/.next/server/chunks/5585.js +28 -4
  158. package/.next/standalone/.next/server/chunks/5908.js +63 -42
  159. package/.next/standalone/.next/server/chunks/6142.js +10 -2
  160. package/.next/standalone/.next/server/chunks/8461.js +10 -8
  161. package/.next/standalone/.next/server/chunks/9032.js +5 -5
  162. package/.next/standalone/.next/server/chunks/9164.js +487 -177
  163. package/.next/standalone/.next/server/chunks/9304.js +51 -12
  164. package/.next/standalone/.next/server/chunks/{423.js → 9590.js} +84 -24
  165. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  166. package/.next/standalone/.next/server/middleware.js +89 -21
  167. package/.next/standalone/.next/server/pages/404.html +14 -2
  168. package/.next/standalone/.next/server/pages/500.html +1 -1
  169. package/.next/standalone/.next/server/preview-props.json +3 -3
  170. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  171. package/.next/standalone/.next/static/chunks/{1395-e4a99912b8f83044.js → 1395-bfe1f3ef760c0f50.js} +54 -8
  172. package/.next/standalone/.next/static/chunks/app/{layout-9bc0b10127cb7d42.js → layout-7b24ad13faa3944b.js} +69 -2
  173. package/.next/standalone/.next/static/chunks/app/{page-213a623b37226452.js → page-2ef8d75d40eb4311.js} +10643 -10295
  174. package/.next/standalone/.next/static/css/c160ea862133acd2.css +5 -0
  175. package/.next/standalone/docs/adoption/changesets.json +2805 -0
  176. package/.next/standalone/package.json +1 -1
  177. package/CHANGELOG.md +52 -0
  178. package/api/client.models.test.ts +10 -0
  179. package/api/client.startup.test.ts +129 -0
  180. package/api/client.ts +51 -9
  181. package/api/thread-metadata.test.ts +72 -0
  182. package/api/types.ts +6 -3
  183. package/app/api/v1/providers/[provider]/models/route.test.ts +216 -6
  184. package/app/api/v1/providers/[provider]/models/route.ts +259 -40
  185. package/app/api/v1/threads/[thread_id]/route.ts +26 -23
  186. package/app/api/v1/threads/[thread_id]/run/route.ts +0 -1
  187. package/app/globals.css +119 -29
  188. package/app/layout.tsx +12 -0
  189. package/components/agents/AgentsPanel.tsx +5 -13
  190. package/components/chat/ChatView.tsx +9 -18
  191. package/components/chat/InputBar.tsx +1 -1
  192. package/components/chat/MessageBubble.tsx +13 -1
  193. package/components/chat/MessageList.test.tsx +45 -4
  194. package/components/chat/MessageList.tsx +123 -89
  195. package/components/chat/ToolList.tsx +88 -84
  196. package/components/chat/useThreadActivity.test.tsx +2 -2
  197. package/components/chat/useThreadActivity.ts +2 -2
  198. package/components/chat/useThreadData.ts +1 -30
  199. package/components/chat/useThreadMetadataPolling.test.tsx +128 -0
  200. package/components/chat/useThreadMetadataPolling.ts +50 -0
  201. package/components/chat/useUserProfileAndAgent.test.tsx +31 -0
  202. package/components/chat/useUserProfileAndAgent.ts +13 -2
  203. package/components/dashboard/DashboardPanel.tsx +1 -1
  204. package/components/dashboard/Series.tsx +34 -21
  205. package/components/dashboard/SummaryCards.tsx +1 -1
  206. package/components/integrations/NetworkSection.tsx +2 -2
  207. package/components/layout/AppShell.tsx +22 -7
  208. package/components/layout/MenuPanel.tsx +14 -24
  209. package/components/profile/ProfilePanel.tsx +2 -2
  210. package/components/settings/AppearancePanel.tsx +70 -3
  211. package/components/settings/SettingsPanel.tsx +2 -2
  212. package/components/tools/ToolsPanel.tsx +2 -7
  213. package/components/ui/AppearancePreferences.test.tsx +68 -0
  214. package/components/ui/BootScreen.test.tsx +44 -0
  215. package/components/ui/BootScreen.tsx +24 -11
  216. package/components/ui/NotificationStatus.test.tsx +2 -2
  217. package/components/ui/NotificationStatus.tsx +5 -5
  218. package/components/ui/SubTabBar.tsx +2 -3
  219. package/contexts/ThemeContext.tsx +84 -1
  220. package/hooks/useAgentSession.test.ts +12 -1
  221. package/hooks/useAgentSession.ts +6 -4
  222. package/hooks/useUrlSync.test.ts +13 -0
  223. package/hooks/useUrlSync.ts +0 -4
  224. package/lib/agents/citation-checker.test.ts +40 -2
  225. package/lib/agents/citation-checker.ts +56 -11
  226. package/lib/agents/context-boundary.ts +5 -6
  227. package/lib/agents/instruction-edits.test.ts +120 -0
  228. package/lib/agents/instruction-edits.ts +65 -42
  229. package/lib/agents/prepare/request.ts +0 -2
  230. package/lib/agents/prepare/system-prompt.test.ts +10 -0
  231. package/lib/agents/prepare/system-prompt.ts +8 -2
  232. package/lib/agents/proposals.test.ts +76 -0
  233. package/lib/agents/proposals.ts +13 -5
  234. package/lib/agents/run-thread.auto-boundary.test.ts +125 -5
  235. package/lib/agents/run-thread.ts +24 -9
  236. package/lib/agents/sqlite-checkpoint-saver.test.ts +91 -0
  237. package/lib/agents/warm-summary-background.ts +22 -2
  238. package/lib/agents/warm-topics.test.ts +155 -1
  239. package/lib/agents/warm-topics.ts +27 -7
  240. package/lib/bridges/dispatcher.ts +1 -0
  241. package/lib/bridges/message-role.test.ts +81 -0
  242. package/lib/bridges/message-role.ts +23 -10
  243. package/lib/bridges/types.ts +6 -0
  244. package/lib/bridges/whatsapp-link.test.ts +32 -0
  245. package/lib/bridges/whatsapp-link.ts +21 -0
  246. package/lib/bridges/whatsapp.inbound.test.ts +239 -0
  247. package/lib/bridges/whatsapp.sender.test.ts +80 -1
  248. package/lib/bridges/whatsapp.ts +76 -38
  249. package/lib/db/migrations.test.ts +61 -0
  250. package/lib/db/migrations.ts +13 -0
  251. package/lib/embeddings/performance.test.ts +114 -0
  252. package/lib/pricing/snapshot.test.ts +70 -0
  253. package/lib/pricing/snapshot.ts +10 -2
  254. package/lib/proxy/dispatcher.test.ts +119 -1
  255. package/lib/proxy/dispatcher.ts +22 -9
  256. package/lib/stores/agent-configs.ts +10 -5
  257. package/lib/stores/bridges.test.ts +81 -0
  258. package/lib/stores/bridges.ts +9 -8
  259. package/lib/stores/dashboard-metrics-cache.test.ts +99 -0
  260. package/lib/stores/dashboard-metrics.ts +30 -4
  261. package/lib/stores/message-embedding-jobs.test.ts +27 -0
  262. package/lib/stores/message-embedding-jobs.ts +5 -3
  263. package/lib/stores/message-usage.test.ts +21 -1
  264. package/lib/stores/pricing-cache.test.ts +31 -0
  265. package/lib/stores/pricing.ts +3 -0
  266. package/lib/stores/proxy-config.test.ts +120 -0
  267. package/lib/stores/proxy-config.ts +22 -4
  268. package/lib/stores/threads.ts +12 -8
  269. package/lib/tools/communications/calendar.test.ts +43 -2
  270. package/lib/tools/communications/calendar.ts +2 -0
  271. package/lib/tools/communications/gmail.test.ts +51 -1
  272. package/lib/tools/communications/gmail.ts +44 -2
  273. package/lib/tools/communications/outlook-calendar.ts +2 -0
  274. package/lib/tools/communications/outlook.test.ts +33 -2
  275. package/lib/tools/communications/outlook.ts +2 -0
  276. package/lib/tools/filesystem/edit-match.test.ts +133 -0
  277. package/lib/tools/filesystem/edit-match.ts +7 -2
  278. package/lib/tools/packages/default-packages.test.ts +21 -0
  279. package/lib/tools/packages/optional-package.test.ts +72 -0
  280. package/lib/tools/packages/optional-package.ts +33 -4
  281. package/lib/tools/support/result-refs.test.ts +131 -0
  282. package/lib/tools/support/result-refs.ts +41 -9
  283. package/lib/ui/navigate.test.ts +13 -0
  284. package/lib/ui/navigate.ts +10 -2
  285. package/lib/utils/source-link.test.ts +51 -0
  286. package/lib/utils/source-link.ts +45 -0
  287. package/package.json +1 -1
  288. package/.next/standalone/.next/static/css/312542a5725ba0d5.css +0 -5
  289. /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → 544OFJV-q0RC6Gjgje4LT}/_buildManifest.js +0 -0
  290. /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → 544OFJV-q0RC6Gjgje4LT}/_ssgManifest.js +0 -0
@@ -1227,12 +1227,13 @@ function drainQueuedBoundary(threadId) {
1227
1227
  function runBoundaryCompaction(threadId, boundarySeq, options) {
1228
1228
  const baseThread = (0,threads/* getThread */.fG)(threadId);
1229
1229
  const basePinSeq = baseThread?.hot_since_seq ?? null;
1230
+ const baseLock = baseThread?.auto_boundary_locked_until_msg_count ?? 0;
1230
1231
  void (0,thread_compaction_state/* runTrackedCompaction */.PL)(threadId, "auto", boundarySeq, async (attempt)=>{
1231
1232
  await Promise.resolve();
1232
- await commitBoundaryCompaction(threadId, boundarySeq, basePinSeq, options, attempt);
1233
+ await commitBoundaryCompaction(threadId, boundarySeq, basePinSeq, baseLock, options, attempt);
1233
1234
  }).catch((err)=>console.warn(`[context-boundary:auto] compaction failed thread=${threadId}: ${String(err)}`)).finally(()=>drainQueuedBoundary(threadId));
1234
1235
  }
1235
- async function commitBoundaryCompaction(threadId, boundarySeq, basePinSeq, options, attempt) {
1236
+ async function commitBoundaryCompaction(threadId, boundarySeq, basePinSeq, baseLock, options, attempt) {
1236
1237
  const committed = await compactThreadWarmContext(threadId, boundarySeq, {
1237
1238
  expectedHotSinceSeq: basePinSeq,
1238
1239
  alignTopicBoundary: true,
@@ -1240,7 +1241,18 @@ async function commitBoundaryCompaction(threadId, boundarySeq, basePinSeq, optio
1240
1241
  ...options,
1241
1242
  attempt
1242
1243
  });
1243
- if (!committed) return;
1244
+ if (!committed) {
1245
+ // A pass that resolved to no change (the active topic still starts at the
1246
+ // current pin) must not be retried on every following turn either. Skip
1247
+ // it when the boundary or lock changed mid-pass (e.g. the user cleared or
1248
+ // moved the boundary): that newer state wins over this stale pass.
1249
+ const lockUntil = options.autoBoundaryLockedUntilMessageCount;
1250
+ const current = (0,threads/* getThread */.fG)(threadId);
1251
+ if (lockUntil !== undefined && current && (current.hot_since_seq ?? null) === basePinSeq && (current.auto_boundary_locked_until_msg_count ?? 0) === baseLock && lockUntil > baseLock) {
1252
+ (0,threads/* setAutoBoundaryLock */.NU)(threadId, lockUntil);
1253
+ }
1254
+ return;
1255
+ }
1244
1256
  console.info(`[context-boundary:auto] thread=${threadId} committed boundary_seq=${committed.boundarySeq} warm_msgs=${committed.sourceMessages}`);
1245
1257
  }
1246
1258
  async function findTopicBoundary(threadId, boundarySeq) {
@@ -2342,12 +2354,17 @@ function upsertAgentConfigTransaction(input) {
2342
2354
  const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
2343
2355
  const existing = getAgentConfig(input.id);
2344
2356
  const created_at = existing?.created_at ?? t;
2345
- const mbti = input.adaptive_mbti ?? toMbti(existing?.adaptive_mbti) ?? "INTJ";
2357
+ const existingMbti = toMbti(existing?.adaptive_mbti);
2358
+ const mbti = input.adaptive_mbti ?? existingMbti ?? "INTJ";
2346
2359
  const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
2347
- const strength = input.adaptive_persona_strength ?? preset.strength;
2348
- const empathy = input.adaptive_empathy ?? preset.empathy;
2349
- const expressiveness = input.adaptive_expressiveness ?? preset.expressiveness;
2350
- const verbosity = input.adaptive_verbosity ?? preset.verbosity;
2360
+ // Omitted sliders keep their tuned values; they only fall back to the
2361
+ // preset when the type changes or the agent is new. Otherwise every
2362
+ // partial update (approved proposals, tool edits) reset them.
2363
+ const keepTuned = existing !== null && existing !== undefined && mbti === existingMbti;
2364
+ const strength = input.adaptive_persona_strength ?? (keepTuned ? existing.adaptive_persona_strength : preset.strength);
2365
+ const empathy = input.adaptive_empathy ?? (keepTuned ? existing.adaptive_empathy : preset.empathy);
2366
+ const expressiveness = input.adaptive_expressiveness ?? (keepTuned ? existing.adaptive_expressiveness : preset.expressiveness);
2367
+ const verbosity = input.adaptive_verbosity ?? (keepTuned ? existing.adaptive_verbosity : preset.verbosity);
2351
2368
  if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
2352
2369
  // harness_id: explicit `undefined` means "keep existing"; explicit `null`
2353
2370
  // means "use the global default". Empty string is normalised to null too,
@@ -2833,8 +2850,21 @@ const MEMORY_WRITE_NAMESPACES = new Set([
2833
2850
  function rowsInRange(rows, topic) {
2834
2851
  return rows.filter((row)=>row.seq >= (topic.start_seq ?? Infinity) && row.seq <= (topic.end_seq ?? -Infinity));
2835
2852
  }
2853
+ // Unicode-aware so non-Latin subjects get distinct keys; an ASCII-only slug
2854
+ // collapsed them all to "" and the uplift skipped them. Subjects with no
2855
+ // letters or digits fall back to a stable hash.
2836
2856
  function slugifyForMemoryKey(subject) {
2837
- return subject.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
2857
+ const slug = subject.normalize("NFC").toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "");
2858
+ const capped = Array.from(slug).slice(0, 80).join("").replace(/-+$/, "");
2859
+ return capped || `fact-${fnv1a(subject)}`;
2860
+ }
2861
+ function fnv1a(text) {
2862
+ let hash = 0x811c9dc5;
2863
+ for(let i = 0; i < text.length; i++){
2864
+ hash ^= text.charCodeAt(i);
2865
+ hash = Math.imul(hash, 0x01000193);
2866
+ }
2867
+ return (hash >>> 0).toString(16).padStart(8, "0");
2838
2868
  }
2839
2869
  /**
2840
2870
  * Merge facts by subject (case-insensitive) and memory key. Later entries win,
@@ -2846,9 +2876,18 @@ function slugifyForMemoryKey(subject) {
2846
2876
  for (const list of lists){
2847
2877
  for (const fact of list){
2848
2878
  const subjectId = fact.subject.trim().toLowerCase();
2849
- const existingSubject = fact.key ? keyToSubject.get(fact.key) : undefined;
2850
- if (existingSubject && existingSubject !== subjectId) merged.delete(existingSubject);
2851
- merged.delete(subjectId);
2879
+ const sameKeySubject = fact.key ? keyToSubject.get(fact.key) : undefined;
2880
+ for (const replaced of [
2881
+ sameKeySubject,
2882
+ subjectId
2883
+ ]){
2884
+ if (replaced === undefined) continue;
2885
+ // Drop the replaced fact's key mapping too, so a later fact reusing
2886
+ // that key cannot delete whatever now lives under this subject.
2887
+ const previousKey = merged.get(replaced)?.key;
2888
+ if (previousKey) keyToSubject.delete(previousKey);
2889
+ merged.delete(replaced);
2890
+ }
2852
2891
  merged.set(subjectId, fact);
2853
2892
  if (fact.key) keyToSubject.set(fact.key, subjectId);
2854
2893
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- exports.id = 423;
3
- exports.ids = [423];
2
+ exports.id = 9590;
3
+ exports.ids = [9590];
4
4
  exports.modules = {
5
5
 
6
6
  /***/ 423:
@@ -527,9 +527,11 @@ function claimMessageEmbeddingJobs(limit = 16, leaseMs = 5 * 60000, nowMs = Date
527
527
  });
528
528
  }
529
529
  function nextMessageEmbeddingDelayMs(nowMs = Date.now()) {
530
- const row = (0,_lib_db__WEBPACK_IMPORTED_MODULE_2__/* .getDb */ .L)().prepare(`SELECT MIN(CASE WHEN state='pending' THEN available_at_ms ELSE lease_until_ms END) AS next_at_ms
531
- FROM message_embedding_jobs
532
- WHERE state IN ('pending','processing')`).get();
530
+ const row = (0,_lib_db__WEBPACK_IMPORTED_MODULE_2__/* .getDb */ .L)().prepare(`SELECT MIN(next_at_ms) AS next_at_ms FROM (
531
+ SELECT MIN(available_at_ms) AS next_at_ms FROM message_embedding_jobs WHERE state='pending'
532
+ UNION ALL
533
+ SELECT MIN(lease_until_ms) AS next_at_ms FROM message_embedding_jobs WHERE state='processing'
534
+ )`).get();
533
535
  return typeof row?.next_at_ms === "number" ? Math.max(0, row.next_at_ms - nowMs) : null;
534
536
  }
535
537
  function completeMessageEmbeddingJob(job, embedding, modelSignature) {
@@ -3928,6 +3930,9 @@ function runMigrations(db) {
3928
3930
  -- (getMessages, getRecentMessagesWindow, getMessagesPage, clear).
3929
3931
  -- Without this every read full-scans the messages table.
3930
3932
  CREATE INDEX IF NOT EXISTS idx_messages_thread_id ON messages(thread_id, created_at);
3933
+ CREATE INDEX IF NOT EXISTS idx_messages_thread_seq ON messages(thread_id);
3934
+ CREATE INDEX IF NOT EXISTS idx_messages_created_at ON messages(created_at);
3935
+ CREATE INDEX IF NOT EXISTS idx_threads_updated ON threads(updated_at DESC);
3931
3936
  CREATE TABLE IF NOT EXISTS runtime_operations (
3932
3937
  id TEXT PRIMARY KEY,
3933
3938
  kind TEXT NOT NULL,
@@ -3951,6 +3956,9 @@ function runMigrations(db) {
3951
3956
  created_at INTEGER NOT NULL,
3952
3957
  UNIQUE(kind,operation_id,agent_id,thread_id)
3953
3958
  );
3959
+ CREATE INDEX IF NOT EXISTS idx_runtime_operations_thread_state ON runtime_operations(thread_id,state);
3960
+ CREATE INDEX IF NOT EXISTS idx_signal_events_thread ON signal_events(thread_id);
3961
+ CREATE INDEX IF NOT EXISTS idx_signal_events_operation ON signal_events(operation_id);
3954
3962
  CREATE TABLE IF NOT EXISTS signal_deliveries (
3955
3963
  event_id TEXT PRIMARY KEY REFERENCES signal_events(id) ON DELETE CASCADE,
3956
3964
  wake_eligible INTEGER NOT NULL DEFAULT 0,
@@ -3965,6 +3973,7 @@ function runMigrations(db) {
3965
3973
  );
3966
3974
  CREATE INDEX IF NOT EXISTS idx_signal_events_target ON signal_events(agent_id,thread_id,seq);
3967
3975
  CREATE INDEX IF NOT EXISTS idx_signal_deliveries_due ON signal_deliveries(state,available_at);
3976
+ CREATE INDEX IF NOT EXISTS idx_signal_deliveries_lease ON signal_deliveries(state,lease_until);
3968
3977
  CREATE TABLE IF NOT EXISTS background_tool_results (
3969
3978
  key TEXT PRIMARY KEY REFERENCES runtime_operations(id) ON DELETE CASCADE,
3970
3979
  thread_id TEXT NOT NULL REFERENCES threads(thread_id) ON DELETE CASCADE,
@@ -3976,6 +3985,7 @@ function runMigrations(db) {
3976
3985
  expires_at INTEGER NOT NULL
3977
3986
  );
3978
3987
  CREATE INDEX IF NOT EXISTS idx_background_results_owner ON background_tool_results(thread_id,expires_at);
3988
+ CREATE INDEX IF NOT EXISTS idx_background_results_expiry ON background_tool_results(expires_at);
3979
3989
  CREATE TABLE IF NOT EXISTS memory_store (
3980
3990
  namespace TEXT NOT NULL,
3981
3991
  key TEXT NOT NULL,
@@ -3984,6 +3994,8 @@ function runMigrations(db) {
3984
3994
  updated_at TEXT NOT NULL,
3985
3995
  PRIMARY KEY (namespace, key)
3986
3996
  );
3997
+ CREATE INDEX IF NOT EXISTS idx_memory_namespace_updated ON memory_store(namespace,updated_at DESC);
3998
+ CREATE INDEX IF NOT EXISTS idx_memory_updated ON memory_store(updated_at DESC);
3987
3999
  CREATE TABLE IF NOT EXISTS model_configs (
3988
4000
  name TEXT PRIMARY KEY,
3989
4001
  provider TEXT NOT NULL,
@@ -4557,6 +4569,7 @@ function ensureMessageUsageTable(db) {
4557
4569
  );
4558
4570
  CREATE INDEX IF NOT EXISTS idx_message_usage_created_at ON message_usage(created_at);
4559
4571
  CREATE INDEX IF NOT EXISTS idx_message_usage_agent_id ON message_usage(agent_id);
4572
+ CREATE INDEX IF NOT EXISTS idx_message_usage_thread_created ON message_usage(thread_id,created_at DESC);
4560
4573
  `);
4561
4574
  }
4562
4575
  function ensureEmbeddingColumns(db) {
@@ -4596,6 +4609,8 @@ function ensureMessageEmbeddingJobsTable(db) {
4596
4609
  );
4597
4610
  CREATE INDEX IF NOT EXISTS idx_message_embedding_jobs_due
4598
4611
  ON message_embedding_jobs(state, available_at_ms, lease_until_ms);
4612
+ CREATE INDEX IF NOT EXISTS idx_message_embedding_jobs_lease
4613
+ ON message_embedding_jobs(state, lease_until_ms);
4599
4614
  INSERT OR IGNORE INTO message_embedding_jobs (message_id, created_at, updated_at)
4600
4615
  SELECT msg_id, created_at, created_at FROM messages WHERE embedding IS NULL;
4601
4616
  `);
@@ -5626,6 +5641,8 @@ var external_node_child_process_ = __webpack_require__(31421);
5626
5641
  var external_node_util_ = __webpack_require__(57975);
5627
5642
  // EXTERNAL MODULE: external "undici"
5628
5643
  var external_undici_ = __webpack_require__(9956);
5644
+ // EXTERNAL MODULE: external "node:net"
5645
+ var external_node_net_ = __webpack_require__(77030);
5629
5646
  // EXTERNAL MODULE: ./lib/stores/integrations.ts
5630
5647
  var integrations = __webpack_require__(38775);
5631
5648
  ;// ./lib/stores/proxy-config.ts
@@ -5648,6 +5665,7 @@ var integrations = __webpack_require__(38775);
5648
5665
 
5649
5666
 
5650
5667
 
5668
+
5651
5669
  const DEFAULT_STATUS = {
5652
5670
  mode: "off",
5653
5671
  scheme: "http",
@@ -5698,15 +5716,26 @@ function saveProxyConfig(input) {
5698
5716
  };
5699
5717
  const scheme = input.scheme === "https" ? "https" : "http";
5700
5718
  // Manual mode requires host + port. system / off don't.
5719
+ let host = nullable(input.host);
5701
5720
  if (input.mode === "manual") {
5702
- if (!input.host || !input.host.trim()) return {
5721
+ if (!host) return {
5703
5722
  error: "host is required in manual mode"
5704
5723
  };
5705
- if (input.port == null || !Number.isFinite(input.port) || input.port <= 0 || input.port > 65535) {
5724
+ const normalisedHost = normaliseProxyHost(host);
5725
+ if (!normalisedHost) {
5706
5726
  return {
5707
- error: "port must be between 1 and 65535"
5727
+ error: "host must be a hostname or IP address, without scheme, port, path or credentials"
5708
5728
  };
5709
5729
  }
5730
+ host = normalisedHost;
5731
+ if (input.port == null) return {
5732
+ error: "port must be between 1 and 65535"
5733
+ };
5734
+ }
5735
+ if (input.port != null && (!Number.isInteger(input.port) || input.port <= 0 || input.port > 65535)) {
5736
+ return {
5737
+ error: "port must be between 1 and 65535"
5738
+ };
5710
5739
  }
5711
5740
  // CA bundle: empty/null clears; non-empty must look like PEM.
5712
5741
  let storedCaBundle = null;
@@ -5741,7 +5770,7 @@ function saveProxyConfig(input) {
5741
5770
  password = excluded.password,
5742
5771
  no_proxy = excluded.no_proxy,
5743
5772
  ca_bundle = excluded.ca_bundle,
5744
- updated_at = excluded.updated_at`).run(input.mode, scheme, nullable(input.host), input.port ?? null, nullable(input.username), storedPassword, nullable(input.no_proxy), storedCaBundle, now);
5773
+ updated_at = excluded.updated_at`).run(input.mode, scheme, host, input.port ?? null, nullable(input.username), storedPassword, nullable(input.no_proxy), storedCaBundle, now);
5745
5774
  return getProxyConfigStatus();
5746
5775
  }
5747
5776
  function deleteProxyConfig() {
@@ -5763,6 +5792,15 @@ function normaliseMode(m) {
5763
5792
  function normaliseScheme(s) {
5764
5793
  return s === "https" ? "https" : "http";
5765
5794
  }
5795
+ // The dispatcher builds `${scheme}://${auth}${host}:${port}`, so a pasted URL
5796
+ // or host:port would produce an unusable proxy URL. IPv6 is stored unbracketed;
5797
+ // the dispatcher adds the brackets.
5798
+ function normaliseProxyHost(host) {
5799
+ const unbracketed = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
5800
+ if (/^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(unbracketed)) return unbracketed;
5801
+ if (isIPv6(unbracketed)) return unbracketed;
5802
+ return null;
5803
+ }
5766
5804
  function nullable(v) {
5767
5805
  if (v == null) return null;
5768
5806
  const trimmed = v.trim();
@@ -6053,7 +6091,25 @@ async function applyProxyConfigFromDb() {
6053
6091
  // ---------------------------------------------------------------------
6054
6092
  function buildProxyUrl(scheme, host, port, username, password) {
6055
6093
  const auth = username ? `${encodeURIComponent(username)}${password ? `:${encodeURIComponent(password)}` : ""}@` : "";
6056
- return `${scheme}://${auth}${host}:${port}`;
6094
+ const urlHost = host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
6095
+ return `${scheme}://${auth}${urlHost}:${port}`;
6096
+ }
6097
+ // undici's EnvHttpProxyAgent has no implicit loopback exemption, so without
6098
+ // these a configured proxy would also receive local traffic (Ollama, the
6099
+ // WhatsApp bridge sidecar, the app's own loopback API).
6100
+ const LOOPBACK_NO_PROXY = [
6101
+ "localhost",
6102
+ "127.0.0.1",
6103
+ "::1"
6104
+ ];
6105
+ function mergeNoProxy(noProxy) {
6106
+ const entries = (noProxy ?? "").split(/[,\s]+/).map((entry)=>entry.trim()).filter(Boolean);
6107
+ return [
6108
+ ...new Set([
6109
+ ...entries,
6110
+ ...LOOPBACK_NO_PROXY
6111
+ ])
6112
+ ].join(",");
6057
6113
  }
6058
6114
  function installProxy(url, noProxy, caBundle) {
6059
6115
  // Set process.env so EnvHttpProxyAgent honors NO_PROXY semantics
@@ -6061,27 +6117,31 @@ function installProxy(url, noProxy, caBundle) {
6061
6117
  // We still treat the boot-time env snapshot as authoritative for the
6062
6118
  // "env beats DB" rule — this mutation only happens after we've
6063
6119
  // confirmed the user did NOT set HTTP_PROXY at launch.
6120
+ const merged = mergeNoProxy(noProxy);
6064
6121
  process.env.HTTP_PROXY = url;
6065
6122
  process.env.HTTPS_PROXY = url;
6066
- if (noProxy && noProxy.trim().length > 0) {
6067
- process.env.NO_PROXY = noProxy.trim();
6068
- } else {
6069
- delete process.env.NO_PROXY;
6070
- }
6123
+ process.env.NO_PROXY = merged;
6071
6124
  // ADR-0012: when the user pasted a corporate root CA, inject it on
6072
6125
  // both TLS legs — the proxy hop (proxyTls) for https-scheme proxies
6073
6126
  // signed by the corporate root, and the upstream tunnel (requestTls)
6074
6127
  // for proxies that MITM outbound HTTPS with the same internal CA.
6075
6128
  // Same blob is correct: the corporate trust chain typically signs
6076
6129
  // both ends.
6077
- const opts = caBundle ? {
6078
- requestTls: {
6079
- ca: caBundle
6080
- },
6081
- proxyTls: {
6082
- ca: caBundle
6083
- }
6084
- } : {};
6130
+ // Pass the values explicitly too: undici prefers lowercase http_proxy /
6131
+ // no_proxy from the environment over the uppercase ones set above.
6132
+ const opts = {
6133
+ httpProxy: url,
6134
+ httpsProxy: url,
6135
+ noProxy: merged,
6136
+ ...caBundle ? {
6137
+ requestTls: {
6138
+ ca: caBundle
6139
+ },
6140
+ proxyTls: {
6141
+ ca: caBundle
6142
+ }
6143
+ } : {}
6144
+ };
6085
6145
  (0,external_undici_.setGlobalDispatcher)(new external_undici_.EnvHttpProxyAgent(opts));
6086
6146
  }
6087
6147
  function resetToBaseline() {
@@ -10807,4 +10867,4 @@ function getAuthStatus() {
10807
10867
 
10808
10868
  };
10809
10869
  ;
10810
- //# sourceMappingURL=423.js.map
10870
+ //# sourceMappingURL=9590.js.map
@@ -4,8 +4,8 @@ globalThis.__BUILD_MANIFEST = {
4
4
  ],
5
5
  "devFiles": [],
6
6
  "lowPriorityFiles": [
7
- "static/bMRK5y3ruT7c3WtBfCQOG/_buildManifest.js",
8
- "static/bMRK5y3ruT7c3WtBfCQOG/_ssgManifest.js"
7
+ "static/544OFJV-q0RC6Gjgje4LT/_buildManifest.js",
8
+ "static/544OFJV-q0RC6Gjgje4LT/_ssgManifest.js"
9
9
  ],
10
10
  "rootMainFiles": [
11
11
  "static/chunks/webpack-22f2423f357dd0a1.js",
@@ -48715,6 +48715,9 @@ function runMigrations(db) {
48715
48715
  -- (getMessages, getRecentMessagesWindow, getMessagesPage, clear).
48716
48716
  -- Without this every read full-scans the messages table.
48717
48717
  CREATE INDEX IF NOT EXISTS idx_messages_thread_id ON messages(thread_id, created_at);
48718
+ CREATE INDEX IF NOT EXISTS idx_messages_thread_seq ON messages(thread_id);
48719
+ CREATE INDEX IF NOT EXISTS idx_messages_created_at ON messages(created_at);
48720
+ CREATE INDEX IF NOT EXISTS idx_threads_updated ON threads(updated_at DESC);
48718
48721
  CREATE TABLE IF NOT EXISTS runtime_operations (
48719
48722
  id TEXT PRIMARY KEY,
48720
48723
  kind TEXT NOT NULL,
@@ -48738,6 +48741,9 @@ function runMigrations(db) {
48738
48741
  created_at INTEGER NOT NULL,
48739
48742
  UNIQUE(kind,operation_id,agent_id,thread_id)
48740
48743
  );
48744
+ CREATE INDEX IF NOT EXISTS idx_runtime_operations_thread_state ON runtime_operations(thread_id,state);
48745
+ CREATE INDEX IF NOT EXISTS idx_signal_events_thread ON signal_events(thread_id);
48746
+ CREATE INDEX IF NOT EXISTS idx_signal_events_operation ON signal_events(operation_id);
48741
48747
  CREATE TABLE IF NOT EXISTS signal_deliveries (
48742
48748
  event_id TEXT PRIMARY KEY REFERENCES signal_events(id) ON DELETE CASCADE,
48743
48749
  wake_eligible INTEGER NOT NULL DEFAULT 0,
@@ -48752,6 +48758,7 @@ function runMigrations(db) {
48752
48758
  );
48753
48759
  CREATE INDEX IF NOT EXISTS idx_signal_events_target ON signal_events(agent_id,thread_id,seq);
48754
48760
  CREATE INDEX IF NOT EXISTS idx_signal_deliveries_due ON signal_deliveries(state,available_at);
48761
+ CREATE INDEX IF NOT EXISTS idx_signal_deliveries_lease ON signal_deliveries(state,lease_until);
48755
48762
  CREATE TABLE IF NOT EXISTS background_tool_results (
48756
48763
  key TEXT PRIMARY KEY REFERENCES runtime_operations(id) ON DELETE CASCADE,
48757
48764
  thread_id TEXT NOT NULL REFERENCES threads(thread_id) ON DELETE CASCADE,
@@ -48763,6 +48770,7 @@ function runMigrations(db) {
48763
48770
  expires_at INTEGER NOT NULL
48764
48771
  );
48765
48772
  CREATE INDEX IF NOT EXISTS idx_background_results_owner ON background_tool_results(thread_id,expires_at);
48773
+ CREATE INDEX IF NOT EXISTS idx_background_results_expiry ON background_tool_results(expires_at);
48766
48774
  CREATE TABLE IF NOT EXISTS memory_store (
48767
48775
  namespace TEXT NOT NULL,
48768
48776
  key TEXT NOT NULL,
@@ -48771,6 +48779,8 @@ function runMigrations(db) {
48771
48779
  updated_at TEXT NOT NULL,
48772
48780
  PRIMARY KEY (namespace, key)
48773
48781
  );
48782
+ CREATE INDEX IF NOT EXISTS idx_memory_namespace_updated ON memory_store(namespace,updated_at DESC);
48783
+ CREATE INDEX IF NOT EXISTS idx_memory_updated ON memory_store(updated_at DESC);
48774
48784
  CREATE TABLE IF NOT EXISTS model_configs (
48775
48785
  name TEXT PRIMARY KEY,
48776
48786
  provider TEXT NOT NULL,
@@ -49344,6 +49354,7 @@ function ensureMessageUsageTable(db) {
49344
49354
  );
49345
49355
  CREATE INDEX IF NOT EXISTS idx_message_usage_created_at ON message_usage(created_at);
49346
49356
  CREATE INDEX IF NOT EXISTS idx_message_usage_agent_id ON message_usage(agent_id);
49357
+ CREATE INDEX IF NOT EXISTS idx_message_usage_thread_created ON message_usage(thread_id,created_at DESC);
49347
49358
  `);
49348
49359
  }
49349
49360
  function ensureEmbeddingColumns(db) {
@@ -49383,6 +49394,8 @@ function ensureMessageEmbeddingJobsTable(db) {
49383
49394
  );
49384
49395
  CREATE INDEX IF NOT EXISTS idx_message_embedding_jobs_due
49385
49396
  ON message_embedding_jobs(state, available_at_ms, lease_until_ms);
49397
+ CREATE INDEX IF NOT EXISTS idx_message_embedding_jobs_lease
49398
+ ON message_embedding_jobs(state, lease_until_ms);
49386
49399
  INSERT OR IGNORE INTO message_embedding_jobs (message_id, created_at, updated_at)
49387
49400
  SELECT msg_id, created_at, created_at FROM messages WHERE embedding IS NULL;
49388
49401
  `);
@@ -50419,6 +50432,8 @@ function runCryptoMigration(db) {
50419
50432
  var external_node_util_ = __webpack_require__(57975);
50420
50433
  // EXTERNAL MODULE: external "undici"
50421
50434
  var external_undici_ = __webpack_require__(9956);
50435
+ // EXTERNAL MODULE: external "node:net"
50436
+ var external_node_net_ = __webpack_require__(77030);
50422
50437
  // EXTERNAL MODULE: ./node_modules/@anthropic-ai/sdk/internal/tslib.mjs
50423
50438
  var tslib = __webpack_require__(74300);
50424
50439
  // EXTERNAL MODULE: ./node_modules/@anthropic-ai/sdk/internal/utils/values.mjs
@@ -103232,9 +103247,11 @@ function message_embedding_jobs_claimMessageEmbeddingJobs(limit = 16, leaseMs =
103232
103247
  });
103233
103248
  }
103234
103249
  function message_embedding_jobs_nextMessageEmbeddingDelayMs(nowMs = Date.now()) {
103235
- const row = getDb().prepare(`SELECT MIN(CASE WHEN state='pending' THEN available_at_ms ELSE lease_until_ms END) AS next_at_ms
103236
- FROM message_embedding_jobs
103237
- WHERE state IN ('pending','processing')`).get();
103250
+ const row = getDb().prepare(`SELECT MIN(next_at_ms) AS next_at_ms FROM (
103251
+ SELECT MIN(available_at_ms) AS next_at_ms FROM message_embedding_jobs WHERE state='pending'
103252
+ UNION ALL
103253
+ SELECT MIN(lease_until_ms) AS next_at_ms FROM message_embedding_jobs WHERE state='processing'
103254
+ )`).get();
103238
103255
  return typeof row?.next_at_ms === "number" ? Math.max(0, row.next_at_ms - nowMs) : null;
103239
103256
  }
103240
103257
  function message_embedding_jobs_completeMessageEmbeddingJob(job, embedding, modelSignature) {
@@ -105606,6 +105623,7 @@ function maskSecrets(name, values) {
105606
105623
 
105607
105624
 
105608
105625
 
105626
+
105609
105627
  const DEFAULT_STATUS = {
105610
105628
  mode: "off",
105611
105629
  scheme: "http",
@@ -105656,15 +105674,26 @@ function saveProxyConfig(input) {
105656
105674
  };
105657
105675
  const scheme = input.scheme === "https" ? "https" : "http";
105658
105676
  // Manual mode requires host + port. system / off don't.
105677
+ let host = proxy_config_nullable(input.host);
105659
105678
  if (input.mode === "manual") {
105660
- if (!input.host || !input.host.trim()) return {
105679
+ if (!host) return {
105661
105680
  error: "host is required in manual mode"
105662
105681
  };
105663
- if (input.port == null || !Number.isFinite(input.port) || input.port <= 0 || input.port > 65535) {
105682
+ const normalisedHost = normaliseProxyHost(host);
105683
+ if (!normalisedHost) {
105664
105684
  return {
105665
- error: "port must be between 1 and 65535"
105685
+ error: "host must be a hostname or IP address, without scheme, port, path or credentials"
105666
105686
  };
105667
105687
  }
105688
+ host = normalisedHost;
105689
+ if (input.port == null) return {
105690
+ error: "port must be between 1 and 65535"
105691
+ };
105692
+ }
105693
+ if (input.port != null && (!Number.isInteger(input.port) || input.port <= 0 || input.port > 65535)) {
105694
+ return {
105695
+ error: "port must be between 1 and 65535"
105696
+ };
105668
105697
  }
105669
105698
  // CA bundle: empty/null clears; non-empty must look like PEM.
105670
105699
  let storedCaBundle = null;
@@ -105699,7 +105728,7 @@ function saveProxyConfig(input) {
105699
105728
  password = excluded.password,
105700
105729
  no_proxy = excluded.no_proxy,
105701
105730
  ca_bundle = excluded.ca_bundle,
105702
- updated_at = excluded.updated_at`).run(input.mode, scheme, proxy_config_nullable(input.host), input.port ?? null, proxy_config_nullable(input.username), storedPassword, proxy_config_nullable(input.no_proxy), storedCaBundle, now);
105731
+ updated_at = excluded.updated_at`).run(input.mode, scheme, host, input.port ?? null, proxy_config_nullable(input.username), storedPassword, proxy_config_nullable(input.no_proxy), storedCaBundle, now);
105703
105732
  return getProxyConfigStatus();
105704
105733
  }
105705
105734
  function deleteProxyConfig() {
@@ -105721,6 +105750,15 @@ function normaliseMode(m) {
105721
105750
  function normaliseScheme(s) {
105722
105751
  return s === "https" ? "https" : "http";
105723
105752
  }
105753
+ // The dispatcher builds `${scheme}://${auth}${host}:${port}`, so a pasted URL
105754
+ // or host:port would produce an unusable proxy URL. IPv6 is stored unbracketed;
105755
+ // the dispatcher adds the brackets.
105756
+ function normaliseProxyHost(host) {
105757
+ const unbracketed = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
105758
+ if (/^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(unbracketed)) return unbracketed;
105759
+ if (isIPv6(unbracketed)) return unbracketed;
105760
+ return null;
105761
+ }
105724
105762
  function proxy_config_nullable(v) {
105725
105763
  if (v == null) return null;
105726
105764
  const trimmed = v.trim();
@@ -106009,7 +106047,25 @@ async function applyProxyConfigFromDb() {
106009
106047
  // ---------------------------------------------------------------------
106010
106048
  function buildProxyUrl(scheme, host, port, username, password) {
106011
106049
  const auth = username ? `${encodeURIComponent(username)}${password ? `:${encodeURIComponent(password)}` : ""}@` : "";
106012
- return `${scheme}://${auth}${host}:${port}`;
106050
+ const urlHost = host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
106051
+ return `${scheme}://${auth}${urlHost}:${port}`;
106052
+ }
106053
+ // undici's EnvHttpProxyAgent has no implicit loopback exemption, so without
106054
+ // these a configured proxy would also receive local traffic (Ollama, the
106055
+ // WhatsApp bridge sidecar, the app's own loopback API).
106056
+ const LOOPBACK_NO_PROXY = [
106057
+ "localhost",
106058
+ "127.0.0.1",
106059
+ "::1"
106060
+ ];
106061
+ function mergeNoProxy(noProxy) {
106062
+ const entries = (noProxy ?? "").split(/[,\s]+/).map((entry)=>entry.trim()).filter(Boolean);
106063
+ return [
106064
+ ...new Set([
106065
+ ...entries,
106066
+ ...LOOPBACK_NO_PROXY
106067
+ ])
106068
+ ].join(",");
106013
106069
  }
106014
106070
  function installProxy(url, noProxy, caBundle) {
106015
106071
  // Set process.env so EnvHttpProxyAgent honors NO_PROXY semantics
@@ -106017,27 +106073,31 @@ function installProxy(url, noProxy, caBundle) {
106017
106073
  // We still treat the boot-time env snapshot as authoritative for the
106018
106074
  // "env beats DB" rule — this mutation only happens after we've
106019
106075
  // confirmed the user did NOT set HTTP_PROXY at launch.
106076
+ const merged = mergeNoProxy(noProxy);
106020
106077
  process.env.HTTP_PROXY = url;
106021
106078
  process.env.HTTPS_PROXY = url;
106022
- if (noProxy && noProxy.trim().length > 0) {
106023
- process.env.NO_PROXY = noProxy.trim();
106024
- } else {
106025
- delete process.env.NO_PROXY;
106026
- }
106079
+ process.env.NO_PROXY = merged;
106027
106080
  // ADR-0012: when the user pasted a corporate root CA, inject it on
106028
106081
  // both TLS legs — the proxy hop (proxyTls) for https-scheme proxies
106029
106082
  // signed by the corporate root, and the upstream tunnel (requestTls)
106030
106083
  // for proxies that MITM outbound HTTPS with the same internal CA.
106031
106084
  // Same blob is correct: the corporate trust chain typically signs
106032
106085
  // both ends.
106033
- const opts = caBundle ? {
106034
- requestTls: {
106035
- ca: caBundle
106036
- },
106037
- proxyTls: {
106038
- ca: caBundle
106039
- }
106040
- } : {};
106086
+ // Pass the values explicitly too: undici prefers lowercase http_proxy /
106087
+ // no_proxy from the environment over the uppercase ones set above.
106088
+ const opts = {
106089
+ httpProxy: url,
106090
+ httpsProxy: url,
106091
+ noProxy: merged,
106092
+ ...caBundle ? {
106093
+ requestTls: {
106094
+ ca: caBundle
106095
+ },
106096
+ proxyTls: {
106097
+ ca: caBundle
106098
+ }
106099
+ } : {}
106100
+ };
106041
106101
  (0,external_undici_.setGlobalDispatcher)(new external_undici_.EnvHttpProxyAgent(opts));
106042
106102
  }
106043
106103
  function resetToBaseline() {
@@ -115293,6 +115353,14 @@ module.exports = require("node:path");
115293
115353
 
115294
115354
  /***/ }),
115295
115355
 
115356
+ /***/ 77030:
115357
+ /***/ ((module) => {
115358
+
115359
+ "use strict";
115360
+ module.exports = require("node:net");
115361
+
115362
+ /***/ }),
115363
+
115296
115364
  /***/ 77150:
115297
115365
  /***/ ((__unused_webpack_module, exports) => {
115298
115366