@lobu/runtime-server 20.0.0 → 20.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalogs/connectors.json +165 -15
- package/dist/component.json +1 -1
- package/dist/connectors/chat-automation-events.ts +33 -0
- package/dist/connectors/discord.ts +2 -0
- package/dist/connectors/gchat.ts +2 -0
- package/dist/connectors/google_drive.ts +210 -40
- package/dist/connectors/slack-automation-events.ts +0 -31
- package/dist/connectors/slack.ts +2 -2
- package/dist/connectors/teams.ts +2 -0
- package/dist/connectors/telegram.ts +2 -0
- package/dist/connectors/whatsapp.ts +2 -0
- package/dist/dependencies.bun.lock +4 -4
- package/dist/guest.bundle.js +13 -1
- package/dist/owletto/dist/apple-touch-icon.png +0 -0
- package/dist/owletto/dist/assets/{_-WVpKI9q9.js → _-BTmsEMQo.js} +2 -2
- package/dist/owletto/dist/assets/_-ea0K1u_g.js +1 -0
- package/dist/owletto/dist/assets/{_agentId-U2D1yGV_.js → _agentId-DON3NuNk.js} +1 -1
- package/dist/owletto/dist/assets/_agentId-qF8hi8Cf.js +1 -0
- package/dist/owletto/dist/assets/{_automationId-BggDSfkK.js → _automationId-Bprfhhg8.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey._connectionId-BalfcgLi.js → _connectorKey._connectionId-75LMK1pB.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey.index-IRfifXtO.js → _connectorKey.index-N0fJPz8N.js} +1 -1
- package/dist/owletto/dist/assets/{_conversationId-1GSbJquw.js → _conversationId-BY5q9MHG.js} +1 -1
- package/dist/owletto/dist/assets/{_deploymentId-DpMLDfMN.js → _deploymentId-DFh2d5Pm.js} +1 -1
- package/dist/owletto/dist/assets/_name-OY_X_Zm-.js +1 -0
- package/dist/owletto/dist/assets/{_owner-CZwj2Fc5.js → _owner-B92z-CVu.js} +1 -1
- package/dist/owletto/dist/assets/_skillKey-CeEE23_w.js +1 -0
- package/dist/owletto/dist/assets/{_slug-5SDJ_Zlr.js → _slug-CvHxtUEf.js} +1 -1
- package/dist/owletto/dist/assets/accept-invitation-CXSrxBJN.js +1 -0
- package/dist/owletto/dist/assets/activity-route-view-C9W2Ipni.js +1 -0
- package/dist/owletto/dist/assets/{agent-card-controls-Duh-6QNV.js → agent-card-controls-CLupkefQ.js} +1 -1
- package/dist/owletto/dist/assets/{agent-client-setup-list-u6MIKBDe.js → agent-client-setup-list-DgFv4h0W.js} +1 -1
- package/dist/owletto/dist/assets/{agent-connect-pages-22bJIutE.js → agent-connect-pages-DT8R_qnj.js} +1 -1
- package/dist/owletto/dist/assets/{agent-editor-form-DIo7SWp4.js → agent-editor-form-ayUg3Ws1.js} +1 -1
- package/dist/owletto/dist/assets/{agent-guardrails-route-Duv7Rpd9.js → agent-guardrails-route-D-b6CIt2.js} +1 -1
- package/dist/owletto/dist/assets/{agent-loading-shells-D6mLqg3d.js → agent-loading-shells-DjMpSoub.js} +1 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-BuGatiEq.js +1 -0
- package/dist/owletto/dist/assets/{agent-skill-context-DjPLOCBS.js → agent-skill-context-DKpIFmCh.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skills-route-CdCVU8ZJ.js → agent-skills-route-DqIMttMK.js} +1 -1
- package/dist/owletto/dist/assets/{agent-subpage-shell-BfomD6m2.js → agent-subpage-shell-Bojgj1uq.js} +1 -1
- package/dist/owletto/dist/assets/{agent-thread-COEinkFo.js → agent-thread-R8Pego9t.js} +2 -2
- package/dist/owletto/dist/assets/agents-C9x76gSX.js +1 -0
- package/dist/owletto/dist/assets/{agents-workbench-BuIaYVFK.js → agents-workbench-BojDv6gX.js} +1 -1
- package/dist/owletto/dist/assets/{app._appId-BULz-FRp.js → app._appId-DNNB5FaI.js} +1 -1
- package/dist/owletto/dist/assets/{automation-detail-content-Ck6YhKpX.js → automation-detail-content-CzqrHc4P.js} +1 -1
- package/dist/owletto/dist/assets/automations-C9x76gSX.js +1 -0
- package/dist/owletto/dist/assets/{calendar-BZSx-Jno.js → calendar-VAaxHxss.js} +1 -1
- package/dist/owletto/dist/assets/{callback-DTbt2OS1.js → callback-0VB9tUCF.js} +1 -1
- package/dist/owletto/dist/assets/{card-BsWGRkun.js → card-HMQT7vU5.js} +1 -1
- package/dist/owletto/dist/assets/{claim-6BXg-jBt.js → claim-C2-YTMw-.js} +1 -1
- package/dist/owletto/dist/assets/{clients-CJI4gT-V.js → clients-C0I3V7XE.js} +1 -1
- package/dist/owletto/dist/assets/{code-editor-C104Bzj2.js → code-editor-hOZHdlxM.js} +1 -1
- package/dist/owletto/dist/assets/connect-DSr_gD8x.js +1 -0
- package/dist/owletto/dist/assets/connect._clientId-CTamwGrw.js +1 -0
- package/dist/owletto/dist/assets/{connected._clientId-L6cpG1ip.js → connected._clientId-BFuU4-8j.js} +1 -1
- package/dist/owletto/dist/assets/{connection-CqXJ7EAc.js → connection-De_2AD46.js} +1 -1
- package/dist/owletto/dist/assets/{connection-feed-detail-DgZF0nux.js → connection-feed-detail-Cbn85fG9.js} +1 -1
- package/dist/owletto/dist/assets/{connector-provenance-DyEHCwrM.js → connector-provenance-B17-ze5S.js} +1 -1
- package/dist/owletto/dist/assets/{connectors-zM9Yv-LM.js → connectors-KnNED_-4.js} +1 -1
- package/dist/owletto/dist/assets/{consent-CvL2QShm.js → consent-BOYb4pNu.js} +1 -1
- package/dist/owletto/dist/assets/{core.esm-DUExfZp5.js → core.esm-COW6Pfy6.js} +1 -1
- package/dist/owletto/dist/assets/{create-BiERXyJD.js → create-BFpUZ_mU.js} +1 -1
- package/dist/owletto/dist/assets/create-CblXKFGZ.js +1 -0
- package/dist/owletto/dist/assets/create-ChUbSYvl.js +1 -0
- package/dist/owletto/dist/assets/create-automation-form-CRenA7Ix.js +1 -0
- package/dist/owletto/dist/assets/{create._connectorKey-DWUsdgk7.js → create._connectorKey-D4dIDQIQ.js} +1 -1
- package/dist/owletto/dist/assets/{cronstrue-Bmga7mGH.js → cronstrue-BrlFh5Jy.js} +1 -1
- package/dist/owletto/dist/assets/deployments-DTFrUY7p.js +1 -0
- package/dist/owletto/dist/assets/{deployments-body-Cw9tB9-c.js → deployments-body-CXqfjLqj.js} +1 -1
- package/dist/owletto/dist/assets/{device-Dy4u9FiS.js → device-B0BBIdVx.js} +1 -1
- package/dist/owletto/dist/assets/{device-pin-tombstone-CmAxFq2z.js → device-pin-tombstone-BBYes4en.js} +1 -1
- package/dist/owletto/dist/assets/{device-rows-CVv5-okl.js → device-rows-E63OZ9Cp.js} +1 -1
- package/dist/owletto/dist/assets/{device._deviceId-DNKPNnE2.js → device._deviceId-JN0cUCGe.js} +1 -1
- package/dist/owletto/dist/assets/{entity-options-C5Mj2ZVk.js → entity-options-qan9-Ycm.js} +1 -1
- package/dist/owletto/dist/assets/{entity-page-BdTxty8B.js → entity-page-CozUOlVP.js} +1 -1
- package/dist/owletto/dist/assets/{entity-type-page-jhiER8wM.js → entity-type-page-xISySjVW.js} +1 -1
- package/dist/owletto/dist/assets/{events-feed-CEQj2uAu.js → events-feed-DmZ3Ig3X.js} +1 -1
- package/dist/owletto/dist/assets/{full-page-spinner-BSp5F0ls.js → full-page-spinner-Q_J5Wcop.js} +1 -1
- package/dist/owletto/dist/assets/guardrails-BB9iOxE3.js +1 -0
- package/dist/owletto/dist/assets/identity-DYbfG4hU.js +1 -0
- package/dist/owletto/dist/assets/index-7d9B918E.js +1 -0
- package/dist/owletto/dist/assets/{index-C2YGEKPo.js → index-BKZMzuMS.js} +7 -7
- package/dist/owletto/dist/assets/index-BsDA0XzK.js +1 -0
- package/dist/owletto/dist/assets/{index-1D5YJuZt.js → index-BwN9pHNs.js} +1 -1
- package/dist/owletto/dist/assets/{index-DFD8r981.js → index-BwVojwkg.js} +1 -1
- package/dist/owletto/dist/assets/index-C4Lz_gB-.js +1 -0
- package/dist/owletto/dist/assets/{index-BO8P4P_v.js → index-C78ucWDF.js} +1 -1
- package/dist/owletto/dist/assets/{index-D6nIYLM-.js → index-C9Dtjaoi.js} +1 -1
- package/dist/owletto/dist/assets/{index-CKWRiFJL.js → index-CGx4og7r.js} +1 -1
- package/dist/owletto/dist/assets/index-CO65Rkad.js +1 -0
- package/dist/owletto/dist/assets/index-CT_kxGkR.js +1 -0
- package/dist/owletto/dist/assets/index-ChcQMdod.css +1 -0
- package/dist/owletto/dist/assets/index-CrKgNtiq.js +1 -0
- package/dist/owletto/dist/assets/{index-CLQ-2wO3.js → index-DLZbFRSM.js} +1 -1
- package/dist/owletto/dist/assets/index-DUIbfL6x.js +1 -0
- package/dist/owletto/dist/assets/{index-DtRraJyI.js → index-DmB-3GhU.js} +1 -1
- package/dist/owletto/dist/assets/{index-CyT-Rwip.js → index-pKfsEvLt.js} +1 -1
- package/dist/owletto/dist/assets/{json-diff-gsOHOgl7.js → json-diff-1FNS_wGA.js} +1 -1
- package/dist/owletto/dist/assets/{list-skeleton-Cs18bNnk.js → list-skeleton-B6gjzr8t.js} +1 -1
- package/dist/owletto/dist/assets/login-S9EGV_EA.js +1 -0
- package/dist/owletto/dist/assets/{logout-DKUiKENJ.js → logout-BOXPSr57.js} +1 -1
- package/dist/owletto/dist/assets/{member-scope-gate-g7uB6GYE.js → member-scope-gate-yGr4lrGD.js} +1 -1
- package/dist/owletto/dist/assets/{memory-browse-page-BUwnO2o2.js → memory-browse-page-5n3MvqdS.js} +2 -2
- package/dist/owletto/dist/assets/{model-selector-DfsEq1db.js → model-selector-9ZRlR7Sa.js} +1 -1
- package/dist/owletto/dist/assets/models-LOhfJ0sb.js +1 -0
- package/dist/owletto/dist/assets/{new-BWw3u5jE.js → new-BeZJOJgR.js} +1 -1
- package/dist/owletto/dist/assets/{new-CW9MfqPX.js → new-D4wlbvAZ.js} +1 -1
- package/dist/owletto/dist/assets/{new-BSo83s7P.js → new-Dxn1qrmS.js} +1 -1
- package/dist/owletto/dist/assets/{oauth-workspace-access-DM3uXXPM.js → oauth-workspace-access-DoE-9F42.js} +1 -1
- package/dist/owletto/dist/assets/{organization-DJtG7bUJ.js → organization-BezNEJK7.js} +1 -1
- package/dist/owletto/dist/assets/{permissions-DcYSiYWQ.js → permissions-GkKtC6a5.js} +1 -1
- package/dist/owletto/dist/assets/{proposal-review-shell-CLrF2OFP.js → proposal-review-shell-Bk9D_9YN.js} +1 -1
- package/dist/owletto/dist/assets/{recent-BAuh77AP.js → recent-BVvscz1V.js} +1 -1
- package/dist/owletto/dist/assets/{renderer-BdAH16jE.js → renderer-CAyr3B3s.js} +2 -2
- package/dist/owletto/dist/assets/reset-password-atCMI5uQ.js +1 -0
- package/dist/owletto/dist/assets/{runs-tK0NlrM5.js → runs-CftQDTkq.js} +1 -1
- package/dist/owletto/dist/assets/runs-panel-BkRtr_C4.js +1 -0
- package/dist/owletto/dist/assets/{runs-table-BQACrHq5.js → runs-table-CWCl38L5.js} +1 -1
- package/dist/owletto/dist/assets/{schema-value-normalization-Dr5Osu6u.js → schema-value-normalization-C9Lm83-q.js} +1 -1
- package/dist/owletto/dist/assets/settings-BKMOjfYf.js +1 -0
- package/dist/owletto/dist/assets/{settings-D9ezdxp8.js → settings-CgTgofgd.js} +1 -1
- package/dist/owletto/dist/assets/skills-DWr8qR3U.js +1 -0
- package/dist/owletto/dist/assets/{switch-C1vQiKIo.js → switch-BOGbkDQb.js} +1 -1
- package/dist/owletto/dist/assets/{use-mention-search-CCqN_8wM.js → use-mention-search-C9ckRw0s.js} +2 -2
- package/dist/owletto/dist/favicon.ico +0 -0
- package/dist/owletto/dist/favicon.svg +5 -6
- package/dist/owletto/dist/fonts/dm-mono-latin-500-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/dm-sans-latin-400-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/dm-sans-latin-600-normal.woff2 +0 -0
- package/dist/owletto/dist/index.html +8 -8
- package/dist/owletto/dist/lobu-logo.svg +16 -0
- package/dist/server-main.bundle.mjs +2415 -1268
- package/npm-shrinkwrap.json +17 -17
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/index.d.ts +1 -1
- package/vendor/connector-sdk/dist/logger.js +4 -1
- package/vendor/connector-sdk/dist/reaction-sdk.d.ts +9 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +16 -0
- package/vendor/core/dist/contracts/tools/manage-automations.js +12 -3
- package/vendor/core/dist/contracts/worker/protocol.d.ts +9 -0
- package/vendor/core/dist/contracts/worker/protocol.js +10 -1
- package/vendor/core/dist/logger.js +4 -2
- package/vendor/core/package.json +1 -1
- package/dist/owletto/dist/assets/_-BjTOSrPW.js +0 -1
- package/dist/owletto/dist/assets/_agentId-E5FuvQ_W.js +0 -1
- package/dist/owletto/dist/assets/_name-Ca5sRv2h.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-BnDO8aEk.js +0 -1
- package/dist/owletto/dist/assets/accept-invitation-tMqF2W59.js +0 -1
- package/dist/owletto/dist/assets/activity-route-view-DSJj0TBg.js +0 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-QvA6xL8Q.js +0 -1
- package/dist/owletto/dist/assets/agents-DztpCplG.js +0 -1
- package/dist/owletto/dist/assets/automations-DztpCplG.js +0 -1
- package/dist/owletto/dist/assets/connect-9tegWawc.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-Dh6e0n6A.js +0 -1
- package/dist/owletto/dist/assets/create-BL_WcDoF.js +0 -1
- package/dist/owletto/dist/assets/create-Dyz5QbON.js +0 -1
- package/dist/owletto/dist/assets/create-automation-form-DCYFtK4q.js +0 -1
- package/dist/owletto/dist/assets/deployments-h8jIWEVy.js +0 -1
- package/dist/owletto/dist/assets/guardrails-DrOhJHr5.js +0 -1
- package/dist/owletto/dist/assets/identity-BTE8ZlL9.js +0 -1
- package/dist/owletto/dist/assets/index-Be4XiWxU.js +0 -1
- package/dist/owletto/dist/assets/index-CPqabIYs.css +0 -1
- package/dist/owletto/dist/assets/index-CS1UPepo.js +0 -1
- package/dist/owletto/dist/assets/index-DGinfBZr.js +0 -1
- package/dist/owletto/dist/assets/index-DJs1EEbu.js +0 -1
- package/dist/owletto/dist/assets/index-DZb_utnT.js +0 -1
- package/dist/owletto/dist/assets/index-RH7aiqHs.js +0 -1
- package/dist/owletto/dist/assets/index-xwlLZWva.js +0 -1
- package/dist/owletto/dist/assets/login-B3RTCs3p.js +0 -1
- package/dist/owletto/dist/assets/models-CZZt4VcZ.js +0 -1
- package/dist/owletto/dist/assets/reset-password-DjgDJAYG.js +0 -1
- package/dist/owletto/dist/assets/runs-panel-Dqq-0G9H.js +0 -1
- package/dist/owletto/dist/assets/settings-DZifZxa5.js +0 -1
- package/dist/owletto/dist/assets/skills-CNtoLPU_.js +0 -1
- package/dist/owletto/dist/fonts/geist-pixel-square.woff2 +0 -0
- package/dist/owletto/dist/fonts/inter-latin-400-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/inter-latin-500-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/inter-latin-600-normal.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizBRFtNs2ka5fXjeivQ4LroWlx-6zUTjnTLgNs.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizBRFtNs2ka5fXjeivQ4LroWlx-6zsTjnTLgNuZ5w.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizHRFtNs2ka5fXjeivQ4LroWlx-6zAjgn7Motmp5r61.woff2 +0 -0
- package/dist/owletto/dist/fonts/jizHRFtNs2ka5fXjeivQ4LroWlx-6zAjjH7Motmp5g.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD0OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD1OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD2OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD4OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD7OwGtT0rU.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbV2o-flEEny0FZhsfKu5WU4xD_OwGtT0rU3BE.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-Cw2nSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-Cw6nSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwCnSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwOnSGjW7BA.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwenSGjW7BDEAQ.woff2 +0 -0
- package/dist/owletto/dist/fonts/tDbX2o-flEEny0FZhsfKu5WU4xD-CwynSGjW7BDEAQ.woff2 +0 -0
|
@@ -20,7 +20,37 @@
|
|
|
20
20
|
"webhook": null,
|
|
21
21
|
"feeds_schema": null,
|
|
22
22
|
"actions_schema": null,
|
|
23
|
-
"automation_events":
|
|
23
|
+
"automation_events": [
|
|
24
|
+
{
|
|
25
|
+
"key": "message.created",
|
|
26
|
+
"label": "A message is sent",
|
|
27
|
+
"description": "Runs for messages in the selected conversation scope.",
|
|
28
|
+
"resourceType": "channel",
|
|
29
|
+
"filterSchema": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"channel_id": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"title": "Channel",
|
|
35
|
+
"description": "Optional channel or direct-message identifier."
|
|
36
|
+
},
|
|
37
|
+
"mention_only": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"title": "Only when mentioned"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"capabilities": {
|
|
44
|
+
"steering": true,
|
|
45
|
+
"replyToSource": true
|
|
46
|
+
},
|
|
47
|
+
"defaults": {
|
|
48
|
+
"execution": "turn",
|
|
49
|
+
"activeRun": "steer",
|
|
50
|
+
"output": "reply_to_source"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
],
|
|
24
54
|
"options_schema": {
|
|
25
55
|
"type": "object",
|
|
26
56
|
"x-lobu-chat-platform": "discord",
|
|
@@ -2196,7 +2226,37 @@
|
|
|
2196
2226
|
"webhook": null,
|
|
2197
2227
|
"feeds_schema": null,
|
|
2198
2228
|
"actions_schema": null,
|
|
2199
|
-
"automation_events":
|
|
2229
|
+
"automation_events": [
|
|
2230
|
+
{
|
|
2231
|
+
"key": "message.created",
|
|
2232
|
+
"label": "A message is sent",
|
|
2233
|
+
"description": "Runs for messages in the selected conversation scope.",
|
|
2234
|
+
"resourceType": "channel",
|
|
2235
|
+
"filterSchema": {
|
|
2236
|
+
"type": "object",
|
|
2237
|
+
"properties": {
|
|
2238
|
+
"channel_id": {
|
|
2239
|
+
"type": "string",
|
|
2240
|
+
"title": "Channel",
|
|
2241
|
+
"description": "Optional channel or direct-message identifier."
|
|
2242
|
+
},
|
|
2243
|
+
"mention_only": {
|
|
2244
|
+
"type": "boolean",
|
|
2245
|
+
"title": "Only when mentioned"
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
},
|
|
2249
|
+
"capabilities": {
|
|
2250
|
+
"steering": true,
|
|
2251
|
+
"replyToSource": true
|
|
2252
|
+
},
|
|
2253
|
+
"defaults": {
|
|
2254
|
+
"execution": "turn",
|
|
2255
|
+
"activeRun": "steer",
|
|
2256
|
+
"output": "reply_to_source"
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
],
|
|
2200
2260
|
"options_schema": {
|
|
2201
2261
|
"type": "object",
|
|
2202
2262
|
"x-lobu-chat-platform": "gchat",
|
|
@@ -2352,12 +2412,12 @@
|
|
|
2352
2412
|
}
|
|
2353
2413
|
},
|
|
2354
2414
|
"actions_schema": {
|
|
2355
|
-
"
|
|
2356
|
-
"key": "
|
|
2415
|
+
"download_file": {
|
|
2416
|
+
"key": "download_file",
|
|
2357
2417
|
"kind": "read",
|
|
2358
2418
|
"requiresApproval": false,
|
|
2359
|
-
"name": "
|
|
2360
|
-
"description": "
|
|
2419
|
+
"name": "Download File",
|
|
2420
|
+
"description": "Download one Drive file. Google Docs/Sheets/Slides are exported (text/plain, CSV); everything else is downloaded as-is, binary included. The bytes are published as an attachment with a `download_url` a device can fetch, and small text files are ALSO returned inline as `content` so they can be read without a second call.",
|
|
2361
2421
|
"requiredScopes": [
|
|
2362
2422
|
"https://www.googleapis.com/auth/drive.readonly"
|
|
2363
2423
|
],
|
|
@@ -2369,13 +2429,13 @@
|
|
|
2369
2429
|
"properties": {
|
|
2370
2430
|
"file_id": {
|
|
2371
2431
|
"type": "string",
|
|
2372
|
-
"description": "Drive file ID to
|
|
2432
|
+
"description": "Drive file ID to download."
|
|
2373
2433
|
},
|
|
2374
|
-
"
|
|
2434
|
+
"inline_max_bytes": {
|
|
2375
2435
|
"type": "integer",
|
|
2376
|
-
"minimum":
|
|
2377
|
-
"maximum":
|
|
2378
|
-
"description": "
|
|
2436
|
+
"minimum": 0,
|
|
2437
|
+
"maximum": 1048576,
|
|
2438
|
+
"description": "Return text content inline when the file is at most this many bytes (default 262144, max 1048576). Binary files are never inlined. 0 disables inlining; the attachment is still published."
|
|
2379
2439
|
}
|
|
2380
2440
|
}
|
|
2381
2441
|
}
|
|
@@ -3387,7 +3447,37 @@
|
|
|
3387
3447
|
"webhook": null,
|
|
3388
3448
|
"feeds_schema": null,
|
|
3389
3449
|
"actions_schema": null,
|
|
3390
|
-
"automation_events":
|
|
3450
|
+
"automation_events": [
|
|
3451
|
+
{
|
|
3452
|
+
"key": "message.created",
|
|
3453
|
+
"label": "A message is sent",
|
|
3454
|
+
"description": "Runs for messages in the selected conversation scope.",
|
|
3455
|
+
"resourceType": "channel",
|
|
3456
|
+
"filterSchema": {
|
|
3457
|
+
"type": "object",
|
|
3458
|
+
"properties": {
|
|
3459
|
+
"channel_id": {
|
|
3460
|
+
"type": "string",
|
|
3461
|
+
"title": "Channel",
|
|
3462
|
+
"description": "Optional channel or direct-message identifier."
|
|
3463
|
+
},
|
|
3464
|
+
"mention_only": {
|
|
3465
|
+
"type": "boolean",
|
|
3466
|
+
"title": "Only when mentioned"
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
},
|
|
3470
|
+
"capabilities": {
|
|
3471
|
+
"steering": true,
|
|
3472
|
+
"replyToSource": true
|
|
3473
|
+
},
|
|
3474
|
+
"defaults": {
|
|
3475
|
+
"execution": "turn",
|
|
3476
|
+
"activeRun": "steer",
|
|
3477
|
+
"output": "reply_to_source"
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
],
|
|
3391
3481
|
"options_schema": {
|
|
3392
3482
|
"type": "object",
|
|
3393
3483
|
"x-lobu-chat-platform": "teams",
|
|
@@ -4047,7 +4137,7 @@
|
|
|
4047
4137
|
{
|
|
4048
4138
|
"key": "message.created",
|
|
4049
4139
|
"label": "A message is sent",
|
|
4050
|
-
"description": "Runs for messages in the selected
|
|
4140
|
+
"description": "Runs for messages in the selected conversation scope.",
|
|
4051
4141
|
"resourceType": "channel",
|
|
4052
4142
|
"filterSchema": {
|
|
4053
4143
|
"type": "object",
|
|
@@ -4120,7 +4210,37 @@
|
|
|
4120
4210
|
"webhook": null,
|
|
4121
4211
|
"feeds_schema": null,
|
|
4122
4212
|
"actions_schema": null,
|
|
4123
|
-
"automation_events":
|
|
4213
|
+
"automation_events": [
|
|
4214
|
+
{
|
|
4215
|
+
"key": "message.created",
|
|
4216
|
+
"label": "A message is sent",
|
|
4217
|
+
"description": "Runs for messages in the selected conversation scope.",
|
|
4218
|
+
"resourceType": "channel",
|
|
4219
|
+
"filterSchema": {
|
|
4220
|
+
"type": "object",
|
|
4221
|
+
"properties": {
|
|
4222
|
+
"channel_id": {
|
|
4223
|
+
"type": "string",
|
|
4224
|
+
"title": "Channel",
|
|
4225
|
+
"description": "Optional channel or direct-message identifier."
|
|
4226
|
+
},
|
|
4227
|
+
"mention_only": {
|
|
4228
|
+
"type": "boolean",
|
|
4229
|
+
"title": "Only when mentioned"
|
|
4230
|
+
}
|
|
4231
|
+
}
|
|
4232
|
+
},
|
|
4233
|
+
"capabilities": {
|
|
4234
|
+
"steering": true,
|
|
4235
|
+
"replyToSource": true
|
|
4236
|
+
},
|
|
4237
|
+
"defaults": {
|
|
4238
|
+
"execution": "turn",
|
|
4239
|
+
"activeRun": "steer",
|
|
4240
|
+
"output": "reply_to_source"
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
],
|
|
4124
4244
|
"options_schema": {
|
|
4125
4245
|
"type": "object",
|
|
4126
4246
|
"x-lobu-chat-platform": "telegram",
|
|
@@ -4685,7 +4805,37 @@
|
|
|
4685
4805
|
"webhook": null,
|
|
4686
4806
|
"feeds_schema": null,
|
|
4687
4807
|
"actions_schema": null,
|
|
4688
|
-
"automation_events":
|
|
4808
|
+
"automation_events": [
|
|
4809
|
+
{
|
|
4810
|
+
"key": "message.created",
|
|
4811
|
+
"label": "A message is sent",
|
|
4812
|
+
"description": "Runs for messages in the selected conversation scope.",
|
|
4813
|
+
"resourceType": "channel",
|
|
4814
|
+
"filterSchema": {
|
|
4815
|
+
"type": "object",
|
|
4816
|
+
"properties": {
|
|
4817
|
+
"channel_id": {
|
|
4818
|
+
"type": "string",
|
|
4819
|
+
"title": "Channel",
|
|
4820
|
+
"description": "Optional channel or direct-message identifier."
|
|
4821
|
+
},
|
|
4822
|
+
"mention_only": {
|
|
4823
|
+
"type": "boolean",
|
|
4824
|
+
"title": "Only when mentioned"
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
},
|
|
4828
|
+
"capabilities": {
|
|
4829
|
+
"steering": true,
|
|
4830
|
+
"replyToSource": true
|
|
4831
|
+
},
|
|
4832
|
+
"defaults": {
|
|
4833
|
+
"execution": "turn",
|
|
4834
|
+
"activeRun": "steer",
|
|
4835
|
+
"output": "reply_to_source"
|
|
4836
|
+
}
|
|
4837
|
+
}
|
|
4838
|
+
],
|
|
4689
4839
|
"options_schema": {
|
|
4690
4840
|
"type": "object",
|
|
4691
4841
|
"x-lobu-chat-platform": "whatsapp",
|
package/dist/component.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ConnectorAutomationEvent } from "@lobu/connector-sdk";
|
|
2
|
+
|
|
3
|
+
// All server chat adapters use the same normalized message signal and turn
|
|
4
|
+
// routing. Keep the catalog aligned with that shared runtime capability.
|
|
5
|
+
export const CHAT_AUTOMATION_EVENTS: ConnectorAutomationEvent[] = [
|
|
6
|
+
{
|
|
7
|
+
key: "message.created",
|
|
8
|
+
label: "A message is sent",
|
|
9
|
+
description: "Runs for messages in the selected conversation scope.",
|
|
10
|
+
resourceType: "channel",
|
|
11
|
+
filterSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
channel_id: {
|
|
15
|
+
type: "string",
|
|
16
|
+
title: "Channel",
|
|
17
|
+
description: "Optional channel or direct-message identifier.",
|
|
18
|
+
},
|
|
19
|
+
mention_only: {
|
|
20
|
+
type: "boolean",
|
|
21
|
+
title: "Only when mentioned",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
capabilities: { steering: true, replyToSource: true },
|
|
26
|
+
defaults: {
|
|
27
|
+
execution: "turn",
|
|
28
|
+
activeRun: "steer",
|
|
29
|
+
output: "reply_to_source",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
@@ -2,11 +2,13 @@ import {
|
|
|
2
2
|
type ConnectorDefinition,
|
|
3
3
|
IntegrationConnector,
|
|
4
4
|
} from "@lobu/connector-sdk";
|
|
5
|
+
import { CHAT_AUTOMATION_EVENTS } from "./chat-automation-events.js";
|
|
5
6
|
|
|
6
7
|
export default class DiscordConnector extends IntegrationConnector {
|
|
7
8
|
readonly definition: ConnectorDefinition = {
|
|
8
9
|
key: "discord",
|
|
9
10
|
kind: "integration",
|
|
11
|
+
automationEvents: CHAT_AUTOMATION_EVENTS,
|
|
10
12
|
name: "Discord",
|
|
11
13
|
description:
|
|
12
14
|
"Connect a Discord bot and route server conversations to Lobu agents.",
|
package/dist/connectors/gchat.ts
CHANGED
|
@@ -2,11 +2,13 @@ import {
|
|
|
2
2
|
type ConnectorDefinition,
|
|
3
3
|
IntegrationConnector,
|
|
4
4
|
} from "@lobu/connector-sdk";
|
|
5
|
+
import { CHAT_AUTOMATION_EVENTS } from "./chat-automation-events.js";
|
|
5
6
|
|
|
6
7
|
export default class GoogleChatConnector extends IntegrationConnector {
|
|
7
8
|
readonly definition: ConnectorDefinition = {
|
|
8
9
|
key: "gchat",
|
|
9
10
|
kind: "integration",
|
|
11
|
+
automationEvents: CHAT_AUTOMATION_EVENTS,
|
|
10
12
|
name: "Google Chat",
|
|
11
13
|
description: "Connect a Google Chat app to Lobu.",
|
|
12
14
|
version: "1.0.2",
|
|
@@ -147,10 +147,22 @@ const TEXTUAL_MIME_TYPES = new Set([
|
|
|
147
147
|
* This is NOT the artifact limit — it is an embedding-cost limit. Every event's
|
|
148
148
|
* payload is chunked and embedded, so a 10 MB CSV inlined here would produce
|
|
149
149
|
* hundreds of vectors of almost no retrieval value. Files above the cap sync as
|
|
150
|
-
* metadata and their content is fetched on demand through `
|
|
150
|
+
* metadata and their content is fetched on demand through `download_file`.
|
|
151
151
|
*/
|
|
152
152
|
const MAX_INLINE_TEXT_BYTES = 256 * 1024;
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Default and ceiling for the text `download_file` echoes back inline.
|
|
156
|
+
*
|
|
157
|
+
* Inlining is a convenience for the caller that wants to READ a small file
|
|
158
|
+
* without a second fetch through the artifact's `download_url`. It is not the
|
|
159
|
+
* transport: the attachment is published either way. The ceiling exists because
|
|
160
|
+
* inline content lands in an agent's context verbatim, where a multi-megabyte
|
|
161
|
+
* blob is worse than useless — the `download_url` is the path for anything big.
|
|
162
|
+
*/
|
|
163
|
+
const DEFAULT_INLINE_CONTENT_BYTES = 256 * 1024;
|
|
164
|
+
const MAX_INLINE_CONTENT_BYTES = 1024 * 1024;
|
|
165
|
+
|
|
154
166
|
/**
|
|
155
167
|
* Grace window subtracted from `last_sync_at` before deciding a file's content
|
|
156
168
|
* is unchanged.
|
|
@@ -163,7 +175,11 @@ const MAX_INLINE_TEXT_BYTES = 256 * 1024;
|
|
|
163
175
|
*/
|
|
164
176
|
const CONTENT_SKEW_GRACE_MS = 5 * 60 * 1000;
|
|
165
177
|
|
|
166
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Ceiling on anything this connector pulls in one piece — Google's own hard cap
|
|
180
|
+
* on `files.export` (requesting more returns a 403), reused as the `alt=media`
|
|
181
|
+
* download ceiling so both content paths refuse at the same size.
|
|
182
|
+
*/
|
|
167
183
|
const MAX_EXPORT_BYTES = 10 * 1024 * 1024;
|
|
168
184
|
|
|
169
185
|
/** Field mask for files.list / changes.list. Drive v3 returns almost nothing without it. */
|
|
@@ -228,6 +244,27 @@ function decodeTruncated(encoded: Uint8Array, maxBytes: number): string {
|
|
|
228
244
|
return '';
|
|
229
245
|
}
|
|
230
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Decode downloaded bytes as text and cut them to the inline budget.
|
|
249
|
+
*
|
|
250
|
+
* The decode comes FIRST because `decodeTruncated` requires well-formed UTF-8
|
|
251
|
+
* (it hands back nothing rather than manufacture a U+FFFD), and a downloaded
|
|
252
|
+
* file is not required to be any such thing — a latin-1 CSV would otherwise
|
|
253
|
+
* inline as an empty string, the exact "looks like an empty file" outcome this
|
|
254
|
+
* connector refuses everywhere else. Decoding lossily once and re-encoding
|
|
255
|
+
* gives the truncator the input it documents, and makes a truncated file read
|
|
256
|
+
* the same as the first page of an untruncated one.
|
|
257
|
+
*/
|
|
258
|
+
function inlineText(
|
|
259
|
+
bytes: Uint8Array,
|
|
260
|
+
maxBytes: number
|
|
261
|
+
): { content: string; truncated: boolean } {
|
|
262
|
+
const text = new TextDecoder('utf-8').decode(bytes);
|
|
263
|
+
const encoded = new TextEncoder().encode(text);
|
|
264
|
+
if (encoded.byteLength <= maxBytes) return { content: text, truncated: false };
|
|
265
|
+
return { content: decodeTruncated(encoded, maxBytes), truncated: true };
|
|
266
|
+
}
|
|
267
|
+
|
|
231
268
|
function exportMimeTypeFor(mimeType: string | undefined): string | undefined {
|
|
232
269
|
if (!mimeType) return undefined;
|
|
233
270
|
return EXPORT_MIME_TYPES[mimeType];
|
|
@@ -423,25 +460,27 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
|
|
|
423
460
|
},
|
|
424
461
|
},
|
|
425
462
|
actions: {
|
|
426
|
-
|
|
427
|
-
key: '
|
|
463
|
+
download_file: {
|
|
464
|
+
key: 'download_file',
|
|
428
465
|
kind: 'read',
|
|
429
466
|
requiresApproval: false,
|
|
430
|
-
name: '
|
|
467
|
+
name: 'Download File',
|
|
431
468
|
description:
|
|
432
|
-
'
|
|
469
|
+
'Download one Drive file. Google Docs/Sheets/Slides are exported (text/plain, CSV); everything else is downloaded as-is, binary included. The bytes are published as an attachment with a `download_url` a device can fetch, and small text files are ALSO returned inline as `content` so they can be read without a second call.',
|
|
433
470
|
requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'],
|
|
434
471
|
inputSchema: {
|
|
435
472
|
type: 'object',
|
|
436
473
|
required: ['file_id'],
|
|
437
474
|
properties: {
|
|
438
|
-
file_id: {
|
|
439
|
-
|
|
475
|
+
file_id: {
|
|
476
|
+
type: 'string',
|
|
477
|
+
description: 'Drive file ID to download.',
|
|
478
|
+
},
|
|
479
|
+
inline_max_bytes: {
|
|
440
480
|
type: 'integer',
|
|
441
|
-
minimum:
|
|
442
|
-
maximum:
|
|
443
|
-
description:
|
|
444
|
-
'Truncate the returned text to this many bytes (default 1048576).',
|
|
481
|
+
minimum: 0,
|
|
482
|
+
maximum: MAX_INLINE_CONTENT_BYTES,
|
|
483
|
+
description: `Return text content inline when the file is at most this many bytes (default ${DEFAULT_INLINE_CONTENT_BYTES}, max ${MAX_INLINE_CONTENT_BYTES}). Binary files are never inlined. 0 disables inlining; the attachment is still published.`,
|
|
445
484
|
},
|
|
446
485
|
},
|
|
447
486
|
},
|
|
@@ -831,8 +870,8 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
|
|
|
831
870
|
const http = this.client(token);
|
|
832
871
|
|
|
833
872
|
switch (ctx.actionKey) {
|
|
834
|
-
case '
|
|
835
|
-
return await this.
|
|
873
|
+
case 'download_file':
|
|
874
|
+
return await this.downloadFile(http, ctx.input);
|
|
836
875
|
case 'get_file':
|
|
837
876
|
return await this.getFile(http, ctx.input);
|
|
838
877
|
default:
|
|
@@ -860,16 +899,33 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
|
|
|
860
899
|
return { success: true, output: this.driveFileToRow(file) };
|
|
861
900
|
}
|
|
862
901
|
|
|
863
|
-
|
|
902
|
+
/**
|
|
903
|
+
* Download a file's bytes and publish them as an attachment.
|
|
904
|
+
*
|
|
905
|
+
* The bytes always go out as an attachment, so the gateway stores them and
|
|
906
|
+
* hands back a `download_url` — that is the path a device or sandbox uses,
|
|
907
|
+
* and it is why binary is no longer refused here. Inline `content` is an
|
|
908
|
+
* extra for the small-text case only: a caller that just wants to read a
|
|
909
|
+
* config file should not have to make a second request for it.
|
|
910
|
+
*
|
|
911
|
+
* Nothing here enforces the gateway's attachment size cap. The gateway owns
|
|
912
|
+
* that limit and reports what it refused in `attachments_rejected`;
|
|
913
|
+
* duplicating the number on this side of the boundary would just let the two
|
|
914
|
+
* drift apart.
|
|
915
|
+
*/
|
|
916
|
+
private async downloadFile(
|
|
864
917
|
http: HttpClient,
|
|
865
918
|
input: Record<string, unknown>
|
|
866
919
|
): Promise<ActionResult> {
|
|
867
920
|
const fileId = input.file_id as string;
|
|
868
921
|
if (!fileId) return { success: false, error: 'file_id is required.' };
|
|
869
922
|
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
923
|
+
const requestedInline = input.inline_max_bytes;
|
|
924
|
+
const inlineMaxBytes = Math.min(
|
|
925
|
+
typeof requestedInline === 'number' && Number.isFinite(requestedInline) && requestedInline >= 0
|
|
926
|
+
? requestedInline
|
|
927
|
+
: DEFAULT_INLINE_CONTENT_BYTES,
|
|
928
|
+
MAX_INLINE_CONTENT_BYTES
|
|
873
929
|
);
|
|
874
930
|
|
|
875
931
|
const file = await this.fetchFileMetadata(http, fileId);
|
|
@@ -877,22 +933,51 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
|
|
|
877
933
|
return { success: false, error: `Drive file not found: ${fileId}` };
|
|
878
934
|
}
|
|
879
935
|
|
|
880
|
-
const fetched = await this.
|
|
936
|
+
const fetched = await this.fetchFileBytes(http, file);
|
|
881
937
|
if (!fetched.ok) {
|
|
882
938
|
return { success: false, error: fetched.error };
|
|
883
939
|
}
|
|
884
940
|
|
|
941
|
+
const filename = file.name ?? file.id;
|
|
942
|
+
// `kind` is deliberately omitted: the gateway infers it from the media type
|
|
943
|
+
// (`inferKindFromMime`), so there is one rule rather than two that can
|
|
944
|
+
// disagree about what counts as an image.
|
|
945
|
+
const attachment = {
|
|
946
|
+
filename,
|
|
947
|
+
mime_type: fetched.contentType,
|
|
948
|
+
data: fetched.bytes.toString('base64'),
|
|
949
|
+
size_bytes: fetched.bytes.length,
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
// Text is TRUNCATED to the inline budget rather than withheld: an agent
|
|
953
|
+
// peeking at a large log or CSV is better served by its first page than by
|
|
954
|
+
// being told to go fetch a URL. The attachment always carries the whole
|
|
955
|
+
// file, so truncating here loses nothing.
|
|
956
|
+
const textual =
|
|
957
|
+
fetched.exportedAs !== undefined || isTextualMimeType(file.mimeType);
|
|
958
|
+
const inline = inlineMaxBytes > 0 && textual ? inlineText(fetched.bytes, inlineMaxBytes) : undefined;
|
|
959
|
+
|
|
885
960
|
return {
|
|
886
961
|
success: true,
|
|
887
962
|
output: {
|
|
888
963
|
file_id: file.id,
|
|
889
|
-
name:
|
|
964
|
+
name: filename,
|
|
890
965
|
mime_type: file.mimeType ?? '',
|
|
891
966
|
exported_as: fetched.exportedAs,
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
967
|
+
size_bytes: fetched.bytes.length,
|
|
968
|
+
attachments: [attachment],
|
|
969
|
+
...(inline
|
|
970
|
+
? {
|
|
971
|
+
content: inline.content,
|
|
972
|
+
content_truncated: inline.truncated,
|
|
973
|
+
line_count:
|
|
974
|
+
inline.content.length === 0 ? 0 : inline.content.split('\n').length,
|
|
975
|
+
}
|
|
976
|
+
: {
|
|
977
|
+
content_omitted_reason: textual
|
|
978
|
+
? 'inlining disabled'
|
|
979
|
+
: 'file is binary; fetch it through the attachment download_url',
|
|
980
|
+
}),
|
|
896
981
|
},
|
|
897
982
|
};
|
|
898
983
|
}
|
|
@@ -901,12 +986,106 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
|
|
|
901
986
|
// Content fetching
|
|
902
987
|
// -------------------------------------------------------------------------
|
|
903
988
|
|
|
989
|
+
/**
|
|
990
|
+
* Decide how a file's content is retrieved: `files.export` for a Google-native
|
|
991
|
+
* doc, `alt=media` for everything else.
|
|
992
|
+
*
|
|
993
|
+
* Shared by the bytes and text paths so the two can never disagree about
|
|
994
|
+
* which URL a given file needs, or about which items have no content at all.
|
|
995
|
+
*/
|
|
996
|
+
private contentRequest(
|
|
997
|
+
file: DriveFile
|
|
998
|
+
): { ok: true; url: string; exportMime?: string } | { ok: false; error: string } {
|
|
999
|
+
const exportMime = exportMimeTypeFor(file.mimeType);
|
|
1000
|
+
|
|
1001
|
+
if (isGoogleNative(file.mimeType) && !exportMime) {
|
|
1002
|
+
return {
|
|
1003
|
+
ok: false,
|
|
1004
|
+
error: `Google Drive item of type ${file.mimeType} has no text export (folders, shortcuts and forms carry no content).`,
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return {
|
|
1009
|
+
ok: true,
|
|
1010
|
+
url: exportMime
|
|
1011
|
+
? `${this.BASE_URL}/files/${encodeURIComponent(file.id)}/export?mimeType=${encodeURIComponent(exportMime)}`
|
|
1012
|
+
: `${this.BASE_URL}/files/${encodeURIComponent(file.id)}?alt=media&supportsAllDrives=true`,
|
|
1013
|
+
...(exportMime ? { exportMime } : {}),
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Fetch a file's raw bytes, binary included.
|
|
1019
|
+
*
|
|
1020
|
+
* Unlike `fetchTextContent` this never decodes, so a PDF or an image survives
|
|
1021
|
+
* intact on its way to the artifact store. Google-native docs still go through
|
|
1022
|
+
* `files.export`, because their "raw" bytes are not a document.
|
|
1023
|
+
*/
|
|
1024
|
+
private async fetchFileBytes(
|
|
1025
|
+
http: HttpClient,
|
|
1026
|
+
file: DriveFile
|
|
1027
|
+
): Promise<
|
|
1028
|
+
| { ok: true; bytes: Buffer; contentType: string; exportedAs?: string }
|
|
1029
|
+
| { ok: false; error: string }
|
|
1030
|
+
> {
|
|
1031
|
+
const request = this.contentRequest(file);
|
|
1032
|
+
if (!request.ok) return request;
|
|
1033
|
+
|
|
1034
|
+
// Refuse before fetching. The isolate buffers the whole body, then base64s
|
|
1035
|
+
// it to cross the host boundary at 4/3 the size, so an unbounded download
|
|
1036
|
+
// is an out-of-memory kill rather than an error the caller can read.
|
|
1037
|
+
// MAX_EXPORT_BYTES sits above the gateway's own attachment cap on purpose:
|
|
1038
|
+
// the gateway stays the authority on what is too big to store, and this
|
|
1039
|
+
// only stops what cannot physically make the trip.
|
|
1040
|
+
const declaredSize = parseSize(file.size);
|
|
1041
|
+
if (declaredSize !== undefined && declaredSize > MAX_EXPORT_BYTES) {
|
|
1042
|
+
return {
|
|
1043
|
+
ok: false,
|
|
1044
|
+
error: `File ${file.name ?? file.id} is ${declaredSize} bytes, above the ${MAX_EXPORT_BYTES}-byte download limit.`,
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
const response = await http.raw(request.url);
|
|
1049
|
+
if (!response.ok) {
|
|
1050
|
+
return {
|
|
1051
|
+
ok: false,
|
|
1052
|
+
error: `Drive ${request.exportMime ? 'files.export' : 'files.get'} error (${response.status}): ${await response.text()}`,
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
1057
|
+
if (bytes.length > MAX_EXPORT_BYTES) {
|
|
1058
|
+
// Drive omits `size` for native docs, so the export path only learns the
|
|
1059
|
+
// real size here. Same refusal, after the fact.
|
|
1060
|
+
return {
|
|
1061
|
+
ok: false,
|
|
1062
|
+
error: `File ${file.name ?? file.id} returned ${bytes.length} bytes, above the ${MAX_EXPORT_BYTES}-byte download limit.`,
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
if (bytes.length === 0) {
|
|
1066
|
+
return { ok: false, error: `Drive file ${file.name ?? file.id} is empty.` };
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
return {
|
|
1070
|
+
ok: true,
|
|
1071
|
+
bytes,
|
|
1072
|
+
contentType:
|
|
1073
|
+
request.exportMime ??
|
|
1074
|
+
response.headers.get('content-type')?.split(';')[0]?.trim() ??
|
|
1075
|
+
file.mimeType ??
|
|
1076
|
+
'application/octet-stream',
|
|
1077
|
+
...(request.exportMime ? { exportedAs: request.exportMime } : {}),
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
|
|
904
1081
|
/**
|
|
905
1082
|
* Fetch a file's text, choosing export vs. direct download by MIME type.
|
|
906
1083
|
*
|
|
907
1084
|
* Binary files are refused rather than decoded: running a PDF through
|
|
908
1085
|
* `response.text()` yields replacement characters that look like content to
|
|
909
|
-
* a model and would be indistinguishable from a genuinely empty file.
|
|
1086
|
+
* a model and would be indistinguishable from a genuinely empty file. This
|
|
1087
|
+
* path feeds the FEED, where the text is embedded; `download_file` uses
|
|
1088
|
+
* `fetchFileBytes` and has no such restriction.
|
|
910
1089
|
*/
|
|
911
1090
|
private async fetchTextContent(
|
|
912
1091
|
http: HttpClient,
|
|
@@ -922,27 +1101,18 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
|
|
|
922
1101
|
}
|
|
923
1102
|
| { ok: false; error: string }
|
|
924
1103
|
> {
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
return {
|
|
929
|
-
ok: false,
|
|
930
|
-
error: `Google Drive item of type ${file.mimeType} has no text export (folders, shortcuts and forms carry no content).`,
|
|
931
|
-
};
|
|
932
|
-
}
|
|
1104
|
+
const request = this.contentRequest(file);
|
|
1105
|
+
if (!request.ok) return request;
|
|
1106
|
+
const exportMime = request.exportMime;
|
|
933
1107
|
|
|
934
1108
|
if (!exportMime && !isTextualMimeType(file.mimeType)) {
|
|
935
1109
|
return {
|
|
936
1110
|
ok: false,
|
|
937
|
-
error: `File ${file.name ?? file.id} is binary (${file.mimeType ?? 'unknown type'}); its bytes are not text and were not decoded.`,
|
|
1111
|
+
error: `File ${file.name ?? file.id} is binary (${file.mimeType ?? 'unknown type'}); its bytes are not text and were not decoded. Use download_file to fetch it.`,
|
|
938
1112
|
};
|
|
939
1113
|
}
|
|
940
1114
|
|
|
941
|
-
const
|
|
942
|
-
? `${this.BASE_URL}/files/${encodeURIComponent(file.id)}/export?mimeType=${encodeURIComponent(exportMime)}`
|
|
943
|
-
: `${this.BASE_URL}/files/${encodeURIComponent(file.id)}?alt=media&supportsAllDrives=true`;
|
|
944
|
-
|
|
945
|
-
const response = await http.raw(url);
|
|
1115
|
+
const response = await http.raw(request.url);
|
|
946
1116
|
if (!response.ok) {
|
|
947
1117
|
return {
|
|
948
1118
|
ok: false,
|
|
@@ -1076,7 +1246,7 @@ export default class GoogleDriveConnector extends ConnectorRuntime<
|
|
|
1076
1246
|
// The failure is RECORDED rather than retried. A file that syncs once and
|
|
1077
1247
|
// never changes again is never revisited, so a silent miss would be
|
|
1078
1248
|
// permanent and indistinguishable from "this file has no text by design".
|
|
1079
|
-
// `content_error` makes the two tellable apart, and the `
|
|
1249
|
+
// `content_error` makes the two tellable apart, and the `download_file`
|
|
1080
1250
|
// action can still fetch on demand — which is the recovery path, not a
|
|
1081
1251
|
// retry queue whose state would grow without bound.
|
|
1082
1252
|
if (includeContent && this.shouldInlineContent(file, lastSyncAt)) {
|