@circuitwall/jarela 2.3.0 → 2.4.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 (208) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +4 -4
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  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 +2 -2
  13. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  14. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  15. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  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/documents/search/route.js +7 -0
  49. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +7 -0
  50. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +7 -0
  51. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +7 -0
  52. package/.next/standalone/.next/server/app/api/v1/events/route.js +26 -32
  53. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +7 -0
  55. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +7 -0
  56. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +7 -0
  57. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +7 -0
  58. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +7 -0
  59. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +7 -0
  60. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +7 -0
  61. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +7 -0
  62. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +7 -0
  63. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +7 -0
  64. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +7 -0
  65. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +7 -0
  66. package/.next/standalone/.next/server/app/api/v1/health/route.js +17 -5
  67. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +7 -0
  68. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +7 -0
  69. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +7 -0
  70. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +7 -0
  71. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +7 -0
  72. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +7 -0
  73. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +7 -0
  74. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +7 -0
  75. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +17 -5
  76. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +7 -0
  77. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +17 -5
  78. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +17 -5
  79. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +7 -0
  80. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +7 -0
  81. package/.next/standalone/.next/server/app/api/v1/memory/route.js +7 -0
  82. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +7 -0
  83. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +7 -0
  84. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +7 -0
  85. package/.next/standalone/.next/server/app/api/v1/models/route.js +7 -0
  86. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +27 -12
  87. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +7 -0
  88. package/.next/standalone/.next/server/app/api/v1/profile/route.js +7 -0
  89. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +7 -0
  90. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +7 -0
  91. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +7 -0
  92. package/.next/standalone/.next/server/app/api/v1/providers/route.js +7 -0
  93. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +7 -0
  94. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +7 -0
  95. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +7 -0
  96. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +17 -5
  97. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +7 -0
  98. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +7 -0
  99. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +7 -0
  100. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +7 -0
  101. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +7 -0
  102. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +7 -0
  103. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +7 -0
  104. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +7 -0
  105. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +7 -0
  106. package/.next/standalone/.next/server/app/api/v1/skills/route.js +7 -0
  107. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +7 -0
  108. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +7 -0
  109. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +7 -0
  110. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +12 -6
  111. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +7 -0
  112. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +0 -1
  113. package/.next/standalone/.next/server/app/api/v1/threads/route.js +17 -5
  114. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +17 -5
  116. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +17 -5
  117. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +17 -5
  118. package/.next/standalone/.next/server/app/page.js +322 -275
  119. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/app/setup/page.js +8 -0
  121. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  122. package/.next/standalone/.next/server/app-paths-manifest.json +4 -4
  123. package/.next/standalone/.next/server/chunks/1388.js +106 -36
  124. package/.next/standalone/.next/server/chunks/2068.js +47 -10
  125. package/.next/standalone/.next/server/chunks/210.js +6 -6
  126. package/.next/standalone/.next/server/chunks/2447.js +10 -5
  127. package/.next/standalone/.next/server/chunks/2471.js +17 -17
  128. package/.next/standalone/.next/server/chunks/3042.js +10 -8
  129. package/.next/standalone/.next/server/chunks/{4540.js → 309.js} +104 -38
  130. package/.next/standalone/.next/server/chunks/{2350.js → 3272.js} +104 -37
  131. package/.next/standalone/.next/server/chunks/3399.js +525 -525
  132. package/.next/standalone/.next/server/chunks/3524.js +150 -67
  133. package/.next/standalone/.next/server/chunks/4189.js +1 -1
  134. package/.next/standalone/.next/server/chunks/4508.js +2 -2
  135. package/.next/standalone/.next/server/chunks/46.js +73 -28
  136. package/.next/standalone/.next/server/chunks/5908.js +63 -42
  137. package/.next/standalone/.next/server/chunks/6142.js +10 -2
  138. package/.next/standalone/.next/server/chunks/6649.js +1 -1
  139. package/.next/standalone/.next/server/chunks/8461.js +10 -8
  140. package/.next/standalone/.next/server/chunks/9032.js +5 -5
  141. package/.next/standalone/.next/server/chunks/9164.js +435 -176
  142. package/.next/standalone/.next/server/chunks/9304.js +51 -12
  143. package/.next/standalone/.next/server/chunks/{423.js → 9590.js} +66 -21
  144. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  145. package/.next/standalone/.next/server/middleware.js +71 -18
  146. package/.next/standalone/.next/server/pages/404.html +2 -2
  147. package/.next/standalone/.next/server/pages/500.html +1 -1
  148. package/.next/standalone/.next/server/preview-props.json +3 -3
  149. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  150. package/.next/standalone/.next/static/chunks/app/{page-213a623b37226452.js → page-04748847c6ff866f.js} +171 -132
  151. package/.next/standalone/.next/static/css/{312542a5725ba0d5.css → 2669e8744cc8c212.css} +2 -2
  152. package/.next/standalone/docs/adoption/changesets.json +49 -0
  153. package/.next/standalone/package.json +1 -1
  154. package/CHANGELOG.md +19 -0
  155. package/app/api/v1/threads/[thread_id]/run/route.ts +0 -1
  156. package/components/chat/MessageBubble.tsx +12 -0
  157. package/components/integrations/NetworkSection.tsx +2 -2
  158. package/lib/agents/citation-checker.test.ts +40 -2
  159. package/lib/agents/citation-checker.ts +56 -11
  160. package/lib/agents/context-boundary.ts +5 -6
  161. package/lib/agents/instruction-edits.test.ts +120 -0
  162. package/lib/agents/instruction-edits.ts +65 -42
  163. package/lib/agents/prepare/request.ts +0 -2
  164. package/lib/agents/prepare/system-prompt.test.ts +10 -0
  165. package/lib/agents/prepare/system-prompt.ts +8 -2
  166. package/lib/agents/proposals.test.ts +76 -0
  167. package/lib/agents/proposals.ts +13 -5
  168. package/lib/agents/run-thread.auto-boundary.test.ts +125 -5
  169. package/lib/agents/run-thread.ts +24 -9
  170. package/lib/agents/sqlite-checkpoint-saver.test.ts +91 -0
  171. package/lib/agents/warm-summary-background.ts +22 -2
  172. package/lib/agents/warm-topics.test.ts +155 -1
  173. package/lib/agents/warm-topics.ts +27 -7
  174. package/lib/bridges/dispatcher.ts +1 -0
  175. package/lib/bridges/message-role.test.ts +81 -0
  176. package/lib/bridges/message-role.ts +23 -10
  177. package/lib/bridges/types.ts +6 -0
  178. package/lib/bridges/whatsapp-link.test.ts +32 -0
  179. package/lib/bridges/whatsapp-link.ts +21 -0
  180. package/lib/bridges/whatsapp.inbound.test.ts +239 -0
  181. package/lib/bridges/whatsapp.sender.test.ts +80 -1
  182. package/lib/bridges/whatsapp.ts +76 -38
  183. package/lib/pricing/snapshot.test.ts +70 -0
  184. package/lib/pricing/snapshot.ts +10 -2
  185. package/lib/proxy/dispatcher.test.ts +119 -1
  186. package/lib/proxy/dispatcher.ts +22 -9
  187. package/lib/stores/agent-configs.ts +10 -5
  188. package/lib/stores/bridges.test.ts +81 -0
  189. package/lib/stores/bridges.ts +9 -8
  190. package/lib/stores/proxy-config.test.ts +120 -0
  191. package/lib/stores/proxy-config.ts +22 -4
  192. package/lib/stores/threads.ts +12 -8
  193. package/lib/tools/communications/calendar.test.ts +43 -2
  194. package/lib/tools/communications/calendar.ts +2 -0
  195. package/lib/tools/communications/gmail.test.ts +51 -1
  196. package/lib/tools/communications/gmail.ts +44 -2
  197. package/lib/tools/communications/outlook-calendar.ts +2 -0
  198. package/lib/tools/communications/outlook.test.ts +33 -2
  199. package/lib/tools/communications/outlook.ts +2 -0
  200. package/lib/tools/filesystem/edit-match.test.ts +133 -0
  201. package/lib/tools/filesystem/edit-match.ts +7 -2
  202. package/lib/tools/support/result-refs.test.ts +131 -0
  203. package/lib/tools/support/result-refs.ts +41 -9
  204. package/lib/utils/source-link.test.ts +51 -0
  205. package/lib/utils/source-link.ts +45 -0
  206. package/package.json +1 -1
  207. /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → hwujW4hR1b-r3k5WdMxZO}/_buildManifest.js +0 -0
  208. /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → hwujW4hR1b-r3k5WdMxZO}/_ssgManifest.js +0 -0
@@ -1,105 +1,6 @@
1
1
  (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([[8974],{
2
2
 
3
- /***/ 30737:
4
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5
-
6
- "use strict";
7
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8
- /* harmony export */ D: () => (/* binding */ useTheme),
9
- /* harmony export */ ThemeProvider: () => (/* binding */ ThemeProvider)
10
- /* harmony export */ });
11
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(95155);
12
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12115);
13
- /* __next_internal_client_entry_do_not_use__ ThemeProvider,useTheme auto */
14
-
15
- const STORAGE_KEY = "jarela-theme";
16
- function isTheme(v) {
17
- return v === "light" || v === "dark" || v === "system";
18
- }
19
- function readStored() {
20
- if (false) {}
21
- try {
22
- const v = window.localStorage.getItem(STORAGE_KEY);
23
- return isTheme(v) ? v : "system";
24
- } catch {
25
- return "system";
26
- }
27
- }
28
- const LIGHT_CHROME = "#ffffff";
29
- const DARK_CHROME = "#09090b";
30
- function resolveChrome(theme) {
31
- if (theme === "light") return LIGHT_CHROME;
32
- if (theme === "dark") return DARK_CHROME;
33
- if (false) {}
34
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? DARK_CHROME : LIGHT_CHROME;
35
- }
36
- // Keep the single <meta name="theme-color"> tag (installed by the pre-paint
37
- // script in app/layout.tsx) aligned with the active surface so the PWA's
38
- // desktop title bar and mobile address bar match the theme.
39
- function syncChrome(theme) {
40
- if (typeof document === "undefined") return;
41
- const meta = document.querySelector('meta[name="theme-color"]');
42
- if (meta) meta.setAttribute("content", resolveChrome(theme));
43
- }
44
- function apply(theme) {
45
- if (typeof document === "undefined") return;
46
- document.documentElement.setAttribute("data-theme", theme);
47
- syncChrome(theme);
48
- }
49
- const ThemeContext = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(null);
50
- function ThemeProvider({ children }) {
51
- // Initial state stays "system" on the server to match the pre-paint script,
52
- // which writes data-theme before React hydrates. The effect below syncs the
53
- // React state to whatever the script (or localStorage) decided.
54
- const [theme, setThemeState] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)("system");
55
- (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
56
- const stored = readStored();
57
- setThemeState(stored);
58
- // When in "system" mode, mirror OS-level changes into the PWA chrome.
59
- if (false) {}
60
- const mq = window.matchMedia("(prefers-color-scheme: dark)");
61
- const onChange = ()=>{
62
- if (readStored() === "system") syncChrome("system");
63
- };
64
- mq.addEventListener?.("change", onChange);
65
- return ()=>mq.removeEventListener?.("change", onChange);
66
- }, []);
67
- const setTheme = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((t)=>{
68
- setThemeState(t);
69
- apply(t);
70
- try {
71
- window.localStorage.setItem(STORAGE_KEY, t);
72
- } catch {
73
- /* ignore quota / private-mode errors */ }
74
- }, []);
75
- return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(ThemeContext.Provider, {
76
- value: {
77
- theme,
78
- setTheme
79
- },
80
- children: children
81
- });
82
- }
83
- function useTheme() {
84
- const ctx = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(ThemeContext);
85
- if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
86
- return ctx;
87
- }
88
-
89
-
90
- /***/ }),
91
-
92
- /***/ 39852:
93
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
94
-
95
- Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 54986));
96
- ;
97
- Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 12283));
98
-
99
-
100
- /***/ }),
101
-
102
- /***/ 54986:
3
+ /***/ 11362:
103
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
104
5
 
105
6
  "use strict";
@@ -5499,6 +5400,41 @@ function formatRoutingDuration(durationMs) {
5499
5400
  return `${seconds.toFixed(seconds >= 10 ? 0 : 1)}s`;
5500
5401
  }
5501
5402
 
5403
+ ;// ./lib/utils/source-link.ts
5404
+ /**
5405
+ * Source-link fields for tool results, so an agent can link a reply back to
5406
+ * the email, calendar event, or chat it came from without building URLs.
5407
+ *
5408
+ * `cite_as` is a ready-made markdown link the system prompt tells agents to
5409
+ * paste verbatim. Building it in code keeps the label and URL well-formed:
5410
+ * a stray `]` in a subject or `)` in a URL would otherwise break the link.
5411
+ */ const MAX_LABEL_CHARS = 80;
5412
+ /** Returns `url` when it is an absolute https URL, otherwise null. */ function source_link_httpsUrlOrNull(url) {
5413
+ if (!url) return null;
5414
+ try {
5415
+ const parsed = new URL(url);
5416
+ return parsed.protocol === "https:" ? parsed.href : null;
5417
+ } catch {
5418
+ return null;
5419
+ }
5420
+ }
5421
+ function markdownLabel(label, fallback) {
5422
+ const flat = (label ?? "").replace(/\s+/g, " ").trim();
5423
+ const capped = flat.length > MAX_LABEL_CHARS ? `${flat.slice(0, MAX_LABEL_CHARS - 1).trimEnd()}…` : flat;
5424
+ return (capped || fallback).replace(/[\\[\]]/g, (c)=>`\\${c}`);
5425
+ }
5426
+ function markdownDestination(url) {
5427
+ return url.replace(/[()\s<>]/g, (c)=>`%${c.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`);
5428
+ }
5429
+ /**
5430
+ * Pre-built markdown link for `cite_as`, or null when there is no usable URL.
5431
+ * Only https URLs qualify: the chat renderer drops other schemes.
5432
+ */ function citeAs(label, url, fallbackLabel = "source") {
5433
+ const safe = source_link_httpsUrlOrNull(url);
5434
+ if (!safe) return null;
5435
+ return `[${markdownLabel(label, fallbackLabel)}](${markdownDestination(safe)})`;
5436
+ }
5437
+
5502
5438
  ;// ./lib/bridges/message-role.ts
5503
5439
  /**
5504
5440
  * Cross-adapter framing for bridge inbound messages.
@@ -5516,25 +5452,8 @@ function formatRoutingDuration(durationMs) {
5516
5452
  * sees. Adding a new adapter is a matter of mapping its platform-specific
5517
5453
  * "who sent this" signal onto `MessageRole`; the framing code does not need
5518
5454
  * to change.
5519
- */ /**
5520
- * Who sent the message from the agent's perspective.
5521
- *
5522
- * - `user`: the paired account holder themselves — typed on their phone,
5523
- * in their browser, etc. The agent treats these as the user's own
5524
- * reaction/input to the conversation. Useful as an intent signal but
5525
- * NOT a direct command to the agent (the user is talking to the
5526
- * counterpart, not the agent).
5527
- *
5528
- * - `counterpart`: another participant in the chat — 1:1 partner in a DM,
5529
- * or another member in a group chat. The agent treats these as
5530
- * conversation context the user has not yet reacted to. Not a request
5531
- * directed at the agent.
5532
- *
5533
- * - `agent`: the agent's own prior output, surfaced inbound when the
5534
- * adapter cannot suppress its echo (rare). Adapters with reliable
5535
- * echo-filtering (e.g. WhatsApp's `sentIdsSet`) should never emit this
5536
- * value; it exists for adapters where deduplication is best-effort.
5537
- */ /**
5455
+ */
5456
+ /**
5538
5457
  * Build the prompt prefix the agent receives for one bridge-inbound message.
5539
5458
  *
5540
5459
  * Output shape:
@@ -5548,6 +5467,7 @@ function formatRoutingDuration(durationMs) {
5548
5467
  * [message_role:user|counterpart|agent]
5549
5468
  * [sender_id:<id>]
5550
5469
  * [sender_name:<label>]
5470
+ * ([chat_link:<https url>] when the platform has a permalink for the chat)
5551
5471
  * ([group_name:<label>] [participant_id:<id>] [participant_name:<label>] for groups)
5552
5472
  *
5553
5473
  * <raw text>
@@ -5557,23 +5477,29 @@ function formatRoutingDuration(durationMs) {
5557
5477
  * convention. Both are stable across adapters.
5558
5478
  */ function formatBridgePrompt(input) {
5559
5479
  const note = roleNote(input.role, input.is_group, input.silent === true, input.event);
5480
+ // Header values come from the platform (display names, group subjects) and
5481
+ // are sender-controlled: a line break would forge extra headers or end the
5482
+ // header block early, so every value is flattened onto one line.
5483
+ const h = (value)=>String(value ?? "").replace(/[\r\n\u0085\u2028\u2029]+/g, " ");
5560
5484
  const lines = [
5561
- `[bridge:${input.bridge_id}]`,
5562
- `[chat_id:${input.chat_id}]`,
5563
- `[chat_name:${input.chat_name}]`,
5485
+ `[bridge:${h(input.bridge_id)}]`,
5486
+ `[chat_id:${h(input.chat_id)}]`,
5487
+ `[chat_name:${h(input.chat_name)}]`,
5564
5488
  `[chat_type:${input.is_group ? "group" : "dm"}]`,
5565
5489
  `[message_role:${input.role}]`,
5566
- `[sender_id:${input.sender_id}]`,
5567
- `[sender_name:${input.sender_name}]`
5490
+ `[sender_id:${h(input.sender_id)}]`,
5491
+ `[sender_name:${h(input.sender_name)}]`
5568
5492
  ];
5493
+ const chatLink = httpsUrlOrNull(input.chat_link);
5494
+ if (chatLink) lines.push(`[chat_link:${chatLink}]`);
5569
5495
  if (input.event) {
5570
5496
  lines.push(`[event_type:${input.event.type}]`);
5571
- lines.push(`[event_subtype:${input.event.subtype}]`);
5497
+ lines.push(`[event_subtype:${h(input.event.subtype)}]`);
5572
5498
  }
5573
5499
  if (input.is_group) {
5574
- lines.push(`[group_name:${input.chat_name}]`);
5575
- lines.push(`[participant_id:${input.sender_id}]`);
5576
- lines.push(`[participant_name:${input.sender_name}]`);
5500
+ lines.push(`[group_name:${h(input.chat_name)}]`);
5501
+ lines.push(`[participant_id:${h(input.sender_id)}]`);
5502
+ lines.push(`[participant_name:${h(input.sender_name)}]`);
5577
5503
  }
5578
5504
  return `${note}\n\n${lines.join("\n")}\n\n${input.text}`;
5579
5505
  }
@@ -5588,7 +5514,7 @@ function parseBridgePrompt(raw) {
5588
5514
  const lines = src.split("\n");
5589
5515
  let i = 0;
5590
5516
  for(; i < lines.length; i++){
5591
- const line = lines[i];
5517
+ const line = lines[i].replace(/\r$/, "");
5592
5518
  if (line === "") {
5593
5519
  i++;
5594
5520
  break;
@@ -5607,6 +5533,7 @@ function parseBridgePrompt(raw) {
5607
5533
  isGroup: headers.chat_type === "group",
5608
5534
  senderJid: senderId,
5609
5535
  senderName: headers.sender_name || senderId || "Unknown",
5536
+ chatLink: source_link_httpsUrlOrNull(headers.chat_link),
5610
5537
  body: lines.slice(i).join("\n").trimEnd()
5611
5538
  };
5612
5539
  }
@@ -6738,6 +6665,19 @@ function BridgeMessageCard({ ctx, activity }) {
6738
6665
  activityStatus(activity).copy,
6739
6666
  activity.occurrence_count > 1 ? ` · ${activity.occurrence_count} checks` : ""
6740
6667
  ]
6668
+ }) : null,
6669
+ ctx.chatLink ? /*#__PURE__*/ (0,jsx_runtime.jsxs)("a", {
6670
+ href: ctx.chatLink,
6671
+ target: "_blank",
6672
+ rel: "noopener noreferrer",
6673
+ className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-white/15 hover:bg-white/25 text-[9.5px] shrink-0",
6674
+ title: `Open this chat (${ctx.chatLink})`,
6675
+ children: [
6676
+ /*#__PURE__*/ (0,jsx_runtime.jsx)(external_link/* default */.A, {
6677
+ size: 9
6678
+ }),
6679
+ "open chat"
6680
+ ]
6741
6681
  }) : null
6742
6682
  ]
6743
6683
  });
@@ -13320,12 +13260,12 @@ function NetworkSection() {
13320
13260
  /*#__PURE__*/ (0,jsx_runtime.jsxs)("label", {
13321
13261
  className: "block text-xs text-fg-subtle",
13322
13262
  children: [
13323
- "No proxy (comma-separated, optional)",
13263
+ "No proxy (comma-separated, optional; localhost is always direct)",
13324
13264
  /*#__PURE__*/ (0,jsx_runtime.jsx)("input", {
13325
13265
  type: "text",
13326
13266
  value: noProxy,
13327
13267
  onChange: (e)=>setNoProxy(e.target.value),
13328
- placeholder: "localhost,127.0.0.1,.internal",
13268
+ placeholder: ".internal,corp.example",
13329
13269
  className: "mt-1 w-full px-2 py-1.5 text-sm rounded border border-border bg-surface-3 text-fg font-mono"
13330
13270
  })
13331
13271
  ]
@@ -33886,6 +33826,105 @@ function AppShell() {
33886
33826
  }
33887
33827
 
33888
33828
 
33829
+ /***/ }),
33830
+
33831
+ /***/ 30737:
33832
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
33833
+
33834
+ "use strict";
33835
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33836
+ /* harmony export */ D: () => (/* binding */ useTheme),
33837
+ /* harmony export */ ThemeProvider: () => (/* binding */ ThemeProvider)
33838
+ /* harmony export */ });
33839
+ /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(95155);
33840
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12115);
33841
+ /* __next_internal_client_entry_do_not_use__ ThemeProvider,useTheme auto */
33842
+
33843
+ const STORAGE_KEY = "jarela-theme";
33844
+ function isTheme(v) {
33845
+ return v === "light" || v === "dark" || v === "system";
33846
+ }
33847
+ function readStored() {
33848
+ if (false) {}
33849
+ try {
33850
+ const v = window.localStorage.getItem(STORAGE_KEY);
33851
+ return isTheme(v) ? v : "system";
33852
+ } catch {
33853
+ return "system";
33854
+ }
33855
+ }
33856
+ const LIGHT_CHROME = "#ffffff";
33857
+ const DARK_CHROME = "#09090b";
33858
+ function resolveChrome(theme) {
33859
+ if (theme === "light") return LIGHT_CHROME;
33860
+ if (theme === "dark") return DARK_CHROME;
33861
+ if (false) {}
33862
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? DARK_CHROME : LIGHT_CHROME;
33863
+ }
33864
+ // Keep the single <meta name="theme-color"> tag (installed by the pre-paint
33865
+ // script in app/layout.tsx) aligned with the active surface so the PWA's
33866
+ // desktop title bar and mobile address bar match the theme.
33867
+ function syncChrome(theme) {
33868
+ if (typeof document === "undefined") return;
33869
+ const meta = document.querySelector('meta[name="theme-color"]');
33870
+ if (meta) meta.setAttribute("content", resolveChrome(theme));
33871
+ }
33872
+ function apply(theme) {
33873
+ if (typeof document === "undefined") return;
33874
+ document.documentElement.setAttribute("data-theme", theme);
33875
+ syncChrome(theme);
33876
+ }
33877
+ const ThemeContext = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(null);
33878
+ function ThemeProvider({ children }) {
33879
+ // Initial state stays "system" on the server to match the pre-paint script,
33880
+ // which writes data-theme before React hydrates. The effect below syncs the
33881
+ // React state to whatever the script (or localStorage) decided.
33882
+ const [theme, setThemeState] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)("system");
33883
+ (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
33884
+ const stored = readStored();
33885
+ setThemeState(stored);
33886
+ // When in "system" mode, mirror OS-level changes into the PWA chrome.
33887
+ if (false) {}
33888
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
33889
+ const onChange = ()=>{
33890
+ if (readStored() === "system") syncChrome("system");
33891
+ };
33892
+ mq.addEventListener?.("change", onChange);
33893
+ return ()=>mq.removeEventListener?.("change", onChange);
33894
+ }, []);
33895
+ const setTheme = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)((t)=>{
33896
+ setThemeState(t);
33897
+ apply(t);
33898
+ try {
33899
+ window.localStorage.setItem(STORAGE_KEY, t);
33900
+ } catch {
33901
+ /* ignore quota / private-mode errors */ }
33902
+ }, []);
33903
+ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(ThemeContext.Provider, {
33904
+ value: {
33905
+ theme,
33906
+ setTheme
33907
+ },
33908
+ children: children
33909
+ });
33910
+ }
33911
+ function useTheme() {
33912
+ const ctx = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(ThemeContext);
33913
+ if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
33914
+ return ctx;
33915
+ }
33916
+
33917
+
33918
+ /***/ }),
33919
+
33920
+ /***/ 39852:
33921
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
33922
+
33923
+ Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 11362));
33924
+ ;
33925
+ Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 12283));
33926
+
33927
+
33889
33928
  /***/ })
33890
33929
 
33891
33930
  },
@@ -33896,4 +33935,4 @@ function AppShell() {
33896
33935
  /******/ _N_E = __webpack_exports__;
33897
33936
  /******/ }
33898
33937
  ]);
33899
- //# sourceMappingURL=page-213a623b37226452.js.map
33938
+ //# sourceMappingURL=page-04748847c6ff866f.js.map