@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
@@ -705,12 +705,17 @@ function upsertAgentConfigTransaction(input) {
705
705
  const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
706
706
  const existing = getAgentConfig(input.id);
707
707
  const created_at = existing?.created_at ?? t;
708
- const mbti = input.adaptive_mbti ?? toMbti(existing?.adaptive_mbti) ?? "INTJ";
708
+ const existingMbti = toMbti(existing?.adaptive_mbti);
709
+ const mbti = input.adaptive_mbti ?? existingMbti ?? "INTJ";
709
710
  const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
710
- const strength = input.adaptive_persona_strength ?? preset.strength;
711
- const empathy = input.adaptive_empathy ?? preset.empathy;
712
- const expressiveness = input.adaptive_expressiveness ?? preset.expressiveness;
713
- const verbosity = input.adaptive_verbosity ?? preset.verbosity;
711
+ // Omitted sliders keep their tuned values; they only fall back to the
712
+ // preset when the type changes or the agent is new. Otherwise every
713
+ // partial update (approved proposals, tool edits) reset them.
714
+ const keepTuned = existing !== null && existing !== undefined && mbti === existingMbti;
715
+ const strength = input.adaptive_persona_strength ?? (keepTuned ? existing.adaptive_persona_strength : preset.strength);
716
+ const empathy = input.adaptive_empathy ?? (keepTuned ? existing.adaptive_empathy : preset.empathy);
717
+ const expressiveness = input.adaptive_expressiveness ?? (keepTuned ? existing.adaptive_expressiveness : preset.expressiveness);
718
+ const verbosity = input.adaptive_verbosity ?? (keepTuned ? existing.adaptive_verbosity : preset.verbosity);
714
719
  if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
715
720
  // harness_id: explicit `undefined` means "keep existing"; explicit `null`
716
721
  // means "use the global default". Empty string is normalised to null too,
@@ -1050,6 +1055,13 @@ module.exports = require("node:path");
1050
1055
 
1051
1056
  /***/ }),
1052
1057
 
1058
+ /***/ 77030:
1059
+ /***/ ((module) => {
1060
+
1061
+ module.exports = require("node:net");
1062
+
1063
+ /***/ }),
1064
+
1053
1065
  /***/ 77598:
1054
1066
  /***/ ((module) => {
1055
1067
 
@@ -1072,8 +1084,8 @@ module.exports = require("node:crypto");
1072
1084
  /* harmony export */ X9: () => (/* binding */ listBridges),
1073
1085
  /* harmony export */ aM: () => (/* binding */ getRoute),
1074
1086
  /* harmony export */ e1: () => (/* binding */ getBridge),
1087
+ /* harmony export */ gH: () => (/* binding */ getRouteLastSeenTsMap),
1075
1088
  /* harmony export */ kZ: () => (/* binding */ listIgnores),
1076
- /* harmony export */ mp: () => (/* binding */ getMaxRouteLastSeenTs),
1077
1089
  /* harmony export */ nE: () => (/* binding */ removeIgnore),
1078
1090
  /* harmony export */ pi: () => (/* binding */ isIgnored),
1079
1091
  /* harmony export */ po: () => (/* binding */ updateBridge),
@@ -1206,12 +1218,16 @@ function bumpRouteLastSeenTs(bridgeId, remoteJid, ts) {
1206
1218
  if (!Number.isFinite(ts) || ts <= 0) return;
1207
1219
  (0,_lib_db__WEBPACK_IMPORTED_MODULE_1__/* .getDb */ .Lf)().prepare("UPDATE bridge_routes SET last_seen_ts=? WHERE bridge_id=? AND remote_jid=? AND (last_seen_ts IS NULL OR last_seen_ts < ?)").run(ts, bridgeId, remoteJid, ts);
1208
1220
  }
1209
- // Snapshot the highest watermark across every route on a bridge. The
1210
- // adapter uses this on reconnect to short-circuit very-old appends before
1211
- // it has loaded individual route rows.
1212
- function getMaxRouteLastSeenTs(bridgeId) {
1213
- const row = (0,_lib_db__WEBPACK_IMPORTED_MODULE_1__/* .getDb */ .Lf)().prepare("SELECT MAX(last_seen_ts) AS m FROM bridge_routes WHERE bridge_id=?").get(bridgeId);
1214
- return row?.m ?? 0;
1221
+ // Per-chat watermarks for every explicitly routed chat on a bridge, loaded
1222
+ // once per upsert batch. Each chat is gated only by its own progress: a
1223
+ // bridge-wide maximum would drop chat B's offline backlog as soon as a newer
1224
+ // message from chat A had been delivered.
1225
+ function getRouteLastSeenTsMap(bridgeId) {
1226
+ const rows = (0,_lib_db__WEBPACK_IMPORTED_MODULE_1__/* .getDb */ .Lf)().prepare("SELECT remote_jid, last_seen_ts FROM bridge_routes WHERE bridge_id=? AND last_seen_ts IS NOT NULL").all(bridgeId);
1227
+ return new Map(rows.map((r)=>[
1228
+ r.remote_jid,
1229
+ r.last_seen_ts
1230
+ ]));
1215
1231
  }
1216
1232
  // ---------------------------------------------------------------------------
1217
1233
  // Ignore-list CRUD (per-bridge chat blocklist)
@@ -894,12 +894,17 @@ function upsertAgentConfigTransaction(input) {
894
894
  const db = (0,_lib_db__WEBPACK_IMPORTED_MODULE_0__/* .getDb */ .Lf)();
895
895
  const existing = getAgentConfig(input.id);
896
896
  const created_at = existing?.created_at ?? t;
897
- const mbti = input.adaptive_mbti ?? toMbti(existing?.adaptive_mbti) ?? "INTJ";
897
+ const existingMbti = toMbti(existing?.adaptive_mbti);
898
+ const mbti = input.adaptive_mbti ?? existingMbti ?? "INTJ";
898
899
  const preset = _lib_agents_adaptive_persona_presets__WEBPACK_IMPORTED_MODULE_2__/* .MBTI_PRESETS */ .e[mbti];
899
- const strength = input.adaptive_persona_strength ?? preset.strength;
900
- const empathy = input.adaptive_empathy ?? preset.empathy;
901
- const expressiveness = input.adaptive_expressiveness ?? preset.expressiveness;
902
- const verbosity = input.adaptive_verbosity ?? preset.verbosity;
900
+ // Omitted sliders keep their tuned values; they only fall back to the
901
+ // preset when the type changes or the agent is new. Otherwise every
902
+ // partial update (approved proposals, tool edits) reset them.
903
+ const keepTuned = existing !== null && existing !== undefined && mbti === existingMbti;
904
+ const strength = input.adaptive_persona_strength ?? (keepTuned ? existing.adaptive_persona_strength : preset.strength);
905
+ const empathy = input.adaptive_empathy ?? (keepTuned ? existing.adaptive_empathy : preset.empathy);
906
+ const expressiveness = input.adaptive_expressiveness ?? (keepTuned ? existing.adaptive_expressiveness : preset.expressiveness);
907
+ const verbosity = input.adaptive_verbosity ?? (keepTuned ? existing.adaptive_verbosity : preset.verbosity);
903
908
  if (input.is_default) db.prepare("UPDATE agent_configs SET is_default=0").run();
904
909
  // harness_id: explicit `undefined` means "keep existing"; explicit `null`
905
910
  // means "use the global default". Empty string is normalised to null too,
@@ -1137,6 +1142,13 @@ module.exports = require("node:path");
1137
1142
 
1138
1143
  /***/ }),
1139
1144
 
1145
+ /***/ 77030:
1146
+ /***/ ((module) => {
1147
+
1148
+ module.exports = require("node:net");
1149
+
1150
+ /***/ }),
1151
+
1140
1152
  /***/ 77598:
1141
1153
  /***/ ((module) => {
1142
1154
 
@@ -1159,8 +1171,8 @@ module.exports = require("node:crypto");
1159
1171
  /* harmony export */ X9: () => (/* binding */ listBridges),
1160
1172
  /* harmony export */ aM: () => (/* binding */ getRoute),
1161
1173
  /* harmony export */ e1: () => (/* binding */ getBridge),
1174
+ /* harmony export */ gH: () => (/* binding */ getRouteLastSeenTsMap),
1162
1175
  /* harmony export */ kZ: () => (/* binding */ listIgnores),
1163
- /* harmony export */ mp: () => (/* binding */ getMaxRouteLastSeenTs),
1164
1176
  /* harmony export */ nE: () => (/* binding */ removeIgnore),
1165
1177
  /* harmony export */ pi: () => (/* binding */ isIgnored),
1166
1178
  /* harmony export */ po: () => (/* binding */ updateBridge),
@@ -1293,12 +1305,16 @@ function bumpRouteLastSeenTs(bridgeId, remoteJid, ts) {
1293
1305
  if (!Number.isFinite(ts) || ts <= 0) return;
1294
1306
  (0,_lib_db__WEBPACK_IMPORTED_MODULE_1__/* .getDb */ .Lf)().prepare("UPDATE bridge_routes SET last_seen_ts=? WHERE bridge_id=? AND remote_jid=? AND (last_seen_ts IS NULL OR last_seen_ts < ?)").run(ts, bridgeId, remoteJid, ts);
1295
1307
  }
1296
- // Snapshot the highest watermark across every route on a bridge. The
1297
- // adapter uses this on reconnect to short-circuit very-old appends before
1298
- // it has loaded individual route rows.
1299
- function getMaxRouteLastSeenTs(bridgeId) {
1300
- const row = (0,_lib_db__WEBPACK_IMPORTED_MODULE_1__/* .getDb */ .Lf)().prepare("SELECT MAX(last_seen_ts) AS m FROM bridge_routes WHERE bridge_id=?").get(bridgeId);
1301
- return row?.m ?? 0;
1308
+ // Per-chat watermarks for every explicitly routed chat on a bridge, loaded
1309
+ // once per upsert batch. Each chat is gated only by its own progress: a
1310
+ // bridge-wide maximum would drop chat B's offline backlog as soon as a newer
1311
+ // message from chat A had been delivered.
1312
+ function getRouteLastSeenTsMap(bridgeId) {
1313
+ const rows = (0,_lib_db__WEBPACK_IMPORTED_MODULE_1__/* .getDb */ .Lf)().prepare("SELECT remote_jid, last_seen_ts FROM bridge_routes WHERE bridge_id=? AND last_seen_ts IS NOT NULL").all(bridgeId);
1314
+ return new Map(rows.map((r)=>[
1315
+ r.remote_jid,
1316
+ r.last_seen_ts
1317
+ ]));
1302
1318
  }
1303
1319
  // ---------------------------------------------------------------------------
1304
1320
  // Ignore-list CRUD (per-bridge chat blocklist)
@@ -125,6 +125,8 @@ var agent_turn = __webpack_require__(62032);
125
125
  return (0,bridges/* findRoute */.$6)(bridge_id, remote_jid) ?? (0,bridges/* findRoute */.$6)(bridge_id, "*");
126
126
  }
127
127
 
128
+ // EXTERNAL MODULE: ./lib/utils/source-link.ts
129
+ var source_link = __webpack_require__(12262);
128
130
  ;// ./lib/bridges/message-role.ts
129
131
  /**
130
132
  * Cross-adapter framing for bridge inbound messages.
@@ -142,25 +144,8 @@ var agent_turn = __webpack_require__(62032);
142
144
  * sees. Adding a new adapter is a matter of mapping its platform-specific
143
145
  * "who sent this" signal onto `MessageRole`; the framing code does not need
144
146
  * to change.
145
- */ /**
146
- * Who sent the message from the agent's perspective.
147
- *
148
- * - `user`: the paired account holder themselves — typed on their phone,
149
- * in their browser, etc. The agent treats these as the user's own
150
- * reaction/input to the conversation. Useful as an intent signal but
151
- * NOT a direct command to the agent (the user is talking to the
152
- * counterpart, not the agent).
153
- *
154
- * - `counterpart`: another participant in the chat — 1:1 partner in a DM,
155
- * or another member in a group chat. The agent treats these as
156
- * conversation context the user has not yet reacted to. Not a request
157
- * directed at the agent.
158
- *
159
- * - `agent`: the agent's own prior output, surfaced inbound when the
160
- * adapter cannot suppress its echo (rare). Adapters with reliable
161
- * echo-filtering (e.g. WhatsApp's `sentIdsSet`) should never emit this
162
- * value; it exists for adapters where deduplication is best-effort.
163
- */ /**
147
+ */
148
+ /**
164
149
  * Build the prompt prefix the agent receives for one bridge-inbound message.
165
150
  *
166
151
  * Output shape:
@@ -174,6 +159,7 @@ var agent_turn = __webpack_require__(62032);
174
159
  * [message_role:user|counterpart|agent]
175
160
  * [sender_id:<id>]
176
161
  * [sender_name:<label>]
162
+ * ([chat_link:<https url>] when the platform has a permalink for the chat)
177
163
  * ([group_name:<label>] [participant_id:<id>] [participant_name:<label>] for groups)
178
164
  *
179
165
  * <raw text>
@@ -183,23 +169,29 @@ var agent_turn = __webpack_require__(62032);
183
169
  * convention. Both are stable across adapters.
184
170
  */ function formatBridgePrompt(input) {
185
171
  const note = roleNote(input.role, input.is_group, input.silent === true, input.event);
172
+ // Header values come from the platform (display names, group subjects) and
173
+ // are sender-controlled: a line break would forge extra headers or end the
174
+ // header block early, so every value is flattened onto one line.
175
+ const h = (value)=>String(value ?? "").replace(/[\r\n\u0085\u2028\u2029]+/g, " ");
186
176
  const lines = [
187
- `[bridge:${input.bridge_id}]`,
188
- `[chat_id:${input.chat_id}]`,
189
- `[chat_name:${input.chat_name}]`,
177
+ `[bridge:${h(input.bridge_id)}]`,
178
+ `[chat_id:${h(input.chat_id)}]`,
179
+ `[chat_name:${h(input.chat_name)}]`,
190
180
  `[chat_type:${input.is_group ? "group" : "dm"}]`,
191
181
  `[message_role:${input.role}]`,
192
- `[sender_id:${input.sender_id}]`,
193
- `[sender_name:${input.sender_name}]`
182
+ `[sender_id:${h(input.sender_id)}]`,
183
+ `[sender_name:${h(input.sender_name)}]`
194
184
  ];
185
+ const chatLink = (0,source_link/* httpsUrlOrNull */.N)(input.chat_link);
186
+ if (chatLink) lines.push(`[chat_link:${chatLink}]`);
195
187
  if (input.event) {
196
188
  lines.push(`[event_type:${input.event.type}]`);
197
- lines.push(`[event_subtype:${input.event.subtype}]`);
189
+ lines.push(`[event_subtype:${h(input.event.subtype)}]`);
198
190
  }
199
191
  if (input.is_group) {
200
- lines.push(`[group_name:${input.chat_name}]`);
201
- lines.push(`[participant_id:${input.sender_id}]`);
202
- lines.push(`[participant_name:${input.sender_name}]`);
192
+ lines.push(`[group_name:${h(input.chat_name)}]`);
193
+ lines.push(`[participant_id:${h(input.sender_id)}]`);
194
+ lines.push(`[participant_name:${h(input.sender_name)}]`);
203
195
  }
204
196
  return `${note}\n\n${lines.join("\n")}\n\n${input.text}`;
205
197
  }
@@ -214,7 +206,7 @@ function parseBridgePrompt(raw) {
214
206
  const lines = src.split("\n");
215
207
  let i = 0;
216
208
  for(; i < lines.length; i++){
217
- const line = lines[i];
209
+ const line = lines[i].replace(/\r$/, "");
218
210
  if (line === "") {
219
211
  i++;
220
212
  break;
@@ -233,6 +225,7 @@ function parseBridgePrompt(raw) {
233
225
  isGroup: headers.chat_type === "group",
234
226
  senderJid: senderId,
235
227
  senderName: headers.sender_name || senderId || "Unknown",
228
+ chatLink: httpsUrlOrNull(headers.chat_link),
236
229
  body: lines.slice(i).join("\n").trimEnd()
237
230
  };
238
231
  }
@@ -345,6 +338,7 @@ var automation_activity = __webpack_require__(26316);
345
338
  role: msg.role,
346
339
  sender_id: senderJid,
347
340
  sender_name: senderName,
341
+ chat_link: adapter.chatLink?.(msg.remote_jid) ?? null,
348
342
  text: msg.text,
349
343
  silent,
350
344
  event: msg.event
@@ -473,8 +467,8 @@ var automation_activity = __webpack_require__(26316);
473
467
  }
474
468
  }
475
469
 
476
- // EXTERNAL MODULE: ./lib/bridges/registry.ts + 4 modules
477
- var registry = __webpack_require__(44540);
470
+ // EXTERNAL MODULE: ./lib/bridges/registry.ts + 5 modules
471
+ var registry = __webpack_require__(70309);
478
472
  ;// ./lib/bridges/runtime.ts
479
473
  /**
480
474
  * Bridge lifecycle manager.
@@ -1385,7 +1379,7 @@ module.exports = import("@huggingface/transformers");;
1385
1379
  var __webpack_require__ = require("../../../../../../webpack-runtime.js");
1386
1380
  __webpack_require__.C(exports);
1387
1381
  var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
1388
- var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,513,6299,563,8808,7547,4992,46,3042,3566,2068,4377,1638,5585,9304,3524,3175,6142,540,4189,4955,5908,5120,1388,4540], () => (__webpack_exec__(11221)));
1382
+ var __webpack_exports__ = __webpack_require__.X(0, [2970,7377,1813,7981,513,6299,563,8808,7547,4992,46,3042,3566,2068,4377,1638,5585,9304,3524,3175,6142,540,4189,4955,5908,5120,1388,309], () => (__webpack_exec__(11221)));
1389
1383
  module.exports = __webpack_exports__;
1390
1384
 
1391
1385
  })();