@lobu/runtime-server 21.2.1 → 22.0.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 +40 -13
- package/dist/catalogs/connectors.json +16601 -597
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +7 -5
- package/dist/connectors/_google/actions.ts +270 -0
- package/dist/connectors/_google/discovery/calendar_v3.json +1 -0
- package/dist/connectors/_google/discovery/chat_v1.json +1 -0
- package/dist/connectors/_google/discovery/docs_v1.json +1 -0
- package/dist/connectors/_google/discovery/drive_v3.json +1 -0
- package/dist/connectors/_google/discovery/gmail_v1.json +1 -0
- package/dist/connectors/_google/discovery/people_v1.json +1 -0
- package/dist/connectors/_google/discovery/sheets_v4.json +1 -0
- package/dist/connectors/_google/discovery/tasks_v1.json +1 -0
- package/dist/connectors/_google/discovery/youtube_v3.json +1 -0
- package/dist/connectors/_google/discovery.ts +442 -0
- package/dist/connectors/_google/errors.ts +91 -0
- package/dist/connectors/_google/list-feed.ts +223 -0
- package/dist/connectors/_google/policies.ts +127 -0
- package/dist/connectors/agentid.ts +43 -0
- package/dist/connectors/chat-user-identity.ts +2 -1
- package/dist/connectors/github-automation-events.ts +9 -0
- package/dist/connectors/github-identity.ts +28 -3
- package/dist/connectors/github.ts +101 -59
- package/dist/connectors/google_calendar.ts +207 -719
- package/dist/connectors/google_drive.ts +16 -2
- package/dist/connectors/google_gmail.ts +51 -33
- package/dist/connectors/herdr.ts +406 -0
- package/dist/connectors/jira.ts +6 -6
- package/dist/connectors/linear.ts +7 -4
- package/dist/connectors/postgres.ts +27 -2
- package/dist/connectors/tiktok-inbox-page.js +230 -0
- package/dist/connectors/tiktok-web-page.js +211 -0
- package/dist/connectors/tiktok_web.ts +286 -0
- package/dist/connectors/whatsapp-web-adapter.js +228 -10
- package/dist/connectors/whatsapp-web-helpers.ts +47 -14
- package/dist/connectors/whatsapp-web-identity.ts +121 -0
- package/dist/connectors/whatsapp_web.ts +170 -29
- package/dist/connectors/x.ts +276 -136
- package/dist/db/migrations/20261005150000_retire_agent_tool_config.sql +31 -0
- package/dist/db/migrations/20261005173700_drop_retired_agent_tool_config.sql +29 -0
- package/dist/db/migrations/20261007010000_identity_association_guards.sql +242 -0
- package/dist/db/migrations/20261007010001_identity_association_indexes.sql +35 -0
- package/dist/db/migrations/20261007012000_connector_browser_requirement.sql +7 -0
- package/dist/db/migrations/20261009010000_identity_member_decision_indexes.sql +22 -0
- package/dist/db/migrations/20261009015900_retire_remaining_physical_merges.sql +196 -0
- package/dist/db/migrations/20261009020000_retire_physical_entity_merge.sql +82 -0
- package/dist/db/migrations/20261009030000_retire_physical_merge_indexes.sql +39 -0
- package/dist/db/migrations/20261009030001_drop_physical_entity_redirect.sql +62 -0
- package/dist/db/migrations/20261009040000_normalize_identity_decisions.sql +60 -0
- package/dist/db/migrations/20261010220000_notification_targets_user_event_order.sql +53 -0
- package/dist/db/migrations/20261010223000_device_workers_user_fresh_cover.sql +39 -0
- package/dist/db/migrations/20261010223001_runs_org_default_view.sql +41 -0
- package/dist/db/migrations/20261010223002_events_org_guidance.sql +42 -0
- package/dist/db/migrations/20261011002000_finish_product_eval_retirement.sql +37 -0
- package/dist/db/migrations/20261011160000_mcp_conversation_workspaces.sql +97 -0
- package/dist/db/migrations/20261013120000_events_live_org_effective_date.sql +42 -0
- package/dist/db/migrations/20261013150000_events_live_linked_org_ids_gin.sql +41 -0
- package/dist/db/migrations/20261014120000_clear_team_device_auto_pause.sql +34 -0
- package/dist/db/migrations/20261014150000_connector_webhook_event_type_backfill.sql +30 -0
- package/dist/db/migrations/20261014170000_retire_atlassian_mcp_webhook_refresh.sql +51 -0
- package/dist/db/migrations/20261015010000_connection_auth_profile_fk_set_null_column.sql +53 -0
- package/dist/db/migrations/20261015120000_personal_org_connector_auto_policy.sql +38 -0
- package/dist/db/migrations/preconditions/20261005150000_retire_agent_tool_config.sql +22 -0
- package/dist/db/migrations/preconditions/20261005173700_drop_retired_agent_tool_config.sql +13 -0
- package/dist/db/migrations/preconditions/20261009020000_retire_physical_entity_merge.sql +26 -0
- package/dist/db/migrations/preconditions/20261011002000_finish_product_eval_retirement.sql +14 -0
- package/dist/dependencies.bun.lock +135 -128
- package/dist/guest.bundle.js +131 -185
- package/dist/owletto/dist/assets/_-CEPl6gU4.js +3 -0
- package/dist/owletto/dist/assets/_-C_zNZben.js +2 -0
- package/dist/owletto/dist/assets/_-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/_agentId-CBC_SadO.js +2 -0
- package/dist/owletto/dist/assets/_agentId-QQW91cHX.js +2 -0
- package/dist/owletto/dist/assets/_automationId-YTTNksw6.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-fK0h7RAp.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-C7TPS598.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-CEhxlTIo.js +2 -0
- package/dist/owletto/dist/assets/_deploymentId-BQfYN1U2.js +2 -0
- package/dist/owletto/dist/assets/_eventId-Cl8GSdjg.js +2 -0
- package/dist/owletto/dist/assets/_name-t3oBJ6Zf.js +2 -0
- package/dist/owletto/dist/assets/_owner-cUtGHqSw.js +3 -0
- package/dist/owletto/dist/assets/_shape-bo2lMVCu.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-Dwm4Q4wI.js +2 -0
- package/dist/owletto/dist/assets/_slug-CU1PuHB9.js +2 -0
- package/dist/owletto/dist/assets/_threadId-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-Bh6E_NxA.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-D4jKl-Zf.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-D3OgJG4i.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-DQglkhXU.js +2 -0
- package/dist/owletto/dist/assets/agent-card-controls-DzRs4Ix9.js +2 -0
- package/dist/owletto/dist/assets/{agent-client-setup-list-BFtgRwe8.js → agent-client-setup-list-B2SvH7xD.js} +4 -3
- package/dist/owletto/dist/assets/agent-connect-pages-B6uKvT_X.js +2 -0
- package/dist/owletto/dist/assets/agent-editor-form-oUnIYHd7.js +2 -0
- package/dist/owletto/dist/assets/agent-guardrails-route-BaV1VpDh.js +2 -0
- package/dist/owletto/dist/assets/agent-loading-shells-CtZJM2Gc.js +2 -0
- package/dist/owletto/dist/assets/agent-permissions-matrix-Ds48KFK9.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-BAr2Dw3F.js → agent-skill-context-DPk5r08w.js} +2 -1
- package/dist/owletto/dist/assets/agent-skills-route-DYpB5H1J.js +2 -0
- package/dist/owletto/dist/assets/agent-subpage-shell-B3K_jPYR.js +2 -0
- package/dist/owletto/dist/assets/agent-thread-C8UaUTWc.js +6 -0
- package/dist/owletto/dist/assets/agents-F4mGI2oF.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-CMyk4PI7.js +2 -0
- package/dist/owletto/dist/assets/app-bridge-BCm4muqj.js +128 -0
- package/dist/owletto/dist/assets/app._appId-DH1Qutz6.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-CEDNboId.js +2 -0
- package/dist/owletto/dist/assets/automations-F4mGI2oF.js +2 -0
- package/dist/owletto/dist/assets/{callback-CaRe2TOT.js → callback-CU-hb8JB.js} +2 -1
- package/dist/owletto/dist/assets/{card-CMmh2mzo.js → card-DIF8SF9b.js} +2 -1
- package/dist/owletto/dist/assets/claim-DELEa-gH.js +2 -0
- package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +1 -0
- package/dist/owletto/dist/assets/clients-CpG676mg.js +2 -0
- package/dist/owletto/dist/assets/code-editor-V27Z4o3P.js +16 -0
- package/dist/owletto/dist/assets/connect-B2YL6qIK.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-B6LDmDRV.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-D_HaKoI1.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-DQWcUqKM.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-BC3R303A.js +2 -0
- package/dist/owletto/dist/assets/connection-DySpRE9x.js +2 -0
- package/dist/owletto/dist/assets/connection-feed-detail-C_D68j6d.js +2 -0
- package/dist/owletto/dist/assets/connection-label-BobuYiAG.js +1 -0
- package/dist/owletto/dist/assets/connections-browser-Cnv2iBbZ.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-BjKiUhYE.js → connector-provenance-CNXtzYg5.js} +2 -1
- package/dist/owletto/dist/assets/connector-scope-lists-BKDetNDc.js +2 -0
- package/dist/owletto/dist/assets/{connectors-Baejya0T.js → connectors-BJnk1z_2.js} +2 -1
- package/dist/owletto/dist/assets/consent-BVzxrAO9.js +2 -0
- package/dist/owletto/dist/assets/conversations-table-DfZGICl7.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-QA7BQgiK.js → core.esm-DiTpULFl.js} +2 -1
- package/dist/owletto/dist/assets/create-CUqO6Kfk.js +2 -0
- package/dist/owletto/dist/assets/create-JRFM8mMf.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-_4vUkrls.js +3 -0
- package/dist/owletto/dist/assets/create-iHcxV0xd.js +2 -0
- package/dist/owletto/dist/assets/create._connectorKey-CCYLEicg.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-2GHCtD7h.js → cronstrue-DPXl0qA2.js} +2 -1
- package/dist/owletto/dist/assets/deployments-DCQdFdwG.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-Bm2upStd.js → deployments-body-D6TAWs_6.js} +2 -1
- package/dist/owletto/dist/assets/deployments-ihkhK1zV.js +2 -0
- package/dist/owletto/dist/assets/device-CntqYW65.js +2 -0
- package/dist/owletto/dist/assets/device-pin-tombstone-Bz4JHHMK.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-D4plO3GM.js +2 -0
- package/dist/owletto/dist/assets/{entity-options-CrbS6K-i.js → entity-options-UJs64GdQ.js} +2 -1
- package/dist/owletto/dist/assets/entity-page-Djz6T50J.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-OznRag6A.js +2 -0
- package/dist/owletto/dist/assets/event-detail-04qOUGIP.js +2 -0
- package/dist/owletto/dist/assets/events-feed-fucGZSJR.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-DCQgGLyR.js +2 -0
- package/dist/owletto/dist/assets/full-page-spinner-KpV2FS2u.js +2 -0
- package/dist/owletto/dist/assets/guardrails-molekzAF.js +2 -0
- package/dist/owletto/dist/assets/identity-BJcaG66g.js +2 -0
- package/dist/owletto/dist/assets/index-B04ON9Jv.js +2 -0
- package/dist/owletto/dist/assets/index-BEvyBdOU.js +2 -0
- package/dist/owletto/dist/assets/{index-Cf0GJoiG.js → index-BJXkc60S.js} +2 -1
- package/dist/owletto/dist/assets/index-BLEcy9-T.css +1 -0
- package/dist/owletto/dist/assets/index-BNh2cidi.js +2 -0
- package/dist/owletto/dist/assets/index-BOsK-K-2.js +2 -0
- package/dist/owletto/dist/assets/{index-DlepU3cY.js → index-BOzuAbvi.js} +2 -1
- package/dist/owletto/dist/assets/index-Bk1x7A67.js +2 -0
- package/dist/owletto/dist/assets/index-CDz3-ieP.js +1 -0
- package/dist/owletto/dist/assets/index-CFnx5huL.js +2 -0
- package/dist/owletto/dist/assets/index-D3s8rhG9.js +2 -0
- package/dist/owletto/dist/assets/index-DCdkwg9H.js +2 -0
- package/dist/owletto/dist/assets/index-Dbd1jusf.js +2 -0
- package/dist/owletto/dist/assets/index-DqZuqC08.js +2 -0
- package/dist/owletto/dist/assets/index-Dr-Xg_xO.js +2 -0
- package/dist/owletto/dist/assets/index-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/index-KPOvMVa-.js +2 -0
- package/dist/owletto/dist/assets/index-Vcq4gwWv.js +1 -0
- package/dist/owletto/dist/assets/index-_oPeVpL_.js +7950 -0
- package/dist/owletto/dist/assets/index-rrnUF981.js +1 -0
- package/dist/owletto/dist/assets/json-diff-D_Ym3Uku.js +4 -0
- package/dist/owletto/dist/assets/{list-skeleton-BtWn2eo2.js → list-skeleton-Bl0OS39L.js} +2 -1
- package/dist/owletto/dist/assets/login-QHdxqX-4.js +2 -0
- package/dist/owletto/dist/assets/logout-DUccApuZ.js +2 -0
- package/dist/owletto/dist/assets/member-scope-gate-CFbrq1by.js +2 -0
- package/dist/owletto/dist/assets/memory-browse-page-IrIXuZTF.js +103 -0
- package/dist/owletto/dist/assets/model-selector-CB1BDvlW.js +2 -0
- package/dist/owletto/dist/assets/models-DnMb3n-Z.js +2 -0
- package/dist/owletto/dist/assets/new-B5UsLiy6.js +2 -0
- package/dist/owletto/dist/assets/new-BWo8_Pms.js +2 -0
- package/dist/owletto/dist/assets/new-DpmDXmFI.js +2 -0
- package/dist/owletto/dist/assets/oauth-workspace-access-PGyTnW2K.js +2 -0
- package/dist/owletto/dist/assets/organization-BH8PYlVu.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-B2AFNTzP.js +2 -0
- package/dist/owletto/dist/assets/{permissions-h_qSft1A.js → permissions-CwN_YP3u.js} +2 -1
- package/dist/owletto/dist/assets/proposal-review-shell-DKKGu4Ww.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-7KYnww6e.js +2 -0
- package/dist/owletto/dist/assets/{recent-JiBNvZzD.js → recent-DqdZE_TI.js} +2 -1
- package/dist/owletto/dist/assets/record-activity-CvgZyCmw.js +2 -0
- package/dist/owletto/dist/assets/{renderer-DgPLyEbx.js → renderer-BL6VcwQH.js} +28 -27
- package/dist/owletto/dist/assets/reset-password-DAvBYkiI.js +2 -0
- package/dist/owletto/dist/assets/runs-BWtc5rmc.js +2 -0
- package/dist/owletto/dist/assets/runs-panel-BO3h5RkS.js +2 -0
- package/dist/owletto/dist/assets/runs-table-DxIiqrSk.js +2 -0
- package/dist/owletto/dist/assets/settings-4Ev-0iNL.js +2 -0
- package/dist/owletto/dist/assets/settings-Crxlwps-.js +2 -0
- package/dist/owletto/dist/assets/skill-editor-D_W3QlRz.js +1 -0
- package/dist/owletto/dist/assets/skills-D0X430X8.js +2 -0
- package/dist/owletto/dist/assets/source-record-panels-CRIPMWfN.js +2 -0
- package/dist/owletto/dist/assets/status-dot-C5KDvvm9.js +2 -0
- package/dist/owletto/dist/assets/tabs-B4Er9hJj.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-B4DfZFm5.js → use-mention-search-DqEykWl_.js} +3 -2
- package/dist/owletto/dist/assets/view-param-filters-Cylutoy1.js +2 -0
- package/dist/owletto/dist/assets/workspace-label-o_QfBuCM.js +2 -0
- package/dist/owletto/dist/index.html +46 -4
- package/dist/providers.json +1 -1
- package/dist/server-main.bundle.mjs +135551 -132880
- package/npm-shrinkwrap.json +578 -611
- package/package.json +4 -3
- package/vendor/connector-sdk/dist/browser-requirement.d.ts +36 -0
- package/vendor/connector-sdk/dist/browser-requirement.js +60 -0
- package/vendor/connector-sdk/dist/connector-runtime.d.ts +3 -1
- package/vendor/connector-sdk/dist/connector-runtime.js +10 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +159 -45
- package/vendor/connector-sdk/dist/define-connector.d.ts +4 -2
- package/vendor/connector-sdk/dist/define-connector.js +3 -0
- package/vendor/connector-sdk/dist/index.d.ts +5 -2
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +16 -21
- package/vendor/connector-sdk/dist/reaction-client-types.typecheck.d.ts +5 -0
- package/vendor/connector-sdk/package.json +5 -1
- package/vendor/core/dist/agent-policy.js +1 -1
- package/vendor/core/dist/agent-store.d.ts +2 -0
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +1 -1
- package/vendor/core/dist/capabilities.js +2 -0
- package/vendor/core/dist/contracts/agent-settings.d.ts +0 -11
- package/vendor/core/dist/contracts/agent-settings.js +1 -7
- package/vendor/core/dist/contracts/tools/collection-presentation.d.ts +93 -0
- package/vendor/core/dist/contracts/tools/collection-presentation.js +88 -0
- package/vendor/core/dist/contracts/tools/collection-selection.d.ts +47 -0
- package/vendor/core/dist/contracts/tools/collection-selection.js +74 -0
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +10 -4
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/manage-auth-profiles.js +5 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +19 -4
- package/vendor/core/dist/contracts/tools/manage-automations.js +25 -8
- package/vendor/core/dist/contracts/tools/manage-connections.d.ts +1 -0
- package/vendor/core/dist/contracts/tools/manage-connections.js +3 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +11 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +42 -3
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +181 -152
- package/vendor/core/dist/contracts/tools/manage-entity.js +118 -162
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +41 -3
- package/vendor/core/dist/contracts/tools/manage-operations.js +40 -2
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +182 -7
- package/vendor/core/dist/contracts/tools/manage-views.js +49 -13
- package/vendor/core/dist/contracts/tools/read-knowledge.d.ts +11 -2
- package/vendor/core/dist/contracts/tools/read-knowledge.js +23 -3
- package/vendor/core/dist/contracts/tools/save-memory.d.ts +3 -6
- package/vendor/core/dist/contracts/tools/save-memory.js +2 -6
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +2 -1
- package/vendor/core/dist/contracts/tools/view-attach.js +7 -2
- package/vendor/core/dist/contracts/worker/protocol.d.ts +122 -28
- package/vendor/core/dist/contracts/worker/protocol.js +81 -17
- package/vendor/core/dist/index.d.ts +3 -4
- package/vendor/core/dist/index.js +3 -6
- package/vendor/core/dist/json-template.d.ts +6 -10
- package/vendor/core/dist/json-template.js +5 -9
- package/vendor/core/dist/logger.js +11 -5
- package/vendor/core/dist/shell-safety.d.ts +9 -0
- package/vendor/core/dist/shell-safety.js +154 -0
- package/vendor/core/dist/suggestions.d.ts +1 -1
- package/vendor/core/dist/suggestions.js +1 -1
- package/vendor/core/dist/tool-trace-summary.d.ts +1 -1
- package/vendor/core/dist/tool-trace-summary.js +1 -1
- package/vendor/core/dist/types.d.ts +1 -3
- package/vendor/core/dist/utils/diagnostic-scrubber.d.ts +7 -0
- package/vendor/core/dist/utils/{sentry-scrubber.js → diagnostic-scrubber.js} +25 -53
- package/vendor/core/dist/worker/auth.d.ts +44 -6
- package/vendor/core/dist/worker/auth.js +44 -11
- package/vendor/core/package.json +15 -6
- package/vendor/views/dist/api.d.ts +39 -29
- package/vendor/views/dist/api.js +110 -83
- package/vendor/views/dist/bridge.d.ts +4 -0
- package/vendor/views/dist/bridge.js +15 -0
- package/vendor/views/dist/index.d.ts +1 -0
- package/vendor/views/dist/index.js +0 -7
- package/vendor/views/package.json +4 -1
- package/dist/owletto/dist/assets/_-CLhipgJI.js +0 -1
- package/dist/owletto/dist/assets/_-D0ZVGAIA.js +0 -2
- package/dist/owletto/dist/assets/_agentId-BLXUf3ot.js +0 -1
- package/dist/owletto/dist/assets/_agentId-DnI66MF3.js +0 -1
- package/dist/owletto/dist/assets/_automationId-ziwseLb7.js +0 -1
- package/dist/owletto/dist/assets/_connectorKey._connectionId-B6V3ySFK.js +0 -1
- package/dist/owletto/dist/assets/_connectorKey.index-CR5u_dtt.js +0 -1
- package/dist/owletto/dist/assets/_conversationId-FBMYmOl8.js +0 -1
- package/dist/owletto/dist/assets/_deploymentId-DNTXbT_m.js +0 -1
- package/dist/owletto/dist/assets/_name-B37LKIxH.js +0 -1
- package/dist/owletto/dist/assets/_owner-BxYumqC2.js +0 -1
- package/dist/owletto/dist/assets/_shape-Bxz-04jR.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-D5MFbiw2.js +0 -1
- package/dist/owletto/dist/assets/_slug-Dlhit09k.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-C6535i-t.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-CQCtY3Y8.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-CxKfKbRa.js +0 -1
- package/dist/owletto/dist/assets/accept-invitation-BQQwec3R.js +0 -1
- package/dist/owletto/dist/assets/activity-route-view-BwThvdGs.js +0 -1
- package/dist/owletto/dist/assets/agent-card-controls-B3RhzsPz.js +0 -1
- package/dist/owletto/dist/assets/agent-connect-pages-BO4wQn4L.js +0 -1
- package/dist/owletto/dist/assets/agent-editor-form-BYC4uSNz.js +0 -1
- package/dist/owletto/dist/assets/agent-guardrails-route-Dp02G1AQ.js +0 -1
- package/dist/owletto/dist/assets/agent-loading-shells-OagauQzV.js +0 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-B9Ho3P1t.js +0 -1
- package/dist/owletto/dist/assets/agent-skills-route-B4VUnVi0.js +0 -1
- package/dist/owletto/dist/assets/agent-subpage-shell-Dz8I-GUt.js +0 -1
- package/dist/owletto/dist/assets/agent-thread-B9-cdkaV.js +0 -8
- package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +0 -1
- package/dist/owletto/dist/assets/agents-D0CIg4b9.js +0 -1
- package/dist/owletto/dist/assets/agents-workbench-C2sr5h82.js +0 -1
- package/dist/owletto/dist/assets/app-bridge-BH3g2mKG.js +0 -127
- package/dist/owletto/dist/assets/app._appId-DLsJ_QWS.js +0 -1
- package/dist/owletto/dist/assets/automation-detail-content-9Rjb_I9j.js +0 -1
- package/dist/owletto/dist/assets/automations-D0CIg4b9.js +0 -1
- package/dist/owletto/dist/assets/calendar-DAiyi1ZL.js +0 -1
- package/dist/owletto/dist/assets/claim-CYHnUF7G.js +0 -1
- package/dist/owletto/dist/assets/clients-Cp1BJ28u.js +0 -1
- package/dist/owletto/dist/assets/code-editor-CYsR2VBP.js +0 -15
- package/dist/owletto/dist/assets/connect-CZip2g_B.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-CEKY8Dnv.js +0 -1
- package/dist/owletto/dist/assets/connected._clientId-C5xRjxNO.js +0 -1
- package/dist/owletto/dist/assets/connection-C06HZ241.js +0 -1
- package/dist/owletto/dist/assets/connection-feed-detail-D1whY5hL.js +0 -1
- package/dist/owletto/dist/assets/consent-CfYDldcF.js +0 -1
- package/dist/owletto/dist/assets/create-C3P-3_8O.js +0 -1
- package/dist/owletto/dist/assets/create-CwnrPUEw.js +0 -1
- package/dist/owletto/dist/assets/create-DOScS9Gl.js +0 -1
- package/dist/owletto/dist/assets/create-automation-form-CuxiIRCF.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-Bjv3lCf8.js +0 -1
- package/dist/owletto/dist/assets/deployments-ByBv1DW-.js +0 -1
- package/dist/owletto/dist/assets/deployments-C-_ECORv.js +0 -1
- package/dist/owletto/dist/assets/device-B0i7Xp8y.js +0 -1
- package/dist/owletto/dist/assets/device-automation-BIjs7DZJ.js +0 -1
- package/dist/owletto/dist/assets/device-pin-tombstone-Bd6vS2zu.js +0 -1
- package/dist/owletto/dist/assets/device-rows-Bwf8qDte.js +0 -1
- package/dist/owletto/dist/assets/device._deviceId-DJLAesm3.js +0 -1
- package/dist/owletto/dist/assets/entity-page-ijZe_1-6.js +0 -1
- package/dist/owletto/dist/assets/entity-type-page-onp2Tk_E.js +0 -1
- package/dist/owletto/dist/assets/event-page-C0B2UDY-.js +0 -1
- package/dist/owletto/dist/assets/events-feed-DK35T4g7.js +0 -1
- package/dist/owletto/dist/assets/full-page-spinner-Dd8eEaxq.js +0 -1
- package/dist/owletto/dist/assets/guardrails-DKO8_J-G.js +0 -1
- package/dist/owletto/dist/assets/identity-CKM54vrM.js +0 -1
- package/dist/owletto/dist/assets/index--VmN5WxW.js +0 -1
- package/dist/owletto/dist/assets/index-B2AmRqYh.js +0 -7898
- package/dist/owletto/dist/assets/index-B_rcEgFX.js +0 -1
- package/dist/owletto/dist/assets/index-BmAuAhub.css +0 -1
- package/dist/owletto/dist/assets/index-BmhGe6-Z.js +0 -1
- package/dist/owletto/dist/assets/index-C1dJSGrL.js +0 -1
- package/dist/owletto/dist/assets/index-CAFw4qCb.js +0 -1
- package/dist/owletto/dist/assets/index-CCcc_xBw.js +0 -52
- package/dist/owletto/dist/assets/index-CLU3gXVm.js +0 -1
- package/dist/owletto/dist/assets/index-CqQVnAY-.js +0 -1
- package/dist/owletto/dist/assets/index-CxT0uyIe.js +0 -1
- package/dist/owletto/dist/assets/index-DR08e6Ec.js +0 -1
- package/dist/owletto/dist/assets/index-DYb9L5FC.js +0 -1
- package/dist/owletto/dist/assets/index-SUUcQGT-.js +0 -1
- package/dist/owletto/dist/assets/index-SdiFOfR1.js +0 -1
- package/dist/owletto/dist/assets/index-zcfi5r1l.js +0 -1
- package/dist/owletto/dist/assets/json-diff-ClBBYBQD.js +0 -3
- package/dist/owletto/dist/assets/login-d3PdO-qV.js +0 -1
- package/dist/owletto/dist/assets/logout-DgckxwLn.js +0 -1
- package/dist/owletto/dist/assets/member-scope-gate-DXOCfx-v.js +0 -1
- package/dist/owletto/dist/assets/memory-browse-page-CeAnKoTR.js +0 -101
- package/dist/owletto/dist/assets/missing-view-DrZ8m8yo.js +0 -1
- package/dist/owletto/dist/assets/model-selector-CapL1ARf.js +0 -1
- package/dist/owletto/dist/assets/models-CB8mhq7j.js +0 -1
- package/dist/owletto/dist/assets/new-BBUb-VR4.js +0 -1
- package/dist/owletto/dist/assets/new-CBLJ25_w.js +0 -1
- package/dist/owletto/dist/assets/new-tTXB4qBW.js +0 -1
- package/dist/owletto/dist/assets/oauth-workspace-access-DearynqZ.js +0 -1
- package/dist/owletto/dist/assets/organization-BgdBg-PJ.js +0 -1
- package/dist/owletto/dist/assets/pending-seed-CPbfgnLX.js +0 -1
- package/dist/owletto/dist/assets/proposal-review-shell-D4YNrrye.js +0 -1
- package/dist/owletto/dist/assets/reset-password-B8tWPtIj.js +0 -1
- package/dist/owletto/dist/assets/runs-oHveuEUB.js +0 -1
- package/dist/owletto/dist/assets/runs-panel-C56GDaJm.js +0 -1
- package/dist/owletto/dist/assets/runs-table-BUKDjiBc.js +0 -1
- package/dist/owletto/dist/assets/schema-value-normalization-3JuM_r1H.js +0 -1
- package/dist/owletto/dist/assets/settings-DaKg6U5O.js +0 -1
- package/dist/owletto/dist/assets/settings-DhnRi2nq.js +0 -1
- package/dist/owletto/dist/assets/skills-BpQncuMC.js +0 -1
- package/dist/owletto/dist/assets/switch-BQ40_DMb.js +0 -1
- package/dist/owletto/dist/assets/use-applied-views-B-Z-Weji.js +0 -1
- package/dist/owletto/dist/assets/view-frame-C7ciEoLo.js +0 -1
- package/vendor/core/dist/sentry.d.ts +0 -26
- package/vendor/core/dist/sentry.js +0 -133
- package/vendor/core/dist/tool-policy.d.ts +0 -74
- package/vendor/core/dist/tool-policy.js +0 -305
- package/vendor/core/dist/utils/sentry-scrubber.d.ts +0 -29
|
@@ -354,7 +354,7 @@ export default class PostgresConnector extends ConnectorRuntime {
|
|
|
354
354
|
description:
|
|
355
355
|
'Bring your own PostgreSQL database as memory, read a configured feed directly, or run governed connection-level SQL.',
|
|
356
356
|
version: '1.1.0',
|
|
357
|
-
queryCapabilities: { exactMatch: true },
|
|
357
|
+
queryCapabilities: { exactMatch: true, selection: true },
|
|
358
358
|
faviconDomain: 'postgresql.org',
|
|
359
359
|
authSchema: {
|
|
360
360
|
methods: [
|
|
@@ -588,11 +588,36 @@ export default class PostgresConnector extends ConnectorRuntime {
|
|
|
588
588
|
});
|
|
589
589
|
where = `WHERE CASE ${cases.join(' ')} ELSE FALSE END`;
|
|
590
590
|
}
|
|
591
|
+
if (ctx.selection?.search || ctx.selection?.filters?.length) {
|
|
592
|
+
const projection = await tx.unsafe(`SELECT * FROM (\n${baseSql}\n) q LIMIT 0`);
|
|
593
|
+
const names = new Set(projection.columns.map((column) => column.name));
|
|
594
|
+
const requireColumn = (field: string) => {
|
|
595
|
+
if (!names.has(field)) throw Object.assign(new Error(`Unknown selection attribute: ${field}`), { status: 400 });
|
|
596
|
+
};
|
|
597
|
+
const predicates: string[] = [];
|
|
598
|
+
if (ctx.selection.search) {
|
|
599
|
+
requireColumn('name');
|
|
600
|
+
const escaped = ctx.selection.search.replace(/[!%_]/g, '!$&');
|
|
601
|
+
predicates.push(`q."name"::text ILIKE ${bind(`%${escaped}%`)} ESCAPE '!'`);
|
|
602
|
+
}
|
|
603
|
+
for (const filter of ctx.selection.filters ?? []) {
|
|
604
|
+
requireColumn(filter.field);
|
|
605
|
+
const actual = `COALESCE(to_jsonb(q) -> ${bind(filter.field)}, 'null'::jsonb)`;
|
|
606
|
+
const expected = `${bind(JSON.stringify(filter.value))}::jsonb`;
|
|
607
|
+
if (filter.op === 'eq' || filter.op === 'neq') {
|
|
608
|
+
predicates.push(`${actual} ${filter.op === 'eq' ? '=' : '<>'} ${expected}`);
|
|
609
|
+
} else {
|
|
610
|
+
const operator = { lt: '<', lte: '<=', gt: '>', gte: '>=' }[filter.op];
|
|
611
|
+
predicates.push(`(jsonb_typeof(${actual}) = jsonb_typeof(${expected}) AND ${actual} ${operator} ${expected})`);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (predicates.length) where += `${where ? ' AND' : 'WHERE'} ${predicates.join(' AND ')}`;
|
|
615
|
+
}
|
|
591
616
|
const wrapped = `SELECT * FROM (\n${baseSql}\n) q\n${where}\n${orderBy}\nLIMIT ${limit} OFFSET ${offset}`;
|
|
592
617
|
const rows = await tx.unsafe(wrapped, params);
|
|
593
618
|
// Record lookup needs only its bounded result, never a full-source count.
|
|
594
619
|
if (ctx.exactMatch) return { data: rows, total: undefined };
|
|
595
|
-
const counted = (await tx.unsafe(countSql)) as unknown as Array<{ n: number }>;
|
|
620
|
+
const counted = (await tx.unsafe(`${countSql}\n${where}`, params)) as unknown as Array<{ n: number }>;
|
|
596
621
|
return { data: rows, total: counted[0]?.n };
|
|
597
622
|
})) as unknown as {
|
|
598
623
|
data: Array<Record<string, unknown>> & { columns?: Array<{ name: string; type: number }> };
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// Serialized into the paired browser. Read only the inbox's own loaded records
|
|
2
|
+
// and read loaders; never return provider clients, tickets, or arbitrary state.
|
|
3
|
+
export async function tiktokInboxPage(input) {
|
|
4
|
+
const fail = message => { throw new Error(`TikTok inbox: ${message}`); };
|
|
5
|
+
const visible = element => !!element?.getClientRects().length;
|
|
6
|
+
const account = () => {
|
|
7
|
+
if (location.origin !== "https://www.tiktok.com") fail("Wrong page origin");
|
|
8
|
+
if (visible(document.querySelector("#captcha-verify-container-main-page"))) fail("Verification required in the connected browser");
|
|
9
|
+
const raw = document.querySelector("#__UNIVERSAL_DATA_FOR_REHYDRATION__")?.textContent;
|
|
10
|
+
const user = raw && JSON.parse(raw).__DEFAULT_SCOPE__?.["webapp.app-context"]?.user;
|
|
11
|
+
if (typeof user?.uid !== "string" || !/^\d+$/.test(user.uid)) fail("Sign-in is required");
|
|
12
|
+
return user.uid;
|
|
13
|
+
};
|
|
14
|
+
const owner = account();
|
|
15
|
+
const deadline = Date.now() + 20000;
|
|
16
|
+
const pause = () => new Promise(resolve => setTimeout(resolve, 100));
|
|
17
|
+
const wait = async read => {
|
|
18
|
+
while (Date.now() < deadline) {
|
|
19
|
+
if (account() !== owner) fail("Account changed during the read");
|
|
20
|
+
const value = read();
|
|
21
|
+
if (value) return value;
|
|
22
|
+
await pause();
|
|
23
|
+
}
|
|
24
|
+
fail("Inbox did not finish loading; restart this page read");
|
|
25
|
+
};
|
|
26
|
+
const readWithinDeadline = async read => {
|
|
27
|
+
let outcome;
|
|
28
|
+
Promise.resolve().then(read).then(value => { outcome = { value }; }, error => { outcome = { error }; });
|
|
29
|
+
const settled = await wait(() => outcome);
|
|
30
|
+
if ("error" in settled) throw settled.error;
|
|
31
|
+
return settled.value;
|
|
32
|
+
};
|
|
33
|
+
const feed = input.feed;
|
|
34
|
+
if (!["messages", "activity"].includes(feed)) fail("Unsupported feed");
|
|
35
|
+
const limit = input.limit ?? 20;
|
|
36
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) fail("limit must be between 1 and 100");
|
|
37
|
+
let cursor = {};
|
|
38
|
+
if (input.cursor !== undefined) {
|
|
39
|
+
if (typeof input.cursor !== "string" || input.cursor.length > 100000) fail("Invalid cursor");
|
|
40
|
+
try { cursor = JSON.parse(input.cursor); } catch { fail("Invalid cursor"); }
|
|
41
|
+
if (!cursor || cursor.v !== (feed === "messages" ? 2 : 1) || cursor.feed !== feed || cursor.account !== owner) fail("Cursor belongs to a different source or account");
|
|
42
|
+
if (cursor.after !== undefined && (typeof cursor.after !== "string" || !/^\d+$/.test(cursor.after))) fail("Invalid message or activity cursor");
|
|
43
|
+
if (feed === "messages" && (typeof cursor.thread !== "string" || !/^[0-9:]{1,150}$/.test(cursor.thread))) fail("Invalid conversation cursor");
|
|
44
|
+
}
|
|
45
|
+
const result = async (rows, next) => {
|
|
46
|
+
const revised = await Promise.all(rows.map(async row => {
|
|
47
|
+
const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(row)));
|
|
48
|
+
return { ...row, source_revision: [...new Uint8Array(bytes)].map(byte => byte.toString(16).padStart(2, "0")).join("") };
|
|
49
|
+
}));
|
|
50
|
+
if (account() !== owner) fail("Account changed during the read");
|
|
51
|
+
return { rows: revised, hasMore: !!next, ...(next ? { nextCursor: JSON.stringify({ v: feed === "messages" ? 2 : 1, feed, account: owner, ...next }) } : {}) };
|
|
52
|
+
};
|
|
53
|
+
// React attaches the source record and loading state to these exact inbox
|
|
54
|
+
// components. Match their shape, not minified component names or hook indexes.
|
|
55
|
+
function* fibers(element) {
|
|
56
|
+
let fiber = element?.[Object.keys(element).find(key => key.startsWith("__reactFiber$"))];
|
|
57
|
+
// DOM references can retain the alternate after an immutable React commit.
|
|
58
|
+
// Resolve membership in the committed tree, never prefer an alternate blindly.
|
|
59
|
+
const nodeBudget = 50000;
|
|
60
|
+
let root = fiber;
|
|
61
|
+
// TikTok's inbox can sit more than 100 ancestors below its host root.
|
|
62
|
+
for (let i = 0; root?.return && i < nodeBudget; i++) root = root.return;
|
|
63
|
+
if (root?.return) fail("Inbox component root exceeds this read's node budget");
|
|
64
|
+
const current = root?.stateNode?.current;
|
|
65
|
+
if (current) {
|
|
66
|
+
const pending = [{ node: current, parent: null }];
|
|
67
|
+
let found;
|
|
68
|
+
for (let i = 0; pending.length && i < nodeBudget; i++) {
|
|
69
|
+
const entry = pending.pop();
|
|
70
|
+
const node = entry.node;
|
|
71
|
+
if (node === fiber || node === fiber?.alternate) { found = entry; break; }
|
|
72
|
+
if (node.sibling) pending.push({ node: node.sibling, parent: entry.parent });
|
|
73
|
+
if (node.child) pending.push({ node: node.child, parent: entry });
|
|
74
|
+
}
|
|
75
|
+
if (!found) fail("Inbox component is no longer mounted");
|
|
76
|
+
// A reused child can still point back to an old ancestor via `return`.
|
|
77
|
+
// Keep the ancestor path discovered in the committed tree itself.
|
|
78
|
+
for (let i = 0; found && i < 16; i++, found = found.parent) yield found.node;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (fiber?.alternate) fail("Committed inbox component is unavailable");
|
|
82
|
+
for (let i = 0; fiber && i < 16; i++, fiber = fiber.return) yield fiber;
|
|
83
|
+
}
|
|
84
|
+
const props = (element, predicate) => {
|
|
85
|
+
for (const fiber of fibers(element)) {
|
|
86
|
+
if (predicate(fiber.memoizedProps)) return fiber.memoizedProps;
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
};
|
|
90
|
+
const show = async key => {
|
|
91
|
+
const button = await wait(() => [...document.querySelectorAll(`[data-e2e="nav-${key}"]`)].find(visible));
|
|
92
|
+
if (button.getAttribute("aria-pressed") !== "true") button.click();
|
|
93
|
+
};
|
|
94
|
+
if (feed === "activity") {
|
|
95
|
+
await show("activity");
|
|
96
|
+
const panel = await wait(() => [...document.querySelectorAll('[data-e2e="inbox-list"]')].find(visible));
|
|
97
|
+
const source = () => props(panel, p => Array.isArray(p?.item?.notice_list) && typeof p.onHitBottom === "function");
|
|
98
|
+
await wait(source);
|
|
99
|
+
const current = () => {
|
|
100
|
+
const value = source();
|
|
101
|
+
if (!value || ![0, 1, false, true].includes(value.item.has_more) || typeof value.item.loading !== "boolean") fail("Activity loading state is unavailable");
|
|
102
|
+
return value;
|
|
103
|
+
};
|
|
104
|
+
const load = async () => {
|
|
105
|
+
await wait(() => !current().item.loading);
|
|
106
|
+
const before = current().item;
|
|
107
|
+
const stamp = JSON.stringify([before.min_time, before.max_time, before.notice_list.map(n => n.nid_str)]);
|
|
108
|
+
await readWithinDeadline(() => current().onHitBottom());
|
|
109
|
+
await wait(() => {
|
|
110
|
+
const next = current().item;
|
|
111
|
+
return !next.loading && (!next.has_more || JSON.stringify([next.min_time, next.max_time, next.notice_list.map(n => n.nid_str)]) !== stamp);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
// TikTok can display its empty placeholder before making the first request.
|
|
115
|
+
// Its initial has_more=1 must never be interpreted as a successful empty read.
|
|
116
|
+
await wait(() => !current().item.loading);
|
|
117
|
+
if (!current().item.notice_list.length && current().item.has_more) await load();
|
|
118
|
+
for (let page = 0; page < 20; page++) {
|
|
119
|
+
const state = current().item;
|
|
120
|
+
if (state.notice_list.some(n => typeof n.nid_str !== "string" || !/^\d+$/.test(n.nid_str))) fail("Activity source identity is unavailable");
|
|
121
|
+
const start = cursor.after ? state.notice_list.findIndex(n => n.nid_str === cursor.after) + 1 : 0;
|
|
122
|
+
if (cursor.after && !start) {
|
|
123
|
+
if (!state.has_more) fail("Activity cursor expired; restart the read");
|
|
124
|
+
await load();
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const items = state.notice_list.slice(start, start + limit);
|
|
128
|
+
if (!items.length && state.has_more) { await load(); continue; }
|
|
129
|
+
const rendered = new Map();
|
|
130
|
+
for (const element of panel.querySelectorAll('[data-e2e="inbox-list-item"]')) {
|
|
131
|
+
const item = props(element, p => typeof p?.item?.nid_str === "string")?.item;
|
|
132
|
+
if (item) rendered.set(item.nid_str, element);
|
|
133
|
+
}
|
|
134
|
+
const rows = items.map(item => {
|
|
135
|
+
const element = rendered.get(item.nid_str);
|
|
136
|
+
const text = element?.innerText?.trim();
|
|
137
|
+
if (!text) fail("An activity record has no rendered content; coverage is incomplete");
|
|
138
|
+
const links = [...new Set([...element.querySelectorAll("a[href]")].map(a => {
|
|
139
|
+
const url = new URL(a.href);
|
|
140
|
+
return url.origin === location.origin ? `${url.origin}${url.pathname}` : null;
|
|
141
|
+
}).filter(Boolean))];
|
|
142
|
+
const seconds = Number(item.create_time);
|
|
143
|
+
if (!Number.isFinite(seconds) || seconds <= 0 || seconds > 8640000000000) fail("Activity timestamp is unavailable");
|
|
144
|
+
return { id: item.nid_str, origin_id: item.nid_str, type: item.type, text, occurred_at: new Date(seconds * 1000).toISOString(), read: item.has_read === true, source_url: links.find(url => /\/(video|photo)\/\d+$/.test(url)) ?? links[0] ?? location.origin, links };
|
|
145
|
+
});
|
|
146
|
+
const more = start + items.length < state.notice_list.length || !!state.has_more;
|
|
147
|
+
return result(rows, more ? { after: items.at(-1).nid_str } : null);
|
|
148
|
+
}
|
|
149
|
+
fail("Activity cursor exceeds this read's page budget; restart the read");
|
|
150
|
+
}
|
|
151
|
+
await show("messages");
|
|
152
|
+
const list = await wait(() => document.querySelector('[data-e2e="dm-new-conversation-list"]'));
|
|
153
|
+
const clientApi = () => {
|
|
154
|
+
const elements = [list, ...list.querySelectorAll("div")].slice(0,12);
|
|
155
|
+
for (const element of elements) for (const fiber of fibers(element)) {
|
|
156
|
+
let hook = fiber.memoizedState;
|
|
157
|
+
for (let i = 0; hook && i < 180; i++, hook = hook.next) {
|
|
158
|
+
const api = hook.memoizedState?.current?.value;
|
|
159
|
+
if (api?.stateStore && typeof api.stateStore.isInitSucceeded === "boolean" && typeof api.instance?.getConversationList === "function" && typeof api.instance?.getMessagesByConversation === "function") return api;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
};
|
|
164
|
+
const api = await wait(clientApi);
|
|
165
|
+
if (api.instance.ctx?.option?.userId !== owner) fail("Message client belongs to a different account");
|
|
166
|
+
await wait(() => {
|
|
167
|
+
if (api.stateStore.isInitError || api.stateStore.isNotAvailable) fail("Message initialization failed");
|
|
168
|
+
return api.stateStore.isInitSucceeded && api.stateStore.isInitLoadDone;
|
|
169
|
+
});
|
|
170
|
+
const sourceThreads = api.instance.getConversationList();
|
|
171
|
+
if (!Array.isArray(sourceThreads)) fail("Conversation list is unavailable");
|
|
172
|
+
if (sourceThreads.some(thread => typeof thread.id !== "string" || !/^[0-9:]{1,150}$/.test(thread.id))) fail("Conversation source identity is unavailable");
|
|
173
|
+
if (sourceThreads.length > 200) fail("Conversation list exceeds this scan's budget; coverage is incomplete");
|
|
174
|
+
const ids = sourceThreads.map(thread => thread.id);
|
|
175
|
+
const snapshot = [...ids].sort();
|
|
176
|
+
const finish = async (rows, next) => {
|
|
177
|
+
const output = await result(rows, next);
|
|
178
|
+
if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read");
|
|
179
|
+
const latest = api.instance.getConversationList();
|
|
180
|
+
if (!Array.isArray(latest) || JSON.stringify(latest.map(thread => thread.id).sort()) !== JSON.stringify(snapshot)) fail("Conversation set changed; restart the read, previous coverage is incomplete");
|
|
181
|
+
return output;
|
|
182
|
+
};
|
|
183
|
+
const validIds = values => Array.isArray(values) && values.length <= 200 && values.every(id => typeof id === "string" && ids.includes(id));
|
|
184
|
+
if (input.cursor !== undefined) {
|
|
185
|
+
if (!Array.isArray(cursor.snapshot) || JSON.stringify(cursor.snapshot) !== JSON.stringify(snapshot)) fail("Conversation set changed; restart the read, previous coverage is incomplete");
|
|
186
|
+
if (!ids.includes(cursor.thread) || !["recent", "history"].includes(cursor.phase) || (cursor.phase === "history" ? cursor.after === undefined : cursor.after !== undefined) || !validIds(cursor.remaining) || !Array.isArray(cursor.history) || cursor.history.length > 200 || cursor.history.some(item => !ids.includes(item?.thread) || typeof item.after !== "string" || !/^\d+$/.test(item.after))) fail("Invalid conversation scan cursor");
|
|
187
|
+
}
|
|
188
|
+
// Take one recent page per conversation before draining old history. Preserve
|
|
189
|
+
// the initial order across recency changes; set changes require a fresh scan.
|
|
190
|
+
const phase = cursor.phase ?? "recent";
|
|
191
|
+
const remaining = cursor.remaining ?? ids.slice(1);
|
|
192
|
+
const history = cursor.history ?? [];
|
|
193
|
+
const thread = sourceThreads.find(thread => thread.id === (cursor.thread ?? ids[0]));
|
|
194
|
+
if (!thread) return finish([], null);
|
|
195
|
+
if (typeof thread.getMessageList !== "function" || typeof thread.hasMoreMessages !== "boolean") fail("Conversation loading state is unavailable");
|
|
196
|
+
const project = message => {
|
|
197
|
+
if (typeof message.serverId !== "string" || !/^\d+$/.test(message.serverId) || message.conversationId !== thread.id) fail("Message source identity is unavailable");
|
|
198
|
+
let content;
|
|
199
|
+
try { content = typeof message.content === "string" ? JSON.parse(message.content) : message.content; } catch { fail("Message content is unavailable"); }
|
|
200
|
+
const timestamp = message.createdAt?.getTime?.();
|
|
201
|
+
if (!Number.isFinite(timestamp) || typeof message.isFromMe !== "boolean") fail("Message timestamp or direction is unavailable");
|
|
202
|
+
const plainText = message.type === 7 && typeof content?.text === "string" && Object.keys(content).every(key => key === "text");
|
|
203
|
+
return { id: message.serverId, origin_id: message.serverId, conversation_id: thread.id, conversation_name: thread.isGroupChat ? thread.coreInfo?.name ?? null : null, source_url: location.origin, text: message.isRecalled ? "" : typeof content?.text === "string" ? content.text : typeof content?.tips === "string" ? content.tips : "", type: message.type, sender_id: typeof message.sender === "string" ? message.sender : null, from_me: message.isFromMe, occurred_at: new Date(timestamp).toISOString(), recalled: message.isRecalled === true, has_uninspected_content: !plainText };
|
|
204
|
+
};
|
|
205
|
+
for (let page = 0; page < 20; page++) {
|
|
206
|
+
await wait(() => !thread.isPullingMessages);
|
|
207
|
+
if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read");
|
|
208
|
+
const messages = thread.getMessageList().map(project).sort((a,b) => b.occurred_at.localeCompare(a.occurred_at) || b.id.localeCompare(a.id));
|
|
209
|
+
const start = cursor.after ? messages.findIndex(message => message.id === cursor.after) + 1 : 0;
|
|
210
|
+
if ((cursor.after && !start) || start === messages.length && thread.hasMoreMessages) {
|
|
211
|
+
if (!thread.hasMoreMessages) fail("Message cursor expired; restart the read");
|
|
212
|
+
const response = await readWithinDeadline(() => api.instance.getMessagesByConversation({ conversation: thread, limit: 50 }));
|
|
213
|
+
if (typeof response?.hasMore !== "boolean" || !Array.isArray(response.messages)) fail("Message history returned no completion state");
|
|
214
|
+
if (response.hasMore && !response.messages.length) fail("Message history did not advance");
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
const rows = messages.slice(start, start + limit);
|
|
218
|
+
const more = start + rows.length < messages.length || thread.hasMoreMessages;
|
|
219
|
+
const queued = [...history];
|
|
220
|
+
if (more && phase === "recent") queued.push({ thread: thread.id, after: rows.at(-1).id });
|
|
221
|
+
const base = { snapshot, remaining, history: queued };
|
|
222
|
+
const next = phase === "recent" && remaining.length
|
|
223
|
+
? { ...base, phase: "recent", thread: remaining[0], remaining: remaining.slice(1) }
|
|
224
|
+
: more && phase === "history"
|
|
225
|
+
? { ...base, phase, thread: thread.id, after: rows.at(-1).id }
|
|
226
|
+
: queued.length ? { ...base, phase: "history", ...queued[0], history: queued.slice(1) } : null;
|
|
227
|
+
return finish(rows, next);
|
|
228
|
+
}
|
|
229
|
+
fail("Message cursor exceeds this read's page budget; restart the read");
|
|
230
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Self-contained browser adapter. Serialized into the user's paired browser;
|
|
2
|
+
// keep every dependency inside this function, as in the WhatsApp page adapter.
|
|
3
|
+
export async function tiktokPage(command, args = {}) {
|
|
4
|
+
const visible = (e) => !!e && e.getClientRects().length > 0;
|
|
5
|
+
const assertNoChallenge = () => {
|
|
6
|
+
if (visible(document.querySelector("#captcha-verify-container-main-page"))) {
|
|
7
|
+
throw new Error("TikTok verification required; complete the challenge in the connected browser");
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
assertNoChallenge();
|
|
11
|
+
const scope = () => {
|
|
12
|
+
const script = document.querySelector("#__UNIVERSAL_DATA_FOR_REHYDRATION__");
|
|
13
|
+
return script ? JSON.parse(script.textContent).__DEFAULT_SCOPE__ || {} : {};
|
|
14
|
+
};
|
|
15
|
+
const identity = () => {
|
|
16
|
+
const user = scope()["webapp.app-context"]?.user;
|
|
17
|
+
return typeof user?.uid === "string" && /^[0-9]+$/.test(user.uid)
|
|
18
|
+
? { accountId: user.uid, displayName: user.uniqueId } : null;
|
|
19
|
+
};
|
|
20
|
+
const wait = async (read) => {
|
|
21
|
+
for (let i = 0; i < 40; i++) {
|
|
22
|
+
const value = read();
|
|
23
|
+
if (value) return value;
|
|
24
|
+
await new Promise(resolve => setTimeout(resolve, 250));
|
|
25
|
+
}
|
|
26
|
+
throw new Error("TikTok page did not expose the requested content; it may be loading, signed out, or unavailable");
|
|
27
|
+
};
|
|
28
|
+
if (command === "identity") {
|
|
29
|
+
try { return await wait(identity); } catch { return null; }
|
|
30
|
+
}
|
|
31
|
+
if (!identity()) throw new Error("TikTok sign-in is required");
|
|
32
|
+
const assertFollowing = () => {
|
|
33
|
+
if (location.origin !== "https://www.tiktok.com" || location.pathname !== "/following") throw new Error("TikTok Following page changed");
|
|
34
|
+
assertNoChallenge();
|
|
35
|
+
if (!identity()) throw new Error("TikTok sign-in is required");
|
|
36
|
+
};
|
|
37
|
+
if (command === "following_status" || command === "following_wait") {
|
|
38
|
+
assertFollowing();
|
|
39
|
+
document.querySelectorAll("video,audio").forEach(media => { media.muted = true; });
|
|
40
|
+
if (command === "following_wait") {
|
|
41
|
+
await new Promise(resolve => setTimeout(resolve, 250));
|
|
42
|
+
assertFollowing();
|
|
43
|
+
}
|
|
44
|
+
return { ready: true };
|
|
45
|
+
}
|
|
46
|
+
const project = (item) => ({
|
|
47
|
+
id: item.id, desc: item.desc, createTime: item.createTime,
|
|
48
|
+
author: item.author && { id: item.author.id, uniqueId: item.author.uniqueId, nickname: item.author.nickname },
|
|
49
|
+
video: item.video && { duration: item.video.duration, width: item.video.width, height: item.video.height },
|
|
50
|
+
imagePost: item.imagePost && { images: item.imagePost.images?.map(() => ({})) },
|
|
51
|
+
stats: item.stats && { diggCount: item.stats.diggCount, commentCount: item.stats.commentCount, playCount: item.stats.playCount, shareCount: item.stats.shareCount },
|
|
52
|
+
digged: item.digged,
|
|
53
|
+
});
|
|
54
|
+
if (command === "following_posts") {
|
|
55
|
+
assertFollowing();
|
|
56
|
+
const url = new URL(args.url);
|
|
57
|
+
if (url.origin !== location.origin || url.pathname !== "/api/following/item_list/" || url.username || url.password) throw new Error("Unexpected TikTok Following URL");
|
|
58
|
+
if (!Number.isInteger(args.limit) || args.limit < 1 || args.limit > 30 || !Array.isArray(args.seen_ids)) throw new Error("Invalid TikTok Following collection request");
|
|
59
|
+
const seen = new Set(args.seen_ids);
|
|
60
|
+
const items = new Map();
|
|
61
|
+
const requested = new Set();
|
|
62
|
+
let { cursor, level } = args;
|
|
63
|
+
let hasMore = true;
|
|
64
|
+
const controller = new AbortController();
|
|
65
|
+
const timer = setTimeout(() => controller.abort(), 16000);
|
|
66
|
+
try {
|
|
67
|
+
for (let round = 0; round < 12 && seen.size < args.limit && hasMore; round++) {
|
|
68
|
+
assertFollowing();
|
|
69
|
+
if (typeof cursor !== "string" || !cursor || cursor.length > 256 || !Number.isSafeInteger(level) || level < 1) throw new Error("TikTok Following continuation is unavailable");
|
|
70
|
+
const key = `${level}:${cursor}`;
|
|
71
|
+
if (requested.has(key)) break;
|
|
72
|
+
requested.add(key);
|
|
73
|
+
// Native nine-item requests repeat the first page. Thirty-item
|
|
74
|
+
// requests expose older pages; preserve the returned cursor's units
|
|
75
|
+
// and level rather than guessing a timestamp or an offset.
|
|
76
|
+
url.searchParams.set("count", "30");
|
|
77
|
+
url.searchParams.set("pullType", "2");
|
|
78
|
+
url.searchParams.set("cursor", cursor);
|
|
79
|
+
url.searchParams.set("level", String(level));
|
|
80
|
+
document.querySelectorAll("video,audio").forEach(media => { media.muted = true; });
|
|
81
|
+
const response = await fetch(url.href, { credentials: "include", signal: controller.signal });
|
|
82
|
+
if (response.status !== 200) throw new Error("TikTok Following continuation request failed");
|
|
83
|
+
const json = await response.json();
|
|
84
|
+
assertFollowing();
|
|
85
|
+
if (json.status_code !== 0 || (json.statusCode !== undefined && json.statusCode !== 0) || !Array.isArray(json.itemList) || typeof json.hasMore !== "boolean") throw new Error("TikTok did not return a successful Following feed");
|
|
86
|
+
for (const item of json.itemList) {
|
|
87
|
+
seen.add(item.id);
|
|
88
|
+
items.set(item.id, project(item));
|
|
89
|
+
}
|
|
90
|
+
({ cursor, level, hasMore } = json);
|
|
91
|
+
}
|
|
92
|
+
} finally { clearTimeout(timer); }
|
|
93
|
+
assertFollowing();
|
|
94
|
+
if (seen.size < args.limit && hasMore) throw new Error(`TikTok Following read incomplete: collected ${seen.size} of ${args.limit} requested posts; retry the read`);
|
|
95
|
+
return { items: [...items.values()] };
|
|
96
|
+
}
|
|
97
|
+
if (command === "snapshot") {
|
|
98
|
+
const d = scope();
|
|
99
|
+
return { items: (d["webapp.updated-items"] || []).map(project) };
|
|
100
|
+
}
|
|
101
|
+
if (command === "post_links") {
|
|
102
|
+
// Hidden preload links appear before search results render. Their presence
|
|
103
|
+
// satisfies wait_for_selector but cannot establish readable coverage.
|
|
104
|
+
const links = await wait(() => {
|
|
105
|
+
assertNoChallenge();
|
|
106
|
+
const rendered = [...document.querySelectorAll('a[href*="/video/"],a[href*="/photo/"]')].filter(visible);
|
|
107
|
+
return rendered.length ? rendered : null;
|
|
108
|
+
});
|
|
109
|
+
return { rows: links.map(a => ({
|
|
110
|
+
url: a.href, text: a.querySelector("img")?.alt || a.innerText || "",
|
|
111
|
+
})) };
|
|
112
|
+
}
|
|
113
|
+
const detail = args.source_item || await wait(() => scope()["webapp.video-detail"]?.itemInfo?.itemStruct);
|
|
114
|
+
const target = new URL(args.url);
|
|
115
|
+
if (!/^[A-Za-z0-9_.]{1,64}$/.test(detail.author?.uniqueId || "")) throw new Error("TikTok post author is invalid");
|
|
116
|
+
const assertTarget = () => {
|
|
117
|
+
if (location.origin !== target.origin || location.pathname !== target.pathname || detail.id !== target.pathname.split("/").pop()) {
|
|
118
|
+
throw new Error("TikTok post changed; refusing to act on a different post");
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
assertTarget();
|
|
122
|
+
const card = await wait(() => {
|
|
123
|
+
// The rendered card has no permalink. Its menu carries the source post
|
|
124
|
+
// ID, which distinguishes posts even when a creator reuses a caption.
|
|
125
|
+
const matches = [...document.querySelectorAll('[data-e2e="recommend-list-item-container"]')].filter(candidate =>
|
|
126
|
+
visible(candidate) && candidate.querySelector('[data-e2e="more-menu-icon"]')?.getAttribute("data-more-menu-item-id") === detail.id
|
|
127
|
+
);
|
|
128
|
+
if (matches.length > 1) throw new Error("TikTok displayed post identity is ambiguous");
|
|
129
|
+
return matches[0];
|
|
130
|
+
});
|
|
131
|
+
// A user-owned tab can change posts while the rendered card is loading.
|
|
132
|
+
assertTarget();
|
|
133
|
+
const author = card.querySelector(`a[href="/@${detail.author.uniqueId}"]`);
|
|
134
|
+
const description = card.querySelector('[data-e2e="video-desc"]');
|
|
135
|
+
const compact = text => String(text || "").replace(/\s+/g, "").trim();
|
|
136
|
+
if (!author || (detail.desc && !compact(description?.textContent).includes(compact(detail.desc)))) {
|
|
137
|
+
throw new Error("TikTok displayed post does not match the requested source record");
|
|
138
|
+
}
|
|
139
|
+
const likeButton = card.querySelector('[data-e2e="like-icon"]');
|
|
140
|
+
const liked = () => {
|
|
141
|
+
const value = likeButton?.getAttribute("aria-pressed");
|
|
142
|
+
if (value !== "true" && value !== "false") throw new Error("TikTok like state is unavailable");
|
|
143
|
+
return value === "true";
|
|
144
|
+
};
|
|
145
|
+
if (command === "detail") return { item: project(detail), liked: liked() };
|
|
146
|
+
if (command === "mute") {
|
|
147
|
+
card.querySelectorAll("video,audio").forEach(media => { media.muted = true; });
|
|
148
|
+
return { muted: true };
|
|
149
|
+
}
|
|
150
|
+
if (command === "photo") {
|
|
151
|
+
const count = detail.imagePost?.images?.length;
|
|
152
|
+
const index = args.index;
|
|
153
|
+
if (!Number.isInteger(index) || index < 0 || !count || index >= count) throw new Error("Photo index is outside this post");
|
|
154
|
+
const carousel = card.querySelector(".swiper")?.swiper;
|
|
155
|
+
if (typeof carousel?.slideToLoop !== "function" || typeof carousel?.autoplay?.stop !== "function") throw new Error("TikTok photo carousel is unavailable");
|
|
156
|
+
carousel.autoplay.stop();
|
|
157
|
+
carousel.slideToLoop(index, 0);
|
|
158
|
+
await wait(() => carousel.realIndex === index && !carousel.animating);
|
|
159
|
+
const slide = card.querySelector(".swiper-slide-active");
|
|
160
|
+
const image = slide?.querySelector("img");
|
|
161
|
+
await wait(() => image?.complete && image.naturalWidth > 0);
|
|
162
|
+
assertTarget();
|
|
163
|
+
slide.scrollIntoView({ block: "center", behavior: "instant" });
|
|
164
|
+
return { photo_index: index, photo_count: count };
|
|
165
|
+
}
|
|
166
|
+
if (command === "set_like") {
|
|
167
|
+
if (typeof args.liked !== "boolean") throw new Error("liked must be a boolean");
|
|
168
|
+
const before = liked();
|
|
169
|
+
if (before !== args.liked) {
|
|
170
|
+
likeButton.click();
|
|
171
|
+
await wait(() => liked() === args.liked);
|
|
172
|
+
}
|
|
173
|
+
assertTarget();
|
|
174
|
+
return { liked: liked(), changed: before !== args.liked };
|
|
175
|
+
}
|
|
176
|
+
if (command === "frame") {
|
|
177
|
+
const video = card.querySelector("video");
|
|
178
|
+
if (!video) throw new Error("No playable video on this post");
|
|
179
|
+
video.muted = true;
|
|
180
|
+
await video.play();
|
|
181
|
+
await wait(() => video.readyState >= 2 && Number.isFinite(video.duration) && video.duration > 0);
|
|
182
|
+
assertTarget();
|
|
183
|
+
video.pause();
|
|
184
|
+
const seconds = args.seconds;
|
|
185
|
+
if (!Number.isFinite(seconds) || seconds < 0 || seconds >= video.duration) throw new Error("Frame time is outside the video duration");
|
|
186
|
+
video.currentTime = seconds;
|
|
187
|
+
await wait(() => !video.seeking && Math.abs(video.currentTime - seconds) < 0.15 && video.readyState >= 2);
|
|
188
|
+
assertTarget();
|
|
189
|
+
video.scrollIntoView({ block: "center", behavior: "instant" });
|
|
190
|
+
return { seconds: video.currentTime, duration_seconds: video.duration };
|
|
191
|
+
}
|
|
192
|
+
if (command === "open_comment") {
|
|
193
|
+
const existing = [...document.querySelectorAll('[contenteditable="true"][role="textbox"]')].find(visible);
|
|
194
|
+
if (!existing) {
|
|
195
|
+
const button = card.querySelector('[data-e2e="comment-icon"]');
|
|
196
|
+
if (!button) throw new Error("TikTok comment control is unavailable");
|
|
197
|
+
button.click();
|
|
198
|
+
}
|
|
199
|
+
const editor = await wait(() => [...document.querySelectorAll('[contenteditable="true"][role="textbox"]')].find(visible));
|
|
200
|
+
assertTarget();
|
|
201
|
+
if (editor.textContent.trim()) throw new Error("The comment composer already contains text; preserving the user's draft");
|
|
202
|
+
editor.scrollIntoView({ block: "center", behavior: "instant" });
|
|
203
|
+
return { opened: true };
|
|
204
|
+
}
|
|
205
|
+
if (command === "comment_text") {
|
|
206
|
+
const editors = [...document.querySelectorAll('[contenteditable="true"][role="textbox"]')].filter(visible);
|
|
207
|
+
if (editors.length !== 1) throw new Error("TikTok comment composer is ambiguous");
|
|
208
|
+
return { text: editors[0].innerText };
|
|
209
|
+
}
|
|
210
|
+
throw new Error("Unsupported TikTok page command");
|
|
211
|
+
}
|