@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
package/dist/component.json
CHANGED
|
@@ -197,16 +197,18 @@ type ConnectorFeedSpec = {
|
|
|
197
197
|
metadataSchema?: object;
|
|
198
198
|
}>;
|
|
199
199
|
} & (
|
|
200
|
-
| { sync: FeedSyncHandler; read?: FeedReadHandler }
|
|
201
|
-
| { sync?:
|
|
200
|
+
| { sync: FeedSyncHandler; read?: FeedReadHandler; observe?: never }
|
|
201
|
+
| { sync?: never; read: FeedReadHandler; observe?: (ctx: FeedObserveContext) => Promise<void> }
|
|
202
202
|
);
|
|
203
203
|
```
|
|
204
204
|
|
|
205
205
|
The record key becomes the feed key. A `sync` handler publishes
|
|
206
206
|
`operations: ['sync']`, a `read` handler publishes `['read']`, and defining both
|
|
207
|
-
publishes `['sync', 'read']`.
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
publishes `['sync', 'read']`. An optional `observe(ctx): Promise<void>` hook
|
|
208
|
+
attaches browser listeners for a read-only trigger feed. It returns no data
|
|
209
|
+
and does not add a public operation; notifications use existing subscriptions.
|
|
210
|
+
Metadata-only device or MCP connector definitions declare `operations`
|
|
211
|
+
explicitly because their executable handlers live outside the connector process.
|
|
210
212
|
|
|
211
213
|
`configSchema` describes the persisted feed instance, not one operation. Its
|
|
212
214
|
top-level `required` fields are therefore enforced for read-only, sync-only,
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connector actions compiled from a pinned Google Discovery document.
|
|
3
|
+
*
|
|
4
|
+
* One action per Discovery method, executed by one generic `execute`. What
|
|
5
|
+
* Discovery cannot say is supplied per API by a small {@link GoogleApiPolicy}:
|
|
6
|
+
* which scopes the connector may ask for, which methods stay hidden, which
|
|
7
|
+
* POSTs only read, and parameter defaults such as Gmail's `userId: 'me'`.
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
type ActionContext,
|
|
11
|
+
type ActionDefinition,
|
|
12
|
+
type ActionResult,
|
|
13
|
+
type ConnectorFile,
|
|
14
|
+
downloadSizeError,
|
|
15
|
+
fileDownloadOutput,
|
|
16
|
+
type HttpClient,
|
|
17
|
+
} from '@lobu/connector-sdk';
|
|
18
|
+
import {
|
|
19
|
+
buildGoogleRequest,
|
|
20
|
+
type DiscoveryDocument,
|
|
21
|
+
type DiscoveryMethod,
|
|
22
|
+
discoveryMethods,
|
|
23
|
+
methodInputSchema,
|
|
24
|
+
methodParameters,
|
|
25
|
+
type UploadMedia,
|
|
26
|
+
} from './discovery';
|
|
27
|
+
import { classifyGoogleError, type GoogleError } from './errors';
|
|
28
|
+
|
|
29
|
+
export interface GoogleApiPolicy {
|
|
30
|
+
/**
|
|
31
|
+
* Scopes this connector may request, narrowest first. Discovery lists the
|
|
32
|
+
* scopes that can EACH authorize a method (any-of); a method requires the
|
|
33
|
+
* first ladder scope it accepts. A method that accepts none is not exposed.
|
|
34
|
+
*/
|
|
35
|
+
scopeLadder: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Rungs every connection is granted at connect time (the auth method's
|
|
38
|
+
* `requiredScopes`); the narrowest rung when omitted. A method one of them
|
|
39
|
+
* authorizes requires it rather than a narrower rung the connection lacks.
|
|
40
|
+
*/
|
|
41
|
+
connectScopes?: string[];
|
|
42
|
+
/** Exact method ids never exposed. */
|
|
43
|
+
blockedMethods?: string[];
|
|
44
|
+
/** Method id prefixes never exposed. */
|
|
45
|
+
blockedPrefixes?: string[];
|
|
46
|
+
/** Non-GET methods that only read, e.g. `calendar.freebusy.query`. */
|
|
47
|
+
readMethods?: string[];
|
|
48
|
+
/** Non-DELETE methods that destroy data irreversibly, e.g. `calendar.calendars.clear`. */
|
|
49
|
+
destructiveMethods?: string[];
|
|
50
|
+
/** Filled when the caller omits the parameter, e.g. `{ userId: 'me' }`. */
|
|
51
|
+
defaults?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Push-channel plumbing. A `watch` call registers a callback URL with Google
|
|
56
|
+
* and must be paired with renewal and teardown, which the connector owns
|
|
57
|
+
* through its webhook lifecycle — never something an agent invokes ad hoc.
|
|
58
|
+
*/
|
|
59
|
+
const CHANNEL_METHOD = /\.(watch|(?:channels|users)\.stop)$/;
|
|
60
|
+
|
|
61
|
+
type SkipReason = 'blocked' | 'channel' | 'deprecated' | 'scope_outside_ladder';
|
|
62
|
+
|
|
63
|
+
interface ActionTarget {
|
|
64
|
+
method: DiscoveryMethod;
|
|
65
|
+
/** The policy defaults this method takes, applied under the caller's input. */
|
|
66
|
+
defaults: Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* The response is file bytes: `alt` asks for them with `alt=media` (Drive
|
|
69
|
+
* `files.get`, whose plain response is JSON metadata); `body` is a method
|
|
70
|
+
* that only ever answers with bytes (Drive `files.export`).
|
|
71
|
+
*/
|
|
72
|
+
download?: 'alt' | 'body';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface CompiledGoogleApi {
|
|
76
|
+
doc: DiscoveryDocument;
|
|
77
|
+
actions: Record<string, ActionDefinition>;
|
|
78
|
+
targets: Map<string, ActionTarget>;
|
|
79
|
+
skipped: Array<{ methodId: string; reason: SkipReason }>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** `calendar.events.list` → `events_list`. */
|
|
83
|
+
function actionKeyFor(doc: DiscoveryDocument, methodId: string): string {
|
|
84
|
+
return methodId.replace(`${doc.name}.`, '').replace(/\./g, '_');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function connectScopes(policy: GoogleApiPolicy): string[] {
|
|
88
|
+
return policy.connectScopes ?? policy.scopeLadder.slice(0, 1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The OAuth method's scope fields. Only `optionalScopes` can be requested as an
|
|
93
|
+
* upgrade later, so every rung a compiled action may require is listed there.
|
|
94
|
+
*/
|
|
95
|
+
export function oauthScopes(policy: GoogleApiPolicy): { requiredScopes: string[]; optionalScopes: string[] } {
|
|
96
|
+
const required = connectScopes(policy);
|
|
97
|
+
return { requiredScopes: required, optionalScopes: policy.scopeLadder.filter((s) => !required.includes(s)) };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function pickScope(accepted: string[] | undefined, policy: GoogleApiPolicy): string | null | undefined {
|
|
101
|
+
if (!accepted || accepted.length === 0) return null; // public method: no scope needed
|
|
102
|
+
const granted = connectScopes(policy).find((scope) => accepted.includes(scope));
|
|
103
|
+
return granted ?? policy.scopeLadder.find((scope) => accepted.includes(scope));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function compileGoogleActions(doc: DiscoveryDocument, policy: GoogleApiPolicy): CompiledGoogleApi {
|
|
107
|
+
const compiled: CompiledGoogleApi = { doc, actions: {}, targets: new Map(), skipped: [] };
|
|
108
|
+
const blocked = (id: string) =>
|
|
109
|
+
policy.blockedMethods?.includes(id) || policy.blockedPrefixes?.some((p) => id.startsWith(p));
|
|
110
|
+
|
|
111
|
+
for (const method of discoveryMethods(doc)) {
|
|
112
|
+
const skip = (reason: SkipReason) => compiled.skipped.push({ methodId: method.id, reason });
|
|
113
|
+
if (blocked(method.id)) {
|
|
114
|
+
skip('blocked');
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (CHANNEL_METHOD.test(method.id)) {
|
|
118
|
+
skip('channel');
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (method.deprecated) {
|
|
122
|
+
skip('deprecated');
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const scope = pickScope(method.scopes, policy);
|
|
126
|
+
if (scope === undefined) {
|
|
127
|
+
skip('scope_outside_ladder');
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const isRead = method.httpMethod === 'GET' || policy.readMethods?.includes(method.id) === true;
|
|
132
|
+
const defaults = Object.fromEntries(
|
|
133
|
+
methodParameters(method)
|
|
134
|
+
.filter(([name]) => policy.defaults && name in policy.defaults)
|
|
135
|
+
.map(([name]) => [name, policy.defaults?.[name]])
|
|
136
|
+
);
|
|
137
|
+
const key = actionKeyFor(doc, method.id);
|
|
138
|
+
const base: ActionDefinition = {
|
|
139
|
+
key,
|
|
140
|
+
name: method.id,
|
|
141
|
+
description: method.description,
|
|
142
|
+
kind: isRead ? 'read' : 'write',
|
|
143
|
+
...(scope ? { requiredScopes: [scope] } : {}),
|
|
144
|
+
annotations: isRead
|
|
145
|
+
? { readOnlyHint: true, idempotentHint: true }
|
|
146
|
+
: {
|
|
147
|
+
openWorldHint: true,
|
|
148
|
+
...(method.httpMethod === 'DELETE' || policy.destructiveMethods?.includes(method.id)
|
|
149
|
+
? { destructiveHint: true }
|
|
150
|
+
: {}),
|
|
151
|
+
...(method.httpMethod === 'PUT' ? { idempotentHint: true } : {}),
|
|
152
|
+
},
|
|
153
|
+
inputSchema: methodInputSchema(doc, method, defaults),
|
|
154
|
+
};
|
|
155
|
+
compiled.actions[key] = base;
|
|
156
|
+
const bytesOnly = method.supportsMediaDownload && !method.response;
|
|
157
|
+
compiled.targets.set(key, { method, defaults, ...(bytesOnly ? { download: 'body' as const } : {}) });
|
|
158
|
+
|
|
159
|
+
if (method.supportsMediaDownload && method.response) {
|
|
160
|
+
const mediaKey = `${key}_media`;
|
|
161
|
+
compiled.actions[mediaKey] = {
|
|
162
|
+
...base,
|
|
163
|
+
key: mediaKey,
|
|
164
|
+
name: `${method.id} (media)`,
|
|
165
|
+
description: `Download the content bytes of ${method.id} (alt=media) as an attachment.`,
|
|
166
|
+
kind: 'read',
|
|
167
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
168
|
+
};
|
|
169
|
+
compiled.targets.set(mediaKey, { method, defaults, download: 'alt' });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return compiled;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const MAX_RATE_LIMIT_ATTEMPTS = 3;
|
|
176
|
+
|
|
177
|
+
export async function executeGoogleAction(
|
|
178
|
+
compiled: CompiledGoogleApi,
|
|
179
|
+
ctx: ActionContext,
|
|
180
|
+
http: HttpClient,
|
|
181
|
+
sleep: (ms: number) => Promise<void> = (ms) => new Promise((r) => setTimeout(r, ms))
|
|
182
|
+
): Promise<ActionResult> {
|
|
183
|
+
const target = compiled.targets.get(ctx.actionKey);
|
|
184
|
+
if (!target) return { success: false, error: `Unknown action: ${ctx.actionKey}` };
|
|
185
|
+
const action = compiled.actions[ctx.actionKey];
|
|
186
|
+
const { media, ...input } = { ...target.defaults, ...ctx.input };
|
|
187
|
+
|
|
188
|
+
try {
|
|
189
|
+
const request = buildGoogleRequest(compiled.doc, target.method, input, {
|
|
190
|
+
...(target.download === 'alt' ? { media: 'download' as const } : {}),
|
|
191
|
+
...(media === undefined ? {} : { upload: uploadMedia(media, target.method) }),
|
|
192
|
+
});
|
|
193
|
+
for (let attempt = 1; ; attempt++) {
|
|
194
|
+
const response = await http.raw(request.url, {
|
|
195
|
+
method: request.method,
|
|
196
|
+
headers: request.headers,
|
|
197
|
+
body: request.body,
|
|
198
|
+
idempotent: action.kind === 'read',
|
|
199
|
+
});
|
|
200
|
+
if (response.ok) {
|
|
201
|
+
if (target.download) return await downloadResult(response, String(input.fileId ?? input.id ?? target.method.id));
|
|
202
|
+
return { success: true, output: jsonOutput(await response.text()) };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const error = classifyGoogleError(response.status, await response.text());
|
|
206
|
+
// The SDK throws after retrying 429/5xx. Google also reports per-user rate
|
|
207
|
+
// limits as 403 `rateLimitExceeded`, which only the body identifies.
|
|
208
|
+
if (response.status === 403 && error.code === 'rate_limited' && attempt < MAX_RATE_LIMIT_ATTEMPTS) {
|
|
209
|
+
await sleep(2 ** attempt * 500);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
return actionFailure(target.method.id, error);
|
|
213
|
+
}
|
|
214
|
+
} catch (error) {
|
|
215
|
+
// The SDK client throws its HttpStatusError for 429/5xx once its own
|
|
216
|
+
// retries are spent. Read the fields, not `instanceof`: the class reaches
|
|
217
|
+
// this module through more than one copy of the SDK (bundles, test mocks).
|
|
218
|
+
const { status, bodyText } = (error ?? {}) as { status?: unknown; bodyText?: unknown };
|
|
219
|
+
if (typeof status === 'number') {
|
|
220
|
+
return actionFailure(target.method.id, classifyGoogleError(status, typeof bodyText === 'string' ? bodyText : ''));
|
|
221
|
+
}
|
|
222
|
+
return { success: false, error: error instanceof Error ? error.message : String(error) };
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function actionFailure(methodId: string, error: GoogleError): ActionResult {
|
|
227
|
+
return {
|
|
228
|
+
success: false,
|
|
229
|
+
error: `${methodId} failed (${error.status} ${error.code}): ${error.message}`,
|
|
230
|
+
output: { error_code: error.code, http_status: error.status, retryable: error.retryable },
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** The server hands a resolved file input over as base64; Google wants the bytes. */
|
|
235
|
+
function uploadMedia(media: unknown, method: DiscoveryMethod): UploadMedia {
|
|
236
|
+
const file = media as Partial<ConnectorFile> | null;
|
|
237
|
+
if (typeof file?.base64 !== 'string' || typeof file.content_type !== 'string') {
|
|
238
|
+
throw new Error(`${method.id}: \`media\` must be a file input (run_sdk ctx.files or a Lobu file reference).`);
|
|
239
|
+
}
|
|
240
|
+
return { bytes: Buffer.from(file.base64, 'base64'), contentType: file.content_type };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* File bytes as an attachment. Refused before reading when Google declares a
|
|
245
|
+
* size over the connector limit, and again after, for responses that do not:
|
|
246
|
+
* an isolate buffers the whole body, so an unbounded read is an OOM.
|
|
247
|
+
*/
|
|
248
|
+
async function downloadResult(response: Response, label: string): Promise<ActionResult> {
|
|
249
|
+
const declared = Number(response.headers.get('content-length'));
|
|
250
|
+
const tooBig = downloadSizeError(Number.isFinite(declared) && declared > 0 ? declared : undefined, label);
|
|
251
|
+
if (tooBig) {
|
|
252
|
+
await response.body?.cancel();
|
|
253
|
+
return { success: false, error: tooBig };
|
|
254
|
+
}
|
|
255
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
256
|
+
const receivedTooBig = downloadSizeError(bytes.length, label);
|
|
257
|
+
if (receivedTooBig) return { success: false, error: receivedTooBig };
|
|
258
|
+
const mimeType = response.headers.get('content-type')?.split(';')[0]?.trim() || 'application/octet-stream';
|
|
259
|
+
return { success: true, output: fileDownloadOutput({ bytes, filename: label, mimeType }) };
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Google answers JSON; an empty body (DELETE) is `{}`, anything else is kept as text. */
|
|
263
|
+
function jsonOutput(text: string): Record<string, unknown> {
|
|
264
|
+
if (!text) return {};
|
|
265
|
+
try {
|
|
266
|
+
return JSON.parse(text) as Record<string, unknown>;
|
|
267
|
+
} catch {
|
|
268
|
+
return { content: text };
|
|
269
|
+
}
|
|
270
|
+
}
|