@lobu/runtime-server 21.2.1 → 23.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 +18435 -1259
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +21 -6
- 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 +52 -33
- package/dist/connectors/herdr.ts +406 -0
- package/dist/connectors/jira-helpers.ts +313 -0
- package/dist/connectors/jira.ts +35 -227
- package/dist/connectors/linear.ts +7 -4
- package/dist/connectors/linkedin-browser-script.ts +13 -0
- package/dist/connectors/linkedin-draft-page.js +104 -0
- package/dist/connectors/linkedin-drafts.ts +73 -0
- package/dist/connectors/linkedin-identity.ts +32 -0
- package/dist/connectors/linkedin-inbox-adapter.js +1185 -0
- package/dist/connectors/linkedin-inbox.ts +156 -0
- package/dist/connectors/linkedin-like.ts +114 -0
- package/dist/connectors/linkedin-takeout.ts +577 -0
- package/dist/connectors/linkedin.ts +3998 -0
- package/dist/connectors/postgres.ts +27 -2
- package/dist/connectors/takeout-utils.ts +240 -0
- package/dist/connectors/tiktok-inbox-page.js +230 -0
- package/dist/connectors/tiktok-web-page.js +217 -0
- package/dist/connectors/tiktok_web.ts +319 -0
- package/dist/connectors/whatsapp-web-adapter.js +285 -567
- package/dist/connectors/whatsapp-web-helpers.ts +74 -455
- package/dist/connectors/whatsapp-web-identity.ts +135 -0
- package/dist/connectors/whatsapp_web.ts +159 -618
- package/dist/connectors/x-dm-adapter.js +556 -0
- package/dist/connectors/x-identity.ts +31 -2
- package/dist/connectors/x.ts +539 -253
- 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/20261017120000_drop_feeds_kind_virtual.sql +26 -0
- package/dist/db/migrations/20261017130000_drop_retired_dead_code_columns.sql +46 -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 +144 -137
- package/dist/guest.bundle.js +416 -330
- package/dist/owletto/dist/assets/_-3J-IrxWk.js +2 -0
- package/dist/owletto/dist/assets/_-DYUE3ix4.js +3 -0
- package/dist/owletto/dist/assets/_-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +2 -0
- package/dist/owletto/dist/assets/_agentId-Cam7Z0N7.js +2 -0
- package/dist/owletto/dist/assets/_automationId-CXEiKVZJ.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CS85l61t.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-clVDIyW0.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-Ci2k-BuN.js +2 -0
- package/dist/owletto/dist/assets/_deploymentId-BuUzGtVL.js +2 -0
- package/dist/owletto/dist/assets/_eventId-B0662F8h.js +2 -0
- package/dist/owletto/dist/assets/_name-CwWePlOl.js +2 -0
- package/dist/owletto/dist/assets/_owner-dTWkrKsK.js +3 -0
- package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +2 -0
- package/dist/owletto/dist/assets/_slug-DQHutM41.js +2 -0
- package/dist/owletto/dist/assets/_threadId-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-w17IFTtf.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-CMqYiiKM.js +2 -0
- package/dist/owletto/dist/assets/agent-card-controls-mnTN2AZt.js +2 -0
- package/dist/owletto/dist/assets/{agent-client-setup-list-BFtgRwe8.js → agent-client-setup-list-Bg3hBfUV.js} +4 -3
- package/dist/owletto/dist/assets/agent-connect-pages-B_vrqLVc.js +2 -0
- package/dist/owletto/dist/assets/agent-editor-form-hTs7eO_U.js +2 -0
- package/dist/owletto/dist/assets/agent-guardrails-route-BOrCXcAl.js +2 -0
- package/dist/owletto/dist/assets/agent-loading-shells-Dqcvky-k.js +2 -0
- package/dist/owletto/dist/assets/agent-permissions-matrix-BOo_4r_4.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-BAr2Dw3F.js → agent-skill-context-CCdvtlmH.js} +2 -1
- package/dist/owletto/dist/assets/agent-skills-route-BUxIswuq.js +2 -0
- package/dist/owletto/dist/assets/agent-subpage-shell-D92imvSt.js +2 -0
- package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +6 -0
- package/dist/owletto/dist/assets/agents-9XjpDj_S.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-Bt5QCYQ7.js +2 -0
- package/dist/owletto/dist/assets/app-bridge-BCm4muqj.js +128 -0
- package/dist/owletto/dist/assets/app._appId-CKv7_squ.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-vUwVumXf.js +2 -0
- package/dist/owletto/dist/assets/automations-9XjpDj_S.js +2 -0
- package/dist/owletto/dist/assets/{callback-CaRe2TOT.js → callback-BRgcL8gz.js} +2 -1
- package/dist/owletto/dist/assets/{card-CMmh2mzo.js → card-Djgp00r_.js} +2 -1
- package/dist/owletto/dist/assets/claim-BYUZnyMp.js +2 -0
- package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +1 -0
- package/dist/owletto/dist/assets/clients-D3Zbjxin.js +2 -0
- package/dist/owletto/dist/assets/code-editor-DHeyRGZI.js +16 -0
- package/dist/owletto/dist/assets/connect-CfsFsy9P.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-Ckdz6I0y.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-CNxafNeo.js +2 -0
- package/dist/owletto/dist/assets/connection-C3XXFEqh.js +2 -0
- package/dist/owletto/dist/assets/connection-feed-detail-CIJJLDP8.js +2 -0
- package/dist/owletto/dist/assets/connection-label-BobuYiAG.js +1 -0
- package/dist/owletto/dist/assets/connections-browser-CKZjzRz6.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-BjKiUhYE.js → connector-provenance-8-d8hl10.js} +2 -1
- package/dist/owletto/dist/assets/connector-scope-lists-CadPVsI3.js +2 -0
- package/dist/owletto/dist/assets/{connectors-Baejya0T.js → connectors-lvLJ30lo.js} +2 -1
- package/dist/owletto/dist/assets/consent-CdSvVCgx.js +2 -0
- package/dist/owletto/dist/assets/conversations-table-BdXoZAfc.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-QA7BQgiK.js → core.esm-CYvgWCuv.js} +2 -1
- package/dist/owletto/dist/assets/create-0xW9eXxG.js +2 -0
- package/dist/owletto/dist/assets/create-B0qhrrX4.js +2 -0
- package/dist/owletto/dist/assets/create-CAfF-yI1.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-CtSSeYj3.js +3 -0
- package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-2GHCtD7h.js → cronstrue-n4qGUraE.js} +2 -1
- package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +2 -0
- package/dist/owletto/dist/assets/deployments-RvUdVkj3.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-Bm2upStd.js → deployments-body-BMp7UsMo.js} +2 -1
- package/dist/owletto/dist/assets/device-CPU6CjkJ.js +2 -0
- package/dist/owletto/dist/assets/device-pin-tombstone-CrjG7gPo.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-Cs3ZmXWo.js +2 -0
- package/dist/owletto/dist/assets/{entity-options-CrbS6K-i.js → entity-options-uXjgT7y9.js} +2 -1
- package/dist/owletto/dist/assets/entity-page-Dc0LGr5U.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-CwZxa0BR.js +2 -0
- package/dist/owletto/dist/assets/event-detail-ve2d6Gbb.js +2 -0
- package/dist/owletto/dist/assets/events-feed-BtvhZF1f.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-Cj-v6NtH.js +2 -0
- package/dist/owletto/dist/assets/full-page-spinner-DqpH99np.js +2 -0
- package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +2 -0
- package/dist/owletto/dist/assets/identity-BigVSBCl.js +2 -0
- package/dist/owletto/dist/assets/index-B9uPN6FC.js +2 -0
- package/dist/owletto/dist/assets/index-BLEcy9-T.css +1 -0
- package/dist/owletto/dist/assets/index-BQVliQW1.js +2 -0
- package/dist/owletto/dist/assets/index-BfedB4Rc.js +2 -0
- package/dist/owletto/dist/assets/index-CDz3-ieP.js +1 -0
- package/dist/owletto/dist/assets/index-CUw3aKBI.js +2 -0
- package/dist/owletto/dist/assets/index-CXhxUkv3.js +2 -0
- package/dist/owletto/dist/assets/index-Cr5hwh-C.js +7950 -0
- package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +2 -0
- package/dist/owletto/dist/assets/index-DKSx8JN_.js +2 -0
- package/dist/owletto/dist/assets/index-DVk7Ug0d.js +2 -0
- package/dist/owletto/dist/assets/index-DmZuKGf8.js +2 -0
- package/dist/owletto/dist/assets/index-DtqBFgK5.js +1 -0
- package/dist/owletto/dist/assets/index-Hio-HRfo.js +2 -0
- package/dist/owletto/dist/assets/{index-Cf0GJoiG.js → index-ICgKp3YK.js} +2 -1
- package/dist/owletto/dist/assets/index-Vcq4gwWv.js +1 -0
- package/dist/owletto/dist/assets/index-cPcroOH0.js +2 -0
- package/dist/owletto/dist/assets/{index-DlepU3cY.js → index-n7sTbNv4.js} +2 -1
- package/dist/owletto/dist/assets/index-rrnUF981.js +1 -0
- package/dist/owletto/dist/assets/index-xiFpcWKv.js +2 -0
- package/dist/owletto/dist/assets/json-diff-DBoag_OS.js +4 -0
- package/dist/owletto/dist/assets/{list-skeleton-BtWn2eo2.js → list-skeleton-C_GuoxAH.js} +2 -1
- package/dist/owletto/dist/assets/login-Ci6ixHuL.js +2 -0
- package/dist/owletto/dist/assets/logout-CLGgeZB7.js +2 -0
- package/dist/owletto/dist/assets/member-scope-gate-B44INDPY.js +2 -0
- package/dist/owletto/dist/assets/memory-browse-page-DyQiRvzl.js +103 -0
- package/dist/owletto/dist/assets/model-selector-dAbDgJvx.js +2 -0
- package/dist/owletto/dist/assets/models-DpVP7ZwX.js +2 -0
- package/dist/owletto/dist/assets/new-BUb7AnEW.js +2 -0
- package/dist/owletto/dist/assets/new-BkdULx2r.js +2 -0
- package/dist/owletto/dist/assets/new-CHOr-EcI.js +2 -0
- package/dist/owletto/dist/assets/oauth-workspace-access-BxsjwgdH.js +2 -0
- package/dist/owletto/dist/assets/organization-gxGeDjIV.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-CHoQHe2H.js +2 -0
- package/dist/owletto/dist/assets/{permissions-h_qSft1A.js → permissions-aPHaKLec.js} +2 -1
- package/dist/owletto/dist/assets/proposal-review-shell-UcZr87_Q.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +2 -0
- package/dist/owletto/dist/assets/{recent-JiBNvZzD.js → recent-D-65Pgu-.js} +2 -1
- package/dist/owletto/dist/assets/record-activity-CBXH6v1d.js +2 -0
- package/dist/owletto/dist/assets/{renderer-DgPLyEbx.js → renderer-mEDnVW0O.js} +28 -27
- package/dist/owletto/dist/assets/reset-password-uX_V6bip.js +2 -0
- package/dist/owletto/dist/assets/runs-C0rCgGwX.js +2 -0
- package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +2 -0
- package/dist/owletto/dist/assets/runs-table-syPJ6r6T.js +2 -0
- package/dist/owletto/dist/assets/settings-9NkNA1G1.js +2 -0
- package/dist/owletto/dist/assets/settings-E-10sLQX.js +2 -0
- package/dist/owletto/dist/assets/skill-editor-D_W3QlRz.js +1 -0
- package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +2 -0
- package/dist/owletto/dist/assets/source-record-panels-CPyzlfD1.js +2 -0
- package/dist/owletto/dist/assets/status-dot-B-EWMgq6.js +2 -0
- package/dist/owletto/dist/assets/tabs-DqIIkCX-.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-B4DfZFm5.js → use-mention-search-By8RZyKW.js} +3 -2
- package/dist/owletto/dist/assets/view-param-filters-CqLZQrnO.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 +137029 -133673
- package/npm-shrinkwrap.json +612 -645
- package/package.json +4 -3
- package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
- package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
- 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/browser-source-read.d.ts +52 -0
- package/vendor/connector-sdk/dist/browser-source-read.js +107 -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 +169 -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 +8 -2
- package/vendor/connector-sdk/dist/index.js +3 -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 +13 -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.d.ts +1 -1
- package/vendor/core/dist/capabilities.js +2 -1
- package/vendor/core/dist/connector-query-errors.d.ts +32 -0
- package/vendor/core/dist/connector-query-errors.js +41 -1
- 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-conversations.js +2 -2
- 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-feeds.d.ts +14 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
- 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 +130 -159
- package/vendor/core/dist/contracts/worker/protocol.js +88 -76
- package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
- package/vendor/core/dist/device-pin-tombstones.js +57 -0
- package/vendor/core/dist/index.d.ts +5 -5
- package/vendor/core/dist/index.js +4 -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 +17 -26
- 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/diagnostic-scrubber.js +437 -0
- package/vendor/core/dist/worker/auth.d.ts +44 -6
- package/vendor/core/dist/worker/auth.js +44 -11
- package/vendor/core/dist/worker/wire.d.ts +0 -10
- package/vendor/core/package.json +20 -11
- 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/contracts/worker/device-chat.d.ts +0 -4
- package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
- 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/vendor/core/dist/utils/sentry-scrubber.js +0 -228
package/dist/guest.bundle.js
CHANGED
|
@@ -4333,7 +4333,7 @@ var init_agent_policy = __esm({
|
|
|
4333
4333
|
description: "Post a message to one of your conversations. Pass a conversation handle (from list_conversations) to post to the channel, or a thread handle (returned by a previous send_message) to reply in that thread. This is how an automated/scheduled run speaks in its channel."
|
|
4334
4334
|
},
|
|
4335
4335
|
present_event: {
|
|
4336
|
-
description: "
|
|
4336
|
+
description: "Present an existing Lobu event as a summary and Open event link in the current conversation. Custom interactions open in its React view. Use the event id returned by knowledge.save; do not hand-author platform card JSON or action ids."
|
|
4337
4337
|
},
|
|
4338
4338
|
schedule_followup: {
|
|
4339
4339
|
description: "Schedule one durable future wake-up for yourself in the current conversation. The server fixes the agent and destination from the signed turn; provide a stable idempotency key so retries do not duplicate the wake-up."
|
|
@@ -4501,6 +4501,271 @@ var init_agent_tooling = __esm({
|
|
|
4501
4501
|
}
|
|
4502
4502
|
});
|
|
4503
4503
|
|
|
4504
|
+
// ../plugin-toolkit/dist/mcp-content.js
|
|
4505
|
+
var require_mcp_content = __commonJS({
|
|
4506
|
+
"../plugin-toolkit/dist/mcp-content.js"(exports2) {
|
|
4507
|
+
"use strict";
|
|
4508
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4509
|
+
exports2.MAX_TOOL_IMAGES = exports2.MAX_TOOL_IMAGE_BYTES_TOTAL = exports2.MAX_TOOL_IMAGE_BYTES = void 0;
|
|
4510
|
+
exports2.toolImageBudget = toolImageBudget2;
|
|
4511
|
+
exports2.isToolImageMimeType = isToolImageMimeType;
|
|
4512
|
+
exports2.mcpToolResult = mcpToolResult2;
|
|
4513
|
+
exports2.MAX_TOOL_IMAGE_BYTES = 5 * 1024 * 1024;
|
|
4514
|
+
exports2.MAX_TOOL_IMAGE_BYTES_TOTAL = 10 * 1024 * 1024;
|
|
4515
|
+
exports2.MAX_TOOL_IMAGES = 8;
|
|
4516
|
+
function base64DecodedBytes(data) {
|
|
4517
|
+
return Math.ceil(data.length / 4) * 3 - (data.endsWith("==") ? 2 : data.endsWith("=") ? 1 : 0);
|
|
4518
|
+
}
|
|
4519
|
+
function toolImageBudget2(content) {
|
|
4520
|
+
const budget = { bytes: 0 };
|
|
4521
|
+
for (const raw of content) {
|
|
4522
|
+
if (!raw || typeof raw !== "object")
|
|
4523
|
+
continue;
|
|
4524
|
+
const part = raw;
|
|
4525
|
+
if (part.type !== "image" || typeof part.data !== "string")
|
|
4526
|
+
continue;
|
|
4527
|
+
budget.bytes += base64DecodedBytes(part.data);
|
|
4528
|
+
}
|
|
4529
|
+
return budget;
|
|
4530
|
+
}
|
|
4531
|
+
var IMAGE_TYPES = /* @__PURE__ */ new Set([
|
|
4532
|
+
"image/png",
|
|
4533
|
+
"image/jpeg",
|
|
4534
|
+
"image/webp",
|
|
4535
|
+
"image/gif"
|
|
4536
|
+
]);
|
|
4537
|
+
function isToolImageMimeType(value) {
|
|
4538
|
+
return typeof value === "string" && IMAGE_TYPES.has(value);
|
|
4539
|
+
}
|
|
4540
|
+
function imageBytes(data) {
|
|
4541
|
+
if (typeof data !== "string" || data.length === 0)
|
|
4542
|
+
return null;
|
|
4543
|
+
if (data.length > 4 * Math.ceil(exports2.MAX_TOOL_IMAGE_BYTES / 3))
|
|
4544
|
+
return null;
|
|
4545
|
+
if (data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(data))
|
|
4546
|
+
return null;
|
|
4547
|
+
return base64DecodedBytes(data);
|
|
4548
|
+
}
|
|
4549
|
+
function hasImageSignature(data, mimeType) {
|
|
4550
|
+
const header = atob(data.slice(0, 16));
|
|
4551
|
+
if (mimeType === "image/png")
|
|
4552
|
+
return header.startsWith("\x89PNG\r\n\n");
|
|
4553
|
+
if (mimeType === "image/jpeg")
|
|
4554
|
+
return header.startsWith("\xFF\xD8\xFF");
|
|
4555
|
+
if (mimeType === "image/gif")
|
|
4556
|
+
return header.startsWith("GIF87a") || header.startsWith("GIF89a");
|
|
4557
|
+
return header.startsWith("RIFF") && header.slice(8, 12) === "WEBP";
|
|
4558
|
+
}
|
|
4559
|
+
function mcpToolResult2(content, fallback, supportsImages = true, budget) {
|
|
4560
|
+
const result = { content: [] };
|
|
4561
|
+
let count = 0;
|
|
4562
|
+
let total = 0;
|
|
4563
|
+
let hasImageLink = false;
|
|
4564
|
+
const diagnostics = /* @__PURE__ */ new Set();
|
|
4565
|
+
for (const raw of Array.isArray(content) ? content : []) {
|
|
4566
|
+
if (!raw || typeof raw !== "object")
|
|
4567
|
+
continue;
|
|
4568
|
+
const part = raw;
|
|
4569
|
+
if (part.type === "text" && typeof part.text === "string") {
|
|
4570
|
+
if (part.text)
|
|
4571
|
+
result.content.push({ type: "text", text: part.text });
|
|
4572
|
+
continue;
|
|
4573
|
+
}
|
|
4574
|
+
if (part.type === "resource_link") {
|
|
4575
|
+
hasImageLink ||= isToolImageMimeType(part.mimeType);
|
|
4576
|
+
continue;
|
|
4577
|
+
}
|
|
4578
|
+
const resource = part.type === "resource" && part.resource && typeof part.resource === "object" ? part.resource : void 0;
|
|
4579
|
+
if (resource && typeof resource.text === "string") {
|
|
4580
|
+
if (resource.text)
|
|
4581
|
+
result.content.push({ type: "text", text: resource.text });
|
|
4582
|
+
continue;
|
|
4583
|
+
}
|
|
4584
|
+
if (part.type !== "image" && !(resource && typeof resource.mimeType === "string" && resource.mimeType.startsWith("image/")))
|
|
4585
|
+
continue;
|
|
4586
|
+
const mimeType = resource ? resource.mimeType : part.mimeType;
|
|
4587
|
+
const data = resource ? resource.blob : part.data;
|
|
4588
|
+
const size = imageBytes(data);
|
|
4589
|
+
let reason;
|
|
4590
|
+
if (!supportsImages)
|
|
4591
|
+
reason = "the selected model does not declare image input support";
|
|
4592
|
+
else if (!isToolImageMimeType(mimeType) || size === null || !hasImageSignature(data, mimeType))
|
|
4593
|
+
reason = "unsupported MIME type, invalid image bytes, or image size limit";
|
|
4594
|
+
else if (size > exports2.MAX_TOOL_IMAGE_BYTES || count >= exports2.MAX_TOOL_IMAGES || total + size > exports2.MAX_TOOL_IMAGE_BYTES_TOTAL || budget && budget.bytes + size > exports2.MAX_TOOL_IMAGE_BYTES_TOTAL)
|
|
4595
|
+
reason = "tool image budget exhausted";
|
|
4596
|
+
if (reason) {
|
|
4597
|
+
diagnostics.add(`Image not delivered: ${reason}. Do not infer visual contents.`);
|
|
4598
|
+
continue;
|
|
4599
|
+
}
|
|
4600
|
+
result.content.push({
|
|
4601
|
+
type: "image",
|
|
4602
|
+
mimeType,
|
|
4603
|
+
data
|
|
4604
|
+
});
|
|
4605
|
+
count++;
|
|
4606
|
+
total += size;
|
|
4607
|
+
if (budget)
|
|
4608
|
+
budget.bytes += size;
|
|
4609
|
+
}
|
|
4610
|
+
if (hasImageLink && count === 0)
|
|
4611
|
+
diagnostics.add("Image bytes were not supplied. A resource link alone is not a visual observation.");
|
|
4612
|
+
for (const text2 of diagnostics)
|
|
4613
|
+
result.content.push({ type: "text", text: text2 });
|
|
4614
|
+
if (result.content.length === 0)
|
|
4615
|
+
result.content.push({ type: "text", text: fallback });
|
|
4616
|
+
return result;
|
|
4617
|
+
}
|
|
4618
|
+
}
|
|
4619
|
+
});
|
|
4620
|
+
|
|
4621
|
+
// ../plugin-toolkit/dist/index.js
|
|
4622
|
+
var require_dist = __commonJS({
|
|
4623
|
+
"../plugin-toolkit/dist/index.js"(exports2) {
|
|
4624
|
+
"use strict";
|
|
4625
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4626
|
+
exports2.toolLogger = exports2.MAX_TOOL_IMAGES = exports2.MAX_TOOL_IMAGE_BYTES_TOTAL = exports2.MAX_TOOL_IMAGE_BYTES = exports2.isToolImageMimeType = exports2.mcpToolResult = exports2.toolImageBudget = void 0;
|
|
4627
|
+
exports2.setToolLogger = setToolLogger;
|
|
4628
|
+
exports2.createGatewayClient = createGatewayClient;
|
|
4629
|
+
exports2.textResult = textResult;
|
|
4630
|
+
exports2.jsonResult = jsonResult;
|
|
4631
|
+
exports2.joinTextContent = joinTextContent;
|
|
4632
|
+
exports2.withErrorHandling = withErrorHandling;
|
|
4633
|
+
exports2.parseErrorBody = parseErrorBody;
|
|
4634
|
+
exports2.gatewayFetch = gatewayFetch;
|
|
4635
|
+
exports2.postLinkButton = postLinkButton;
|
|
4636
|
+
exports2.toToolResult = toToolResult;
|
|
4637
|
+
exports2.defineTool = defineTool2;
|
|
4638
|
+
exports2.defineGatewayTool = defineGatewayTool;
|
|
4639
|
+
var agent_tooling_1 = (init_agent_tooling(), __toCommonJS(agent_tooling_exports));
|
|
4640
|
+
var mcp_content_1 = require_mcp_content();
|
|
4641
|
+
Object.defineProperty(exports2, "toolImageBudget", { enumerable: true, get: function() {
|
|
4642
|
+
return mcp_content_1.toolImageBudget;
|
|
4643
|
+
} });
|
|
4644
|
+
Object.defineProperty(exports2, "mcpToolResult", { enumerable: true, get: function() {
|
|
4645
|
+
return mcp_content_1.mcpToolResult;
|
|
4646
|
+
} });
|
|
4647
|
+
Object.defineProperty(exports2, "isToolImageMimeType", { enumerable: true, get: function() {
|
|
4648
|
+
return mcp_content_1.isToolImageMimeType;
|
|
4649
|
+
} });
|
|
4650
|
+
Object.defineProperty(exports2, "MAX_TOOL_IMAGE_BYTES", { enumerable: true, get: function() {
|
|
4651
|
+
return mcp_content_1.MAX_TOOL_IMAGE_BYTES;
|
|
4652
|
+
} });
|
|
4653
|
+
Object.defineProperty(exports2, "MAX_TOOL_IMAGE_BYTES_TOTAL", { enumerable: true, get: function() {
|
|
4654
|
+
return mcp_content_1.MAX_TOOL_IMAGE_BYTES_TOTAL;
|
|
4655
|
+
} });
|
|
4656
|
+
Object.defineProperty(exports2, "MAX_TOOL_IMAGES", { enumerable: true, get: function() {
|
|
4657
|
+
return mcp_content_1.MAX_TOOL_IMAGES;
|
|
4658
|
+
} });
|
|
4659
|
+
var logger = {
|
|
4660
|
+
error: (message, ...args) => console.error(message, ...args),
|
|
4661
|
+
warn: (message, ...args) => console.warn(message, ...args),
|
|
4662
|
+
info: (message, ...args) => console.info(message, ...args),
|
|
4663
|
+
debug: (message, ...args) => console.debug(message, ...args)
|
|
4664
|
+
};
|
|
4665
|
+
function setToolLogger(next) {
|
|
4666
|
+
logger = next;
|
|
4667
|
+
}
|
|
4668
|
+
exports2.toolLogger = {
|
|
4669
|
+
error: (message, ...args) => logger.error(message, ...args),
|
|
4670
|
+
warn: (message, ...args) => logger.warn(message, ...args),
|
|
4671
|
+
info: (message, ...args) => logger.info(message, ...args),
|
|
4672
|
+
debug: (message, ...args) => logger.debug(message, ...args)
|
|
4673
|
+
};
|
|
4674
|
+
function createGatewayClient(config) {
|
|
4675
|
+
const fetchFn = config.fetchFn ?? fetch;
|
|
4676
|
+
return {
|
|
4677
|
+
request(path6, init = {}) {
|
|
4678
|
+
return fetchFn(`${config.baseUrl}${path6}`, {
|
|
4679
|
+
method: init.method,
|
|
4680
|
+
headers: {
|
|
4681
|
+
Authorization: `Bearer ${config.token}`,
|
|
4682
|
+
...init.body !== void 0 ? { "Content-Type": "application/json" } : {},
|
|
4683
|
+
...init.headers
|
|
4684
|
+
},
|
|
4685
|
+
body: init.body,
|
|
4686
|
+
signal: init.signal ?? (init.timeoutMs !== void 0 ? AbortSignal.timeout(init.timeoutMs) : void 0)
|
|
4687
|
+
});
|
|
4688
|
+
}
|
|
4689
|
+
};
|
|
4690
|
+
}
|
|
4691
|
+
function textResult(text2) {
|
|
4692
|
+
return { content: [{ type: "text", text: text2 }] };
|
|
4693
|
+
}
|
|
4694
|
+
function jsonResult(payload) {
|
|
4695
|
+
return textResult(JSON.stringify(payload));
|
|
4696
|
+
}
|
|
4697
|
+
function joinTextContent(content) {
|
|
4698
|
+
return (content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
|
|
4699
|
+
}
|
|
4700
|
+
function withErrorHandling(label, fn2) {
|
|
4701
|
+
return fn2().catch((error) => {
|
|
4702
|
+
logger.error(`${label} error:`, error);
|
|
4703
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
4704
|
+
});
|
|
4705
|
+
}
|
|
4706
|
+
async function parseErrorBody(response) {
|
|
4707
|
+
return response.json().catch(() => ({ error: response.statusText }));
|
|
4708
|
+
}
|
|
4709
|
+
async function gatewayFetch(gateway, path6, options = {}, errorPrefix) {
|
|
4710
|
+
let response;
|
|
4711
|
+
try {
|
|
4712
|
+
response = await createGatewayClient({
|
|
4713
|
+
baseUrl: gateway.gatewayUrl,
|
|
4714
|
+
token: gateway.workerToken
|
|
4715
|
+
}).request(path6, {
|
|
4716
|
+
...options,
|
|
4717
|
+
timeoutMs: options.timeoutMs ?? 6e4
|
|
4718
|
+
});
|
|
4719
|
+
} catch (error) {
|
|
4720
|
+
if (error instanceof Error && error.name === "TimeoutError") {
|
|
4721
|
+
logger.error(`${errorPrefix}: request timed out`);
|
|
4722
|
+
return { error: textResult(`Error: ${errorPrefix} (timed out)`) };
|
|
4723
|
+
}
|
|
4724
|
+
throw error;
|
|
4725
|
+
}
|
|
4726
|
+
if (!response.ok) {
|
|
4727
|
+
const body = await parseErrorBody(response);
|
|
4728
|
+
logger.error(`${errorPrefix}: ${response.status}`, body);
|
|
4729
|
+
return { error: textResult(`Error: ${body.error || errorPrefix}`) };
|
|
4730
|
+
}
|
|
4731
|
+
return { data: await response.json() };
|
|
4732
|
+
}
|
|
4733
|
+
async function postLinkButton(gateway, args) {
|
|
4734
|
+
const { error } = await gatewayFetch(gateway, "/internal/interactions/create", {
|
|
4735
|
+
method: "POST",
|
|
4736
|
+
body: JSON.stringify({
|
|
4737
|
+
interactionType: "link_button",
|
|
4738
|
+
url: args.url,
|
|
4739
|
+
label: args.label,
|
|
4740
|
+
linkType: args.linkType ?? "oauth",
|
|
4741
|
+
body: args.body
|
|
4742
|
+
})
|
|
4743
|
+
}, "Failed to post link button");
|
|
4744
|
+
if (error) {
|
|
4745
|
+
throw new Error(joinTextContent(error.content) || "Failed to post link button");
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4748
|
+
function toToolResult(result) {
|
|
4749
|
+
return { content: result.content, details: {} };
|
|
4750
|
+
}
|
|
4751
|
+
function defineTool2(config) {
|
|
4752
|
+
return {
|
|
4753
|
+
name: config.name,
|
|
4754
|
+
label: config.name,
|
|
4755
|
+
description: config.description,
|
|
4756
|
+
parameters: config.parameters,
|
|
4757
|
+
execute: async (_toolCallId, args) => toToolResult(await config.run(args))
|
|
4758
|
+
};
|
|
4759
|
+
}
|
|
4760
|
+
function defineGatewayTool(config) {
|
|
4761
|
+
return defineTool2({
|
|
4762
|
+
...config,
|
|
4763
|
+
description: (0, agent_tooling_1.getCustomToolDescription)(config.name)
|
|
4764
|
+
});
|
|
4765
|
+
}
|
|
4766
|
+
}
|
|
4767
|
+
});
|
|
4768
|
+
|
|
4504
4769
|
// ../../node_modules/@sinclair/typebox/build/cjs/type/guard/value.js
|
|
4505
4770
|
var require_value = __commonJS({
|
|
4506
4771
|
"../../node_modules/@sinclair/typebox/build/cjs/type/guard/value.js"(exports2) {
|
|
@@ -16114,7 +16379,7 @@ var require_value5 = __commonJS({
|
|
|
16114
16379
|
});
|
|
16115
16380
|
|
|
16116
16381
|
// ../plugin-api/dist/index.js
|
|
16117
|
-
var
|
|
16382
|
+
var require_dist2 = __commonJS({
|
|
16118
16383
|
"../plugin-api/dist/index.js"(exports2) {
|
|
16119
16384
|
"use strict";
|
|
16120
16385
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -16144,135 +16409,6 @@ var require_dist = __commonJS({
|
|
|
16144
16409
|
}
|
|
16145
16410
|
});
|
|
16146
16411
|
|
|
16147
|
-
// ../plugin-toolkit/dist/index.js
|
|
16148
|
-
var require_dist2 = __commonJS({
|
|
16149
|
-
"../plugin-toolkit/dist/index.js"(exports2) {
|
|
16150
|
-
"use strict";
|
|
16151
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
16152
|
-
exports2.toolLogger = void 0;
|
|
16153
|
-
exports2.setToolLogger = setToolLogger;
|
|
16154
|
-
exports2.createGatewayClient = createGatewayClient;
|
|
16155
|
-
exports2.textResult = textResult;
|
|
16156
|
-
exports2.jsonResult = jsonResult;
|
|
16157
|
-
exports2.joinTextContent = joinTextContent;
|
|
16158
|
-
exports2.withErrorHandling = withErrorHandling;
|
|
16159
|
-
exports2.parseErrorBody = parseErrorBody;
|
|
16160
|
-
exports2.gatewayFetch = gatewayFetch;
|
|
16161
|
-
exports2.postLinkButton = postLinkButton;
|
|
16162
|
-
exports2.toToolResult = toToolResult;
|
|
16163
|
-
exports2.defineTool = defineTool2;
|
|
16164
|
-
exports2.defineGatewayTool = defineGatewayTool;
|
|
16165
|
-
var agent_tooling_1 = (init_agent_tooling(), __toCommonJS(agent_tooling_exports));
|
|
16166
|
-
var logger = {
|
|
16167
|
-
error: (message, ...args) => console.error(message, ...args),
|
|
16168
|
-
warn: (message, ...args) => console.warn(message, ...args),
|
|
16169
|
-
info: (message, ...args) => console.info(message, ...args),
|
|
16170
|
-
debug: (message, ...args) => console.debug(message, ...args)
|
|
16171
|
-
};
|
|
16172
|
-
function setToolLogger(next) {
|
|
16173
|
-
logger = next;
|
|
16174
|
-
}
|
|
16175
|
-
exports2.toolLogger = {
|
|
16176
|
-
error: (message, ...args) => logger.error(message, ...args),
|
|
16177
|
-
warn: (message, ...args) => logger.warn(message, ...args),
|
|
16178
|
-
info: (message, ...args) => logger.info(message, ...args),
|
|
16179
|
-
debug: (message, ...args) => logger.debug(message, ...args)
|
|
16180
|
-
};
|
|
16181
|
-
function createGatewayClient(config) {
|
|
16182
|
-
const fetchFn = config.fetchFn ?? fetch;
|
|
16183
|
-
return {
|
|
16184
|
-
request(path6, init = {}) {
|
|
16185
|
-
return fetchFn(`${config.baseUrl}${path6}`, {
|
|
16186
|
-
method: init.method,
|
|
16187
|
-
headers: {
|
|
16188
|
-
Authorization: `Bearer ${config.token}`,
|
|
16189
|
-
...init.body !== void 0 ? { "Content-Type": "application/json" } : {},
|
|
16190
|
-
...init.headers
|
|
16191
|
-
},
|
|
16192
|
-
body: init.body,
|
|
16193
|
-
signal: init.signal ?? (init.timeoutMs !== void 0 ? AbortSignal.timeout(init.timeoutMs) : void 0)
|
|
16194
|
-
});
|
|
16195
|
-
}
|
|
16196
|
-
};
|
|
16197
|
-
}
|
|
16198
|
-
function textResult(text2) {
|
|
16199
|
-
return { content: [{ type: "text", text: text2 }] };
|
|
16200
|
-
}
|
|
16201
|
-
function jsonResult(payload) {
|
|
16202
|
-
return textResult(JSON.stringify(payload));
|
|
16203
|
-
}
|
|
16204
|
-
function joinTextContent(content) {
|
|
16205
|
-
return (content ?? []).filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
|
|
16206
|
-
}
|
|
16207
|
-
function withErrorHandling(label, fn2) {
|
|
16208
|
-
return fn2().catch((error) => {
|
|
16209
|
-
logger.error(`${label} error:`, error);
|
|
16210
|
-
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
16211
|
-
});
|
|
16212
|
-
}
|
|
16213
|
-
async function parseErrorBody(response) {
|
|
16214
|
-
return response.json().catch(() => ({ error: response.statusText }));
|
|
16215
|
-
}
|
|
16216
|
-
async function gatewayFetch(gateway, path6, options = {}, errorPrefix) {
|
|
16217
|
-
let response;
|
|
16218
|
-
try {
|
|
16219
|
-
response = await createGatewayClient({
|
|
16220
|
-
baseUrl: gateway.gatewayUrl,
|
|
16221
|
-
token: gateway.workerToken
|
|
16222
|
-
}).request(path6, {
|
|
16223
|
-
...options,
|
|
16224
|
-
timeoutMs: options.timeoutMs ?? 6e4
|
|
16225
|
-
});
|
|
16226
|
-
} catch (error) {
|
|
16227
|
-
if (error instanceof Error && error.name === "TimeoutError") {
|
|
16228
|
-
logger.error(`${errorPrefix}: request timed out`);
|
|
16229
|
-
return { error: textResult(`Error: ${errorPrefix} (timed out)`) };
|
|
16230
|
-
}
|
|
16231
|
-
throw error;
|
|
16232
|
-
}
|
|
16233
|
-
if (!response.ok) {
|
|
16234
|
-
const body = await parseErrorBody(response);
|
|
16235
|
-
logger.error(`${errorPrefix}: ${response.status}`, body);
|
|
16236
|
-
return { error: textResult(`Error: ${body.error || errorPrefix}`) };
|
|
16237
|
-
}
|
|
16238
|
-
return { data: await response.json() };
|
|
16239
|
-
}
|
|
16240
|
-
async function postLinkButton(gateway, args) {
|
|
16241
|
-
const { error } = await gatewayFetch(gateway, "/internal/interactions/create", {
|
|
16242
|
-
method: "POST",
|
|
16243
|
-
body: JSON.stringify({
|
|
16244
|
-
interactionType: "link_button",
|
|
16245
|
-
url: args.url,
|
|
16246
|
-
label: args.label,
|
|
16247
|
-
linkType: args.linkType ?? "oauth",
|
|
16248
|
-
body: args.body
|
|
16249
|
-
})
|
|
16250
|
-
}, "Failed to post link button");
|
|
16251
|
-
if (error) {
|
|
16252
|
-
throw new Error(joinTextContent(error.content) || "Failed to post link button");
|
|
16253
|
-
}
|
|
16254
|
-
}
|
|
16255
|
-
function toToolResult(result) {
|
|
16256
|
-
return { content: result.content, details: {} };
|
|
16257
|
-
}
|
|
16258
|
-
function defineTool2(config) {
|
|
16259
|
-
return {
|
|
16260
|
-
name: config.name,
|
|
16261
|
-
label: config.name,
|
|
16262
|
-
description: config.description,
|
|
16263
|
-
parameters: config.parameters,
|
|
16264
|
-
execute: async (_toolCallId, args) => toToolResult(await config.run(args))
|
|
16265
|
-
};
|
|
16266
|
-
}
|
|
16267
|
-
function defineGatewayTool(config) {
|
|
16268
|
-
return defineTool2({
|
|
16269
|
-
...config,
|
|
16270
|
-
description: (0, agent_tooling_1.getCustomToolDescription)(config.name)
|
|
16271
|
-
});
|
|
16272
|
-
}
|
|
16273
|
-
}
|
|
16274
|
-
});
|
|
16275
|
-
|
|
16276
16412
|
// ../plugin-conversations/dist/index.js
|
|
16277
16413
|
var require_dist3 = __commonJS({
|
|
16278
16414
|
"../plugin-conversations/dist/index.js"(exports2) {
|
|
@@ -16291,8 +16427,8 @@ var require_dist3 = __commonJS({
|
|
|
16291
16427
|
exports2.createConversationTools = createConversationTools2;
|
|
16292
16428
|
exports2.createConversationPlugin = createConversationPlugin;
|
|
16293
16429
|
var agent_tooling_1 = (init_agent_tooling(), __toCommonJS(agent_tooling_exports));
|
|
16294
|
-
var plugin_api_1 =
|
|
16295
|
-
var plugin_toolkit_1 =
|
|
16430
|
+
var plugin_api_1 = require_dist2();
|
|
16431
|
+
var plugin_toolkit_1 = require_dist();
|
|
16296
16432
|
var typebox_1 = require_cjs();
|
|
16297
16433
|
async function askUserQuestion(gateway, args, hooks) {
|
|
16298
16434
|
return (0, plugin_toolkit_1.withErrorHandling)("ask_user", async () => {
|
|
@@ -16587,7 +16723,7 @@ var require_audio_provider_suggestions = __commonJS({
|
|
|
16587
16723
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
16588
16724
|
exports2.normalizeAudioProviderSuggestions = normalizeAudioProviderSuggestions;
|
|
16589
16725
|
exports2.fetchAudioProviderSuggestions = fetchAudioProviderSuggestions;
|
|
16590
|
-
var plugin_toolkit_1 =
|
|
16726
|
+
var plugin_toolkit_1 = require_dist();
|
|
16591
16727
|
var FALLBACK_PROVIDER_IDS = ["chatgpt"];
|
|
16592
16728
|
var KNOWN_PROVIDER_LABELS = {
|
|
16593
16729
|
chatgpt: "ChatGPT/OpenAI",
|
|
@@ -16691,7 +16827,7 @@ var require_multipart = __commonJS({
|
|
|
16691
16827
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
16692
16828
|
exports2.uploadMultipart = uploadMultipart;
|
|
16693
16829
|
exports2.uploadGeneratedFile = uploadGeneratedFile;
|
|
16694
|
-
var plugin_toolkit_1 =
|
|
16830
|
+
var plugin_toolkit_1 = require_dist();
|
|
16695
16831
|
var UPLOAD_TIMEOUT_MS = 3e5;
|
|
16696
16832
|
async function uploadMultipart(gw2, options) {
|
|
16697
16833
|
const form = new FormData();
|
|
@@ -16745,7 +16881,7 @@ var require_generation = __commonJS({
|
|
|
16745
16881
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
16746
16882
|
exports2.generateImage = generateImage;
|
|
16747
16883
|
exports2.generateAudio = generateAudio;
|
|
16748
|
-
var plugin_toolkit_1 =
|
|
16884
|
+
var plugin_toolkit_1 = require_dist();
|
|
16749
16885
|
var audio_provider_suggestions_1 = require_audio_provider_suggestions();
|
|
16750
16886
|
var multipart_1 = require_multipart();
|
|
16751
16887
|
async function generateAndUploadMedia(gw2, config) {
|
|
@@ -16905,7 +17041,7 @@ var require_file_port = __commonJS({
|
|
|
16905
17041
|
exports2.maxUploadBytes = maxUploadBytes;
|
|
16906
17042
|
exports2.contentTypeForName = contentTypeForName;
|
|
16907
17043
|
exports2.uploadPortedFile = uploadPortedFile;
|
|
16908
|
-
var plugin_toolkit_1 =
|
|
17044
|
+
var plugin_toolkit_1 = require_dist();
|
|
16909
17045
|
var multipart_1 = require_multipart();
|
|
16910
17046
|
function maxUploadBytes() {
|
|
16911
17047
|
const env = globalThis.process?.env;
|
|
@@ -17005,8 +17141,8 @@ var require_tools = __commonJS({
|
|
|
17005
17141
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17006
17142
|
exports2.createMediaTools = createMediaTools2;
|
|
17007
17143
|
exports2.createMediaPlugin = createMediaPlugin;
|
|
17008
|
-
var plugin_api_1 =
|
|
17009
|
-
var plugin_toolkit_1 =
|
|
17144
|
+
var plugin_api_1 = require_dist2();
|
|
17145
|
+
var plugin_toolkit_1 = require_dist();
|
|
17010
17146
|
var typebox_1 = require_cjs();
|
|
17011
17147
|
var file_port_1 = require_file_port();
|
|
17012
17148
|
var generation_1 = require_generation();
|
|
@@ -17146,7 +17282,7 @@ var require_agent_policy = __commonJS({
|
|
|
17146
17282
|
description: "Post a message to one of your conversations. Pass a conversation handle (from list_conversations) to post to the channel, or a thread handle (returned by a previous send_message) to reply in that thread. This is how an automated/scheduled run speaks in its channel."
|
|
17147
17283
|
},
|
|
17148
17284
|
present_event: {
|
|
17149
|
-
description: "
|
|
17285
|
+
description: "Present an existing Lobu event as a summary and Open event link in the current conversation. Custom interactions open in its React view. Use the event id returned by knowledge.save; do not hand-author platform card JSON or action ids."
|
|
17150
17286
|
},
|
|
17151
17287
|
schedule_followup: {
|
|
17152
17288
|
description: "Schedule one durable future wake-up for yourself in the current conversation. The server fixes the agent and destination from the signed turn; provide a stable idempotency key so retries do not duplicate the wake-up."
|
|
@@ -18015,19 +18151,14 @@ var require_bash_command_parser = __commonJS({
|
|
|
18015
18151
|
}
|
|
18016
18152
|
});
|
|
18017
18153
|
|
|
18018
|
-
// ../core/dist/
|
|
18019
|
-
var
|
|
18020
|
-
"../core/dist/
|
|
18154
|
+
// ../core/dist/shell-safety.js
|
|
18155
|
+
var require_shell_safety = __commonJS({
|
|
18156
|
+
"../core/dist/shell-safety.js"(exports2) {
|
|
18021
18157
|
"use strict";
|
|
18022
18158
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
18023
|
-
exports2.DEFAULT_PACKAGE_MANAGER_DENY_PREFIXES = void 0;
|
|
18024
|
-
exports2.normalizeToolList = normalizeToolList;
|
|
18025
|
-
exports2.buildToolPolicy = buildToolPolicy;
|
|
18026
|
-
exports2.isToolAllowedByPolicy = isToolAllowedByPolicy;
|
|
18027
18159
|
exports2.isDirectPackageInstallCommand = isDirectPackageInstallCommand2;
|
|
18028
|
-
exports2.enforceBashCommandPolicy = enforceBashCommandPolicy3;
|
|
18029
18160
|
var bash_command_parser_1 = require_bash_command_parser();
|
|
18030
|
-
|
|
18161
|
+
var PACKAGE_MANAGER_DENY_PREFIXES = [
|
|
18031
18162
|
"apt ",
|
|
18032
18163
|
"apt-get ",
|
|
18033
18164
|
"yum ",
|
|
@@ -18106,85 +18237,6 @@ var require_tool_policy = __commonJS({
|
|
|
18106
18237
|
"poetry add ",
|
|
18107
18238
|
"composer require "
|
|
18108
18239
|
];
|
|
18109
|
-
function normalizeToolName(name) {
|
|
18110
|
-
return name.trim().toLowerCase();
|
|
18111
|
-
}
|
|
18112
|
-
function normalizeToolList(value) {
|
|
18113
|
-
if (!value) {
|
|
18114
|
-
return [];
|
|
18115
|
-
}
|
|
18116
|
-
const rawList = Array.isArray(value) ? value : value.split(/[,\n]/);
|
|
18117
|
-
return rawList.map((entry) => typeof entry === "string" ? entry.trim() : String(entry).trim()).filter((entry) => entry.length > 0);
|
|
18118
|
-
}
|
|
18119
|
-
function parseBashFilter(pattern) {
|
|
18120
|
-
const match2 = pattern.match(/^Bash\(([^:]+):\*\)$/i);
|
|
18121
|
-
const prefix = match2?.[1]?.trim();
|
|
18122
|
-
return prefix || null;
|
|
18123
|
-
}
|
|
18124
|
-
function matchesToolPattern(toolName, pattern) {
|
|
18125
|
-
const normalizedTool = normalizeToolName(toolName);
|
|
18126
|
-
const normalizedPattern = pattern.trim();
|
|
18127
|
-
const normalizedPatternLower = normalizedPattern.toLowerCase();
|
|
18128
|
-
if (normalizedPattern === "*") {
|
|
18129
|
-
return true;
|
|
18130
|
-
}
|
|
18131
|
-
if (normalizedPatternLower.endsWith("*")) {
|
|
18132
|
-
const prefix = normalizedPatternLower.slice(0, -1);
|
|
18133
|
-
return normalizedTool.startsWith(prefix);
|
|
18134
|
-
}
|
|
18135
|
-
return normalizedTool === normalizedPatternLower;
|
|
18136
|
-
}
|
|
18137
|
-
function buildToolPolicy(params) {
|
|
18138
|
-
const allowedPatterns = normalizeToolList(params.allowedTools);
|
|
18139
|
-
const deniedPatterns = normalizeToolList(params.disallowedTools);
|
|
18140
|
-
const toolsConfig = params.toolsConfig;
|
|
18141
|
-
const strictMode = toolsConfig?.strictMode === true;
|
|
18142
|
-
const mergedAllowed = [
|
|
18143
|
-
...toolsConfig?.allowedTools ?? [],
|
|
18144
|
-
...allowedPatterns
|
|
18145
|
-
].map((p) => p.trim());
|
|
18146
|
-
const mergedDenied = [
|
|
18147
|
-
...toolsConfig?.deniedTools ?? [],
|
|
18148
|
-
...deniedPatterns
|
|
18149
|
-
].map((p) => p.trim());
|
|
18150
|
-
const bashAllowPrefixes = mergedAllowed.map((pattern) => parseBashFilter(pattern)).filter((prefix) => Boolean(prefix));
|
|
18151
|
-
const bashDenyPrefixes = mergedDenied.map((pattern) => parseBashFilter(pattern)).filter((prefix) => Boolean(prefix));
|
|
18152
|
-
const bashAllowAll = mergedAllowed.some((pattern) => matchesToolPattern("bash", pattern));
|
|
18153
|
-
return {
|
|
18154
|
-
toolsConfig,
|
|
18155
|
-
allowedPatterns: mergedAllowed,
|
|
18156
|
-
deniedPatterns: mergedDenied,
|
|
18157
|
-
strictMode,
|
|
18158
|
-
bashPolicy: {
|
|
18159
|
-
allowAll: bashAllowAll,
|
|
18160
|
-
allowPrefixes: bashAllowPrefixes,
|
|
18161
|
-
denyPrefixes: [
|
|
18162
|
-
...exports2.DEFAULT_PACKAGE_MANAGER_DENY_PREFIXES,
|
|
18163
|
-
...bashDenyPrefixes
|
|
18164
|
-
]
|
|
18165
|
-
}
|
|
18166
|
-
};
|
|
18167
|
-
}
|
|
18168
|
-
function isToolAllowedByPolicy(toolName, policy) {
|
|
18169
|
-
const normalizedName = normalizeToolName(toolName);
|
|
18170
|
-
const { allowedPatterns, deniedPatterns, strictMode } = policy;
|
|
18171
|
-
const explicitDenied = deniedPatterns.some((pattern) => !parseBashFilter(pattern) && matchesToolPattern(normalizedName, pattern));
|
|
18172
|
-
if (explicitDenied) {
|
|
18173
|
-
return false;
|
|
18174
|
-
}
|
|
18175
|
-
if (normalizedName === "bash") {
|
|
18176
|
-
if (strictMode) {
|
|
18177
|
-
const explicitlyAllowed = allowedPatterns.some((pattern) => matchesToolPattern(normalizedName, pattern));
|
|
18178
|
-
const hasCommandAllowlist = policy.bashPolicy.allowPrefixes.length > 0;
|
|
18179
|
-
return explicitlyAllowed || hasCommandAllowlist;
|
|
18180
|
-
}
|
|
18181
|
-
return true;
|
|
18182
|
-
}
|
|
18183
|
-
if (!strictMode) {
|
|
18184
|
-
return true;
|
|
18185
|
-
}
|
|
18186
|
-
return allowedPatterns.some((pattern) => matchesToolPattern(normalizedName, pattern));
|
|
18187
|
-
}
|
|
18188
18240
|
var DIRECT_PACKAGE_INSTALL_PATTERNS = [
|
|
18189
18241
|
/(^|[\s;|&()])(?:sudo\s+)?(?:apt|apt-get|yum|dnf|apk|pacman|zypper|brew)\s+(?:install|upgrade|add)\b/i,
|
|
18190
18242
|
/(^|[\s;|&()])(?:sudo\s+)?(?:nix-shell|nix-env)\b/i,
|
|
@@ -18216,7 +18268,9 @@ var require_tool_policy = __commonJS({
|
|
|
18216
18268
|
if (trimmed.length > MAX_SCANNED_COMMAND_LENGTH) {
|
|
18217
18269
|
return true;
|
|
18218
18270
|
}
|
|
18219
|
-
|
|
18271
|
+
if ((0, bash_command_parser_1.splitShellCommands)(command).some((segment) => PACKAGE_MANAGER_DENY_PREFIXES.some((prefix) => segment.toLowerCase().startsWith(prefix.toLowerCase()))))
|
|
18272
|
+
return true;
|
|
18273
|
+
const matches = (text2) => PACKAGE_MANAGER_DENY_PREFIXES.some((prefix) => text2.startsWith(prefix.toLowerCase())) || DIRECT_PACKAGE_INSTALL_PATTERNS.some((pattern) => pattern.test(text2));
|
|
18220
18274
|
if ((0, bash_command_parser_1.matchesBeforeArgumentData)((0, bash_command_parser_1.blankQuotedSpans)(trimmed), matches)) {
|
|
18221
18275
|
return true;
|
|
18222
18276
|
}
|
|
@@ -18229,29 +18283,6 @@ var require_tool_policy = __commonJS({
|
|
|
18229
18283
|
}
|
|
18230
18284
|
return false;
|
|
18231
18285
|
}
|
|
18232
|
-
function enforceBashCommandPolicy3(command, policy) {
|
|
18233
|
-
if (!command.trim()) {
|
|
18234
|
-
return;
|
|
18235
|
-
}
|
|
18236
|
-
const segments = (0, bash_command_parser_1.splitShellCommands)(command);
|
|
18237
|
-
if (segments.length === 0) {
|
|
18238
|
-
return;
|
|
18239
|
-
}
|
|
18240
|
-
const hasAllowlist = !policy.allowAll && policy.allowPrefixes.length > 0;
|
|
18241
|
-
for (const segment of segments) {
|
|
18242
|
-
const normalizedSegment = segment.toLowerCase();
|
|
18243
|
-
const denied = policy.denyPrefixes.some((prefix) => normalizedSegment.startsWith(prefix.toLowerCase()));
|
|
18244
|
-
if (denied) {
|
|
18245
|
-
throw new Error("Bash command denied by policy");
|
|
18246
|
-
}
|
|
18247
|
-
if (hasAllowlist) {
|
|
18248
|
-
const allowed = policy.allowPrefixes.some((prefix) => normalizedSegment.startsWith(prefix.toLowerCase()));
|
|
18249
|
-
if (!allowed) {
|
|
18250
|
-
throw new Error("Bash command not allowed by policy");
|
|
18251
|
-
}
|
|
18252
|
-
}
|
|
18253
|
-
}
|
|
18254
|
-
}
|
|
18255
18286
|
}
|
|
18256
18287
|
});
|
|
18257
18288
|
|
|
@@ -35778,7 +35809,7 @@ var require_dist5 = __commonJS({
|
|
|
35778
35809
|
"use strict";
|
|
35779
35810
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
35780
35811
|
exports2.PluginHost = void 0;
|
|
35781
|
-
var plugin_api_1 =
|
|
35812
|
+
var plugin_api_1 = require_dist2();
|
|
35782
35813
|
var PluginHost2 = class {
|
|
35783
35814
|
plugins;
|
|
35784
35815
|
constructor(plugins) {
|
|
@@ -35852,10 +35883,61 @@ var require_dist6 = __commonJS({
|
|
|
35852
35883
|
"use strict";
|
|
35853
35884
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
35854
35885
|
exports2.createMemoryPlugin = createMemoryPlugin2;
|
|
35855
|
-
var plugin_api_1 =
|
|
35856
|
-
var plugin_toolkit_1 =
|
|
35886
|
+
var plugin_api_1 = require_dist2();
|
|
35887
|
+
var plugin_toolkit_1 = require_dist();
|
|
35857
35888
|
var MEMORY_RECALL_LIMIT = 6;
|
|
35858
35889
|
var MEMORY_TOOL_TIMEOUT_MS = 8e3;
|
|
35890
|
+
function withoutRecall(text2) {
|
|
35891
|
+
return text2.replace(/<lobu-memory\b[^>]*>[\s\S]*?(?:<\/lobu-memory\s*>|$)/gi, "").trim();
|
|
35892
|
+
}
|
|
35893
|
+
function quotedExcerpt(text2, budget) {
|
|
35894
|
+
const quoted = JSON.stringify(text2);
|
|
35895
|
+
if (quoted.length <= budget)
|
|
35896
|
+
return quoted;
|
|
35897
|
+
const marker = "\n[... excerpt truncated ...]\n";
|
|
35898
|
+
let keep = budget - JSON.stringify(marker).length - 2;
|
|
35899
|
+
while (keep > 0) {
|
|
35900
|
+
const head = Math.floor(keep / 3);
|
|
35901
|
+
const excerpt = JSON.stringify(text2.slice(0, head) + marker + text2.slice(-(keep - head)));
|
|
35902
|
+
if (excerpt.length <= budget)
|
|
35903
|
+
return excerpt;
|
|
35904
|
+
keep -= Math.max(1, Math.ceil((excerpt.length - budget) / 6));
|
|
35905
|
+
}
|
|
35906
|
+
return JSON.stringify(marker);
|
|
35907
|
+
}
|
|
35908
|
+
function recallQuery(prompt, messages) {
|
|
35909
|
+
if (prompt.length > 200 || !/^(?:(?:what|how) about (?:it|its|that|this|them|their|those|these)\b|(?:why|how|when|where) (?:is|was|does|did|will|would|can|should) (?:it|that|this|they|those|these)\b|(?:can you |please )?(?:explain|expand on|summarize) (?:that|this|it)[?.!]*$|(?:can you |please )?(?:draft|write|prepare|revise|update|fix) (?:it|that|this|them)(?:[?.!]*$| (?:using|with|based on|again|now|up)\b)|(?:what did we decide|go on|continue)[?.!]*$)/i.test(prompt))
|
|
35910
|
+
return prompt;
|
|
35911
|
+
const recent = messages.slice(-12);
|
|
35912
|
+
const current = lastMessage(recent, "user");
|
|
35913
|
+
if (current?.text === prompt && current.index === recent.length - 1)
|
|
35914
|
+
recent.pop();
|
|
35915
|
+
const user = lastMessage(recent, "user");
|
|
35916
|
+
if (!user)
|
|
35917
|
+
return prompt;
|
|
35918
|
+
const assistant = lastMessage(recent, "assistant");
|
|
35919
|
+
const context = [`user: ${quotedExcerpt(user.text, 700)}`];
|
|
35920
|
+
if (assistant && assistant.index > user.index) {
|
|
35921
|
+
context.push(`assistant (not user assertions): ${quotedExcerpt(assistant.text, 700)}`);
|
|
35922
|
+
}
|
|
35923
|
+
return `${prompt}
|
|
35924
|
+
Recent conversation excerpts (context only):
|
|
35925
|
+
${context.join("\n")}`;
|
|
35926
|
+
}
|
|
35927
|
+
function resultText(result) {
|
|
35928
|
+
const text2 = (0, plugin_toolkit_1.joinTextContent)(result.content).trim();
|
|
35929
|
+
if (result.isError === true || result.isError === void 0 && /^error:/i.test(text2)) {
|
|
35930
|
+
throw new Error(text2 || "Memory tool failed");
|
|
35931
|
+
}
|
|
35932
|
+
return text2;
|
|
35933
|
+
}
|
|
35934
|
+
function checkReceipt(result) {
|
|
35935
|
+
const text2 = resultText(result);
|
|
35936
|
+
const receipt = result.structuredContent !== void 0 ? result.structuredContent : JSON.parse(text2);
|
|
35937
|
+
if (!receipt || typeof receipt !== "object" || !Number.isSafeInteger(receipt.id) || receipt.id <= 0 || typeof receipt.durable_at !== "string" || !Number.isFinite(Date.parse(receipt.durable_at))) {
|
|
35938
|
+
throw new Error("save_memory returned an invalid durable receipt");
|
|
35939
|
+
}
|
|
35940
|
+
}
|
|
35859
35941
|
function messageText2(message) {
|
|
35860
35942
|
if (typeof message !== "object" || message === null)
|
|
35861
35943
|
return "";
|
|
@@ -35866,20 +35948,21 @@ var require_dist6 = __commonJS({
|
|
|
35866
35948
|
return "";
|
|
35867
35949
|
return content.filter((part) => typeof part === "object" && part !== null && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
|
|
35868
35950
|
}
|
|
35869
|
-
function lastMessage(messages, role
|
|
35870
|
-
for (let index2 =
|
|
35951
|
+
function lastMessage(messages, role) {
|
|
35952
|
+
for (let index2 = messages.length - 1; index2 >= 0; index2--) {
|
|
35871
35953
|
const message = messages[index2];
|
|
35872
35954
|
if (typeof message !== "object" || message === null || message.role !== role) {
|
|
35873
35955
|
continue;
|
|
35874
35956
|
}
|
|
35875
|
-
const text2 = messageText2(message)
|
|
35957
|
+
const text2 = withoutRecall(messageText2(message));
|
|
35876
35958
|
if (text2)
|
|
35877
35959
|
return { index: index2, text: text2 };
|
|
35960
|
+
if (role === "user")
|
|
35961
|
+
return null;
|
|
35878
35962
|
}
|
|
35879
35963
|
return null;
|
|
35880
35964
|
}
|
|
35881
35965
|
function createMemoryPlugin2(gateway, invokeTool) {
|
|
35882
|
-
let promptForCapture = "";
|
|
35883
35966
|
let capture = null;
|
|
35884
35967
|
const plugin = (0, plugin_api_1.defineLobuPlugin)({
|
|
35885
35968
|
manifest: {
|
|
@@ -35890,26 +35973,27 @@ var require_dist6 = __commonJS({
|
|
|
35890
35973
|
},
|
|
35891
35974
|
hooks: {
|
|
35892
35975
|
beforeAgentStart: async (event, context) => {
|
|
35893
|
-
const
|
|
35894
|
-
|
|
35895
|
-
if (!query || /heartbeat|question:q_/i.test(query))
|
|
35976
|
+
const prompt = withoutRecall(event.prompt);
|
|
35977
|
+
if (!prompt)
|
|
35896
35978
|
return;
|
|
35897
|
-
|
|
35898
|
-
|
|
35899
|
-
|
|
35900
|
-
|
|
35901
|
-
|
|
35902
|
-
|
|
35903
|
-
|
|
35904
|
-
|
|
35905
|
-
|
|
35906
|
-
|
|
35907
|
-
|
|
35908
|
-
|
|
35909
|
-
|
|
35910
|
-
}
|
|
35979
|
+
let recalled;
|
|
35980
|
+
try {
|
|
35981
|
+
const result = await invokeTool(gateway, "lobu", "search_memory", {
|
|
35982
|
+
query: recallQuery(prompt, event.messages),
|
|
35983
|
+
include_content: true,
|
|
35984
|
+
content_limit: MEMORY_RECALL_LIMIT,
|
|
35985
|
+
include_connections: false,
|
|
35986
|
+
limit: 3
|
|
35987
|
+
}, { timeoutMs: MEMORY_TOOL_TIMEOUT_MS });
|
|
35988
|
+
recalled = resultText(result);
|
|
35989
|
+
} catch (error) {
|
|
35990
|
+
context.logger.warn("Plugin memory recall skipped", {
|
|
35991
|
+
error: error instanceof Error ? error.message : String(error)
|
|
35992
|
+
});
|
|
35911
35993
|
return;
|
|
35912
35994
|
}
|
|
35995
|
+
if (!recalled)
|
|
35996
|
+
return;
|
|
35913
35997
|
return {
|
|
35914
35998
|
prependContext: `<lobu-memory>
|
|
35915
35999
|
Use these long-term memories only when directly relevant to the user's request.
|
|
@@ -35922,21 +36006,30 @@ ${recalled}
|
|
|
35922
36006
|
agentEnd: (event, context) => {
|
|
35923
36007
|
if (event.error)
|
|
35924
36008
|
return;
|
|
36009
|
+
const user = lastMessage(event.messages, "user");
|
|
35925
36010
|
const assistant = lastMessage(event.messages, "assistant");
|
|
35926
|
-
if (!assistant)
|
|
35927
|
-
return;
|
|
35928
|
-
const user = lastMessage(event.messages, "user", assistant.index);
|
|
35929
|
-
if (!user)
|
|
35930
|
-
return;
|
|
35931
|
-
const userText = promptForCapture && user.text.endsWith(promptForCapture) ? promptForCapture : user.text.replace(/<lobu-memory>[\s\S]*?<\/lobu-memory>/gi, "").trim();
|
|
35932
|
-
const combined = `User: ${userText}
|
|
35933
|
-
Assistant: ${assistant.text}`;
|
|
35934
|
-
if (combined.length < 16)
|
|
36011
|
+
if (!user || !assistant || assistant.index <= user.index)
|
|
35935
36012
|
return;
|
|
36013
|
+
const content = [
|
|
36014
|
+
"Conversation excerpts, not a full transcript. Use the original conversation transcript as primary evidence.",
|
|
36015
|
+
`User (verbatim excerpt): ${quotedExcerpt(user.text, 800)}`,
|
|
36016
|
+
`Assistant (generated response, not user assertions): ${quotedExcerpt(assistant.text, 800)}`
|
|
36017
|
+
].join("\n");
|
|
35936
36018
|
capture = invokeTool(gateway, "lobu", "save_memory", {
|
|
35937
|
-
content
|
|
36019
|
+
content,
|
|
36020
|
+
// Existing extensible payload, with only references the host supplied.
|
|
36021
|
+
payload_data: {
|
|
36022
|
+
...context.agentId ? { agent_id: context.agentId } : {},
|
|
36023
|
+
...context.conversationId ? { conversation_id: context.conversationId } : {},
|
|
36024
|
+
...context.actorId ? { actor_id: context.actorId } : {},
|
|
36025
|
+
...context.runId > 0 ? { run_id: context.runId } : {},
|
|
36026
|
+
...context.messageId ? { message_id: context.messageId } : {}
|
|
36027
|
+
},
|
|
35938
36028
|
semantic_type: "observation"
|
|
35939
|
-
}, { timeoutMs: MEMORY_TOOL_TIMEOUT_MS }).then(() =>
|
|
36029
|
+
}, { timeoutMs: MEMORY_TOOL_TIMEOUT_MS }).then((result) => {
|
|
36030
|
+
checkReceipt(result);
|
|
36031
|
+
context.logger.info("Captured conversation observation");
|
|
36032
|
+
}).catch((error) => context.logger.warn("Plugin memory capture failed", {
|
|
35940
36033
|
error: error instanceof Error ? error.message : String(error)
|
|
35941
36034
|
}));
|
|
35942
36035
|
}
|
|
@@ -36801,6 +36894,7 @@ __export(guest_entry_exports, {
|
|
|
36801
36894
|
runAgentTurn: () => runAgentTurn
|
|
36802
36895
|
});
|
|
36803
36896
|
module.exports = __toCommonJS(guest_entry_exports);
|
|
36897
|
+
var import_plugin_toolkit = __toESM(require_dist(), 1);
|
|
36804
36898
|
|
|
36805
36899
|
// dist/agent-turn/gateway-tools.js
|
|
36806
36900
|
var import_plugin_conversations = __toESM(require_dist3(), 1);
|
|
@@ -43724,7 +43818,7 @@ function createFindTool(cwd, options) {
|
|
|
43724
43818
|
}
|
|
43725
43819
|
|
|
43726
43820
|
// dist/agent-turn/workspace.js
|
|
43727
|
-
var
|
|
43821
|
+
var import_shell_safety = __toESM(require_shell_safety(), 1);
|
|
43728
43822
|
|
|
43729
43823
|
// ../../node_modules/just-bash/dist/bundle/browser.js
|
|
43730
43824
|
var import_sprintf_js = __toESM(require_sprintf(), 1);
|
|
@@ -79509,7 +79603,7 @@ Command exited with code 1`;
|
|
|
79509
79603
|
Command exited with code ${exitCode}`;
|
|
79510
79604
|
return rendered;
|
|
79511
79605
|
}
|
|
79512
|
-
function createWorkspace(names,
|
|
79606
|
+
function createWorkspace(names, remote) {
|
|
79513
79607
|
const fs2 = new Gn();
|
|
79514
79608
|
const ready = fs2.mkdir(WORKSPACE_ROOT, { recursive: true });
|
|
79515
79609
|
const shell = new rf({ fs: fs2, cwd: WORKSPACE_ROOT, executionLimits: BASH_LIMITS });
|
|
@@ -79651,9 +79745,7 @@ function createWorkspace(names, bashPolicy, remote) {
|
|
|
79651
79745
|
execute: async (_id, args) => {
|
|
79652
79746
|
const command = requireString(args, "command");
|
|
79653
79747
|
const timeout = optionalNumber(args, "timeout");
|
|
79654
|
-
if (
|
|
79655
|
-
(0, import_tool_policy.enforceBashCommandPolicy)(command, bashPolicy);
|
|
79656
|
-
if ((0, import_tool_policy.isDirectPackageInstallCommand)(command)) {
|
|
79748
|
+
if ((0, import_shell_safety.isDirectPackageInstallCommand)(command)) {
|
|
79657
79749
|
throw new Error(remote ? "DIRECT PACKAGE INSTALL BLOCKED. Use the sandbox packages configured by an admin." : "DIRECT PACKAGE INSTALL BLOCKED. This workspace has no package manager and no network; use your other tools to reach data instead.");
|
|
79658
79750
|
}
|
|
79659
79751
|
if (remote)
|
|
@@ -79850,18 +79942,7 @@ function createTurnMediaTools(allowed, args) {
|
|
|
79850
79942
|
var import_plugin_host = __toESM(require_dist5(), 1);
|
|
79851
79943
|
var import_plugin_memory = __toESM(require_dist6(), 1);
|
|
79852
79944
|
function createTurnMemory(context) {
|
|
79853
|
-
const invoke =
|
|
79854
|
-
try {
|
|
79855
|
-
const text2 = await context.callTool(context.mcpId, toolName, args, options);
|
|
79856
|
-
return { content: [{ type: "text", text: text2 }] };
|
|
79857
|
-
} catch (error) {
|
|
79858
|
-
return {
|
|
79859
|
-
content: [
|
|
79860
|
-
{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }
|
|
79861
|
-
]
|
|
79862
|
-
};
|
|
79863
|
-
}
|
|
79864
|
-
};
|
|
79945
|
+
const invoke = (_gateway, _mcpId, toolName, args, options) => context.callTool(context.mcpId, toolName, args, options);
|
|
79865
79946
|
const plugin = (0, import_plugin_memory.createMemoryPlugin)({
|
|
79866
79947
|
// The plugin passes these straight back to the invoker, which ignores
|
|
79867
79948
|
// them: this lane addresses the MCP route itself. They are filled in
|
|
@@ -79921,7 +80002,6 @@ function createTurnMemoryHooks(context) {
|
|
|
79921
80002
|
|
|
79922
80003
|
// dist/agent-turn/guest-entry.js
|
|
79923
80004
|
var import_memory_flush = __toESM(require_memory_flush(), 1);
|
|
79924
|
-
var import_tool_policy2 = __toESM(require_tool_policy(), 1);
|
|
79925
80005
|
var import_tool_trace_summary = __toESM(require_tool_trace_summary(), 1);
|
|
79926
80006
|
|
|
79927
80007
|
// ../../node_modules/@mariozechner/pi-ai/dist/api-registry.js
|
|
@@ -132266,7 +132346,7 @@ var TOOL_EVENT_OUTPUT_CHARS = 2e3;
|
|
|
132266
132346
|
function joinText(content) {
|
|
132267
132347
|
return (content ?? []).filter((part) => part && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
|
|
132268
132348
|
}
|
|
132269
|
-
async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_CALL_TIMEOUT_MS) {
|
|
132349
|
+
async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_CALL_TIMEOUT_MS, supportsImages = true, imageBudget) {
|
|
132270
132350
|
const url = `${gatewayUrl}/mcp/${encodeURIComponent(tool.mcpId)}/tools/${encodeURIComponent(tool.name)}`;
|
|
132271
132351
|
let response;
|
|
132272
132352
|
try {
|
|
@@ -132276,8 +132356,9 @@ async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_
|
|
|
132276
132356
|
Authorization: `Bearer ${credential}`,
|
|
132277
132357
|
"Content-Type": "application/json",
|
|
132278
132358
|
// A retrieval result is summarised into the tool trace from its
|
|
132279
|
-
// structured body; the
|
|
132280
|
-
|
|
132359
|
+
// structured body; capture validates the save receipt. The gateway
|
|
132360
|
+
// renders markdown unless asked.
|
|
132361
|
+
...(0, import_tool_trace_summary.isRetrievalTool)(tool.name) || tool.name === "save_memory" ? { "x-mcp-format": "json" } : {}
|
|
132281
132362
|
},
|
|
132282
132363
|
body: JSON.stringify(args ?? {}),
|
|
132283
132364
|
signal: AbortSignal.timeout(timeoutMs)
|
|
@@ -132295,17 +132376,21 @@ async function callMcpTool(gatewayUrl, credential, tool, args, timeoutMs = TOOL_
|
|
|
132295
132376
|
throw new Error(`${tool.name} returned a non-JSON response (status ${response.status}): ${error instanceof Error ? error.message : String(error)}`);
|
|
132296
132377
|
}
|
|
132297
132378
|
const text2 = joinText(reply.content);
|
|
132298
|
-
if (!response.ok
|
|
132379
|
+
if (!response.ok) {
|
|
132299
132380
|
throw new Error(reply.error || text2 || `${tool.name} failed (${response.status})`);
|
|
132300
132381
|
}
|
|
132301
|
-
return
|
|
132382
|
+
return {
|
|
132383
|
+
...reply,
|
|
132384
|
+
...(0, import_plugin_toolkit.mcpToolResult)(reply.isError === true ? reply.content?.filter((part) => part?.type === "text") : reply.content, reply.error || "", supportsImages, imageBudget)
|
|
132385
|
+
};
|
|
132302
132386
|
}
|
|
132303
132387
|
function buildTools(input, credential, onAskUserPosted, onInBandReplyDelivered, emit, runtimeExec) {
|
|
132388
|
+
const imageBudget = (0, import_plugin_toolkit.toolImageBudget)((input.images ?? []).map((image) => ({ type: "image", data: image.data })));
|
|
132304
132389
|
const tools = input.tools;
|
|
132305
132390
|
if (!tools)
|
|
132306
|
-
return { tools: [], workspace: null, canReadFiles: false };
|
|
132391
|
+
return { tools: [], workspace: null, canReadFiles: false, imageBudget };
|
|
132307
132392
|
const remote = tools.remoteRuntime && runtimeExec ? { exec: runtimeExec } : void 0;
|
|
132308
|
-
const workspace = tools.builtin && tools.builtin.length > 0 ? createWorkspace(tools.builtin,
|
|
132393
|
+
const workspace = tools.builtin && tools.builtin.length > 0 ? createWorkspace(tools.builtin, remote) : null;
|
|
132309
132394
|
const gateway = tools.gateway && tools.gateway.length > 0 && tools.conversation ? createGatewayTools(tools.gateway, {
|
|
132310
132395
|
gatewayUrl: tools.gatewayUrl,
|
|
132311
132396
|
credential,
|
|
@@ -132328,25 +132413,24 @@ function buildTools(input, credential, onAskUserPosted, onInBandReplyDelivered,
|
|
|
132328
132413
|
description: tool.description,
|
|
132329
132414
|
// A plain JSON schema: pi-ai validates arguments against it as-is.
|
|
132330
132415
|
parameters: tool.inputSchema,
|
|
132331
|
-
execute: async (_toolCallId, args) =>
|
|
132332
|
-
|
|
132333
|
-
|
|
132334
|
-
|
|
132335
|
-
|
|
132336
|
-
|
|
132337
|
-
|
|
132338
|
-
|
|
132339
|
-
|
|
132340
|
-
(0, import_tool_policy2.enforceBashCommandPolicy)("cat input/attachment", tools.bashPolicy);
|
|
132341
|
-
bashCanRead = true;
|
|
132342
|
-
} catch {
|
|
132416
|
+
execute: async (_toolCallId, args) => {
|
|
132417
|
+
const result = await callMcpTool(tools.gatewayUrl, credential, tool, args, TOOL_CALL_TIMEOUT_MS, input.provider.input?.includes("image") === true, imageBudget);
|
|
132418
|
+
const text2 = joinText(result.content);
|
|
132419
|
+
if (result.isError === true)
|
|
132420
|
+
throw new Error(String(result.error || text2 || `${tool.name} failed`));
|
|
132421
|
+
return {
|
|
132422
|
+
content: text2 || result.content.some((part) => part.type === "image") ? result.content : [{ type: "text", text: `${tool.name} completed.` }],
|
|
132423
|
+
details: {}
|
|
132424
|
+
};
|
|
132343
132425
|
}
|
|
132344
|
-
}
|
|
132426
|
+
}));
|
|
132427
|
+
const bashCanRead = (tools.builtin ?? []).includes("bash") && !tools.remoteRuntime;
|
|
132345
132428
|
const canReadFiles = workspace !== null && ((tools.builtin ?? []).includes("read") || bashCanRead);
|
|
132346
132429
|
return {
|
|
132347
132430
|
tools: [...mcp, ...gateway, ...media, ...workspace?.tools ?? []],
|
|
132348
132431
|
workspace,
|
|
132349
|
-
canReadFiles
|
|
132432
|
+
canReadFiles,
|
|
132433
|
+
imageBudget
|
|
132350
132434
|
};
|
|
132351
132435
|
}
|
|
132352
132436
|
var guestLogger = {
|
|
@@ -132434,7 +132518,7 @@ async function runAgentTurn(input, emit, takeSteering = () => [], runtimeExec) {
|
|
|
132434
132518
|
agentId: input.memory.agentId,
|
|
132435
132519
|
conversationId: input.tools.conversation?.conversationId ?? "",
|
|
132436
132520
|
mcpId: input.memory.mcpId,
|
|
132437
|
-
callTool: (mcpId, toolName, args, options) => callMcpTool(input.tools.gatewayUrl, credential, { mcpId, name: toolName, description: "", inputSchema: {} }, args, options?.timeoutMs),
|
|
132521
|
+
callTool: (mcpId, toolName, args, options) => callMcpTool(input.tools.gatewayUrl, credential, { mcpId, name: toolName, description: "", inputSchema: {} }, args, options?.timeoutMs).then((result) => ({ ...result, content: [{ type: "text", text: joinText(result.content) }] })),
|
|
132438
132522
|
logger: guestLogger
|
|
132439
132523
|
}) : null;
|
|
132440
132524
|
let toolCalls = 0;
|
|
@@ -132480,6 +132564,7 @@ async function runAgentTurn(input, emit, takeSteering = () => [], runtimeExec) {
|
|
|
132480
132564
|
const text2 = messageText(message);
|
|
132481
132565
|
return text2 === void 0 ? void 0 : messageContext.get(text2);
|
|
132482
132566
|
});
|
|
132567
|
+
built.imageBudget.bytes += (0, import_plugin_toolkit.toolImageBudget)(session.sessionManager.getEntries().flatMap((entry) => entry.type === "message" && "content" in entry.message && Array.isArray(entry.message.content) ? entry.message.content : [])).bytes;
|
|
132483
132568
|
session.subscribe((event) => {
|
|
132484
132569
|
if (event.type === "compaction_end" && event.errorMessage)
|
|
132485
132570
|
console.warn(event.errorMessage);
|
|
@@ -132670,14 +132755,15 @@ ${flush.prompt}`);
|
|
|
132670
132755
|
}
|
|
132671
132756
|
}
|
|
132672
132757
|
await promptNativeSession(session, input.userMessage, input.images);
|
|
132673
|
-
|
|
132758
|
+
settleAnswer();
|
|
132759
|
+
const finalText = ownerAnswer ?? ownerText;
|
|
132760
|
+
const ended = (guardStopped ? null : agent.state.errorMessage) || (!finalText.trim() && toolsUsed.size === 0 && steeredToolsUsed.size === 0 ? "The model returned no response. Please try again." : null);
|
|
132674
132761
|
if (memory) {
|
|
132675
132762
|
const messages = session.sessionManager.getBranch().flatMap((entry) => entry.type === "message" ? [entry.message] : []);
|
|
132676
132763
|
await memory.capture(messages, ended ?? void 0);
|
|
132677
132764
|
}
|
|
132678
132765
|
if (ended)
|
|
132679
132766
|
throw new Error(ended);
|
|
132680
|
-
settleAnswer();
|
|
132681
132767
|
return {
|
|
132682
132768
|
// The answer is the last assistant message WITH TEXT after each user
|
|
132683
132769
|
// message, not the accumulated stream: a model that narrates before a
|
|
@@ -132700,7 +132786,7 @@ ${flush.prompt}`);
|
|
|
132700
132786
|
// aborted mid-answer still owes the user what it managed to say. The
|
|
132701
132787
|
// fallback is the owner's only: a steered input without its own settled
|
|
132702
132788
|
// answer fails below rather than borrowing a sibling's text.
|
|
132703
|
-
text:
|
|
132789
|
+
text: finalText,
|
|
132704
132790
|
stopReason,
|
|
132705
132791
|
usage,
|
|
132706
132792
|
sessionJsonl: nativeSessionJsonl(session),
|