@lobu/runtime-server 24.1.1 → 24.3.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/dist/catalogs/connectors.json +175 -39
- package/dist/catalogs/skills.json +2 -2
- package/dist/component.json +1 -1
- package/dist/connectors/gchat.ts +31 -1
- package/dist/connectors/google_gmail.ts +70 -41
- package/dist/connectors/google_gmail_references.ts +406 -0
- package/dist/connectors/linkedin-inbox-adapter.js +107 -36
- package/dist/connectors/linkedin-inbox.ts +13 -0
- package/dist/connectors/linkedin.ts +1 -1
- package/dist/connectors/postgres.ts +14 -8
- package/dist/connectors/reddit.ts +171 -5
- package/dist/connectors/whatsapp-web-adapter.js +147 -61
- package/dist/connectors/whatsapp-web-helpers.ts +6 -2
- package/dist/connectors/whatsapp_web.ts +48 -17
- package/dist/connectors/x-dm-adapter.js +252 -35
- package/dist/connectors/x.ts +189 -13
- package/dist/db/migrations/20261020140000_view_attachments_by_page.sql +3 -1
- package/dist/db/migrations/20261024050000_events_source_reference_arrival.sql +27 -0
- package/dist/db/migrations/20261026000000_turn_write_receipts.sql +36 -0
- package/dist/db/migrations/20261026190000_federated_relationship_endpoints.sql +143 -0
- package/dist/dependencies.bun.lock +137 -202
- package/dist/embeddings-server.mjs +81 -11
- package/dist/guest.bundle.js +62 -25
- package/dist/owletto/dist/assets/_-XKF0m81R.js +3 -0
- package/dist/owletto/dist/assets/_-e8MbEBtw.js +2 -0
- package/dist/owletto/dist/assets/_agentId-Cv9goIFf.js +2 -0
- package/dist/owletto/dist/assets/_agentId-emObu67X.js +2 -0
- package/dist/owletto/dist/assets/_automationId-CfFFAYK1.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-D6NKXSOE.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-DFrkLLTU.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-D3vuAQPe.js +2 -0
- package/dist/owletto/dist/assets/_eventId-BV5SQaUA.js +2 -0
- package/dist/owletto/dist/assets/_name-DjtJMop4.js +2 -0
- package/dist/owletto/dist/assets/_owner-oBX68rb9.js +3 -0
- package/dist/owletto/dist/assets/_shape-C4lLPAwI.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-Cw-7q6hI.js +2 -0
- package/dist/owletto/dist/assets/_slug-B2g5qzn3.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CIKGCtdK.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-Dx4kJo7o.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-38lHBvjO.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-voRYSM3a.js +2 -0
- package/dist/owletto/dist/assets/agent-card-controls-DiU7Un5w.js +2 -0
- package/dist/owletto/dist/assets/{agent-client-setup-list-BlXB4SE5.js → agent-client-setup-list-Bkyw22GW.js} +4 -4
- package/dist/owletto/dist/assets/agent-connect-pages-CpBxQCpx.js +2 -0
- package/dist/owletto/dist/assets/{agent-editor-form-DsSoeQeF.js → agent-editor-form-QrIDroFL.js} +2 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-CyoGSxcZ.js +2 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-B7v6Cffw.js → agent-loading-shells-CamDtzHY.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-CgsQ8BK_.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-DFucg4c4.js → agent-skill-context-lWbXKEm1.js} +2 -2
- package/dist/owletto/dist/assets/agent-skills-route-D-w3tY_2.js +2 -0
- package/dist/owletto/dist/assets/agent-subpage-shell-CLqpn5Tb.js +2 -0
- package/dist/owletto/dist/assets/{agent-thread-D38STyeu.js → agent-thread-CsRexwTv.js} +4 -4
- package/dist/owletto/dist/assets/agents-DzH_FFKU.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-CmGrMvPC.js +2 -0
- package/dist/owletto/dist/assets/app-bridge-C4nPtae3.js +121 -0
- package/dist/owletto/dist/assets/app._appId-BO7G38fL.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-DMYxs6F6.js +2 -0
- package/dist/owletto/dist/assets/automations-DzH_FFKU.js +2 -0
- package/dist/owletto/dist/assets/calendar-DDCCSPW6.js +2 -0
- package/dist/owletto/dist/assets/callback-DFciMR8u.js +2 -0
- package/dist/owletto/dist/assets/{card-jzhQrMDP.js → card-BCsbrdGs.js} +2 -2
- package/dist/owletto/dist/assets/{claim-B-wq745Q.js → claim-BRua2b_7.js} +2 -2
- package/dist/owletto/dist/assets/client-activity-scopes-BLIy1Zc3.js +2 -0
- package/dist/owletto/dist/assets/client-rows-DiJQ5D1z.js +2 -0
- package/dist/owletto/dist/assets/clients-8-EpRjsm.js +2 -0
- package/dist/owletto/dist/assets/{code-editor-CEqoCky-.js → code-editor-BFZa4EIt.js} +3 -3
- package/dist/owletto/dist/assets/connect-C0cHE9Xl.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-D2K4tmvW.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-D4EG5a0v.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-DhoCT6sT.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-Dn4qw2Us.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-BTI5JXA3.js +2 -0
- package/dist/owletto/dist/assets/connection-X9VU9Ijm.js +2 -0
- package/dist/owletto/dist/assets/connection-feed-detail-B6ydKasK.js +2 -0
- package/dist/owletto/dist/assets/connections-browser-BMV8bf54.js +2 -0
- package/dist/owletto/dist/assets/connector-boxes-DqZA-FdG.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-D-ECOlMJ.js → connector-provenance-BIg8P8WY.js} +2 -2
- package/dist/owletto/dist/assets/connector-scope-lists-CJYz53YF.js +2 -0
- package/dist/owletto/dist/assets/{connectors-CH4KBZyT.js → connectors-BroKpwhB.js} +2 -2
- package/dist/owletto/dist/assets/{consent-C9ZpHb7V.js → consent-fzLN-Qy7.js} +2 -2
- package/dist/owletto/dist/assets/copy-button-Df7QXE0w.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-BupT3V0i.js → core.esm-A1UnFbGs.js} +2 -2
- package/dist/owletto/dist/assets/create-BjwsYarn.js +2 -0
- package/dist/owletto/dist/assets/create-Dzr4mlr0.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-DHW6OUoS.js +3 -0
- package/dist/owletto/dist/assets/create-c94SPL21.js +2 -0
- package/dist/owletto/dist/assets/create._connectorKey-DLLn2nej.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-CWImw-kf.js → cronstrue-xxpD1P2-.js} +2 -2
- package/dist/owletto/dist/assets/{device-D-7WBe9E.js → device-C3AEoL5c.js} +2 -2
- package/dist/owletto/dist/assets/{device-pin-tombstone-2U0UMu3_.js → device-pin-tombstone-B_te59GE.js} +2 -2
- package/dist/owletto/dist/assets/device._deviceId-ZU09qrot.js +2 -0
- package/dist/owletto/dist/assets/elk-worker.min-BENGc9gn.js +23 -0
- package/dist/owletto/dist/assets/{entity-avatar-mdh7Kq5D.js → entity-avatar-CEV4ttUQ.js} +2 -2
- package/dist/owletto/dist/assets/entity-options-DJv2EhVV.js +2 -0
- package/dist/owletto/dist/assets/entity-page-BUghWZ1s.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-Lf6ONdpf.js +2 -0
- package/dist/owletto/dist/assets/event-card-CBlsG32u.js +2 -0
- package/dist/owletto/dist/assets/event-detail-BKSGEOdW.js +2 -0
- package/dist/owletto/dist/assets/events-feed-VfU4csn2.js +2 -0
- package/dist/owletto/dist/assets/feed-event-kinds-BYuZCoU4.js +2 -0
- package/dist/owletto/dist/assets/filter-bar-COU0sBFQ.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-BVbcpW3R.js → full-page-spinner-C1Q_jEzD.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-6ZJv1uzM.js +2 -0
- package/dist/owletto/dist/assets/identity-BaFLmbSo.js +2 -0
- package/dist/owletto/dist/assets/index-008wj-Pz.js +7950 -0
- package/dist/owletto/dist/assets/index-BaetvYLa.js +2 -0
- package/dist/owletto/dist/assets/index-BiEf5xOE.css +1 -0
- package/dist/owletto/dist/assets/{index-CxF2XXzl.js → index-BrDP4PCs.js} +2 -2
- package/dist/owletto/dist/assets/index-BuXIeK7D.js +2 -0
- package/dist/owletto/dist/assets/index-CAVcR9za.js +2 -0
- package/dist/owletto/dist/assets/index-CMLfWGPU.js +2 -0
- package/dist/owletto/dist/assets/index-D0YEYP7N.js +2 -0
- package/dist/owletto/dist/assets/index-DFyBbp7b.js +2 -0
- package/dist/owletto/dist/assets/{index-D7gHOpfg.js → index-DNtYqkiA.js} +2 -2
- package/dist/owletto/dist/assets/index-DQxzeM37.js +2 -0
- package/dist/owletto/dist/assets/index-DkO0nPex.js +2 -0
- package/dist/owletto/dist/assets/index-KlRId0g6.js +2 -0
- package/dist/owletto/dist/assets/index-Ywnqi4A6.js +2 -0
- package/dist/owletto/dist/assets/index-wHFQv1aT.js +12 -0
- package/dist/owletto/dist/assets/index-xnxhf3Op.js +2 -0
- package/dist/owletto/dist/assets/{index-BTlx9K_t.js → index-yIub2xUM.js} +2 -2
- package/dist/owletto/dist/assets/json-diff-LE_vNZrM.js +4 -0
- package/dist/owletto/dist/assets/{list-skeleton-CepswBka.js → list-skeleton-Kzxi2OXB.js} +2 -2
- package/dist/owletto/dist/assets/login-DWOT6jtS.js +2 -0
- package/dist/owletto/dist/assets/logout-Dt_VDilG.js +2 -0
- package/dist/owletto/dist/assets/{member-scope-gate-DD4YBFn-.js → member-scope-gate-De75CR7W.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-p2vIbfkC.js +74 -0
- package/dist/owletto/dist/assets/{model-selector-CDrAjH31.js → model-selector-3l9lY50C.js} +2 -2
- package/dist/owletto/dist/assets/model-udnQ_S43.js +2 -0
- package/dist/owletto/dist/assets/models-CQj7GIOp.js +2 -0
- package/dist/owletto/dist/assets/new-BOwIHkre.js +2 -0
- package/dist/owletto/dist/assets/{new-ktz9Cs_P.js → new-BbdwuJPm.js} +2 -2
- package/dist/owletto/dist/assets/new-DTuFCQhV.js +2 -0
- package/dist/owletto/dist/assets/{oauth-workspace-access-lZNZ9gul.js → oauth-workspace-access-QPo4YwRX.js} +2 -2
- package/dist/owletto/dist/assets/organization-BDzjnqPf.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-D7yt0PrA.js +2 -0
- package/dist/owletto/dist/assets/permissions-CfoY4WFY.js +2 -0
- package/dist/owletto/dist/assets/proposal-review-shell-CVkLnnKo.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-DXUTTGGp.js +2 -0
- package/dist/owletto/dist/assets/record-activity-BXhvJbd9.js +2 -0
- package/dist/owletto/dist/assets/{record-session-Pbr5czGw.js → record-session-D07szzqN.js} +2 -2
- package/dist/owletto/dist/assets/renderer-AJxSmE3-.js +97 -0
- package/dist/owletto/dist/assets/reset-password-kRYyQuTY.js +2 -0
- package/dist/owletto/dist/assets/runs-lG2ChtOt.js +2 -0
- package/dist/owletto/dist/assets/runs-panel-LnGpHCAQ.js +2 -0
- package/dist/owletto/dist/assets/schema-type-editor-panel-C_Es0qDf.js +2 -0
- package/dist/owletto/dist/assets/settings-CEAOg7fr.js +2 -0
- package/dist/owletto/dist/assets/settings-gGYXbFfd.js +2 -0
- package/dist/owletto/dist/assets/skills-BOL5c_Tk.js +2 -0
- package/dist/owletto/dist/assets/source-record-panels-CjFPgKKJ.js +2 -0
- package/dist/owletto/dist/assets/status-dot-CSBtKT4g.js +2 -0
- package/dist/owletto/dist/assets/table-DHM-vCxP.js +2 -0
- package/dist/owletto/dist/assets/use-automations-C4TSie1i.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-Dcunv4L0.js → use-mention-search-PfZrNbu_.js} +4 -4
- package/dist/owletto/dist/assets/use-scroll-sentinel-D-fJx_Md.js +2 -0
- package/dist/owletto/dist/assets/view-param-filters-DkX4YdDT.js +2 -0
- package/dist/owletto/dist/assets/views-access-required-2ubIf_3N.js +2 -0
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +137007 -132255
- package/npm-shrinkwrap.json +723 -1095
- package/package.json +7 -10
- package/vendor/@better-auth-kysely-adapter/LICENSE.md +20 -0
- package/vendor/@better-auth-kysely-adapter/README.md +17 -0
- package/vendor/@better-auth-kysely-adapter/dist/bun-sqlite-dialect-DoOVo4ja.mjs +123 -0
- package/vendor/@better-auth-kysely-adapter/dist/d1-sqlite-dialect-Cru74LbR.mjs +133 -0
- package/vendor/@better-auth-kysely-adapter/dist/index.d.mts +116 -0
- package/vendor/@better-auth-kysely-adapter/dist/index.mjs +719 -0
- package/vendor/@better-auth-kysely-adapter/dist/node-sqlite-dialect.d.mts +27 -0
- package/vendor/@better-auth-kysely-adapter/dist/node-sqlite-dialect.mjs +123 -0
- package/vendor/@better-auth-kysely-adapter/dist/sqlite-introspector-DSCAP82F.mjs +90 -0
- package/vendor/@better-auth-kysely-adapter/package.json +52 -0
- package/vendor/connector-sdk/dist/browser-requirement.js +1 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +34 -1
- package/vendor/connector-sdk/dist/index.d.ts +3 -1
- package/vendor/connector-sdk/dist/index.js +4 -0
- package/vendor/connector-sdk/dist/redact.d.ts +10 -0
- package/vendor/connector-sdk/dist/redact.js +130 -0
- package/vendor/connector-sdk/dist/types.d.ts +2 -1
- package/vendor/connector-sdk/package.json +6 -1
- package/vendor/core/dist/agent-tooling.d.ts +8 -0
- package/vendor/core/dist/agent-tooling.js +9 -1
- package/vendor/core/dist/capabilities.d.ts +1 -1
- package/vendor/core/dist/capabilities.js +5 -0
- package/vendor/core/dist/connector-query-errors.d.ts +6 -0
- package/vendor/core/dist/connector-query-errors.js +4 -0
- package/vendor/core/dist/contracts/entity-reference.d.ts +3 -0
- package/vendor/core/dist/contracts/entity-reference.js +31 -0
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +3 -0
- package/vendor/core/dist/contracts/tools/manage-automations.js +4 -1
- package/vendor/core/dist/contracts/tools/manage-connections.js +1 -1
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +117 -34
- package/vendor/core/dist/contracts/tools/manage-entity.js +47 -14
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +13 -4
- package/vendor/core/dist/contracts/tools/manage-operations.js +19 -7
- package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +6 -1
- package/vendor/core/dist/contracts/tools/read-knowledge.js +20 -1
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/view-runtime.d.ts +2 -0
- package/vendor/core/dist/contracts/tools/view-runtime.js +3 -1
- package/vendor/core/dist/contracts/worker/device-automation.d.ts +4 -9
- package/vendor/core/dist/contracts/worker/device-automation.js +10 -15
- package/vendor/core/dist/contracts/worker/protocol.d.ts +20 -0
- package/vendor/core/dist/contracts/worker/protocol.js +20 -0
- package/vendor/core/dist/errors.d.ts +0 -20
- package/vendor/core/dist/errors.js +1 -25
- package/vendor/core/dist/otel.js +38 -10
- package/vendor/core/dist/reserved.d.ts +6 -3
- package/vendor/core/dist/reserved.js +6 -3
- package/vendor/core/dist/utils/ajv.js +3 -1
- package/vendor/core/dist/worker/auth.d.ts +3 -2
- package/vendor/core/package.json +31 -5
- package/vendor/postgres/.bun-tag-22d644c2873790db +0 -0
- package/vendor/postgres/cf/src/query.js +3 -1
- package/vendor/postgres/cjs/src/query.js +3 -1
- package/vendor/postgres/src/query.js +3 -1
- package/vendor/views/dist/api.js +31 -7
- package/vendor/views/dist/bridge.d.ts +2 -1
- package/vendor/views/dist/bridge.js +10 -1
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-BorucF19.js +0 -3
- package/dist/owletto/dist/assets/_-CkGyNi0G.js +0 -2
- package/dist/owletto/dist/assets/_agentId-BrhcaxUk.js +0 -2
- package/dist/owletto/dist/assets/_agentId-DgRrCE2B.js +0 -2
- package/dist/owletto/dist/assets/_automationId-DSrZIYcs.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DWxv1uoi.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-BTP5ijdT.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-98Y3RuRO.js +0 -2
- package/dist/owletto/dist/assets/_deploymentId-B1UWPY0i.js +0 -2
- package/dist/owletto/dist/assets/_eventId-BAnr8g8z.js +0 -2
- package/dist/owletto/dist/assets/_name-BUfFO_A0.js +0 -2
- package/dist/owletto/dist/assets/_owner-C79BwQ0I.js +0 -3
- package/dist/owletto/dist/assets/_shape-Ep6JpyFX.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-B24alBfT.js +0 -2
- package/dist/owletto/dist/assets/_slug-DbPdDc-5.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DDUxjjFD.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-hdpq3RoX.js +0 -2
- package/dist/owletto/dist/assets/accept-invitation-UXU5Fx2G.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-D7ORHntE.js +0 -2
- package/dist/owletto/dist/assets/agent-card-controls-CplnPhbv.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-BmknviTI.js +0 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-TdvvIc_J.js +0 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-BkZu1LYE.js +0 -2
- package/dist/owletto/dist/assets/agent-skills-route-B3vvvZZe.js +0 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-CZJvnjNC.js +0 -2
- package/dist/owletto/dist/assets/agents-DAOln24A.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-DJ67GZ93.js +0 -2
- package/dist/owletto/dist/assets/app-bridge-BCm4muqj.js +0 -128
- package/dist/owletto/dist/assets/app._appId-Cp78oEZ9.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-DSwbRpbx.js +0 -2
- package/dist/owletto/dist/assets/automations-DAOln24A.js +0 -2
- package/dist/owletto/dist/assets/callback-CBexCo3F.js +0 -2
- package/dist/owletto/dist/assets/client-rows-BYbsXGy9.js +0 -2
- package/dist/owletto/dist/assets/clients-BhNl1tVq.js +0 -2
- package/dist/owletto/dist/assets/connect-wx-qqLir.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-kk0_4Svo.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-QR8o-7M5.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-BqprYeOX.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-DhRoSzBr.js +0 -2
- package/dist/owletto/dist/assets/connection-CNm2ukrI.js +0 -2
- package/dist/owletto/dist/assets/connection-feed-detail-WcGCA6qY.js +0 -2
- package/dist/owletto/dist/assets/connections-browser-CrtnAs0Q.js +0 -2
- package/dist/owletto/dist/assets/connector-scope-lists-CRFEpSvk.js +0 -2
- package/dist/owletto/dist/assets/conversations-table-D_HOe1jN.js +0 -2
- package/dist/owletto/dist/assets/create-C4lptGWj.js +0 -2
- package/dist/owletto/dist/assets/create-CCjZxIkK.js +0 -2
- package/dist/owletto/dist/assets/create-DkgUQAbB.js +0 -2
- package/dist/owletto/dist/assets/create-automation-form-Bpy92SM5.js +0 -3
- package/dist/owletto/dist/assets/create._connectorKey-D6Kc-YQ3.js +0 -2
- package/dist/owletto/dist/assets/deployments-C5hvipQh.js +0 -2
- package/dist/owletto/dist/assets/deployments-CPpFAd_w.js +0 -2
- package/dist/owletto/dist/assets/deployments-body-DGII20dQ.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-Bn37UpWH.js +0 -2
- package/dist/owletto/dist/assets/entity-options-Clz_WXK-.js +0 -2
- package/dist/owletto/dist/assets/entity-page-D3e4iPle.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-DebN1vCM.js +0 -2
- package/dist/owletto/dist/assets/event-detail-DV_zfWnC.js +0 -2
- package/dist/owletto/dist/assets/events-feed-DO3IiJO2.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-Bwhqj7lY.js +0 -2
- package/dist/owletto/dist/assets/guardrails-BiJollCA.js +0 -2
- package/dist/owletto/dist/assets/identity-HCFWtdaI.js +0 -2
- package/dist/owletto/dist/assets/index-8wxsyxqt.js +0 -2
- package/dist/owletto/dist/assets/index-9YuSRymd.js +0 -7950
- package/dist/owletto/dist/assets/index-B3c-0eZG.js +0 -2
- package/dist/owletto/dist/assets/index-B64PGxQm.js +0 -2
- package/dist/owletto/dist/assets/index-BSH07yVD.css +0 -1
- package/dist/owletto/dist/assets/index-BX0EA_oB.js +0 -2
- package/dist/owletto/dist/assets/index-CDz3-ieP.js +0 -12
- package/dist/owletto/dist/assets/index-CdJJaQDX.js +0 -2
- package/dist/owletto/dist/assets/index-CfT_W8Vo.js +0 -2
- package/dist/owletto/dist/assets/index-D3WHeGql.js +0 -2
- package/dist/owletto/dist/assets/index-DB1iWI_a.js +0 -2
- package/dist/owletto/dist/assets/index-DMNzF8Lf.js +0 -2
- package/dist/owletto/dist/assets/index-DyB3IzOA.js +0 -2
- package/dist/owletto/dist/assets/index-Vcq4gwWv.js +0 -2
- package/dist/owletto/dist/assets/index-fgAJydgX.js +0 -2
- package/dist/owletto/dist/assets/json-diff-DIN5Jhfx.js +0 -4
- package/dist/owletto/dist/assets/login-DxGYyE4n.js +0 -2
- package/dist/owletto/dist/assets/logout-Bkzc7J44.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-BnuhLJ6X.css +0 -1
- package/dist/owletto/dist/assets/memory-browse-page-D_UlBa27.js +0 -103
- package/dist/owletto/dist/assets/models-BAVeysNq.js +0 -2
- package/dist/owletto/dist/assets/new-C2av0diq.js +0 -2
- package/dist/owletto/dist/assets/new-snm1ctHn.js +0 -2
- package/dist/owletto/dist/assets/organization-Cb0W823y.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-BNR9ImQY.js +0 -2
- package/dist/owletto/dist/assets/permissions-Dv39zWKt.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-CFhOqCLf.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-DqX8AXfw.js +0 -2
- package/dist/owletto/dist/assets/recent-QhnLDU1_.js +0 -2
- package/dist/owletto/dist/assets/record-activity-ZJntBfN_.js +0 -2
- package/dist/owletto/dist/assets/record-field-peek-Brh1IQGy.js +0 -2
- package/dist/owletto/dist/assets/reset-password-CzZw6RcC.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-C0_DNTcq.js +0 -2
- package/dist/owletto/dist/assets/runs-table-B1APZv7d.js +0 -2
- package/dist/owletto/dist/assets/schema-value-normalization-CKdPjdPC.js +0 -97
- package/dist/owletto/dist/assets/settings-CgZ5Z7wD.js +0 -2
- package/dist/owletto/dist/assets/settings-VDNiffKU.js +0 -2
- package/dist/owletto/dist/assets/skills-DgDGscm5.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-BdfOVPWn.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-B0quibBi.js +0 -2
- /package/vendor/{postgres/.bun-tag-2f292c6554a8475e → @better-auth-kysely-adapter/.bun-tag-abf95749a412716} +0 -0
|
@@ -33,7 +33,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
33
33
|
// when this number moves: shipping a fix under the old number leaves every
|
|
34
34
|
// already-open tab running the previous code with nothing to show for it.
|
|
35
35
|
// Keep in lockstep with WHATSAPP_ADAPTER_VERSION in whatsapp-web-helpers.ts.
|
|
36
|
-
const ADAPTER_VERSION =
|
|
36
|
+
const ADAPTER_VERSION = 27;
|
|
37
37
|
const SOURCE_ERROR_ID = "whatsapp-web:source-observation-error";
|
|
38
38
|
// Storage rows one `chat:` read examines; a whole personal history is
|
|
39
39
|
// usually under this, so one read answers.
|
|
@@ -57,13 +57,18 @@ export function whatsAppWebAdapterProgram() {
|
|
|
57
57
|
if (existing?.version === ADAPTER_VERSION) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
existing?.detach?.();
|
|
60
|
+
existing?.detach?.(undefined, "WhatsApp adapter was replaced; recovery is required");
|
|
61
61
|
const listeners = new Map();
|
|
62
62
|
|
|
63
|
-
function detach(bindingId) {
|
|
63
|
+
function detach(bindingId, reason) {
|
|
64
64
|
const selected = bindingId ? [listeners.get(bindingId)] : [...listeners.values()];
|
|
65
65
|
for (const state of selected) {
|
|
66
66
|
if (!state) continue;
|
|
67
|
+
if (reason) {
|
|
68
|
+
state.error = reason;
|
|
69
|
+
state.post({ sequence: ++state.sequence, record: { id: SOURCE_ERROR_ID, source_error: reason } });
|
|
70
|
+
}
|
|
71
|
+
for (const entry of state.pending.values()) entry.reject?.(new Error(reason ?? "Source listener was detached"));
|
|
67
72
|
state.collection.off("add", state.onAdd);
|
|
68
73
|
state.collection.off("change", state.onChange);
|
|
69
74
|
window.removeEventListener("message", state.onReply);
|
|
@@ -71,7 +76,19 @@ export function whatsAppWebAdapterProgram() {
|
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
78
|
|
|
79
|
+
function assertAccount(account) {
|
|
80
|
+
if (typeof account !== "string" || !account || widString(meUser()) !== account) {
|
|
81
|
+
throw new Error("WhatsApp saved account changed or is unavailable; reconnect this connection");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function digest(value) {
|
|
86
|
+
const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
87
|
+
return Array.from(new Uint8Array(bytes), byte => byte.toString(16).padStart(2, "0")).join("");
|
|
88
|
+
}
|
|
89
|
+
|
|
74
90
|
function listen(request) {
|
|
91
|
+
assertAccount(request.account_id);
|
|
75
92
|
const collection = requireFirst(["WAWebCollections"])?.Msg;
|
|
76
93
|
if (typeof collection?.on !== "function" || typeof collection?.off !== "function") {
|
|
77
94
|
throw new Error("WhatsApp message observation is unavailable in this build");
|
|
@@ -94,7 +111,8 @@ export function whatsAppWebAdapterProgram() {
|
|
|
94
111
|
});
|
|
95
112
|
};
|
|
96
113
|
const resident = listeners.get(request.bridge_id);
|
|
97
|
-
const previous = resident?.request.
|
|
114
|
+
const previous = resident?.request.account_id === request.account_id
|
|
115
|
+
&& resident?.request.chat_filter === request.chat_filter
|
|
98
116
|
&& resident?.request.minimum_timestamp === request.minimum_timestamp ? resident : null;
|
|
99
117
|
detach(request.bridge_id);
|
|
100
118
|
// A new listener identity fences pending normalization from the detached
|
|
@@ -116,8 +134,10 @@ export function whatsAppWebAdapterProgram() {
|
|
|
116
134
|
const sequence = ++state.sequence;
|
|
117
135
|
// A throwing model getter must reach the error record below, not escape
|
|
118
136
|
// the collection handler, so the reference is read inside the promise.
|
|
119
|
-
void new Promise((resolve) => resolve(messageReference(model))).then((record) => {
|
|
120
|
-
if (listeners.get(state.id) !== state
|
|
137
|
+
void new Promise((resolve) => { assertAccount(state.request.account_id); resolve(messageReference(model)); }).then((record) => {
|
|
138
|
+
if (listeners.get(state.id) !== state) return;
|
|
139
|
+
assertAccount(state.request.account_id);
|
|
140
|
+
if (!record || record.timestamp <= 0) return;
|
|
121
141
|
if (state.request.chat_filter === "group" && !record.is_group) return;
|
|
122
142
|
if (state.request.chat_filter === "individual" && record.is_group) return;
|
|
123
143
|
if (state.request.minimum_timestamp != null && record.timestamp < state.request.minimum_timestamp) return;
|
|
@@ -160,6 +180,11 @@ export function whatsAppWebAdapterProgram() {
|
|
|
160
180
|
if (event.source !== window || event.origin !== location.origin || event.data?.token !== state.token) return;
|
|
161
181
|
if (event.data.type === "lobu-feed-record:stop") { detach(state.id); return; }
|
|
162
182
|
if (event.data.type !== "lobu-feed-record:ack") return;
|
|
183
|
+
try { assertAccount(state.request.account_id); }
|
|
184
|
+
catch {
|
|
185
|
+
detach(state.id, "WhatsApp saved account changed; recovery is required");
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
163
188
|
for (const [id, entry] of state.pending) {
|
|
164
189
|
if (entry.sequence !== event.data.sequence) continue;
|
|
165
190
|
if (event.data.ok) {
|
|
@@ -192,7 +217,12 @@ export function whatsAppWebAdapterProgram() {
|
|
|
192
217
|
async function publishChanges(request) {
|
|
193
218
|
const state = listeners.get(request.bridge_id);
|
|
194
219
|
if (!state || state.token !== request.token) throw new Error("Source listener is unavailable");
|
|
195
|
-
|
|
220
|
+
assertAccount(state.request.account_id);
|
|
221
|
+
// Include the complete transition, not just row positions: a hydrated
|
|
222
|
+
// placeholder can change a batch while its insertion cursor stays fixed.
|
|
223
|
+
const record = { ...request.batch, id: `replay:${await digest(JSON.stringify([request.transition ?? null, request.batch]))}` };
|
|
224
|
+
if (listeners.get(state.id) !== state) throw new Error("Source listener was replaced");
|
|
225
|
+
assertAccount(state.request.account_id);
|
|
196
226
|
const bytes = new TextEncoder().encode(JSON.stringify(record)).length;
|
|
197
227
|
const previous = state.pending.get(record.id);
|
|
198
228
|
if (bytes > MAX_RECORD_BYTES || state.pendingBytes - (previous?.bytes ?? 0) + bytes > MAX_BUFFER_BYTES ||
|
|
@@ -360,10 +390,14 @@ export function whatsAppWebAdapterProgram() {
|
|
|
360
390
|
return { id, timestamp: unixSeconds(row), is_group: remote.endsWith("@g.us") };
|
|
361
391
|
}
|
|
362
392
|
|
|
363
|
-
/**
|
|
393
|
+
/** Replay retained routing metadata; row IDs alone do not survive a rebuild. */
|
|
364
394
|
async function observeMessages(input = {}) {
|
|
365
395
|
const after = input.after ?? null;
|
|
366
396
|
if (after !== null && (!Number.isSafeInteger(after) || after < 0)) throw new Error("Invalid WhatsApp observation cursor");
|
|
397
|
+
const pending = input.unresolved ?? [];
|
|
398
|
+
if (!Array.isArray(pending) || pending.length > 32 || pending.some(row =>
|
|
399
|
+
!Number.isSafeInteger(row.position) || row.position <= 0 || typeof row.id !== "string" || row.id.length > 512 ||
|
|
400
|
+
!Number.isSafeInteger(row.first_seen) || row.first_seen < 0)) throw new Error("Invalid WhatsApp pending placeholder cursor");
|
|
367
401
|
const database = await new Promise((resolve, reject) => {
|
|
368
402
|
const request = indexedDB.open("model-storage");
|
|
369
403
|
request.onupgradeneeded = () => { request.transaction.abort(); reject(new Error("WhatsApp source history database is unavailable")); };
|
|
@@ -371,48 +405,82 @@ export function whatsAppWebAdapterProgram() {
|
|
|
371
405
|
request.onblocked = () => reject(new Error("WhatsApp source history database is blocked"));
|
|
372
406
|
request.onsuccess = () => resolve(request.result);
|
|
373
407
|
});
|
|
374
|
-
|
|
408
|
+
const now = Math.floor(Date.now() / 1000);
|
|
409
|
+
const gaps = [];
|
|
410
|
+
const gap = (reason, detail) => gaps.push({ reason, detail });
|
|
411
|
+
const scan = (position, limit, direction = "next", inclusive = false) => new Promise((resolve, reject) => {
|
|
412
|
+
const transaction = database.transaction("message", "readonly");
|
|
413
|
+
transaction.onabort = () => reject(transaction.error ?? new Error("WhatsApp source observation aborted"));
|
|
414
|
+
const index = transaction.objectStore("message").index("rowId");
|
|
415
|
+
const request = index.openCursor(position === null ? null : IDBKeyRange.lowerBound(position, !inclusive), direction);
|
|
416
|
+
const page = [];
|
|
417
|
+
request.onerror = () => reject(request.error);
|
|
418
|
+
request.onsuccess = () => {
|
|
419
|
+
const cursor = request.result;
|
|
420
|
+
if (!cursor) { resolve(page); return; }
|
|
421
|
+
if (!Number.isSafeInteger(cursor.key) || cursor.key <= 0 || typeof cursor.value.id !== "string" || cursor.value.id.length > 512) {
|
|
422
|
+
reject(new Error("WhatsApp source history has an unsupported key layout")); return;
|
|
423
|
+
}
|
|
424
|
+
page.push({ position: cursor.key, id: cursor.value.id, timestamp: unixSeconds(cursor.value), type: cursor.value.type });
|
|
425
|
+
if (page.length >= limit) resolve(page); else cursor.continue();
|
|
426
|
+
};
|
|
427
|
+
});
|
|
428
|
+
let rows, rechecks;
|
|
375
429
|
try {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
});
|
|
430
|
+
if (after === null) {
|
|
431
|
+
rows = await scan(null, 1, "prev");
|
|
432
|
+
const head = rows[0];
|
|
433
|
+
return { after: head?.position ?? 0, anchor: head?.id ?? null,
|
|
434
|
+
unresolved: head?.timestamp === 0 ? [{ position: head.position, id: head.id, first_seen: now }] : [],
|
|
435
|
+
references: [], gaps: [], hasMore: false };
|
|
436
|
+
}
|
|
437
|
+
let start = after;
|
|
438
|
+
if (after > 0) {
|
|
439
|
+
const [anchor] = await scan(after, 1, "next", true);
|
|
440
|
+
if (!input.anchor || anchor?.position !== after || anchor.id !== input.anchor) {
|
|
441
|
+
gap("history-continuity", [after, input.anchor ?? null]);
|
|
442
|
+
start = 0;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
rechecks = await Promise.all(pending.map(async item => ({ item, row: (await scan(item.position, 1, "next", true))[0] })));
|
|
446
|
+
rows = await scan(start, 501);
|
|
394
447
|
} finally { database.close(); }
|
|
395
|
-
if (after === null) return { after: rows[0]?.position ?? 0, references: [], hasMore: false };
|
|
396
448
|
const page = rows.slice(0, 500);
|
|
397
|
-
const references =
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (input.chat_filter === "individual" && reference.is_group) continue;
|
|
412
|
-
references.push(reference);
|
|
449
|
+
const references = new Map();
|
|
450
|
+
const unresolved = new Map();
|
|
451
|
+
const keys = requireFirst(["WAWebMsgKey"]);
|
|
452
|
+
if ((page.length || rechecks.length) && typeof keys?.fromString !== "function") throw new Error("WhatsApp source message keys are unavailable");
|
|
453
|
+
const accept = (row, firstSeen = now) => {
|
|
454
|
+
const reference = messageReference({ id: keys.fromString(row.id), t: row.timestamp, type: row.type });
|
|
455
|
+
if (!reference) return;
|
|
456
|
+
if (input.chat_filter === "group" && !reference.is_group) return;
|
|
457
|
+
if (input.chat_filter === "individual" && reference.is_group) return;
|
|
458
|
+
if (reference.timestamp <= 0) {
|
|
459
|
+
if (now - firstSeen >= 7 * 24 * 60 * 60) gap("placeholder-expired", [row.position, row.id, firstSeen]);
|
|
460
|
+
else if (unresolved.size < 32 || unresolved.has(row.id)) unresolved.set(row.id, { position: row.position, id: row.id, first_seen: firstSeen });
|
|
461
|
+
else gap("placeholder-capacity", [row.position, row.id]);
|
|
462
|
+
return;
|
|
413
463
|
}
|
|
464
|
+
if (reference.timestamp >= input.started_at) references.set(reference.id, reference);
|
|
465
|
+
};
|
|
466
|
+
const checked = new Set();
|
|
467
|
+
for (const { item, row } of rechecks) {
|
|
468
|
+
if (!row || row.position !== item.position || row.id !== item.id) gap("placeholder-unavailable", [item.position, item.id]);
|
|
469
|
+
else { checked.add(item.id); accept(row, item.first_seen); }
|
|
414
470
|
}
|
|
415
|
-
|
|
471
|
+
for (const row of page) if (!checked.has(row.id)) accept(row);
|
|
472
|
+
const last = page[page.length - 1];
|
|
473
|
+
const rebased = gaps.some(item => item.reason === "history-continuity");
|
|
474
|
+
return {
|
|
475
|
+
after: last?.position ?? (rebased ? 0 : after),
|
|
476
|
+
anchor: last?.id ?? (rebased ? null : input.anchor ?? null),
|
|
477
|
+
unresolved: [...unresolved.values()], references: [...references.values()], hasMore: rows.length > 500,
|
|
478
|
+
gaps: await Promise.all(gaps.map(async item => {
|
|
479
|
+
const identity = await digest(JSON.stringify([input.account_id, input.started_at, input.chat_filter, item]));
|
|
480
|
+
return { id: `gap:${identity}`, event_type: "source.gap", resource_type: "message",
|
|
481
|
+
resource_ref: `whatsapp:${item.reason}:${identity}` };
|
|
482
|
+
})),
|
|
483
|
+
};
|
|
416
484
|
}
|
|
417
485
|
|
|
418
486
|
function models(collection) {
|
|
@@ -933,7 +1001,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
933
1001
|
* `id:<message ID>` read is the exception: ids are unique, so it walks
|
|
934
1002
|
* history until that message and answers in one read.
|
|
935
1003
|
*/
|
|
936
|
-
async function readMessages(input = {}) {
|
|
1004
|
+
async function readMessages(input = {}, account) {
|
|
937
1005
|
const query = String(input.query ?? "").trim();
|
|
938
1006
|
const chatFilter = input.chat_filter ?? "all";
|
|
939
1007
|
const limit = Math.min(100, Math.max(1, Math.trunc(Number(input.limit) || 50)));
|
|
@@ -941,7 +1009,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
941
1009
|
if (input.cursor) {
|
|
942
1010
|
const cursor = JSON.parse(input.cursor);
|
|
943
1011
|
if (cursor.v !== 1 || !Number.isSafeInteger(cursor.before) || cursor.before <= 0 ||
|
|
944
|
-
cursor.query !== query || cursor.chat_filter !== chatFilter) {
|
|
1012
|
+
cursor.query !== query || cursor.chat_filter !== chatFilter || cursor.account !== account) {
|
|
945
1013
|
throw new Error("Invalid WhatsApp source cursor or changed query scope");
|
|
946
1014
|
}
|
|
947
1015
|
before = cursor.before;
|
|
@@ -1051,7 +1119,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1051
1119
|
return {
|
|
1052
1120
|
results,
|
|
1053
1121
|
hasMore,
|
|
1054
|
-
...(hasMore ? { nextCursor: JSON.stringify({ v: 1, before: last.position, query, chat_filter: chatFilter }) } : {}),
|
|
1122
|
+
...(hasMore ? { nextCursor: JSON.stringify({ v: 1, before: last.position, query, chat_filter: chatFilter, account }) } : {}),
|
|
1055
1123
|
};
|
|
1056
1124
|
}
|
|
1057
1125
|
|
|
@@ -1166,7 +1234,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1166
1234
|
};
|
|
1167
1235
|
}
|
|
1168
1236
|
|
|
1169
|
-
async function draftMessage(input) {
|
|
1237
|
+
async function draftMessage(input, account) {
|
|
1170
1238
|
const collections = requireFirst(["WAWebCollections"]);
|
|
1171
1239
|
const chat = await resolveChat(collections, input);
|
|
1172
1240
|
const text = String(input?.text ?? "");
|
|
@@ -1187,11 +1255,13 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1187
1255
|
]) {
|
|
1188
1256
|
if (typeof fn !== "function") continue;
|
|
1189
1257
|
try {
|
|
1258
|
+
assertAccount(account);
|
|
1190
1259
|
await fn.call(module, chat, draft);
|
|
1191
1260
|
applied = true;
|
|
1192
1261
|
break;
|
|
1193
1262
|
} catch {
|
|
1194
1263
|
try {
|
|
1264
|
+
assertAccount(account);
|
|
1195
1265
|
await fn.call(module, draft, chat);
|
|
1196
1266
|
applied = true;
|
|
1197
1267
|
break;
|
|
@@ -1201,6 +1271,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1201
1271
|
}
|
|
1202
1272
|
}
|
|
1203
1273
|
if (!applied && typeof chat?.setDraft === "function") {
|
|
1274
|
+
assertAccount(account);
|
|
1204
1275
|
await chat.setDraft(draft);
|
|
1205
1276
|
applied = true;
|
|
1206
1277
|
}
|
|
@@ -1220,7 +1291,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1220
1291
|
};
|
|
1221
1292
|
}
|
|
1222
1293
|
|
|
1223
|
-
async function sendMessage(input) {
|
|
1294
|
+
async function sendMessage(input, account) {
|
|
1224
1295
|
const collections = requireFirst(["WAWebCollections"]);
|
|
1225
1296
|
const chat = await resolveChat(collections, input);
|
|
1226
1297
|
const text = String(input?.text ?? "");
|
|
@@ -1241,6 +1312,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1241
1312
|
const plannedId = rawId(data?.id);
|
|
1242
1313
|
if (!plannedId)
|
|
1243
1314
|
throw new Error("WhatsApp did not assign an id to the outgoing message");
|
|
1315
|
+
assertAccount(account);
|
|
1244
1316
|
await module.addAndSendTextMsg(chat, data);
|
|
1245
1317
|
return {
|
|
1246
1318
|
sent: true,
|
|
@@ -1254,6 +1326,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1254
1326
|
throw new Error(
|
|
1255
1327
|
"WhatsApp send capability is unavailable in this web build"
|
|
1256
1328
|
);
|
|
1329
|
+
assertAccount(account);
|
|
1257
1330
|
const result =
|
|
1258
1331
|
fn === chat?.sendMessage
|
|
1259
1332
|
? await fn.call(chat, text)
|
|
@@ -1308,7 +1381,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1308
1381
|
return message;
|
|
1309
1382
|
}
|
|
1310
1383
|
|
|
1311
|
-
async function editMessage(input) {
|
|
1384
|
+
async function editMessage(input, account) {
|
|
1312
1385
|
const collections = requireFirst(["WAWebCollections"]);
|
|
1313
1386
|
const message = resolveMessage(collections, input?.message_id);
|
|
1314
1387
|
const before = modelData(message);
|
|
@@ -1339,6 +1412,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1339
1412
|
// `canEditText(chat)` check fail and reject with "Cannot edit message",
|
|
1340
1413
|
// an error that reads like the message was ineligible when in fact it
|
|
1341
1414
|
// was being handed the wrong object.
|
|
1415
|
+
assertAccount(account);
|
|
1342
1416
|
await (fn === message?.edit
|
|
1343
1417
|
? fn.call(message, text)
|
|
1344
1418
|
: fn.call(module, message, text, {}));
|
|
@@ -1355,7 +1429,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1355
1429
|
};
|
|
1356
1430
|
}
|
|
1357
1431
|
|
|
1358
|
-
async function reactMessage(input) {
|
|
1432
|
+
async function reactMessage(input, account) {
|
|
1359
1433
|
const collections = requireFirst(["WAWebCollections"]);
|
|
1360
1434
|
const message = resolveMessage(collections, input?.message_id);
|
|
1361
1435
|
const emoji = input?.remove ? "" : String(input?.emoji ?? "");
|
|
@@ -1368,6 +1442,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1368
1442
|
throw new Error(
|
|
1369
1443
|
"WhatsApp reaction capability is unavailable in this web build"
|
|
1370
1444
|
);
|
|
1445
|
+
assertAccount(account);
|
|
1371
1446
|
await (fn === message?.react
|
|
1372
1447
|
? fn.call(message, emoji)
|
|
1373
1448
|
: fn.call(module, message, emoji));
|
|
@@ -1410,7 +1485,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1410
1485
|
};
|
|
1411
1486
|
}
|
|
1412
1487
|
|
|
1413
|
-
async function revokeMessage(input) {
|
|
1488
|
+
async function revokeMessage(input, account) {
|
|
1414
1489
|
const collections = requireFirst(["WAWebCollections"]);
|
|
1415
1490
|
const message = resolveMessage(collections, input?.message_id);
|
|
1416
1491
|
const before = modelData(message);
|
|
@@ -1440,6 +1515,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1440
1515
|
throw new Error(
|
|
1441
1516
|
"WhatsApp revoke capability is unavailable in this web build"
|
|
1442
1517
|
);
|
|
1518
|
+
assertAccount(account);
|
|
1443
1519
|
if (fn === message?.sendRevoke || fn === message?.revoke)
|
|
1444
1520
|
await fn.call(message);
|
|
1445
1521
|
else await fn.call(module, [message], modelData(message).id?.remote);
|
|
@@ -1474,9 +1550,16 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1474
1550
|
? { ok: true, status, capabilities: operationCapabilities() }
|
|
1475
1551
|
: { ok: false, error: status };
|
|
1476
1552
|
}
|
|
1553
|
+
assertAccount(request.account_id);
|
|
1554
|
+
const input = { ...request.input, account_id: request.account_id };
|
|
1555
|
+
const finish = async promise => {
|
|
1556
|
+
const value = await promise;
|
|
1557
|
+
assertAccount(request.account_id);
|
|
1558
|
+
return { ok: true, ...value };
|
|
1559
|
+
};
|
|
1477
1560
|
if (request.op === "listen") return listen(request);
|
|
1478
1561
|
if (request.op === "publish_changes") return await publishChanges(request);
|
|
1479
|
-
if (request.op === "observe_messages") return
|
|
1562
|
+
if (request.op === "observe_messages") return await finish(observeMessages(input));
|
|
1480
1563
|
const capabilities = operationCapabilities();
|
|
1481
1564
|
if (capabilities[request.op] !== true) {
|
|
1482
1565
|
return {
|
|
@@ -1488,24 +1571,27 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1488
1571
|
};
|
|
1489
1572
|
}
|
|
1490
1573
|
if (request.op === "read_messages")
|
|
1491
|
-
return
|
|
1574
|
+
return await finish(readMessages(input, request.account_id));
|
|
1492
1575
|
if (request.op === "search_messages")
|
|
1493
|
-
return
|
|
1576
|
+
return await finish(searchMessages(input));
|
|
1494
1577
|
if (request.op === "draft_message")
|
|
1495
|
-
return
|
|
1578
|
+
return await finish(draftMessage(input, request.account_id));
|
|
1496
1579
|
if (request.op === "send_message")
|
|
1497
|
-
return
|
|
1580
|
+
return await finish(sendMessage(input, request.account_id));
|
|
1498
1581
|
if (request.op === "edit_message")
|
|
1499
|
-
return
|
|
1582
|
+
return await finish(editMessage(input, request.account_id));
|
|
1500
1583
|
if (request.op === "react_message")
|
|
1501
|
-
return
|
|
1584
|
+
return await finish(reactMessage(input, request.account_id));
|
|
1502
1585
|
if (request.op === "revoke_message")
|
|
1503
|
-
return
|
|
1586
|
+
return await finish(revokeMessage(input, request.account_id));
|
|
1504
1587
|
return {
|
|
1505
1588
|
ok: false,
|
|
1506
1589
|
error: { state: "unsupported_operation", reason: String(request?.op) },
|
|
1507
1590
|
};
|
|
1508
1591
|
} catch (error) {
|
|
1592
|
+
if (request?.account_id && widString(meUser()) !== request.account_id) {
|
|
1593
|
+
error = new Error("WhatsApp saved account changed or is unavailable; reconnect this connection");
|
|
1594
|
+
}
|
|
1509
1595
|
return {
|
|
1510
1596
|
ok: false,
|
|
1511
1597
|
error: {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
WHATSAPP_PHONE_SERVER,
|
|
15
15
|
} from "./whatsapp-web-identity.js";
|
|
16
16
|
|
|
17
|
-
export const WHATSAPP_ADAPTER_VERSION =
|
|
17
|
+
export const WHATSAPP_ADAPTER_VERSION = 27;
|
|
18
18
|
export const WHATSAPP_ORIGIN = "https://web.whatsapp.com";
|
|
19
19
|
|
|
20
20
|
export type ChatFilter = "all" | "individual" | "group";
|
|
@@ -50,7 +50,11 @@ export interface WhatsAppMessage {
|
|
|
50
50
|
|
|
51
51
|
/** Reference-only observation position in WhatsApp's own local message store. */
|
|
52
52
|
export interface ObservationCheckpoint {
|
|
53
|
-
observation?: {
|
|
53
|
+
observation?: {
|
|
54
|
+
after: number; started_at: number; chat_filter: ChatFilter;
|
|
55
|
+
account?: string; anchor?: string | null;
|
|
56
|
+
unresolved?: Array<{ position: number; id: string; first_seen: number }>;
|
|
57
|
+
};
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
export function rawMessageId(value: unknown): string | null {
|
|
@@ -61,6 +61,15 @@ interface WhatsAppWebConfig {
|
|
|
61
61
|
chat_filter?: ChatFilter;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/** Use the same identity namespace as the connection's browser account probe. */
|
|
65
|
+
function requireWhatsAppAccount(ctx: { sessionState?: Record<string, unknown> | null }): string {
|
|
66
|
+
const account = ctx.sessionState?.account_id;
|
|
67
|
+
if (typeof account !== "string" || !/^[0-9]+@(c\.us|s\.whatsapp\.net|lid)$/.test(account)) {
|
|
68
|
+
throw new Error("WhatsApp saved account identity is unavailable; reconnect this connection");
|
|
69
|
+
}
|
|
70
|
+
return account;
|
|
71
|
+
}
|
|
72
|
+
|
|
64
73
|
/** Adapter failures the bridge can recover from by re-injecting the program. */
|
|
65
74
|
const REINJECTABLE_STATES = new Set([
|
|
66
75
|
"adapter_unavailable",
|
|
@@ -354,7 +363,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
354
363
|
name: "WhatsApp",
|
|
355
364
|
description:
|
|
356
365
|
"Personal WhatsApp messages read live from WhatsApp Web in the paired Owletto Chrome without importing message history. Automations react to new-message references and read content on demand. Search, draft, send, edit, react to, and revoke messages.",
|
|
357
|
-
version: "2.
|
|
366
|
+
version: "2.3.0",
|
|
358
367
|
faviconDomain: "whatsapp.com",
|
|
359
368
|
authSchema: { methods: [{ type: "browser", mode: "live" }] },
|
|
360
369
|
browser: {
|
|
@@ -386,6 +395,9 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
386
395
|
},
|
|
387
396
|
},
|
|
388
397
|
capabilities: { replyToSource: true },
|
|
398
|
+
}, {
|
|
399
|
+
key: "source.gap", label: "Source history gap", resourceType: "message",
|
|
400
|
+
description: "WhatsApp local history or an unresolved placeholder could not be recovered completely. Read retained messages separately; this is not a new message.",
|
|
389
401
|
}],
|
|
390
402
|
feeds: {
|
|
391
403
|
live_messages: {
|
|
@@ -395,7 +407,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
395
407
|
"Read messages directly from WhatsApp Web without importing history, using literal text search, id:<message ID>, or chat:<chat JID> for one chat's messages in reverse storage order. Follow cursors even after an empty filtered page. Active Automations can subscribe to new-message references. Requires the paired browser to be online and signed in; reconnects replay messages still available in WhatsApp's local history.",
|
|
396
408
|
read: (ctx) => this.readMessages(ctx),
|
|
397
409
|
observe: (ctx) => this.observeMessages(ctx),
|
|
398
|
-
webhook: { mode: "trigger", events: ["message.created"] },
|
|
410
|
+
webhook: { mode: "trigger", events: ["message.created", "source.gap"] },
|
|
399
411
|
configSchema: {
|
|
400
412
|
type: "object",
|
|
401
413
|
properties: {
|
|
@@ -593,14 +605,25 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
593
605
|
};
|
|
594
606
|
|
|
595
607
|
private async observeMessages(ctx: FeedObserveContext<ObservationCheckpoint, WhatsAppWebConfig>): Promise<void> {
|
|
608
|
+
const account = requireWhatsAppAccount(ctx);
|
|
609
|
+
if (ctx.checkpoint?.observation?.account && ctx.checkpoint.observation.account !== account) {
|
|
610
|
+
throw new Error("WhatsApp checkpoint belongs to a different saved account");
|
|
611
|
+
}
|
|
596
612
|
const dispatcher = requireBrowser(ctx);
|
|
597
613
|
const tabId = await readyWhatsAppTab(dispatcher);
|
|
598
614
|
const chatFilter = ctx.config.chat_filter ?? "all";
|
|
599
615
|
const previous = ctx.checkpoint?.observation?.chat_filter === chatFilter ? ctx.checkpoint.observation : undefined;
|
|
600
616
|
const startedAt = previous?.started_at ?? Math.floor(Date.now() / 1000);
|
|
617
|
+
type Replay = {
|
|
618
|
+
after: number; anchor?: string | null;
|
|
619
|
+
unresolved?: NonNullable<ObservationCheckpoint["observation"]>["unresolved"];
|
|
620
|
+
references: Array<{ id: string; timestamp: number }>; hasMore: boolean;
|
|
621
|
+
gaps?: Array<{ id: string; event_type: string; resource_type: string; resource_ref: string }>;
|
|
622
|
+
};
|
|
601
623
|
// Snapshot before attaching so replay covers messages arriving during setup.
|
|
602
|
-
let
|
|
603
|
-
|
|
624
|
+
let position = previous ?? await invokeAdapter<Replay>(dispatcher, tabId, {
|
|
625
|
+
op: "observe_messages", account_id: account, input: {},
|
|
626
|
+
});
|
|
604
627
|
const binding = await dispatcher.dispatch<{
|
|
605
628
|
bridge_id: string; token: string; listening?: boolean; subscription?: { scope_key: string };
|
|
606
629
|
}>("feed_listen", { tab_id: tabId });
|
|
@@ -608,37 +631,43 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
608
631
|
throw new Error("A browser supporting source subscriptions is required for WhatsApp");
|
|
609
632
|
}
|
|
610
633
|
await invokeAdapter(dispatcher, tabId, {
|
|
611
|
-
op: "listen", bridge_id: binding.bridge_id, token: binding.token,
|
|
634
|
+
op: "listen", account_id: account, bridge_id: binding.bridge_id, token: binding.token,
|
|
612
635
|
chat_filter: chatFilter, minimum_timestamp: startedAt,
|
|
613
636
|
});
|
|
614
637
|
let cursor = ctx.checkpoint ?? null;
|
|
615
638
|
for (let page = 0; page < 10; page++) {
|
|
616
|
-
const replay = await invokeAdapter<{
|
|
617
|
-
|
|
618
|
-
|
|
639
|
+
const replay = await invokeAdapter<Replay>(dispatcher, tabId, {
|
|
640
|
+
op: "observe_messages", account_id: account,
|
|
641
|
+
input: { after: position.after, anchor: position.anchor, unresolved: position.unresolved,
|
|
642
|
+
started_at: startedAt, chat_filter: chatFilter },
|
|
643
|
+
});
|
|
619
644
|
const next: ObservationCheckpoint = {
|
|
620
|
-
observation: { after: replay.after, started_at: startedAt, chat_filter: chatFilter
|
|
645
|
+
observation: { after: replay.after, started_at: startedAt, chat_filter: chatFilter,
|
|
646
|
+
account, anchor: replay.anchor ?? null, unresolved: replay.unresolved ?? [] },
|
|
621
647
|
};
|
|
622
|
-
const events = replay.references.map(reference => ({
|
|
648
|
+
const events = [...(replay.gaps ?? []), ...replay.references.map(reference => ({
|
|
623
649
|
id: reference.id, event_type: "message.created", resource_type: "message",
|
|
624
650
|
resource_ref: reference.id, occurred_at: new Date(reference.timestamp * 1000).toISOString(),
|
|
625
|
-
}));
|
|
651
|
+
}))];
|
|
626
652
|
// Earlier chunks may be replayed after interruption; existing signal
|
|
627
653
|
// dedupe handles them. Advance only after the entire page is accepted.
|
|
628
|
-
|
|
629
|
-
|
|
654
|
+
// The page adapter hashes the entire batch before buffering it, including
|
|
655
|
+
// placeholders and predecessor, so unchanged row positions cannot collide.
|
|
656
|
+
const batches = splitReferenceBatches(events, (slice, isLast) => ({
|
|
657
|
+
// Reserve the final SHA-256 record ID when enforcing the byte limit.
|
|
658
|
+
id: `replay:${"0".repeat(64)}`,
|
|
630
659
|
events: slice,
|
|
631
660
|
...(isLast ? { checkpoint: { previous: cursor, next } } : {}),
|
|
632
661
|
more: isLast && replay.hasMore && page === 9,
|
|
633
662
|
}));
|
|
634
663
|
for (const batch of batches) {
|
|
635
664
|
await invokeAdapter(dispatcher, tabId, {
|
|
636
|
-
op: "publish_changes", bridge_id: binding.bridge_id, token: binding.token, batch,
|
|
665
|
+
op: "publish_changes", account_id: account, bridge_id: binding.bridge_id, token: binding.token, batch, transition: { previous: cursor, next },
|
|
637
666
|
});
|
|
638
667
|
}
|
|
639
668
|
if (!replay.hasMore) return;
|
|
640
669
|
cursor = next;
|
|
641
|
-
|
|
670
|
+
position = next.observation!;
|
|
642
671
|
}
|
|
643
672
|
}
|
|
644
673
|
|
|
@@ -648,6 +677,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
648
677
|
// Source message time cannot represent edits, revokes, or delayed arrivals.
|
|
649
678
|
// Automations subscribe to new-message references and read content by ID.
|
|
650
679
|
assertNoWindow(ctx, "WhatsApp live reads do not support change-time windows; subscribe to message.created and read references by id:<message ID>.");
|
|
680
|
+
const account = requireWhatsAppAccount(ctx);
|
|
651
681
|
const dispatcher = requireBrowser(ctx);
|
|
652
682
|
const tabId = await readyWhatsAppTab(dispatcher);
|
|
653
683
|
const response = await invokeAdapter<{
|
|
@@ -655,7 +685,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
655
685
|
nextCursor?: string;
|
|
656
686
|
hasMore: boolean;
|
|
657
687
|
}>(dispatcher, tabId, {
|
|
658
|
-
op: "read_messages",
|
|
688
|
+
op: "read_messages", account_id: account,
|
|
659
689
|
input: {
|
|
660
690
|
query: ctx.query,
|
|
661
691
|
cursor: ctx.cursor,
|
|
@@ -692,12 +722,13 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
692
722
|
return { success: false, error: `Unknown action: ${action}` };
|
|
693
723
|
}
|
|
694
724
|
try {
|
|
725
|
+
const account = requireWhatsAppAccount(ctx);
|
|
695
726
|
const dispatcher = requireBrowser(ctx);
|
|
696
727
|
const tabId = await readyWhatsAppTab(dispatcher);
|
|
697
728
|
const response = await invokeAdapter<Record<string, unknown>>(
|
|
698
729
|
dispatcher,
|
|
699
730
|
tabId,
|
|
700
|
-
{ op: action, input: ctx.input ?? {} }
|
|
731
|
+
{ op: action, account_id: account, input: ctx.input ?? {} }
|
|
701
732
|
);
|
|
702
733
|
if (action === "search_messages") {
|
|
703
734
|
return {
|