@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.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +5 -5
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +4 -4
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +14 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +16 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +16 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +16 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/access/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/agents/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +26 -32
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +18 -7
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +18 -7
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +26 -32
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +27 -33
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +26 -32
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +28 -12
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +28 -12
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +26 -32
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +9 -2
- package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/route.js +19 -7
- package/.next/standalone/.next/server/app/api/v1/bridges/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/events/route.js +26 -32
- package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/health/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/memory/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/models/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +28 -4
- package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +28 -4
- package/.next/standalone/.next/server/app/api/v1/packages/route.js +28 -4
- package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +27 -12
- package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/profile/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +585 -58
- package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/providers/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/redaction/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/security/state/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/skills/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/tasks/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +12 -6
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +125 -26
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +1 -2
- package/.next/standalone/.next/server/app/api/v1/threads/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/tools/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +17 -5
- package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +1 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/route.js +1 -1
- package/.next/standalone/.next/server/app/page.js +27323 -27034
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup/page.js +8 -0
- package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +5 -5
- package/.next/standalone/.next/server/chunks/1388.js +106 -36
- package/.next/standalone/.next/server/chunks/2068.js +47 -10
- package/.next/standalone/.next/server/chunks/210.js +6 -6
- package/.next/standalone/.next/server/chunks/2447.js +10 -5
- package/.next/standalone/.next/server/chunks/2653.js +80 -1
- package/.next/standalone/.next/server/chunks/3042.js +10 -8
- package/.next/standalone/.next/server/chunks/{4540.js → 309.js} +104 -38
- package/.next/standalone/.next/server/chunks/{2350.js → 3272.js} +104 -37
- package/.next/standalone/.next/server/chunks/3524.js +150 -67
- package/.next/standalone/.next/server/chunks/3566.js +1 -1
- package/.next/standalone/.next/server/chunks/4189.js +1 -1
- package/.next/standalone/.next/server/chunks/4596.js +28 -4
- package/.next/standalone/.next/server/chunks/46.js +91 -31
- package/.next/standalone/.next/server/chunks/466.js +53 -7
- package/.next/standalone/.next/server/chunks/4955.js +30 -3
- package/.next/standalone/.next/server/chunks/5585.js +28 -4
- package/.next/standalone/.next/server/chunks/5908.js +63 -42
- package/.next/standalone/.next/server/chunks/6142.js +10 -2
- package/.next/standalone/.next/server/chunks/8461.js +10 -8
- package/.next/standalone/.next/server/chunks/9032.js +5 -5
- package/.next/standalone/.next/server/chunks/9164.js +487 -177
- package/.next/standalone/.next/server/chunks/9304.js +51 -12
- package/.next/standalone/.next/server/chunks/{423.js → 9590.js} +84 -24
- package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
- package/.next/standalone/.next/server/middleware.js +89 -21
- package/.next/standalone/.next/server/pages/404.html +14 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/preview-props.json +3 -3
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/{1395-e4a99912b8f83044.js → 1395-bfe1f3ef760c0f50.js} +54 -8
- package/.next/standalone/.next/static/chunks/app/{layout-9bc0b10127cb7d42.js → layout-7b24ad13faa3944b.js} +69 -2
- package/.next/standalone/.next/static/chunks/app/{page-213a623b37226452.js → page-2ef8d75d40eb4311.js} +10643 -10295
- package/.next/standalone/.next/static/css/c160ea862133acd2.css +5 -0
- package/.next/standalone/docs/adoption/changesets.json +2805 -0
- package/.next/standalone/package.json +1 -1
- package/CHANGELOG.md +52 -0
- package/api/client.models.test.ts +10 -0
- package/api/client.startup.test.ts +129 -0
- package/api/client.ts +51 -9
- package/api/thread-metadata.test.ts +72 -0
- package/api/types.ts +6 -3
- package/app/api/v1/providers/[provider]/models/route.test.ts +216 -6
- package/app/api/v1/providers/[provider]/models/route.ts +259 -40
- package/app/api/v1/threads/[thread_id]/route.ts +26 -23
- package/app/api/v1/threads/[thread_id]/run/route.ts +0 -1
- package/app/globals.css +119 -29
- package/app/layout.tsx +12 -0
- package/components/agents/AgentsPanel.tsx +5 -13
- package/components/chat/ChatView.tsx +9 -18
- package/components/chat/InputBar.tsx +1 -1
- package/components/chat/MessageBubble.tsx +13 -1
- package/components/chat/MessageList.test.tsx +45 -4
- package/components/chat/MessageList.tsx +123 -89
- package/components/chat/ToolList.tsx +88 -84
- package/components/chat/useThreadActivity.test.tsx +2 -2
- package/components/chat/useThreadActivity.ts +2 -2
- package/components/chat/useThreadData.ts +1 -30
- package/components/chat/useThreadMetadataPolling.test.tsx +128 -0
- package/components/chat/useThreadMetadataPolling.ts +50 -0
- package/components/chat/useUserProfileAndAgent.test.tsx +31 -0
- package/components/chat/useUserProfileAndAgent.ts +13 -2
- package/components/dashboard/DashboardPanel.tsx +1 -1
- package/components/dashboard/Series.tsx +34 -21
- package/components/dashboard/SummaryCards.tsx +1 -1
- package/components/integrations/NetworkSection.tsx +2 -2
- package/components/layout/AppShell.tsx +22 -7
- package/components/layout/MenuPanel.tsx +14 -24
- package/components/profile/ProfilePanel.tsx +2 -2
- package/components/settings/AppearancePanel.tsx +70 -3
- package/components/settings/SettingsPanel.tsx +2 -2
- package/components/tools/ToolsPanel.tsx +2 -7
- package/components/ui/AppearancePreferences.test.tsx +68 -0
- package/components/ui/BootScreen.test.tsx +44 -0
- package/components/ui/BootScreen.tsx +24 -11
- package/components/ui/NotificationStatus.test.tsx +2 -2
- package/components/ui/NotificationStatus.tsx +5 -5
- package/components/ui/SubTabBar.tsx +2 -3
- package/contexts/ThemeContext.tsx +84 -1
- package/hooks/useAgentSession.test.ts +12 -1
- package/hooks/useAgentSession.ts +6 -4
- package/hooks/useUrlSync.test.ts +13 -0
- package/hooks/useUrlSync.ts +0 -4
- package/lib/agents/citation-checker.test.ts +40 -2
- package/lib/agents/citation-checker.ts +56 -11
- package/lib/agents/context-boundary.ts +5 -6
- package/lib/agents/instruction-edits.test.ts +120 -0
- package/lib/agents/instruction-edits.ts +65 -42
- package/lib/agents/prepare/request.ts +0 -2
- package/lib/agents/prepare/system-prompt.test.ts +10 -0
- package/lib/agents/prepare/system-prompt.ts +8 -2
- package/lib/agents/proposals.test.ts +76 -0
- package/lib/agents/proposals.ts +13 -5
- package/lib/agents/run-thread.auto-boundary.test.ts +125 -5
- package/lib/agents/run-thread.ts +24 -9
- package/lib/agents/sqlite-checkpoint-saver.test.ts +91 -0
- package/lib/agents/warm-summary-background.ts +22 -2
- package/lib/agents/warm-topics.test.ts +155 -1
- package/lib/agents/warm-topics.ts +27 -7
- package/lib/bridges/dispatcher.ts +1 -0
- package/lib/bridges/message-role.test.ts +81 -0
- package/lib/bridges/message-role.ts +23 -10
- package/lib/bridges/types.ts +6 -0
- package/lib/bridges/whatsapp-link.test.ts +32 -0
- package/lib/bridges/whatsapp-link.ts +21 -0
- package/lib/bridges/whatsapp.inbound.test.ts +239 -0
- package/lib/bridges/whatsapp.sender.test.ts +80 -1
- package/lib/bridges/whatsapp.ts +76 -38
- package/lib/db/migrations.test.ts +61 -0
- package/lib/db/migrations.ts +13 -0
- package/lib/embeddings/performance.test.ts +114 -0
- package/lib/pricing/snapshot.test.ts +70 -0
- package/lib/pricing/snapshot.ts +10 -2
- package/lib/proxy/dispatcher.test.ts +119 -1
- package/lib/proxy/dispatcher.ts +22 -9
- package/lib/stores/agent-configs.ts +10 -5
- package/lib/stores/bridges.test.ts +81 -0
- package/lib/stores/bridges.ts +9 -8
- package/lib/stores/dashboard-metrics-cache.test.ts +99 -0
- package/lib/stores/dashboard-metrics.ts +30 -4
- package/lib/stores/message-embedding-jobs.test.ts +27 -0
- package/lib/stores/message-embedding-jobs.ts +5 -3
- package/lib/stores/message-usage.test.ts +21 -1
- package/lib/stores/pricing-cache.test.ts +31 -0
- package/lib/stores/pricing.ts +3 -0
- package/lib/stores/proxy-config.test.ts +120 -0
- package/lib/stores/proxy-config.ts +22 -4
- package/lib/stores/threads.ts +12 -8
- package/lib/tools/communications/calendar.test.ts +43 -2
- package/lib/tools/communications/calendar.ts +2 -0
- package/lib/tools/communications/gmail.test.ts +51 -1
- package/lib/tools/communications/gmail.ts +44 -2
- package/lib/tools/communications/outlook-calendar.ts +2 -0
- package/lib/tools/communications/outlook.test.ts +33 -2
- package/lib/tools/communications/outlook.ts +2 -0
- package/lib/tools/filesystem/edit-match.test.ts +133 -0
- package/lib/tools/filesystem/edit-match.ts +7 -2
- package/lib/tools/packages/default-packages.test.ts +21 -0
- package/lib/tools/packages/optional-package.test.ts +72 -0
- package/lib/tools/packages/optional-package.ts +33 -4
- package/lib/tools/support/result-refs.test.ts +131 -0
- package/lib/tools/support/result-refs.ts +41 -9
- package/lib/ui/navigate.test.ts +13 -0
- package/lib/ui/navigate.ts +10 -2
- package/lib/utils/source-link.test.ts +51 -0
- package/lib/utils/source-link.ts +45 -0
- package/package.json +1 -1
- package/.next/standalone/.next/static/css/312542a5725ba0d5.css +0 -5
- /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → 544OFJV-q0RC6Gjgje4LT}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → 544OFJV-q0RC6Gjgje4LT}/_ssgManifest.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports.id =
|
|
3
|
-
exports.ids = [
|
|
2
|
+
exports.id = 3272;
|
|
3
|
+
exports.ids = [3272];
|
|
4
4
|
exports.modules = {
|
|
5
5
|
|
|
6
|
-
/***/
|
|
6
|
+
/***/ 63272:
|
|
7
7
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
8
|
|
|
9
9
|
|
|
@@ -144,12 +144,16 @@ function bumpRouteLastSeenTs(bridgeId, remoteJid, ts) {
|
|
|
144
144
|
if (!Number.isFinite(ts) || ts <= 0) return;
|
|
145
145
|
(0,db/* getDb */.L)().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);
|
|
146
146
|
}
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
// Per-chat watermarks for every explicitly routed chat on a bridge, loaded
|
|
148
|
+
// once per upsert batch. Each chat is gated only by its own progress: a
|
|
149
|
+
// bridge-wide maximum would drop chat B's offline backlog as soon as a newer
|
|
150
|
+
// message from chat A had been delivered.
|
|
151
|
+
function getRouteLastSeenTsMap(bridgeId) {
|
|
152
|
+
const rows = (0,db/* getDb */.L)().prepare("SELECT remote_jid, last_seen_ts FROM bridge_routes WHERE bridge_id=? AND last_seen_ts IS NOT NULL").all(bridgeId);
|
|
153
|
+
return new Map(rows.map((r)=>[
|
|
154
|
+
r.remote_jid,
|
|
155
|
+
r.last_seen_ts
|
|
156
|
+
]));
|
|
153
157
|
}
|
|
154
158
|
// ---------------------------------------------------------------------------
|
|
155
159
|
// Ignore-list CRUD (per-bridge chat blocklist)
|
|
@@ -302,6 +306,7 @@ var automation_activity = __webpack_require__(21783);
|
|
|
302
306
|
role: msg.role,
|
|
303
307
|
sender_id: senderJid,
|
|
304
308
|
sender_name: senderName,
|
|
309
|
+
chat_link: adapter.chatLink?.(msg.remote_jid) ?? null,
|
|
305
310
|
text: msg.text,
|
|
306
311
|
silent,
|
|
307
312
|
event: msg.event
|
|
@@ -615,6 +620,26 @@ function safeBridgeId(id) {
|
|
|
615
620
|
return baseDir();
|
|
616
621
|
}
|
|
617
622
|
|
|
623
|
+
;// ./lib/bridges/whatsapp-link.ts
|
|
624
|
+
/**
|
|
625
|
+
* WhatsApp click-to-chat link for a Baileys JID.
|
|
626
|
+
*
|
|
627
|
+
* WhatsApp has no permalink to a group or to a single message, so only 1:1
|
|
628
|
+
* chats with a phone-number JID get a link: `https://wa.me/<digits>` opens
|
|
629
|
+
* that chat in the WhatsApp app or WhatsApp Web. `@lid` ids hide the phone
|
|
630
|
+
* number, and groups, channels and broadcasts have no public chat URL.
|
|
631
|
+
*/ // E.164 numbers are at most 15 digits; the shortest real ones are 7–8.
|
|
632
|
+
const E164_DIGITS = /^[1-9]\d{6,14}$/;
|
|
633
|
+
function whatsappChatLink(jid) {
|
|
634
|
+
if (!jid) return null;
|
|
635
|
+
const at = jid.lastIndexOf("@");
|
|
636
|
+
if (at < 0) return null;
|
|
637
|
+
const host = jid.slice(at + 1);
|
|
638
|
+
if (host !== "s.whatsapp.net" && host !== "c.us") return null;
|
|
639
|
+
const digits = jid.slice(0, at).split(":")[0];
|
|
640
|
+
return E164_DIGITS.test(digits) ? `https://wa.me/${digits}` : null;
|
|
641
|
+
}
|
|
642
|
+
|
|
618
643
|
// EXTERNAL MODULE: ./lib/utils/error.ts
|
|
619
644
|
var error = __webpack_require__(4379);
|
|
620
645
|
;// ./lib/bridges/whatsapp.ts
|
|
@@ -647,6 +672,7 @@ var error = __webpack_require__(4379);
|
|
|
647
672
|
|
|
648
673
|
|
|
649
674
|
|
|
675
|
+
|
|
650
676
|
class WhatsAppBridgeAdapter {
|
|
651
677
|
static{
|
|
652
678
|
this.SENT_IDS_MAX = 500;
|
|
@@ -870,10 +896,10 @@ class WhatsAppBridgeAdapter {
|
|
|
870
896
|
// adapter should re-deliver to agents) and the legacy
|
|
871
897
|
// `replace`/`update` events that arrive via messages.update.
|
|
872
898
|
if (payload.type !== "notify" && payload.type !== "append") return;
|
|
873
|
-
// On a fresh adapter boot the
|
|
874
|
-
// persisted. Read
|
|
875
|
-
//
|
|
876
|
-
const
|
|
899
|
+
// On a fresh adapter boot the watermarks are whatever the last run
|
|
900
|
+
// persisted. Read them once per batch (one cheap SQLite call) so old
|
|
901
|
+
// appends are rejected without per-message queries.
|
|
902
|
+
const watermarks = payload.type === "append" ? getRouteLastSeenTsMap(this.bridge_id) : null;
|
|
877
903
|
for (const raw of payload.messages ?? []){
|
|
878
904
|
const m = raw;
|
|
879
905
|
if (!m.key?.remoteJid) continue;
|
|
@@ -900,18 +926,20 @@ class WhatsAppBridgeAdapter {
|
|
|
900
926
|
// "real" the moment we see any message from it, even one whose
|
|
901
927
|
// body we end up unable to represent (e.g. reactions, polls).
|
|
902
928
|
const ts = typeof m.messageTimestamp === "number" ? m.messageTimestamp * 1000 : (m.messageTimestamp?.low ?? 0) * 1000 || Date.now();
|
|
903
|
-
// Watermark gate: on `append` batches, skip anything
|
|
904
|
-
//
|
|
905
|
-
//
|
|
906
|
-
//
|
|
907
|
-
//
|
|
908
|
-
|
|
909
|
-
if (
|
|
929
|
+
// Watermark gate: on `append` batches, skip anything at or below
|
|
930
|
+
// this chat's own persisted watermark. This prevents the server's
|
|
931
|
+
// reconnect replay from re-delivering messages we already routed in
|
|
932
|
+
// a previous process lifetime. `notify` events skip this check —
|
|
933
|
+
// they're live and may legitimately arrive out of order.
|
|
934
|
+
const watermark = watermarks?.get(remote_jid) ?? 0;
|
|
935
|
+
if (watermark > 0 && ts > 0 && ts <= watermark) {
|
|
910
936
|
continue;
|
|
911
937
|
}
|
|
912
|
-
//
|
|
913
|
-
//
|
|
914
|
-
|
|
938
|
+
// pushName names the *sender*: in groups that's a participant, and on
|
|
939
|
+
// fromMe messages it's the user's own name. Only a counterpart's
|
|
940
|
+
// pushName in a 1:1 chat is a valid label for the chat itself.
|
|
941
|
+
const chatPushName = is_group || m.key.fromMe ? null : m.pushName ?? null;
|
|
942
|
+
this.observeChat(remote_jid, chatPushName, ts);
|
|
915
943
|
// Unwrap protocol envelopes (view-once, ephemeral, etc.) so we can
|
|
916
944
|
// see the underlying payload uniformly, then turn it into a text
|
|
917
945
|
// body + ContentPart attachments the agent can consume.
|
|
@@ -929,7 +957,7 @@ class WhatsAppBridgeAdapter {
|
|
|
929
957
|
// chats it's undefined — the sender == remote_jid. Normalize so the
|
|
930
958
|
// dispatcher gets a routable user JID, not the legacy @c.us form.
|
|
931
959
|
const participant_jid = is_group && m.key.participant ? normalizeUserJid(m.key.participant) : null;
|
|
932
|
-
const chat_name = this.chats.get(remote_jid)?.name ??
|
|
960
|
+
const chat_name = this.chats.get(remote_jid)?.name ?? chatPushName;
|
|
933
961
|
const sender = resolveWhatsAppSender({
|
|
934
962
|
fromMe: m.key.fromMe === true,
|
|
935
963
|
isGroup: is_group,
|
|
@@ -987,7 +1015,11 @@ class WhatsAppBridgeAdapter {
|
|
|
987
1015
|
const ct = raw;
|
|
988
1016
|
const chatJid = pickContactChatJid(ct);
|
|
989
1017
|
if (!chatJid) continue;
|
|
990
|
-
const name =
|
|
1018
|
+
const name = [
|
|
1019
|
+
ct.name,
|
|
1020
|
+
ct.verifiedName,
|
|
1021
|
+
ct.notify
|
|
1022
|
+
].find((n)=>n?.trim()) ?? null;
|
|
991
1023
|
this.observeChat(chatJid, name, null);
|
|
992
1024
|
}
|
|
993
1025
|
});
|
|
@@ -1012,7 +1044,11 @@ class WhatsAppBridgeAdapter {
|
|
|
1012
1044
|
for (const ct of list){
|
|
1013
1045
|
const chatJid = pickContactChatJid(ct);
|
|
1014
1046
|
if (!chatJid) continue;
|
|
1015
|
-
this.observeChat(chatJid,
|
|
1047
|
+
this.observeChat(chatJid, [
|
|
1048
|
+
ct.name,
|
|
1049
|
+
ct.verifiedName,
|
|
1050
|
+
ct.notify
|
|
1051
|
+
].find((n)=>n?.trim()) ?? null, null);
|
|
1016
1052
|
}
|
|
1017
1053
|
});
|
|
1018
1054
|
// Group profile/settings updates (subject/description/permissions/etc.).
|
|
@@ -1121,6 +1157,9 @@ class WhatsAppBridgeAdapter {
|
|
|
1121
1157
|
error: null
|
|
1122
1158
|
});
|
|
1123
1159
|
}
|
|
1160
|
+
chatLink(remote_jid) {
|
|
1161
|
+
return whatsappChatLink(remote_jid);
|
|
1162
|
+
}
|
|
1124
1163
|
async sendText(remote_jid, text) {
|
|
1125
1164
|
// Hard guard: refuse to send to any chat whose route is in silent_mode.
|
|
1126
1165
|
// The dispatcher already short-circuits before calling sendText, but
|
|
@@ -1377,7 +1416,10 @@ class WhatsAppBridgeAdapter {
|
|
|
1377
1416
|
});
|
|
1378
1417
|
attachments.push(ref);
|
|
1379
1418
|
const sizeKb = Math.max(1, Math.round(buf.length / 1024));
|
|
1380
|
-
|
|
1419
|
+
// Sender-supplied document names can carry newlines or brackets;
|
|
1420
|
+
// describe the attachment by the store's sanitized name.
|
|
1421
|
+
const shownName = oneLine("filename" in ref && ref.filename || filename);
|
|
1422
|
+
text = (text ? text + "\n" : "") + `[Attached ${label}: ${shownName} (${mime}, ${sizeKb} KB); retained as a Jarela file reference.]`;
|
|
1381
1423
|
} catch (err) {
|
|
1382
1424
|
const m = (0,error/* errorMessage */.g)(err);
|
|
1383
1425
|
console.warn(`[bridge ${this.bridge_id}] failed to spill ${label} from ${remote_jid}: ${m}`);
|
|
@@ -1432,8 +1474,8 @@ class WhatsAppBridgeAdapter {
|
|
|
1432
1474
|
`lat=${degreesLatitude ?? "?"}`,
|
|
1433
1475
|
`lng=${degreesLongitude ?? "?"}`
|
|
1434
1476
|
];
|
|
1435
|
-
if (name) parts.push(`name
|
|
1436
|
-
if (address) parts.push(`address
|
|
1477
|
+
if (name) parts.push(`name=${JSON.stringify(oneLine(name))}`);
|
|
1478
|
+
if (address) parts.push(`address=${JSON.stringify(oneLine(address))}`);
|
|
1437
1479
|
text = (text ? text + "\n" : "") + `[location: ${parts.join(" ")}]`;
|
|
1438
1480
|
}
|
|
1439
1481
|
if (inner.liveLocationMessage) {
|
|
@@ -1441,12 +1483,12 @@ class WhatsAppBridgeAdapter {
|
|
|
1441
1483
|
text = (text ? text + "\n" : "") + `[live-location: lat=${degreesLatitude ?? "?"} lng=${degreesLongitude ?? "?"}]`;
|
|
1442
1484
|
}
|
|
1443
1485
|
if (inner.contactMessage) {
|
|
1444
|
-
const name = inner.contactMessage.displayName ?? "unknown";
|
|
1445
|
-
const vcard = inner.contactMessage.vcard ?? "";
|
|
1486
|
+
const name = oneLine(inner.contactMessage.displayName ?? "") || "unknown";
|
|
1487
|
+
const vcard = stripVcardBinary(inner.contactMessage.vcard ?? "");
|
|
1446
1488
|
text = (text ? text + "\n" : "") + `[contact: ${name}]\n${vcard}`;
|
|
1447
1489
|
}
|
|
1448
1490
|
if (inner.contactsArrayMessage) {
|
|
1449
|
-
const names = (inner.contactsArrayMessage.contacts ?? []).map((c)=>c?.displayName ?? "unknown").join(", ");
|
|
1491
|
+
const names = (inner.contactsArrayMessage.contacts ?? []).map((c)=>oneLine(c?.displayName ?? "") || "unknown").join(", ");
|
|
1450
1492
|
text = (text ? text + "\n" : "") + `[contacts: ${names}]`;
|
|
1451
1493
|
}
|
|
1452
1494
|
return {
|
|
@@ -1458,8 +1500,9 @@ class WhatsAppBridgeAdapter {
|
|
|
1458
1500
|
if (!remote_jid) return;
|
|
1459
1501
|
const existing = this.chats.get(remote_jid);
|
|
1460
1502
|
// Prefer the most recently-observed name (group subjects rename; users
|
|
1461
|
-
// change push names). Don't overwrite a known name with
|
|
1462
|
-
|
|
1503
|
+
// change push names). Don't overwrite a known name with a missing or
|
|
1504
|
+
// blank one.
|
|
1505
|
+
const nextName = name?.trim() || existing?.name || null;
|
|
1463
1506
|
const nextTs = ts && (!existing?.last_message_at || ts > existing.last_message_at) ? ts : existing?.last_message_at ?? null;
|
|
1464
1507
|
this.chats.set(remote_jid, {
|
|
1465
1508
|
remote_jid,
|
|
@@ -1476,6 +1519,27 @@ class WhatsAppBridgeAdapter {
|
|
|
1476
1519
|
return this.currentStatus;
|
|
1477
1520
|
}
|
|
1478
1521
|
}
|
|
1522
|
+
function oneLine(value) {
|
|
1523
|
+
return value.replace(/[\s\u0085\u2028\u2029]+/g, " ").trim();
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Phones embed contact photos and logos as base64 vCard properties, often
|
|
1527
|
+
* tens of KB of noise in the agent's context. Drop those properties,
|
|
1528
|
+
* including their folded continuation lines (RFC 6350 §3.2), and keep the
|
|
1529
|
+
* readable fields.
|
|
1530
|
+
*/ function stripVcardBinary(vcard) {
|
|
1531
|
+
const out = [];
|
|
1532
|
+
let skipping = false;
|
|
1533
|
+
for (const line of vcard.split(/\r\n|\r|\n/)){
|
|
1534
|
+
if (/^[ \t]/.test(line)) {
|
|
1535
|
+
if (!skipping) out.push(line);
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
skipping = /^(?:[\w-]+\.)?(?:PHOTO|LOGO|SOUND|KEY)[;:]/i.test(line);
|
|
1539
|
+
if (!skipping) out.push(line);
|
|
1540
|
+
}
|
|
1541
|
+
return out.join("\n").trim();
|
|
1542
|
+
}
|
|
1479
1543
|
// Minimal pino-compatible silent logger. Baileys uses `logger.child()`
|
|
1480
1544
|
// chaining internally, so we return ourselves for every child call.
|
|
1481
1545
|
function makeSilentLogger() {
|
|
@@ -1589,6 +1653,9 @@ function sanitizeMediaType(raw, kind, fallback) {
|
|
|
1589
1653
|
return primary;
|
|
1590
1654
|
}
|
|
1591
1655
|
function resolveWhatsAppSender(input) {
|
|
1656
|
+
// Platforms send blank display names ("" or whitespace) for contacts that
|
|
1657
|
+
// never set one; treat those as missing so the fallbacks still apply.
|
|
1658
|
+
const named = (...names)=>names.find((n)=>!!n && n.trim().length > 0)?.trim();
|
|
1592
1659
|
if (input.fromMe) {
|
|
1593
1660
|
return {
|
|
1594
1661
|
senderJid: input.selfJid ?? "me",
|
|
@@ -1599,12 +1666,12 @@ function resolveWhatsAppSender(input) {
|
|
|
1599
1666
|
const senderJid = input.participantJid ?? input.remoteJid;
|
|
1600
1667
|
return {
|
|
1601
1668
|
senderJid,
|
|
1602
|
-
senderName: input.participantName
|
|
1669
|
+
senderName: named(input.participantName, input.pushName) ?? senderJid
|
|
1603
1670
|
};
|
|
1604
1671
|
}
|
|
1605
1672
|
return {
|
|
1606
1673
|
senderJid: input.remoteJid,
|
|
1607
|
-
senderName: input.pushName
|
|
1674
|
+
senderName: named(input.pushName, input.chatName) ?? input.remoteJid
|
|
1608
1675
|
};
|
|
1609
1676
|
}
|
|
1610
1677
|
/**
|
|
@@ -1887,4 +1954,4 @@ async function stopAllBridges() {
|
|
|
1887
1954
|
|
|
1888
1955
|
};
|
|
1889
1956
|
;
|
|
1890
|
-
//# sourceMappingURL=
|
|
1957
|
+
//# sourceMappingURL=3272.js.map
|