@lobu/runtime-server 24.9.0 → 24.11.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/automations.json +2 -2
- package/dist/catalogs/connectors.json +16 -4
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/linkedin-inbox-adapter.js +13 -3
- package/dist/connectors/postgres.ts +39 -24
- package/dist/connectors/whatsapp-web-adapter.js +54 -22
- package/dist/connectors/whatsapp-web-helpers.ts +48 -2
- package/dist/connectors/whatsapp_web.ts +23 -7
- package/dist/connectors/x-dm-adapter.js +17 -3
- package/dist/db/migrations/20261112210000_instance_identity.sql +18 -0
- package/dist/db/migrations/20261113170000_member_sql_rls.sql +254 -0
- package/dist/db/migrations/20261113180000_member_sql_rls_parallel_plans.sql +192 -0
- package/dist/db/migrations/20261113190000_member_sql_schema_usage.sql +24 -0
- package/dist/db/migrations/20261114120000_events_owner_only_visibility.sql +39 -0
- package/dist/dependencies.bun.lock +66 -64
- package/dist/embeddings-server.mjs +39 -6
- package/dist/guest.bundle.js +1 -1
- package/dist/owletto/dist/assets/_-BDMUN9XZ.js +2 -0
- package/dist/owletto/dist/assets/_-CF5X4ANe.js +3 -0
- package/dist/owletto/dist/assets/{_agentId-bna2tPsW.js → _agentId-CGScf8z_.js} +2 -2
- package/dist/owletto/dist/assets/_agentId-EQU2aUP0.js +2 -0
- package/dist/owletto/dist/assets/_automationId-PXZ33jsF.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DcI29kGy.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-Cr2NDJWX.js +2 -0
- package/dist/owletto/dist/assets/{_conversationId-zcs-S3dY.js → _conversationId-CnmLYlVS.js} +2 -2
- package/dist/owletto/dist/assets/_eventId-w5sDz5oa.js +2 -0
- package/dist/owletto/dist/assets/_owner-CkOZR4n0.js +3 -0
- package/dist/owletto/dist/assets/_shape-C_FmSf9G.js +2 -0
- package/dist/owletto/dist/assets/_slug-COPpRXLt.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-BVdJiilV.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-mxxpqjtC.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-BKeIzZXE.js +2 -0
- package/dist/owletto/dist/assets/activity-route-location-sLvKaSCa.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-msesKUwn.js +2 -0
- package/dist/owletto/dist/assets/agent-connect-pages-DVq9nAR7.js +4 -0
- package/dist/owletto/dist/assets/{agent-editor-form-Bnc_q5WD.js → agent-editor-form-DVFyyMyd.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-xteN-pyK.js → agent-loading-shells-BLNHIy-r.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-UBKRR5vs.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-r0O0BVOu.js → agent-skill-context-fqedKd0D.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-C2KpYdu3.js → agent-subpage-shell-BUCoY2Nf.js} +2 -2
- package/dist/owletto/dist/assets/{agent-thread-Bv_chdPy.js → agent-thread-Cqf9ITrT.js} +3 -3
- package/dist/owletto/dist/assets/app-bridge-B-L0rGz9.js +121 -0
- package/dist/owletto/dist/assets/{app._appId-BUcNaSMS.js → app._appId-ByIypCL9.js} +2 -2
- package/dist/owletto/dist/assets/{assist-composer-B1LykXpD.js → assist-composer-kG_heHXo.js} +2 -2
- package/dist/owletto/dist/assets/automation-run-now-C5XTS00o.js +2 -0
- package/dist/owletto/dist/assets/{callback-kSLa4n5s.js → callback-Pz5uS-k7.js} +2 -2
- package/dist/owletto/dist/assets/{card-C01y1O-W.js → card-CAPpY9P5.js} +2 -2
- package/dist/owletto/dist/assets/{claim-Dnux9Lqf.js → claim-DgWWK0KI.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-BBIq16tG.js → client-activity-scopes-Aqdo6Pdr.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-DGh1O-Fu.js → client-rows-Dd5YV8vn.js} +2 -2
- package/dist/owletto/dist/assets/clients-Bf7ZgGro.js +2 -0
- package/dist/owletto/dist/assets/{code-editor-BdRMYojw.js → code-editor-z1Sy_hiX.js} +2 -2
- package/dist/owletto/dist/assets/connect-BFNp1y_s.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-BWrAhMqO.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-CSPfwYIN.js +2 -0
- package/dist/owletto/dist/assets/{connected._clientId-BsDzltNz.js → connected._clientId-CuOeHafK.js} +2 -2
- package/dist/owletto/dist/assets/connection-CVeHmDLs.js +2 -0
- package/dist/owletto/dist/assets/{connection-feed-detail-CJju0qiw.js → connection-feed-detail-BYo7zdVD.js} +2 -2
- package/dist/owletto/dist/assets/connector-page-shell-an3SYLim.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-B2C2cjBg.js → connector-provenance-mSZCOud-.js} +2 -2
- package/dist/owletto/dist/assets/connectors-DBEM9QQz.js +2 -0
- package/dist/owletto/dist/assets/consent-1ulwyJ3k.js +2 -0
- package/dist/owletto/dist/assets/{copy-button-BhXeXLIm.js → copy-button-Xhh7ZnjO.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-CJUp2aNZ.js → core.esm-Ctg_pXLe.js} +3 -3
- package/dist/owletto/dist/assets/create-CGuoqPh8.js +2 -0
- package/dist/owletto/dist/assets/create-Ccb5R-S4.js +2 -0
- package/dist/owletto/dist/assets/{create-DUlRsFNn.js → create-DmhbacIa.js} +2 -2
- package/dist/owletto/dist/assets/{create-automation-form-D141prEG.js → create-automation-form-CD6jSlWL.js} +3 -3
- package/dist/owletto/dist/assets/create._connectorKey-CZsAqj1p.js +2 -0
- package/dist/owletto/dist/assets/{custom-guardrail-edits-DuQ28xv3.js → custom-guardrail-edits-Ce_BwiwD.js} +2 -2
- package/dist/owletto/dist/assets/{definition-comparison-BUDNuAN_.js → definition-comparison-D_qP25jR.js} +2 -2
- package/dist/owletto/dist/assets/{detail-page-skeleton-BRHaq5Sj.js → detail-page-skeleton-CPAfZLG0.js} +2 -2
- package/dist/owletto/dist/assets/device-DDl5XKvt.js +2 -0
- package/dist/owletto/dist/assets/{device-pin-tombstone-BIM-ziCH.js → device-pin-tombstone-Dkj7hrBE.js} +2 -2
- package/dist/owletto/dist/assets/{device._deviceId-BnPqTgK1.js → device._deviceId-bNhTcops.js} +2 -2
- package/dist/owletto/dist/assets/{dynamic-schema-form-OkIZImgp.js → dynamic-schema-form-CRyUchXo.js} +2 -2
- package/dist/owletto/dist/assets/{entity-options-CpeX7iiX.js → entity-options-D4t-NAcg.js} +2 -2
- package/dist/owletto/dist/assets/entity-page-BOOL_vy3.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-_nuesgnp.js +2 -0
- package/dist/owletto/dist/assets/entity-schema-graph-Cq96SJ3c.js +2 -0
- package/dist/owletto/dist/assets/{entity-type-page-MgZ7_0oh.js → entity-type-page-CkCSbkBx.js} +2 -2
- package/dist/owletto/dist/assets/event-detail-DUvlqn9b.js +2 -0
- package/dist/owletto/dist/assets/events-feed-DcKTkJVe.js +2 -0
- package/dist/owletto/dist/assets/{filter-editors-DDTwyYt0.js → filter-editors-DGVl9U4D.js} +3 -3
- package/dist/owletto/dist/assets/{full-page-spinner-DWo519BU.js → full-page-spinner-CtVlF8GQ.js} +2 -2
- package/dist/owletto/dist/assets/{index-BYcFrinP.js → index-BUlkNJzX.js} +2 -2
- package/dist/owletto/dist/assets/{index-Cd8jMsz8.js → index-BifR-LE9.js} +2 -2
- package/dist/owletto/dist/assets/{index-CdDNNAx2.js → index-BoqrvLHQ.js} +1427 -1427
- package/dist/owletto/dist/assets/index-CA9mW_ZM.js +2 -0
- package/dist/owletto/dist/assets/index-CH0GzG4i.js +2 -0
- package/dist/owletto/dist/assets/{index-DznAbTOF.js → index-CK5GDX4B.js} +2 -2
- package/dist/owletto/dist/assets/index-CtI5Eomq.js +2 -0
- package/dist/owletto/dist/assets/{index-BW7IFKXC.js → index-DbjbHlDe.js} +2 -2
- package/dist/owletto/dist/assets/index-DmtQ0bds.js +2 -0
- package/dist/owletto/dist/assets/index-Du_J8hnx.js +2 -0
- package/dist/owletto/dist/assets/{index-DmqnKGqW.js → index-DvuJ_S_o.js} +2 -2
- package/dist/owletto/dist/assets/index-Pae_f9LM.css +1 -0
- package/dist/owletto/dist/assets/{index-D1UCJQl1.js → index-XETZnN7L.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-C-WQqyIf.js → json-diff-OjtREegr.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-0B1bTrAK.js → list-skeleton-CH0qQBYk.js} +2 -2
- package/dist/owletto/dist/assets/login-DG0b9uSC.js +2 -0
- package/dist/owletto/dist/assets/{logout-D474YsYQ.js → logout-DfdgOLoM.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-CH_0jHiM.js → member-scope-gate-Cxg2zGQT.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-qEDQ9Z18.js +74 -0
- package/dist/owletto/dist/assets/missing-view-xT0B-f5z.js +2 -0
- package/dist/owletto/dist/assets/{model-selector-XYmk7Iru.js → model-selector-D2OpDkwH.js} +2 -2
- package/dist/owletto/dist/assets/{needs-you-list-Bd4iiiqm.js → needs-you-list-3uMsWcDv.js} +2 -2
- package/dist/owletto/dist/assets/new-AdGV6a8R.js +2 -0
- package/dist/owletto/dist/assets/new-BdtIhBpo.js +2 -0
- package/dist/owletto/dist/assets/new-BjGwX6s6.js +2 -0
- package/dist/owletto/dist/assets/{new-CJ6TF3Vc.js → new-D-iMjV74.js} +2 -2
- package/dist/owletto/dist/assets/organization-qaIpEiQg.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-CEsDVScl.js +2 -0
- package/dist/owletto/dist/assets/{pending-seed-D7-ld7as.js → pending-seed-BBACroge.js} +2 -2
- package/dist/owletto/dist/assets/{proposal-review-shell-BWRJidwb.js → proposal-review-shell-C8ZfIAYn.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-K2R8iXSI.js +2 -0
- package/dist/owletto/dist/assets/{record-session-ClKBr1_C.js → record-session-BrM9cdXu.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-DZ0w2k2r.js → renderer-CTKNMcXP.js} +5 -5
- package/dist/owletto/dist/assets/reset-password-DKBEneyR.js +2 -0
- package/dist/owletto/dist/assets/{run-initiator-B8IRlRd-.js → run-initiator-BKSgI1o0.js} +2 -2
- package/dist/owletto/dist/assets/runs-k2NpbZm8.js +2 -0
- package/dist/owletto/dist/assets/runs-list-DUXRMkWN.js +2 -0
- package/dist/owletto/dist/assets/{schema-value-k19Ata7u.js → schema-value-wjqGxXhv.js} +3 -3
- package/dist/owletto/dist/assets/{scoped-feed-bar-L7h-Ca4u.js → scoped-feed-bar-DNFL0sYX.js} +2 -2
- package/dist/owletto/dist/assets/{settings-BZqntV3E.js → settings-V0m5Om5j.js} +2 -2
- package/dist/owletto/dist/assets/source-record-panels-BMut9YIA.js +2 -0
- package/dist/owletto/dist/assets/{status-variants-BR_iGWN5.js → status-variants-SzXYYedJ.js} +2 -2
- package/dist/owletto/dist/assets/subDays-9s9OEl5t.js +2 -0
- package/dist/owletto/dist/assets/{table-C3DMoL4K.js → table-ZuYMOjVR.js} +2 -2
- package/dist/owletto/dist/assets/use-automations-DfBtVzGa.js +2 -0
- package/dist/owletto/dist/assets/use-login-redirect-BDiS3eyl.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-CtbixPEE.js → use-mention-search-khySpz_V.js} +2 -2
- package/dist/owletto/dist/assets/view-card-DiHWlypr.js +2 -0
- package/dist/owletto/dist/assets/view-param-filters-DGKxSr7r.js +2 -0
- package/dist/owletto/dist/assets/{views-access-required-CvIIxdS_.js → views-access-required-HA-PiOwA.js} +2 -2
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +3778 -2326
- package/npm-shrinkwrap.json +251 -234
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +6 -0
- package/vendor/connector-sdk/dist/index.d.ts +1 -0
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/dist/ip-reachability.d.ts +1 -1
- package/vendor/connector-sdk/dist/ip-reachability.js +1 -1
- package/vendor/connector-sdk/dist/logger.d.ts +1 -1
- package/vendor/connector-sdk/dist/logger.js +1 -1
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +3 -1
- package/vendor/connector-sdk/dist/retry.d.ts +1 -1
- package/vendor/connector-sdk/dist/retry.js +1 -1
- package/vendor/connector-sdk/dist/source-withheld-error.d.ts +16 -0
- package/vendor/connector-sdk/dist/source-withheld-error.js +19 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/classify-error.d.ts +1 -1
- package/vendor/core/dist/classify-error.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +28 -3
- package/vendor/core/dist/contracts/tools/manage-automations.js +27 -8
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +8 -0
- package/vendor/core/dist/contracts/tools/manage-entity.js +11 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +11 -1
- package/vendor/core/dist/contracts/tools/save-memory.js +25 -3
- package/vendor/core/dist/contracts/tools/search-memory.js +1 -1
- package/vendor/core/dist/credentials.d.ts +12 -0
- package/vendor/core/dist/credentials.js +1 -0
- package/vendor/core/dist/errors.js +2 -2
- package/vendor/core/dist/worker/auth.d.ts +5 -0
- package/vendor/core/dist/worker/auth.js +15 -4
- package/vendor/core/package.json +1 -1
- package/vendor/postgres/cf/src/connection.js +7 -2
- package/vendor/postgres/cjs/src/connection.js +7 -2
- package/vendor/postgres/src/connection.js +7 -2
- package/vendor/views/dist/native.d.ts +33 -1
- package/vendor/views/dist/native.js +3 -0
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-B2C9B2RM.js +0 -2
- package/dist/owletto/dist/assets/_-CjyiGzwB.js +0 -3
- package/dist/owletto/dist/assets/_agentId-DKHXGvS2.js +0 -2
- package/dist/owletto/dist/assets/_automationId-CowRFD4E.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-dE6im18z.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-DqwSv8Zs.js +0 -2
- package/dist/owletto/dist/assets/_eventId-BVOVizs4.js +0 -2
- package/dist/owletto/dist/assets/_owner-DsvIC94q.js +0 -3
- package/dist/owletto/dist/assets/_shape-CWjpzcvv.js +0 -2
- package/dist/owletto/dist/assets/_slug-DuCxYsJk.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-BqVeHB6Z.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DzyOCG5U.js +0 -2
- package/dist/owletto/dist/assets/accept-invitation-k1u3zBcn.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-jTBMW7a9.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-D3mVM_q4.js +0 -4
- package/dist/owletto/dist/assets/agent-permissions-matrix-C_ayr0pd.js +0 -2
- package/dist/owletto/dist/assets/app-bridge-C4nPtae3.js +0 -121
- package/dist/owletto/dist/assets/automation-run-now-CjkJIkaZ.js +0 -2
- package/dist/owletto/dist/assets/clients-BCvjAJDT.js +0 -2
- package/dist/owletto/dist/assets/connect-DZeFSGIH.js +0 -2
- package/dist/owletto/dist/assets/connect-menu-D4w-JhJW.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-IZEMQJ64.js +0 -2
- package/dist/owletto/dist/assets/connection-C7glVpPE.js +0 -2
- package/dist/owletto/dist/assets/connector-page-shell-BeuyjiB2.js +0 -2
- package/dist/owletto/dist/assets/connectors-DSQ5AWPf.js +0 -2
- package/dist/owletto/dist/assets/consent-B6Aw_89N.js +0 -2
- package/dist/owletto/dist/assets/create-CWcza8NT.js +0 -2
- package/dist/owletto/dist/assets/create-bGOYifof.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-Ds4tpwHP.js +0 -2
- package/dist/owletto/dist/assets/device-D3fzoIrM.js +0 -2
- package/dist/owletto/dist/assets/entity-page-Cjc8oXA2.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-18xSANrS.js +0 -2
- package/dist/owletto/dist/assets/entity-schema-graph-uwZ-P0t8.js +0 -2
- package/dist/owletto/dist/assets/event-detail-D6AH6a2C.js +0 -2
- package/dist/owletto/dist/assets/events-feed-BI7wNRUY.js +0 -2
- package/dist/owletto/dist/assets/index-9tTjJo_J.css +0 -1
- package/dist/owletto/dist/assets/index-BhJsTy-C.js +0 -2
- package/dist/owletto/dist/assets/index-CEcsgXDj.js +0 -2
- package/dist/owletto/dist/assets/index-CPscKk2u.js +0 -2
- package/dist/owletto/dist/assets/index-CfJ2-EpK.js +0 -2
- package/dist/owletto/dist/assets/index-D5DM4g2w.js +0 -2
- package/dist/owletto/dist/assets/login-CH7P2AyR.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-Ba4aYavw.js +0 -74
- package/dist/owletto/dist/assets/new-BOsrRqp8.js +0 -2
- package/dist/owletto/dist/assets/new-DGPOjak2.js +0 -2
- package/dist/owletto/dist/assets/new-Q0XqiZq2.js +0 -2
- package/dist/owletto/dist/assets/organization-hD_Z6TSd.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-Cc8YX1oy.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-CRyAZATw.js +0 -2
- package/dist/owletto/dist/assets/record-activity-9ux6SfCd.js +0 -2
- package/dist/owletto/dist/assets/reset-password-D2RfrEVZ.js +0 -2
- package/dist/owletto/dist/assets/runs-CuC7WMtd.js +0 -2
- package/dist/owletto/dist/assets/runs-list-8gUPWjP4.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-C4UItfdk.js +0 -2
- package/dist/owletto/dist/assets/subDays-hOwerOLo.js +0 -2
- package/dist/owletto/dist/assets/use-automations-CdtiVLCv.js +0 -2
- package/dist/owletto/dist/assets/use-login-redirect-CYlVkAhE.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-BdN8OU35.js +0 -2
- /package/vendor/postgres/{.bun-tag-c81dacd34e959a7a → .bun-tag-652f2580b8090d71} +0 -0
|
@@ -20,6 +20,12 @@ export function linkedInInboxProgram() {
|
|
|
20
20
|
function fail(message) {
|
|
21
21
|
throw new Error(`LinkedIn inbox: ${message}`);
|
|
22
22
|
}
|
|
23
|
+
// A stop reason is durable evidence: keep the underlying failure instead of
|
|
24
|
+
// reporting only that the listener could not attach.
|
|
25
|
+
function errorDetail(error) {
|
|
26
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
27
|
+
return clean(message.replace(/^LinkedIn inbox: /, "")).slice(0, 300);
|
|
28
|
+
}
|
|
23
29
|
function headers() {
|
|
24
30
|
const cookie = document.cookie
|
|
25
31
|
.split("; ")
|
|
@@ -1018,6 +1024,7 @@ export function linkedInInboxProgram() {
|
|
|
1018
1024
|
clearTimeout(listener.timer);
|
|
1019
1025
|
window.removeEventListener("message", listener.onReply);
|
|
1020
1026
|
listeners.delete(listener.id);
|
|
1027
|
+
listener.stopReason = reason;
|
|
1021
1028
|
if (reason)
|
|
1022
1029
|
post(listener, {
|
|
1023
1030
|
id: `linkedin:${listener.feed}:source-observation-error`,
|
|
@@ -1053,10 +1060,10 @@ export function linkedInInboxProgram() {
|
|
|
1053
1060
|
listener.batches = await batchesOf(feed, checkpoint, result);
|
|
1054
1061
|
}
|
|
1055
1062
|
if (active(listener)) post(listener, listener.batches[0]);
|
|
1056
|
-
} catch {
|
|
1063
|
+
} catch (error) {
|
|
1057
1064
|
stop(
|
|
1058
1065
|
listener,
|
|
1059
|
-
|
|
1066
|
+
`LinkedIn source observation failed (${errorDetail(error)}); reconnect to recover without skipping changes`
|
|
1060
1067
|
);
|
|
1061
1068
|
}
|
|
1062
1069
|
if (active(listener))
|
|
@@ -1246,7 +1253,10 @@ export function linkedInInboxProgram() {
|
|
|
1246
1253
|
window.addEventListener("message", listener.onReply);
|
|
1247
1254
|
await poll(listener);
|
|
1248
1255
|
if (!listeners.has(listener.id))
|
|
1249
|
-
fail(
|
|
1256
|
+
fail(
|
|
1257
|
+
"Unable to attach source subscription: " +
|
|
1258
|
+
(listener.stopReason ?? "listener stopped")
|
|
1259
|
+
);
|
|
1250
1260
|
return { listening: true };
|
|
1251
1261
|
}
|
|
1252
1262
|
globalThis[key] = { version, read, listen, send, detach };
|
|
@@ -72,9 +72,9 @@ interface PgQueryConfig {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
interface PgCheckpoint {
|
|
75
|
-
/**
|
|
75
|
+
/** Native PostgreSQL text for the last cursor, preserving timestamp microseconds. */
|
|
76
76
|
last_cursor?: string;
|
|
77
|
-
/**
|
|
77
|
+
/** Native PostgreSQL text for the last primary-key value. */
|
|
78
78
|
last_pk?: string;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -362,11 +362,6 @@ async function setReadOnly(
|
|
|
362
362
|
await tx.unsafe(`SET LOCAL statement_timeout = ${Math.floor(timeoutMs)}`);
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
function toCheckpointValue(v: unknown): string {
|
|
366
|
-
if (v instanceof Date) return v.toISOString();
|
|
367
|
-
return String(v);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
365
|
function toDate(v: unknown): Date | null {
|
|
371
366
|
if (v instanceof Date) return v;
|
|
372
367
|
if (typeof v === 'number') return new Date(v);
|
|
@@ -386,7 +381,7 @@ export default class PostgresConnector extends ConnectorRuntime {
|
|
|
386
381
|
name: 'PostgreSQL',
|
|
387
382
|
description:
|
|
388
383
|
'Bring your own PostgreSQL database as memory, read a configured feed directly, or run governed connection-level SQL.',
|
|
389
|
-
version: '1.1.
|
|
384
|
+
version: '1.1.1',
|
|
390
385
|
queryCapabilities: { exactMatch: true, verbatimExactMatch: true, exactMatchAny: true, selection: true },
|
|
391
386
|
faviconDomain: 'postgresql.org',
|
|
392
387
|
authSchema: {
|
|
@@ -449,7 +444,7 @@ export default class PostgresConnector extends ConnectorRuntime {
|
|
|
449
444
|
// Everything runs inside ONE read-only transaction — the probe included —
|
|
450
445
|
// so even a crafted query (e.g. a data-modifying CTE that slipped past
|
|
451
446
|
// validation) cannot write while we introspect or read.
|
|
452
|
-
const rows =
|
|
447
|
+
const rows = await sql.begin(async (tx) => {
|
|
453
448
|
await setReadOnly(tx, timeoutMs);
|
|
454
449
|
|
|
455
450
|
// 1. Probe column types so the string-serialized checkpoint can be re-cast.
|
|
@@ -470,10 +465,28 @@ export default class PostgresConnector extends ConnectorRuntime {
|
|
|
470
465
|
};
|
|
471
466
|
const curCast = castFor(cursorCol);
|
|
472
467
|
const pkCast = castFor(pkCol);
|
|
473
|
-
|
|
474
|
-
//
|
|
468
|
+
// Bind as text before the native cast: binding directly as a timestamp
|
|
469
|
+
// makes postgres.js serialize the string through Date, losing precision again.
|
|
470
|
+
const curBound = curCast ? `$1::text${curCast}` : '$1';
|
|
471
|
+
const pkBound = pkCast ? `$2::text${pkCast}` : '$2';
|
|
472
|
+
|
|
473
|
+
// Keep checkpoints separate from driver-decoded payloads: Date loses
|
|
474
|
+
// microseconds, which can make a capped page repeat forever. Native
|
|
475
|
+
// text round-trips through the same type casts used by the predicate.
|
|
476
|
+
// Choose unused aliases so source columns with these names survive.
|
|
477
|
+
const checkpointAlias = (base: string): string => {
|
|
478
|
+
let name = base;
|
|
479
|
+
let suffix = 0;
|
|
480
|
+
while (colByName.has(name)) name = `${base}_${++suffix}`;
|
|
481
|
+
return name;
|
|
482
|
+
};
|
|
483
|
+
const cursorAlias = checkpointAlias('__lobu_checkpoint_cursor');
|
|
484
|
+
const pkAlias = checkpointAlias('__lobu_checkpoint_pk');
|
|
475
485
|
const colCur = `q."${cursorCol}"`;
|
|
476
486
|
const colPk = `q."${pkCol}"`;
|
|
487
|
+
const projection = `q.*, ${colCur}::text AS "${cursorAlias}", ${colPk}::text AS "${pkAlias}"`;
|
|
488
|
+
|
|
489
|
+
// 2. Build the keyset-paginated query.
|
|
477
490
|
const haveCursor =
|
|
478
491
|
checkpoint.last_cursor !== undefined && checkpoint.last_pk !== undefined;
|
|
479
492
|
|
|
@@ -483,18 +496,25 @@ export default class PostgresConnector extends ConnectorRuntime {
|
|
|
483
496
|
// security-allowed: colCur/colPk are assertIdentifier-validated + quoted;
|
|
484
497
|
// the cursor/pk values are bound parameters ($1/$2/$3), not interpolated.
|
|
485
498
|
wrapped =
|
|
486
|
-
`SELECT
|
|
487
|
-
`WHERE (${colCur} > $
|
|
488
|
-
`OR (${colCur} = $
|
|
499
|
+
`SELECT ${projection} FROM (\n${baseSql}\n) q\n` +
|
|
500
|
+
`WHERE (${colCur} > ${curBound} ` +
|
|
501
|
+
`OR (${colCur} = ${curBound} AND ${colPk} > ${pkBound}))\n` +
|
|
489
502
|
`ORDER BY ${colCur}, ${colPk} LIMIT $3`;
|
|
490
503
|
params = [checkpoint.last_cursor, checkpoint.last_pk, limit];
|
|
491
504
|
} else {
|
|
492
|
-
wrapped = `SELECT
|
|
505
|
+
wrapped = `SELECT ${projection} FROM (\n${baseSql}\n) q\nORDER BY ${colCur}, ${colPk} LIMIT $1`;
|
|
493
506
|
params = [limit];
|
|
494
507
|
}
|
|
495
508
|
|
|
496
|
-
|
|
497
|
-
|
|
509
|
+
const page = await tx.unsafe(wrapped, params as never[]);
|
|
510
|
+
return page.map((source) => {
|
|
511
|
+
const { [cursorAlias]: cursor, [pkAlias]: pk, ...row } = source;
|
|
512
|
+
return {
|
|
513
|
+
row,
|
|
514
|
+
checkpoint: { last_cursor: String(cursor), last_pk: String(pk) } satisfies PgCheckpoint,
|
|
515
|
+
};
|
|
516
|
+
});
|
|
517
|
+
});
|
|
498
518
|
|
|
499
519
|
// Namespace origin_ids by the feed INSTANCE, not the feed key: every
|
|
500
520
|
// postgres feed shares feedKey 'query', so two feeds on one connection with
|
|
@@ -508,14 +528,9 @@ export default class PostgresConnector extends ConnectorRuntime {
|
|
|
508
528
|
// so a run cut short keeps every slice it committed.
|
|
509
529
|
for (let start = 0; start < rows.length; start += COMMIT_ROWS) {
|
|
510
530
|
const slice = rows.slice(start, start + COMMIT_ROWS);
|
|
511
|
-
const last = slice[slice.length - 1];
|
|
512
|
-
const sliceCheckpoint: PgCheckpoint = {
|
|
513
|
-
last_cursor: toCheckpointValue(last[cursorCol]),
|
|
514
|
-
last_pk: toCheckpointValue(last[pkCol]),
|
|
515
|
-
};
|
|
516
531
|
await ctx.commit(
|
|
517
|
-
slice.map((row) => this.rowToEvent(originPrefix, row, config, cursorCol, pkCol)),
|
|
518
|
-
|
|
532
|
+
slice.map(({ row }) => this.rowToEvent(originPrefix, row, config, cursorCol, pkCol)),
|
|
533
|
+
slice[slice.length - 1].checkpoint
|
|
519
534
|
);
|
|
520
535
|
}
|
|
521
536
|
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
* module shapes are load-bearing.
|
|
10
10
|
*
|
|
11
11
|
* How it gets into the page: the connector serialises this function with
|
|
12
|
-
* Function.prototype.toString() and runs `(<source>)()` through the
|
|
13
|
-
* chrome `evaluate` op, which executes in the page's MAIN world. That is
|
|
14
|
-
* same mechanism the extension used with chrome.scripting.executeScript({func}),
|
|
15
|
-
* minus the extension. The
|
|
16
|
-
*
|
|
12
|
+
* Function.prototype.toString() and runs `(<source>)("<version>")` through the
|
|
13
|
+
* generic chrome `evaluate` op, which executes in the page's MAIN world. That is
|
|
14
|
+
* the same mechanism the extension used with chrome.scripting.executeScript({func}),
|
|
15
|
+
* minus the extension. The version is a fingerprint of that exact source,
|
|
16
|
+
* computed by the connector (WHATSAPP_ADAPTER_INSTALL in whatsapp-web-helpers.ts),
|
|
17
|
+
* so the adapter is idempotent per program text and re-injecting is safe.
|
|
17
18
|
*
|
|
18
19
|
* INVARIANT — every binding this function needs must live INSIDE it. A constant
|
|
19
20
|
* hoisted to module scope would vanish from toString() output and the page would
|
|
@@ -26,14 +27,14 @@
|
|
|
26
27
|
* and cost a @ts-nocheck plus a set of `declare const` shims.
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
|
-
export function whatsAppWebAdapterProgram() {
|
|
30
|
+
export function whatsAppWebAdapterProgram(adapterVersion) {
|
|
30
31
|
const GLOBAL_KEY = "__owlettoWhatsAppAdapterV1";
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
// A WhatsApp tab outlives a deploy, so a resident adapter is replaced only
|
|
33
|
+
// when this version differs. The connector derives it from this program's
|
|
34
|
+
// own source, so any change to the program replaces it with no manual bump.
|
|
35
|
+
const ADAPTER_VERSION = adapterVersion;
|
|
36
|
+
if (typeof ADAPTER_VERSION !== "string" || !ADAPTER_VERSION)
|
|
37
|
+
throw new Error("WhatsApp adapter must be installed with its content version");
|
|
37
38
|
const SOURCE_ERROR_ID = "whatsapp-web:source-observation-error";
|
|
38
39
|
// Storage rows one `chat:` read examines; a whole personal history is
|
|
39
40
|
// usually under this, so one read answers.
|
|
@@ -340,6 +341,23 @@ export function whatsAppWebAdapterProgram() {
|
|
|
340
341
|
return false;
|
|
341
342
|
}
|
|
342
343
|
|
|
344
|
+
/** Actual self-mentions, excluding quotes of our messages and other people. */
|
|
345
|
+
async function ownMentionJids(row) {
|
|
346
|
+
const mentions = Array.isArray(row.mentionedJidList) ? row.mentionedJidList : [];
|
|
347
|
+
if (mentions.length === 0) return [];
|
|
348
|
+
const own = await ownJids();
|
|
349
|
+
const mentioned = new Set();
|
|
350
|
+
for (const value of mentions) {
|
|
351
|
+
const candidate = await canonicalJid(value);
|
|
352
|
+
for (const jid of [candidate.jid, candidate.lid]) {
|
|
353
|
+
if (typeof jid === "string" && /^[0-9]{5,32}@(s\.whatsapp\.net|lid)$/.test(jid) && own.has(jid)) {
|
|
354
|
+
mentioned.add(jid);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return [...mentioned].slice(0, 2);
|
|
359
|
+
}
|
|
360
|
+
|
|
343
361
|
/**
|
|
344
362
|
* Module names for each write op, most-current first.
|
|
345
363
|
*
|
|
@@ -386,7 +404,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
386
404
|
const key = row.id ?? model?.id;
|
|
387
405
|
const id = rawId(key);
|
|
388
406
|
const remote = widString(key?.remote ?? row.chatId ?? (key?.fromMe ? row.to : row.from));
|
|
389
|
-
if (!id || !remote || remote
|
|
407
|
+
if (!id || !remote || isBroadcastOnlyJid(remote) || SYSTEM_TYPES.has(row.type)) return null;
|
|
390
408
|
return { id, timestamp: unixSeconds(row), is_group: remote.endsWith("@g.us") };
|
|
391
409
|
}
|
|
392
410
|
|
|
@@ -496,6 +514,21 @@ export function whatsAppWebAdapterProgram() {
|
|
|
496
514
|
return [];
|
|
497
515
|
}
|
|
498
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Chats that are feeds, not conversations: status updates, channels, and the
|
|
519
|
+
* read-only service-announcement chat (`0@c.us`, canonically
|
|
520
|
+
* `0@s.whatsapp.net`). Nobody can reply in them, so they never surface as
|
|
521
|
+
* messages and a send to one is refused instead of hanging.
|
|
522
|
+
*/
|
|
523
|
+
function isBroadcastOnlyJid(jid) {
|
|
524
|
+
return (
|
|
525
|
+
jid === "status@broadcast" ||
|
|
526
|
+
jid.endsWith("@newsletter") ||
|
|
527
|
+
jid === "0@c.us" ||
|
|
528
|
+
jid === "0@s.whatsapp.net"
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
|
|
499
532
|
function widString(value) {
|
|
500
533
|
if (typeof value === "string") return value;
|
|
501
534
|
if (!value) return null;
|
|
@@ -670,11 +703,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
670
703
|
const authorRaw = row.author ?? key?.participant;
|
|
671
704
|
const chatRaw = remoteRaw ?? (fromMe ? toRaw : fromRaw);
|
|
672
705
|
const chat = await canonicalJid(chatRaw);
|
|
673
|
-
if (
|
|
674
|
-
!chat.jid ||
|
|
675
|
-
chat.jid === "status@broadcast" ||
|
|
676
|
-
chat.jid.endsWith("@newsletter")
|
|
677
|
-
) {
|
|
706
|
+
if (!chat.jid || isBroadcastOnlyJid(chat.jid)) {
|
|
678
707
|
return null;
|
|
679
708
|
}
|
|
680
709
|
const senderRaw = fromMe ? fromRaw : (authorRaw ?? fromRaw);
|
|
@@ -723,6 +752,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
723
752
|
media_filename: row.filename ?? row.fileName ?? row.title ?? null,
|
|
724
753
|
quoted_id: quotedId,
|
|
725
754
|
mentions_me: await mentionsOwnAccount(row),
|
|
755
|
+
own_mention_jids: await ownMentionJids(row),
|
|
726
756
|
is_forwarded: Boolean(row.isForwarded || Number(row.forwardingScore) > 0),
|
|
727
757
|
is_starred: Boolean(row.star ?? row.isStarred),
|
|
728
758
|
is_system_event: SYSTEM_TYPES.has(type),
|
|
@@ -1091,7 +1121,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1091
1121
|
const key = keyModule.fromString(row.id);
|
|
1092
1122
|
if (exactId !== null && key.id !== exactId) continue;
|
|
1093
1123
|
const remote = widString(key.remote);
|
|
1094
|
-
if (remote
|
|
1124
|
+
if (isBroadcastOnlyJid(remote)) continue;
|
|
1095
1125
|
const isGroup = remote.endsWith("@g.us");
|
|
1096
1126
|
if ((chatFilter === "group" && !isGroup) || (chatFilter === "individual" && isGroup)) continue;
|
|
1097
1127
|
selected.push(row);
|
|
@@ -1161,8 +1191,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1161
1191
|
const jid = (
|
|
1162
1192
|
await canonicalJid(modelData(candidate).id ?? candidate?.id)
|
|
1163
1193
|
).jid;
|
|
1164
|
-
if (!jid || jid
|
|
1165
|
-
continue;
|
|
1194
|
+
if (!jid || isBroadcastOnlyJid(jid)) continue;
|
|
1166
1195
|
const isGroup = jid.endsWith("@g.us");
|
|
1167
1196
|
if (chatFilter === "group" ? isGroup : !isGroup) {
|
|
1168
1197
|
scopedChats.push(candidate);
|
|
@@ -1294,6 +1323,9 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1294
1323
|
async function sendMessage(input, account) {
|
|
1295
1324
|
const collections = requireFirst(["WAWebCollections"]);
|
|
1296
1325
|
const chat = await resolveChat(collections, input);
|
|
1326
|
+
const chatJid = (await canonicalJid(modelData(chat).id ?? chat?.id)).jid;
|
|
1327
|
+
if (chatJid && isBroadcastOnlyJid(chatJid))
|
|
1328
|
+
throw new Error(`WhatsApp chat ${chatJid} does not accept messages`);
|
|
1297
1329
|
const text = String(input?.text ?? "");
|
|
1298
1330
|
if (!text.trim()) throw new Error("text is required");
|
|
1299
1331
|
const module = requireFirst(SEND_MODULES);
|
|
@@ -1531,7 +1563,7 @@ export function whatsAppWebAdapterProgram() {
|
|
|
1531
1563
|
|
|
1532
1564
|
async function invoke(request) {
|
|
1533
1565
|
try {
|
|
1534
|
-
if (
|
|
1566
|
+
if (request?.adapter_version !== ADAPTER_VERSION) {
|
|
1535
1567
|
return {
|
|
1536
1568
|
ok: false,
|
|
1537
1569
|
error: {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* that live reads and searches return. These helpers do not ingest events.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { whatsAppWebAdapterProgram } from "./whatsapp-web-adapter.js";
|
|
10
11
|
import {
|
|
11
12
|
normalizeWhatsAppUserJid,
|
|
12
13
|
WHATSAPP_GROUP_SUFFIX,
|
|
@@ -14,7 +15,42 @@ import {
|
|
|
14
15
|
WHATSAPP_PHONE_SERVER,
|
|
15
16
|
} from "./whatsapp-web-identity.js";
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A short fingerprint of a program's source (cyrb53, base 36). It only has to
|
|
20
|
+
* tell two program texts apart, so a non-cryptographic hash is enough, and it
|
|
21
|
+
* runs synchronously wherever the connector does.
|
|
22
|
+
*/
|
|
23
|
+
function sourceFingerprint(source: string): string {
|
|
24
|
+
let h1 = 0xdeadbeef;
|
|
25
|
+
let h2 = 0x41c6ce57;
|
|
26
|
+
for (let index = 0; index < source.length; index++) {
|
|
27
|
+
const code = source.charCodeAt(index);
|
|
28
|
+
h1 = Math.imul(h1 ^ code, 2654435761);
|
|
29
|
+
h2 = Math.imul(h2 ^ code, 1597334677);
|
|
30
|
+
}
|
|
31
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
32
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
33
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
34
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
35
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The page adapter's expression and version, both derived from the program
|
|
40
|
+
* text this build injects. An open tab keeps a resident adapter only while the
|
|
41
|
+
* versions match, so any change to the program reaches every open tab without
|
|
42
|
+
* a hand-maintained number two concurrent changes could both claim.
|
|
43
|
+
*/
|
|
44
|
+
export function whatsAppAdapterInstall(
|
|
45
|
+
source: string = whatsAppWebAdapterProgram.toString()
|
|
46
|
+
): { version: string; expression: string } {
|
|
47
|
+
const version = `src-${sourceFingerprint(source)}`;
|
|
48
|
+
return { version, expression: `(${source})(${JSON.stringify(version)})` };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ADAPTER_INSTALL = whatsAppAdapterInstall();
|
|
52
|
+
export const WHATSAPP_ADAPTER_VERSION = ADAPTER_INSTALL.version;
|
|
53
|
+
export const WHATSAPP_ADAPTER_INSTALL = ADAPTER_INSTALL.expression;
|
|
18
54
|
export const WHATSAPP_ORIGIN = "https://web.whatsapp.com";
|
|
19
55
|
|
|
20
56
|
export type ChatFilter = "all" | "individual" | "group";
|
|
@@ -39,6 +75,8 @@ export interface WhatsAppMessage {
|
|
|
39
75
|
quoted_id?: string | null;
|
|
40
76
|
/** The message @mentions the account or quotes one of its messages. */
|
|
41
77
|
mentions_me?: boolean;
|
|
78
|
+
/** Verified phone/LID identities of the paired account actually @mentioned. */
|
|
79
|
+
own_mention_jids?: string[];
|
|
42
80
|
edited?: boolean;
|
|
43
81
|
edit_timestamp?: number | null;
|
|
44
82
|
revoked?: boolean;
|
|
@@ -114,10 +152,13 @@ export function normalizeRelayedMessage(
|
|
|
114
152
|
const timestamp = timestampOf(raw);
|
|
115
153
|
if (timestamp <= 0) return null;
|
|
116
154
|
const chatJid = canonicalizeJid(raw.chat_jid);
|
|
155
|
+
// Status updates, channels and the read-only service-announcement chat
|
|
156
|
+
// (`0@c.us`) are feeds nobody can reply in; the page adapter drops them too.
|
|
117
157
|
if (
|
|
118
158
|
!chatJid ||
|
|
119
159
|
chatJid === "status@broadcast" ||
|
|
120
|
-
chatJid.endsWith("@newsletter")
|
|
160
|
+
chatJid.endsWith("@newsletter") ||
|
|
161
|
+
chatJid === `0@${WHATSAPP_PHONE_SERVER}`
|
|
121
162
|
) {
|
|
122
163
|
return null;
|
|
123
164
|
}
|
|
@@ -136,6 +177,11 @@ export function normalizeRelayedMessage(
|
|
|
136
177
|
from_me: fromMe,
|
|
137
178
|
timestamp,
|
|
138
179
|
occurred_at: new Date(timestamp * 1000).toISOString(),
|
|
180
|
+
own_mention_jids: Array.isArray(raw.own_mention_jids)
|
|
181
|
+
? [...new Set(raw.own_mention_jids.map((jid: unknown) =>
|
|
182
|
+
typeof jid === "string" ? normalizeWhatsAppUserJid(jid) : null,
|
|
183
|
+
).filter((jid: string | null): jid is string => jid !== null))].slice(0, 2)
|
|
184
|
+
: [],
|
|
139
185
|
};
|
|
140
186
|
}
|
|
141
187
|
|
|
@@ -31,10 +31,10 @@ import {
|
|
|
31
31
|
messageTitle,
|
|
32
32
|
normalizeRelayedMessage,
|
|
33
33
|
type ObservationCheckpoint,
|
|
34
|
+
WHATSAPP_ADAPTER_INSTALL,
|
|
34
35
|
WHATSAPP_ADAPTER_VERSION,
|
|
35
36
|
WHATSAPP_ORIGIN,
|
|
36
37
|
} from "./whatsapp-web-helpers.js";
|
|
37
|
-
import { whatsAppWebAdapterProgram } from "./whatsapp-web-adapter.js";
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* How long a run waits for WhatsApp Web to finish hydrating before giving up.
|
|
@@ -119,7 +119,7 @@ async function adapterInstalled(
|
|
|
119
119
|
tab_id: tabId,
|
|
120
120
|
expression: `(() => {
|
|
121
121
|
const a = globalThis.__owlettoWhatsAppAdapterV1;
|
|
122
|
-
return !!a && typeof a.invoke === 'function' && a.version === ${WHATSAPP_ADAPTER_VERSION};
|
|
122
|
+
return !!a && typeof a.invoke === 'function' && a.version === ${JSON.stringify(WHATSAPP_ADAPTER_VERSION)};
|
|
123
123
|
})()`,
|
|
124
124
|
await_promise: false,
|
|
125
125
|
});
|
|
@@ -144,7 +144,7 @@ async function injectAdapter(
|
|
|
144
144
|
exception?: unknown;
|
|
145
145
|
}>("evaluate", {
|
|
146
146
|
tab_id: tabId,
|
|
147
|
-
expression:
|
|
147
|
+
expression: WHATSAPP_ADAPTER_INSTALL,
|
|
148
148
|
await_promise: false,
|
|
149
149
|
});
|
|
150
150
|
if (result.exception) {
|
|
@@ -338,6 +338,7 @@ function normalizedSearchResults(
|
|
|
338
338
|
is_group: message.is_group,
|
|
339
339
|
quoted_id: message.quoted_id ?? null,
|
|
340
340
|
mentions_me: message.mentions_me === true,
|
|
341
|
+
own_mention_jids: message.own_mention_jids ?? [],
|
|
341
342
|
});
|
|
342
343
|
}
|
|
343
344
|
return rows;
|
|
@@ -363,7 +364,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
363
364
|
name: "WhatsApp",
|
|
364
365
|
description:
|
|
365
366
|
"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.",
|
|
366
|
-
version: "2.3.
|
|
367
|
+
version: "2.3.1",
|
|
367
368
|
faviconDomain: "whatsapp.com",
|
|
368
369
|
authSchema: { methods: [{ type: "browser", mode: "live" }] },
|
|
369
370
|
browser: {
|
|
@@ -371,9 +372,9 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
371
372
|
accountProbe: {
|
|
372
373
|
url: `${WHATSAPP_ORIGIN}/`,
|
|
373
374
|
expression: `(async () => {
|
|
374
|
-
|
|
375
|
+
${WHATSAPP_ADAPTER_INSTALL};
|
|
375
376
|
for (let i = 0; i < 40; i++) {
|
|
376
|
-
const identity = await globalThis.__owlettoWhatsAppAdapterV1.invoke({ op: "account_identity", adapter_version: ${WHATSAPP_ADAPTER_VERSION} });
|
|
377
|
+
const identity = await globalThis.__owlettoWhatsAppAdapterV1.invoke({ op: "account_identity", adapter_version: ${JSON.stringify(WHATSAPP_ADAPTER_VERSION)} });
|
|
377
378
|
if (identity?.accountId) return identity;
|
|
378
379
|
await new Promise(resolve => setTimeout(resolve, 250));
|
|
379
380
|
}
|
|
@@ -462,7 +463,21 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
462
463
|
type: "string",
|
|
463
464
|
enum: ["whatsapp_fts", "loaded_model_fallback"],
|
|
464
465
|
},
|
|
465
|
-
results: {
|
|
466
|
+
results: {
|
|
467
|
+
type: "array",
|
|
468
|
+
items: {
|
|
469
|
+
type: "object",
|
|
470
|
+
properties: {
|
|
471
|
+
own_mention_jids: {
|
|
472
|
+
type: "array",
|
|
473
|
+
maxItems: 2,
|
|
474
|
+
uniqueItems: true,
|
|
475
|
+
items: { type: "string", pattern: "^[0-9]{5,32}@(s\\.whatsapp\\.net|lid)$" },
|
|
476
|
+
description: "Verified phone/LID JIDs of the paired account actually @mentioned; empty for quotes alone. Original text is preserved.",
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
},
|
|
466
481
|
hasMore: { type: "boolean" },
|
|
467
482
|
},
|
|
468
483
|
},
|
|
@@ -710,6 +725,7 @@ export default class WhatsAppWebConnector extends ConnectorRuntime<
|
|
|
710
725
|
{ name: "is_group", type: "boolean" },
|
|
711
726
|
{ name: "quoted_id", type: "string" },
|
|
712
727
|
{ name: "mentions_me", type: "boolean" },
|
|
728
|
+
{ name: "own_mention_jids", type: "array" },
|
|
713
729
|
],
|
|
714
730
|
nextCursor: response.nextCursor,
|
|
715
731
|
hasMore: response.hasMore,
|
|
@@ -43,6 +43,16 @@ export function xDirectMessagesProgram() {
|
|
|
43
43
|
if (status !== undefined) error.status = status;
|
|
44
44
|
throw error;
|
|
45
45
|
}
|
|
46
|
+
// A stop reason is durable evidence: keep the underlying failure instead of
|
|
47
|
+
// reporting only that the listener could not attach.
|
|
48
|
+
function errorDetail(error) {
|
|
49
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
50
|
+
return message
|
|
51
|
+
.replace(/^X direct messages: /, "")
|
|
52
|
+
.replace(/\s+/g, " ")
|
|
53
|
+
.trim()
|
|
54
|
+
.slice(0, 300);
|
|
55
|
+
}
|
|
46
56
|
function cookie(name) {
|
|
47
57
|
const raw = document.cookie
|
|
48
58
|
.split("; ")
|
|
@@ -525,6 +535,7 @@ export function xDirectMessagesProgram() {
|
|
|
525
535
|
clearTimeout(listener.timer);
|
|
526
536
|
window.removeEventListener("message", listener.onReply);
|
|
527
537
|
listeners.delete(listener.id);
|
|
538
|
+
listener.stopReason = reason;
|
|
528
539
|
if (reason)
|
|
529
540
|
post(listener, {
|
|
530
541
|
id: "x:live_messages:source-observation-error",
|
|
@@ -552,10 +563,10 @@ export function xDirectMessagesProgram() {
|
|
|
552
563
|
}
|
|
553
564
|
account(listener.account);
|
|
554
565
|
if (active(listener)) post(listener, listener.batches[0]);
|
|
555
|
-
} catch {
|
|
566
|
+
} catch (error) {
|
|
556
567
|
stop(
|
|
557
568
|
listener,
|
|
558
|
-
|
|
569
|
+
`X source observation failed (${errorDetail(error)}); reconnect to recover without skipping messages`,
|
|
559
570
|
);
|
|
560
571
|
}
|
|
561
572
|
if (active(listener))
|
|
@@ -618,7 +629,10 @@ export function xDirectMessagesProgram() {
|
|
|
618
629
|
window.addEventListener("message", listener.onReply);
|
|
619
630
|
await poll(listener);
|
|
620
631
|
if (!listeners.has(listener.id))
|
|
621
|
-
fail(
|
|
632
|
+
fail(
|
|
633
|
+
"Unable to attach source subscription: " +
|
|
634
|
+
(listener.stopReason ?? "listener stopped"),
|
|
635
|
+
);
|
|
622
636
|
return { listening: true };
|
|
623
637
|
}
|
|
624
638
|
// X serves at most 50 entries per notifications page (`count=50`); the
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- migrate:up
|
|
2
|
+
-- lobu:no-quiesce
|
|
3
|
+
-- One row per installation: the random id the anonymous daily install ping
|
|
4
|
+
-- reports, so the same install is counted once across days, restarts and
|
|
5
|
+
-- replicas. Created lazily by the first ping (INSERT ... ON CONFLICT DO
|
|
6
|
+
-- NOTHING); nothing else reads it. The boolean primary key with CHECK pins the
|
|
7
|
+
-- table to a single row.
|
|
8
|
+
--
|
|
9
|
+
-- New table only: code running before this deploy never reads it.
|
|
10
|
+
CREATE TABLE IF NOT EXISTS public.instance_identity (
|
|
11
|
+
singleton boolean PRIMARY KEY DEFAULT true CHECK (singleton),
|
|
12
|
+
install_id uuid NOT NULL DEFAULT gen_random_uuid(),
|
|
13
|
+
created_at timestamptz NOT NULL DEFAULT now()
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
-- migrate:down
|
|
17
|
+
-- squawk-ignore ban-drop-table -- rollback of the identity table introduced above
|
|
18
|
+
DROP TABLE IF EXISTS public.instance_identity;
|