@lobu/runtime-server 24.7.0 → 24.8.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/connectors.json +199 -316
- package/dist/component.json +1 -1
- package/dist/connectors/imessage.ts +953 -0
- package/dist/connectors/linkedin.ts +20 -377
- package/dist/dependencies.bun.lock +124 -92
- package/dist/embeddings-server.mjs +14 -2
- package/dist/owletto/dist/assets/_-B0tmXZ86.js +2 -0
- package/dist/owletto/dist/assets/_-DwXULq4r.js +3 -0
- package/dist/owletto/dist/assets/_agentId-B1dNkhnr.js +2 -0
- package/dist/owletto/dist/assets/_agentId-sYjvnBaB.js +2 -0
- package/dist/owletto/dist/assets/_automationId-Bnw_CnT_.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-D7Z8DQ-B.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-DM5MTO8c.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-OJrZjd0o.js +2 -0
- package/dist/owletto/dist/assets/_eventId-CfB0_2zK.js +2 -0
- package/dist/owletto/dist/assets/_owner-BDvTUY0a.js +3 -0
- package/dist/owletto/dist/assets/_shape-BZidoJMB.js +2 -0
- package/dist/owletto/dist/assets/_slug-R989vOiM.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-BDUSrpe5.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-BnFqh5-t.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-CX7Egv-p.js → accept-invitation-BC-ZIsrf.js} +2 -2
- package/dist/owletto/dist/assets/activity-route-view-CN2dOiCD.js +2 -0
- package/dist/owletto/dist/assets/agent-connect-pages-CdDjrHjn.js +4 -0
- package/dist/owletto/dist/assets/agent-editor-form-CDAHRNWl.js +2 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-DHvKiEUB.js → agent-loading-shells-BupiSjR-.js} +2 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-ju7L2M0l.js +2 -0
- package/dist/owletto/dist/assets/{agent-skill-context-DF5q0Dfr.js → agent-skill-context-B0ZYVE3n.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-Pi5cECga.js → agent-subpage-shell-ByU0xhXn.js} +2 -2
- package/dist/owletto/dist/assets/{agent-thread-B1ZepGZc.js → agent-thread-DiVKn1WX.js} +4 -4
- package/dist/owletto/dist/assets/agent-thread-storage-Bx2-WBHQ.js +2 -0
- package/dist/owletto/dist/assets/app._appId-BQWElSoP.js +2 -0
- package/dist/owletto/dist/assets/assist-composer-igTXq3DL.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-BJwRU6qT.js +2 -0
- package/dist/owletto/dist/assets/{callback-Ckrxv0eo.js → callback-Dmaio9CX.js} +2 -2
- package/dist/owletto/dist/assets/{card-DT9mSjSp.js → card-rE4Ctuy6.js} +2 -2
- package/dist/owletto/dist/assets/{claim-Bzby28tT.js → claim-BN17CPYh.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-DoIErdUy.js → client-activity-scopes-B7xVaUA-.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-BbVQy5Ti.js → client-rows-B3LULJxW.js} +2 -2
- package/dist/owletto/dist/assets/clients-CydgUHrc.js +2 -0
- package/dist/owletto/dist/assets/code-editor-UppEMWpt.js +26 -0
- package/dist/owletto/dist/assets/connect-OdHpIVV9.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-B9u86bb2.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-EI1tcdSE.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-CaF-ZWlZ.js +2 -0
- package/dist/owletto/dist/assets/{connection-BOaMa324.js → connection-D8ZAMHBT.js} +2 -2
- package/dist/owletto/dist/assets/connection-feed-detail-CJYqryAV.js +2 -0
- package/dist/owletto/dist/assets/connector-boxes-BWPXijAk.js +2 -0
- package/dist/owletto/dist/assets/connector-page-shell-C23dWdKz.js +2 -0
- package/dist/owletto/dist/assets/connector-provenance-CW4CXtCz.js +2 -0
- package/dist/owletto/dist/assets/{connectors-D5F5rHxX.js → connectors-Bp08_KPq.js} +2 -2
- package/dist/owletto/dist/assets/consent-_PpYI1cT.js +2 -0
- package/dist/owletto/dist/assets/copy-button-1ALlvZU1.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-BIE97rfo.js → core.esm-6koO33th.js} +2 -2
- package/dist/owletto/dist/assets/create-DULVO0HS.js +2 -0
- package/dist/owletto/dist/assets/create-Drx9tcnG.js +2 -0
- package/dist/owletto/dist/assets/{create-automation-form-B12yTrmj.js → create-automation-form-BhujNbRr.js} +3 -3
- package/dist/owletto/dist/assets/{create-BPxsKwk7.js → create-kUevP9Xx.js} +2 -2
- package/dist/owletto/dist/assets/create._connectorKey-N6fhcIPy.js +2 -0
- package/dist/owletto/dist/assets/{custom-guardrail-edits-B9plaLBN.js → custom-guardrail-edits-B_aCgvoZ.js} +2 -2
- package/dist/owletto/dist/assets/definition-comparison-3zKUSTt8.js +2 -0
- package/dist/owletto/dist/assets/{detail-page-skeleton-I5_7FkKx.js → detail-page-skeleton-BmxqqIsH.js} +2 -2
- package/dist/owletto/dist/assets/{device-CadaiNF4.js → device-D2eUt_nr.js} +2 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-BFPbTM_o.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-Dqtmb1Xp.js +2 -0
- package/dist/owletto/dist/assets/dynamic-schema-form-D3KnzCsW.js +2 -0
- package/dist/owletto/dist/assets/entity-options-IUdQ-64R.js +2 -0
- package/dist/owletto/dist/assets/entity-page-B3Im65EI.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-DJNSQrfB.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-CouHZbc9.js +2 -0
- package/dist/owletto/dist/assets/event-detail-CvaRN1qB.js +2 -0
- package/dist/owletto/dist/assets/event-kind-options-fHAIXu24.js +2 -0
- package/dist/owletto/dist/assets/events-feed-DwOkLk6A.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-DQ5V4Cvh.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-CCU4PkRv.js → full-page-spinner-B7A6Ycyi.js} +2 -2
- package/dist/owletto/dist/assets/home-stream-Bg97PUBJ.js +2 -0
- package/dist/owletto/dist/assets/home-toolbar-CpCcHA6z.js +2 -0
- package/dist/owletto/dist/assets/index-9PGnv4-5.js +2 -0
- package/dist/owletto/dist/assets/{index-pmr1WUoG.js → index-B-dZruj6.js} +2 -2
- package/dist/owletto/dist/assets/index-BztXeLBN.js +2 -0
- package/dist/owletto/dist/assets/{index-B-Ab8srM.js → index-C2TCKJDP.js} +1599 -1597
- package/dist/owletto/dist/assets/index-C7QM3aqU.js +2 -0
- package/dist/owletto/dist/assets/index-CWn46a4y.js +2 -0
- package/dist/owletto/dist/assets/index-CxJONizf.js +2 -0
- package/dist/owletto/dist/assets/index-DJhb3li3.js +2 -0
- package/dist/owletto/dist/assets/{index-B72KYdN1.js → index-DXfYVs5m.js} +2 -2
- package/dist/owletto/dist/assets/{index-BYFDMIQC.js → index-DY-YGnCe.js} +2 -2
- package/dist/owletto/dist/assets/index-j3v7ITPb.js +2 -0
- package/dist/owletto/dist/assets/index-oiy6ygaI.js +2 -0
- package/dist/owletto/dist/assets/index-pEgtAY1t.js +2 -0
- package/dist/owletto/dist/assets/index-xAvK3IyQ.css +1 -0
- package/dist/owletto/dist/assets/json-diff-CJK-gzCt.js +4 -0
- package/dist/owletto/dist/assets/{list-skeleton-BAqT0vxo.js → list-skeleton-bQAZ0hQp.js} +2 -2
- package/dist/owletto/dist/assets/{login-D5bIjMtf.js → login-DLqL54Rk.js} +2 -2
- package/dist/owletto/dist/assets/{logout-JYZvxz8v.js → logout-H0F3IfiO.js} +2 -2
- package/dist/owletto/dist/assets/member-scope-gate-Doic_6qX.js +2 -0
- package/dist/owletto/dist/assets/memory-browse-page-CUea2Llz.js +74 -0
- package/dist/owletto/dist/assets/model-selector-BrfaDwIg.js +2 -0
- package/dist/owletto/dist/assets/new-5GkxlOuQ.js +2 -0
- package/dist/owletto/dist/assets/{new-B-Jd-vBl.js → new-BiA4DGoN.js} +2 -2
- package/dist/owletto/dist/assets/new-M-MX_T5C.js +2 -0
- package/dist/owletto/dist/assets/organization-CLrcmgNK.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-B29OcHwm.js +2 -0
- package/dist/owletto/dist/assets/{pending-seed-CoFPQ835.js → pending-seed-DYYOoCvj.js} +2 -2
- package/dist/owletto/dist/assets/proposal-review-shell-BVwOMoq9.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-BbjPgh3k.js +2 -0
- package/dist/owletto/dist/assets/record-activity-BCpNKaUo.js +2 -0
- package/dist/owletto/dist/assets/{record-session-Bpx4_LGk.js → record-session-KuEDuF3S.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-CgaQKMoG.js → renderer-ucwCQmBk.js} +2 -2
- package/dist/owletto/dist/assets/{reset-password-C-4Jnuqk.js → reset-password-BkiAmXZW.js} +2 -2
- package/dist/owletto/dist/assets/run-initiator-8vdkq-3o.js +2 -0
- package/dist/owletto/dist/assets/{runs-BMzp7j7j.js → runs-B_iywKWb.js} +2 -2
- package/dist/owletto/dist/assets/runs-list-CJJFRhTl.js +2 -0
- package/dist/owletto/dist/assets/schema-type-editor-panel-C4e8pq1A.js +2 -0
- package/dist/owletto/dist/assets/{schema-value-BUgC0Ro8.js → schema-value-CefbtPIY.js} +3 -3
- package/dist/owletto/dist/assets/scoped-feed-bar-CapleZvS.js +2 -0
- package/dist/owletto/dist/assets/{settings-DYYvrrZ4.js → settings-DvzkRYQy.js} +2 -2
- package/dist/owletto/dist/assets/source-record-panels-LJIWGtHb.js +2 -0
- package/dist/owletto/dist/assets/{status-variants-DT61YfsU.js → status-variants-BxHtpMOj.js} +2 -2
- package/dist/owletto/dist/assets/subDays-DwIOMzYC.js +2 -0
- package/dist/owletto/dist/assets/{table-B6yimlsZ.js → table-1O-ik4_O.js} +2 -2
- package/dist/owletto/dist/assets/{use-automations-II_YJWtN.js → use-automations-lV8PuE8L.js} +2 -2
- package/dist/owletto/dist/assets/use-login-redirect-CfCbEeJR.js +2 -0
- package/dist/owletto/dist/assets/use-mention-search-CA-evCDf.js +91 -0
- package/dist/owletto/dist/assets/{view-param-filters-DYlqBocg.js → view-param-filters-Bp84PUMd.js} +2 -2
- package/dist/owletto/dist/assets/{views-access-required-BVtMfgLh.js → views-access-required-BerT4Z1d.js} +2 -2
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +274 -136
- package/npm-shrinkwrap.json +540 -447
- package/package.json +4 -2
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/connector-query-errors.d.ts +6 -0
- package/vendor/core/dist/connector-query-errors.js +4 -0
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +2 -0
- package/vendor/core/dist/contracts/tools/manage-entity.js +7 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +2 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +3 -0
- package/vendor/core/dist/contracts/tools/view-host.js +2 -0
- package/vendor/core/dist/error-report.js +1 -0
- package/vendor/core/package.json +1 -1
- package/vendor/views/package.json +1 -1
- package/dist/connectors/linkedin-takeout.ts +0 -577
- package/dist/connectors/takeout-utils.ts +0 -240
- package/dist/owletto/dist/assets/_-CZgmjLR9.js +0 -2
- package/dist/owletto/dist/assets/_-Cm5OgtYD.js +0 -3
- package/dist/owletto/dist/assets/_-DtqBFgK5.js +0 -2
- package/dist/owletto/dist/assets/_agentId-Cci6NFc1.js +0 -2
- package/dist/owletto/dist/assets/_agentId-GhWTlPO2.js +0 -2
- package/dist/owletto/dist/assets/_automationId-KUlxSTK2.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-Zpy7Hvml.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-CYDRp9UX.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-NNqDdije.js +0 -2
- package/dist/owletto/dist/assets/_eventId-0BSX6VHj.js +0 -2
- package/dist/owletto/dist/assets/_owner-C-CD22NB.js +0 -3
- package/dist/owletto/dist/assets/_shape-CvXp4omb.js +0 -2
- package/dist/owletto/dist/assets/_slug-DgK7zpKA.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-cH54P0zY.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-m0B5j7L9.js +0 -2
- package/dist/owletto/dist/assets/activity-link-rXNpmppV.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-B0m7_g9q.js +0 -2
- package/dist/owletto/dist/assets/agent-client-setup-list-BmD3-_Ox.js +0 -4
- package/dist/owletto/dist/assets/agent-connect-pages-BtOTCsTU.js +0 -2
- package/dist/owletto/dist/assets/agent-editor-form-CirqCpcM.js +0 -2
- package/dist/owletto/dist/assets/agent-list-row-SyACVYX7.js +0 -2
- package/dist/owletto/dist/assets/agent-permissions-matrix-Dsc26dyW.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +0 -2
- package/dist/owletto/dist/assets/agents-D1FHZ0jR.js +0 -2
- package/dist/owletto/dist/assets/app._appId-01I0CJal.js +0 -2
- package/dist/owletto/dist/assets/assist-composer-BD9msDk3.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-BFv1TglZ.js +0 -2
- package/dist/owletto/dist/assets/automation-row-CmTpAD4r.js +0 -2
- package/dist/owletto/dist/assets/automation-source-list-D8ZSavQU.js +0 -2
- package/dist/owletto/dist/assets/automations-D1FHZ0jR.js +0 -2
- package/dist/owletto/dist/assets/change-summary-CGrKEJ04.js +0 -2
- package/dist/owletto/dist/assets/clients-6aJvabvS.js +0 -2
- package/dist/owletto/dist/assets/connect-BmDziBzI.js +0 -2
- package/dist/owletto/dist/assets/connect-menu-Bs8mxsga.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-t5aKu3aa.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-DswMAw8l.js +0 -2
- package/dist/owletto/dist/assets/connection-feed-detail-BLCjhP-H.js +0 -2
- package/dist/owletto/dist/assets/connector-boxes-BAP_f77M.js +0 -2
- package/dist/owletto/dist/assets/connector-page-shell-ClOmVPJr.js +0 -2
- package/dist/owletto/dist/assets/connector-provenance-wmYu5jwO.js +0 -2
- package/dist/owletto/dist/assets/consent-RqHNkmm8.js +0 -2
- package/dist/owletto/dist/assets/copy-button-D6zpsZLi.js +0 -2
- package/dist/owletto/dist/assets/create-GT8_yF0R.js +0 -2
- package/dist/owletto/dist/assets/create-Yx2qBMBy.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-CzXqSkuI.js +0 -2
- package/dist/owletto/dist/assets/definition-comparison-C3k6Wa9B.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-U7Bx05P6.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-DTZqj1HS.js +0 -2
- package/dist/owletto/dist/assets/dynamic-schema-form-DyT_9iVE.js +0 -2
- package/dist/owletto/dist/assets/entity-options-CGTjLlcS.js +0 -2
- package/dist/owletto/dist/assets/entity-page-DHHMmA8V.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-eYbG2FDT.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-CjFqxSdL.js +0 -2
- package/dist/owletto/dist/assets/event-card-BtTUuf2q.js +0 -2
- package/dist/owletto/dist/assets/event-detail-8xHiplt_.js +0 -2
- package/dist/owletto/dist/assets/events-feed-zFnTSE27.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-Dd5R2Etd.js +0 -2
- package/dist/owletto/dist/assets/home-stream-IVsNEkwp.js +0 -2
- package/dist/owletto/dist/assets/index-2oaMOFKe.js +0 -2
- package/dist/owletto/dist/assets/index-B4RZgvvI.js +0 -2
- package/dist/owletto/dist/assets/index-BBZM53p8.js +0 -2
- package/dist/owletto/dist/assets/index-BOb0a5f9.js +0 -2
- package/dist/owletto/dist/assets/index-BwnFQcMe.js +0 -2
- package/dist/owletto/dist/assets/index-CvYsWYlF.js +0 -2
- package/dist/owletto/dist/assets/index-DIXIvtnM.js +0 -2
- package/dist/owletto/dist/assets/index-DLwokXHW.js +0 -2
- package/dist/owletto/dist/assets/index-_nlPHus1.js +0 -2
- package/dist/owletto/dist/assets/index-cwOgj4-i.js +0 -2
- package/dist/owletto/dist/assets/index-pp4qmhkA.js +0 -2
- package/dist/owletto/dist/assets/index-tTbno-PX.css +0 -1
- package/dist/owletto/dist/assets/json-diff-B-1Swv_y.js +0 -28
- package/dist/owletto/dist/assets/member-scope-gate-Lj9m4RL2.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-rAKfVdQ_.js +0 -74
- package/dist/owletto/dist/assets/model-selector-onvGA9Ww.js +0 -2
- package/dist/owletto/dist/assets/new-BmehH1uR.js +0 -2
- package/dist/owletto/dist/assets/new-KDi15LWZ.js +0 -2
- package/dist/owletto/dist/assets/organization-B9bh20Xo.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-Bqus80Mq.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-CnACXCUg.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-Dlh-eWz0.js +0 -2
- package/dist/owletto/dist/assets/record-activity-6CfR95Ul.js +0 -2
- package/dist/owletto/dist/assets/run-initiator-BvruBM5H.js +0 -2
- package/dist/owletto/dist/assets/runs-list-DVhrTr3v.js +0 -2
- package/dist/owletto/dist/assets/schema-type-editor-panel-Bdeumkux.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-CBV9tsR3.js +0 -2
- package/dist/owletto/dist/assets/use-login-redirect-BqtEilid.js +0 -2
- package/dist/owletto/dist/assets/use-mention-search-Bxlpd6Dp.js +0 -96
|
@@ -878,7 +878,8 @@ var init_error_report = __esm({
|
|
|
878
878
|
"NOT_FOUND",
|
|
879
879
|
"VALIDATION",
|
|
880
880
|
"PERMISSION",
|
|
881
|
-
"MANUAL_EDIT_NOT_ALLOWED"
|
|
881
|
+
"MANUAL_EDIT_NOT_ALLOWED",
|
|
882
|
+
"PRECONDITION_FAILED"
|
|
882
883
|
]);
|
|
883
884
|
DEPENDENCY_TOOL_CODES = /* @__PURE__ */ new Set([
|
|
884
885
|
"AUTH_INVALID",
|
|
@@ -1192,6 +1193,10 @@ var init_connector_query_errors = __esm({
|
|
|
1192
1193
|
retryable: false,
|
|
1193
1194
|
message: "This caller may not assert a manual edit; it needs the entities:manual_edit scope and no agent, MCP session or Automation behind it."
|
|
1194
1195
|
},
|
|
1196
|
+
PRECONDITION_FAILED: {
|
|
1197
|
+
retryable: false,
|
|
1198
|
+
message: "A field changed since it was read, so nothing was written; re-read it and retry with the current values."
|
|
1199
|
+
},
|
|
1195
1200
|
RATE_LIMITED: {
|
|
1196
1201
|
retryable: true,
|
|
1197
1202
|
message: "The upstream rate limit was hit; retry shortly."
|
|
@@ -8498,6 +8503,8 @@ function toolErrorHttpStatus(code) {
|
|
|
8498
8503
|
case "PERMISSION":
|
|
8499
8504
|
case "MANUAL_EDIT_NOT_ALLOWED":
|
|
8500
8505
|
return 403;
|
|
8506
|
+
case "PRECONDITION_FAILED":
|
|
8507
|
+
return 409;
|
|
8501
8508
|
case "RATE_LIMITED":
|
|
8502
8509
|
return 429;
|
|
8503
8510
|
case "VALIDATION":
|
|
@@ -8544,12 +8551,19 @@ var init_errors2 = __esm({
|
|
|
8544
8551
|
*/
|
|
8545
8552
|
retryAfterSeconds;
|
|
8546
8553
|
callId;
|
|
8547
|
-
|
|
8554
|
+
/**
|
|
8555
|
+
* Structured, caller-safe facts about the failure (e.g. `mismatched_fields`
|
|
8556
|
+
* for `PRECONDITION_FAILED`). Every wire boundary that reports `code`
|
|
8557
|
+
* reports these alongside it, so a client branches on data, not prose.
|
|
8558
|
+
*/
|
|
8559
|
+
details;
|
|
8560
|
+
constructor(message, httpStatus = 400, code, details) {
|
|
8548
8561
|
super(message);
|
|
8549
8562
|
this.name = "ToolUserError";
|
|
8550
8563
|
this.httpStatus = CDN_SUBSTITUTED_STATUSES.has(httpStatus) ? code ? toolErrorHttpStatus(code) : 500 : httpStatus;
|
|
8551
8564
|
this.code = code;
|
|
8552
8565
|
this.retryable = code ? isRetryable(code) : false;
|
|
8566
|
+
this.details = details;
|
|
8553
8567
|
}
|
|
8554
8568
|
};
|
|
8555
8569
|
ToolNotRegisteredError = class extends Error {
|
|
@@ -12982,8 +12996,9 @@ export default async (_ctx, client) => {
|
|
|
12982
12996
|
};`
|
|
12983
12997
|
},
|
|
12984
12998
|
"entities.update": {
|
|
12985
|
-
summary: "Update an existing entity.",
|
|
12986
|
-
access: "write"
|
|
12999
|
+
summary: "Update an existing entity. Pass `expected` (metadata field -> the value you read) to make the write conditional: if any field changed since, nothing is written and the call fails with 409 PRECONDITION_FAILED, whose `details.mismatched_fields` names the stale fields.",
|
|
13000
|
+
access: "write",
|
|
13001
|
+
example: "await client.entities.update({ entity_id: 42, expected: { stage: 'open' }, metadata: { stage: 'won' } });"
|
|
12987
13002
|
},
|
|
12988
13003
|
"entities.delete": {
|
|
12989
13004
|
summary: "Delete an entity. force_delete_tree hard-deletes the whole descendant tree (event history is kept, only detached); dry_run previews what would be removed/detached without mutating.",
|
|
@@ -14104,6 +14119,12 @@ function resolveSdkMaxAccessLevel(memberRole2, scopes, accountScope = false) {
|
|
|
14104
14119
|
function isPublicReadable(toolName, args) {
|
|
14105
14120
|
return actionMatches(PUBLIC_READ_ACTIONS, toolName, args);
|
|
14106
14121
|
}
|
|
14122
|
+
function publicToolDenial(toolName) {
|
|
14123
|
+
if (toolName === "query_sql" || toolName === "query_sdk") {
|
|
14124
|
+
return "SQL and SDK queries are not available to public workspace visitors. Sign in and join this workspace, or use its public pages.";
|
|
14125
|
+
}
|
|
14126
|
+
return null;
|
|
14127
|
+
}
|
|
14107
14128
|
function getPublicReadableActions(toolName) {
|
|
14108
14129
|
return PUBLIC_READ_ACTIONS[toolName];
|
|
14109
14130
|
}
|
|
@@ -16054,6 +16075,9 @@ async function runScript(options) {
|
|
|
16054
16075
|
error: {
|
|
16055
16076
|
name: error.name,
|
|
16056
16077
|
message: error.message,
|
|
16078
|
+
// A script that catches the failure branches on these (e.g.
|
|
16079
|
+
// `mismatched_fields` on PRECONDITION_FAILED), not on prose.
|
|
16080
|
+
...error.details === void 0 ? {} : { details: safeErrorDetails(error.details) },
|
|
16057
16081
|
classificationToken: trustErrorClassification(code)
|
|
16058
16082
|
}
|
|
16059
16083
|
});
|
|
@@ -34220,9 +34244,9 @@ function parseDateAlias(alias, referenceDate = /* @__PURE__ */ new Date()) {
|
|
|
34220
34244
|
if (named) {
|
|
34221
34245
|
return { date: utcDayStartBefore(referenceDate, named), originalInput: alias };
|
|
34222
34246
|
}
|
|
34223
|
-
const
|
|
34224
|
-
if (
|
|
34225
|
-
return { date: utcDayStartBefore(referenceDate,
|
|
34247
|
+
const relative4 = parseRelativeAlias(lowered);
|
|
34248
|
+
if (relative4) {
|
|
34249
|
+
return { date: utcDayStartBefore(referenceDate, relative4), originalInput: alias };
|
|
34226
34250
|
}
|
|
34227
34251
|
const instant = parseIsoInstant(unquoted);
|
|
34228
34252
|
if (instant) {
|
|
@@ -40373,6 +40397,10 @@ var init_run_lease = __esm({
|
|
|
40373
40397
|
});
|
|
40374
40398
|
|
|
40375
40399
|
// src/tools/admin/approval-events.ts
|
|
40400
|
+
function operationCardLabel(metadata, runActionKey) {
|
|
40401
|
+
const label = metadata.operation_name ?? metadata.action_name ?? metadata.operation_key ?? metadata.action_key ?? runActionKey;
|
|
40402
|
+
return typeof label === "string" && label !== "" ? label : "Operation";
|
|
40403
|
+
}
|
|
40376
40404
|
function requireApprovalCard(runId, eventId, transition) {
|
|
40377
40405
|
if (eventId === void 0) {
|
|
40378
40406
|
throw new Error(
|
|
@@ -40408,10 +40436,11 @@ async function terminalizeApprovalRunCompleted(runId, organizationId, output, ca
|
|
|
40408
40436
|
return cardId;
|
|
40409
40437
|
});
|
|
40410
40438
|
}
|
|
40411
|
-
async function supersedeActionEvent(runId, organizationId, status,
|
|
40439
|
+
async function supersedeActionEvent(runId, organizationId, status, titleText, contentText2, extraMetadata = {}, reviewer = null, db = getDb(), interactionInput) {
|
|
40412
40440
|
const sql2 = db;
|
|
40413
40441
|
const originalEvent = await sql2`
|
|
40414
|
-
SELECT id, entity_ids, metadata, author_name, interaction_input_schema, interaction_input
|
|
40442
|
+
SELECT id, entity_ids, metadata, author_name, interaction_input_schema, interaction_input,
|
|
40443
|
+
(SELECT action_key FROM runs WHERE id = ${runId} AND organization_id = ${organizationId}) AS run_action_key
|
|
40415
40444
|
FROM current_event_records
|
|
40416
40445
|
WHERE run_id = ${runId}
|
|
40417
40446
|
AND organization_id = ${organizationId}
|
|
@@ -40422,6 +40451,9 @@ async function supersedeActionEvent(runId, organizationId, status, title, conten
|
|
|
40422
40451
|
if (originalEvent.length === 0) return void 0;
|
|
40423
40452
|
const orig = originalEvent[0];
|
|
40424
40453
|
const priorMetadata = orig.metadata ?? {};
|
|
40454
|
+
const operationName = operationCardLabel(priorMetadata, orig.run_action_key);
|
|
40455
|
+
const title = typeof titleText === "function" ? titleText(operationName) : titleText;
|
|
40456
|
+
const content = typeof contentText2 === "function" ? contentText2(operationName) : contentText2;
|
|
40425
40457
|
const reviewedById = reviewer?.userId ?? priorMetadata.reviewed_by_id ?? null;
|
|
40426
40458
|
const reviewedByName = reviewer?.name ?? priorMetadata.reviewed_by_name ?? null;
|
|
40427
40459
|
const reviewedAt = reviewer ? (/* @__PURE__ */ new Date()).toISOString() : priorMetadata.reviewed_at ?? null;
|
|
@@ -40461,9 +40493,7 @@ async function supersedeActionEvent(runId, organizationId, status, title, conten
|
|
|
40461
40493
|
runId,
|
|
40462
40494
|
organizationId,
|
|
40463
40495
|
cardStatus: status,
|
|
40464
|
-
operationName
|
|
40465
|
-
priorMetadata.operation_name ?? priorMetadata.action_name ?? priorMetadata.operation_key ?? priorMetadata.action_key ?? "Operation"
|
|
40466
|
-
),
|
|
40496
|
+
operationName,
|
|
40467
40497
|
connectionName: typeof priorMetadata.connection_name === "string" ? priorMetadata.connection_name : null,
|
|
40468
40498
|
output: extraMetadata.output ?? extraMetadata.action_output ?? null,
|
|
40469
40499
|
reason: String(
|
|
@@ -40583,13 +40613,12 @@ async function terminalizeInlineOperationRun(runId, organizationId, claimedBy, t
|
|
|
40583
40613
|
RETURNING action_key
|
|
40584
40614
|
`;
|
|
40585
40615
|
if (rows.length === 0) return false;
|
|
40586
|
-
const actionKey = rows[0].action_key ?? "Operation";
|
|
40587
40616
|
await supersedeActionEvent(
|
|
40588
40617
|
runId,
|
|
40589
40618
|
organizationId,
|
|
40590
40619
|
terminal.status,
|
|
40591
|
-
`${
|
|
40592
|
-
terminal.status === "completed" ? `Operation completed: ${
|
|
40620
|
+
(operation) => `${operation} \u2014 ${terminal.status}`,
|
|
40621
|
+
(operation) => terminal.status === "completed" ? `Operation completed: ${operation}` : `Operation failed: ${operation} \u2014 ${terminal.errorMessage}`,
|
|
40593
40622
|
terminal.status === "completed" ? { output: terminal.output } : {
|
|
40594
40623
|
error_message: terminal.errorMessage,
|
|
40595
40624
|
...output === null ? {} : { output }
|
|
@@ -40729,7 +40758,7 @@ async function applyRunConnectorPolicyAtClaim(params) {
|
|
|
40729
40758
|
if (!blocked && !resolved) throw new Error("Approval operation became unavailable during policy recheck");
|
|
40730
40759
|
const connectionName = resolved?.connection.display_name ?? run.connector_key ?? "Connection";
|
|
40731
40760
|
const status = blocked ? "rejected" : "pending_approval";
|
|
40732
|
-
const title = `${
|
|
40761
|
+
const title = (operation) => `${operation} \u2014 ${blocked ? "blocked by policy" : "pending approval"}`;
|
|
40733
40762
|
const metadata = {
|
|
40734
40763
|
policy_reason: policy.reason,
|
|
40735
40764
|
policy_rule_ids: policy.ruleIds,
|
|
@@ -40741,7 +40770,7 @@ async function applyRunConnectorPolicyAtClaim(params) {
|
|
|
40741
40770
|
entityIds: [],
|
|
40742
40771
|
organizationId,
|
|
40743
40772
|
originId: `run_${runId}_${status}`,
|
|
40744
|
-
title,
|
|
40773
|
+
title: title(operationCardLabel({ operation_name: resolved?.operation.name }, run.action_key)),
|
|
40745
40774
|
content: message,
|
|
40746
40775
|
semanticType: "operation",
|
|
40747
40776
|
runId,
|
|
@@ -40750,7 +40779,7 @@ async function applyRunConnectorPolicyAtClaim(params) {
|
|
|
40750
40779
|
interactionType: "approval",
|
|
40751
40780
|
interactionStatus: blocked ? "rejected" : "pending",
|
|
40752
40781
|
interactionInput: isSourceFeedRead(run.run_metadata) ? null : run.action_input,
|
|
40753
|
-
metadata: { ...metadata, status, run_id: runId, action_key: run.action_key, operation_key: run.action_key }
|
|
40782
|
+
metadata: { ...metadata, ...resolved ? { operation_name: resolved.operation.name } : {}, status, run_id: runId, action_key: run.action_key, operation_key: run.action_key }
|
|
40754
40783
|
}, { sql: sql2 });
|
|
40755
40784
|
cardId = Number(event.id);
|
|
40756
40785
|
}
|
|
@@ -41099,6 +41128,10 @@ function connectorRunEnv(opts) {
|
|
|
41099
41128
|
const env = buildConnectorWorkerEnv();
|
|
41100
41129
|
return { ...opts.cloud && opts.organizationSupplied ? withoutDeploymentProviderKeys(env) : env };
|
|
41101
41130
|
}
|
|
41131
|
+
function httpEgressAllowHostsEnv() {
|
|
41132
|
+
const hosts = process.env.LOBU_HTTP_EGRESS_ALLOW_HOSTS;
|
|
41133
|
+
return hosts ? { LOBU_HTTP_EGRESS_ALLOW_HOSTS: hosts } : {};
|
|
41134
|
+
}
|
|
41102
41135
|
function buildConnectorWorkerEnv() {
|
|
41103
41136
|
return {
|
|
41104
41137
|
ENVIRONMENT: process.env.ENVIRONMENT || "production",
|
|
@@ -41122,7 +41155,8 @@ function buildConnectorWorkerEnv() {
|
|
|
41122
41155
|
// predates that field. The isolate HOST refuses internal/metadata addresses
|
|
41123
41156
|
// for a DB socket under block-private (`socketOpen` in `executor/isolate.ts`);
|
|
41124
41157
|
// self-hosted (allow-private) reaches its own private DB.
|
|
41125
|
-
LOBU_DB_EGRESS_POLICY: cloudModeOn() ? "block-private" : "allow-private"
|
|
41158
|
+
LOBU_DB_EGRESS_POLICY: cloudModeOn() ? "block-private" : "allow-private",
|
|
41159
|
+
...httpEgressAllowHostsEnv()
|
|
41126
41160
|
};
|
|
41127
41161
|
}
|
|
41128
41162
|
var DEPLOYMENT_PROVIDER_ENV_KEYS;
|
|
@@ -43751,6 +43785,11 @@ function refusedAddress(error) {
|
|
|
43751
43785
|
return "";
|
|
43752
43786
|
return null;
|
|
43753
43787
|
}
|
|
43788
|
+
function operatorHttpExemptHosts(job) {
|
|
43789
|
+
if (job.mode === "agent_turn" || job.env?.LOBU_DB_EGRESS_POLICY !== "allow-private")
|
|
43790
|
+
return [];
|
|
43791
|
+
return parseExemptHosts(job.env.LOBU_HTTP_EGRESS_ALLOW_HOSTS, "LOBU_HTTP_EGRESS_ALLOW_HOSTS").map((host2) => stripIpv6Brackets(normalizeDomainPattern(host2)));
|
|
43792
|
+
}
|
|
43754
43793
|
var MIB, DEFAULT_OPTIONS, STREAM_TAIL_CAP_BYTES, MAX_REDIRECTS, MAX_OPEN_FETCHES, IsolateRuntimeUnavailableError, GUEST_RUNNER, CROSS_ORIGIN_SENSITIVE_HEADERS, UNSUPPORTED_SCHEME_MESSAGE, IsolateExecutor;
|
|
43755
43794
|
var init_isolate = __esm({
|
|
43756
43795
|
"../connector-worker/dist/executor/isolate.js"() {
|
|
@@ -44096,6 +44135,7 @@ var init_isolate = __esm({
|
|
|
44096
44135
|
throw new Error("HTTP authentication requires a gateway fetch hook");
|
|
44097
44136
|
}
|
|
44098
44137
|
assertIsolateEligible(compiledCode);
|
|
44138
|
+
const exemptHosts = [...this.exactAllowedHosts, ...operatorHttpExemptHosts(job)];
|
|
44099
44139
|
const ivm = await this.requireIsolatedVm();
|
|
44100
44140
|
const tail = new RingBuffer(STREAM_TAIL_CAP_BYTES);
|
|
44101
44141
|
let logBytesUsed = 0;
|
|
@@ -44115,7 +44155,7 @@ var init_isolate = __esm({
|
|
|
44115
44155
|
closeFetch(active);
|
|
44116
44156
|
activeFetches.clear();
|
|
44117
44157
|
};
|
|
44118
|
-
const egress = new EgressDispatcher({ exemptHosts
|
|
44158
|
+
const egress = new EgressDispatcher({ exemptHosts, lookup: this.options.lookup });
|
|
44119
44159
|
const vault = new CredentialVault();
|
|
44120
44160
|
const guestJob = concealCredentials(job, vault);
|
|
44121
44161
|
let host2 = null;
|
|
@@ -44212,6 +44252,7 @@ var init_isolate = __esm({
|
|
|
44212
44252
|
};
|
|
44213
44253
|
const network = {
|
|
44214
44254
|
egress,
|
|
44255
|
+
exemptHosts,
|
|
44215
44256
|
vault,
|
|
44216
44257
|
spends: /* @__PURE__ */ new Set(),
|
|
44217
44258
|
log: log3,
|
|
@@ -44717,7 +44758,7 @@ ${GUEST_RUNNER}`;
|
|
|
44717
44758
|
let spent;
|
|
44718
44759
|
try {
|
|
44719
44760
|
spent = net4.vault.swapHeaders(headers, url, {
|
|
44720
|
-
plaintextAllowed:
|
|
44761
|
+
plaintextAllowed: net4.exemptHosts.includes(bareHost) && (bareHost === "localhost" || isReservedIp(bareHost))
|
|
44721
44762
|
});
|
|
44722
44763
|
} catch (error) {
|
|
44723
44764
|
throw refuse(net4.log, `fetch to ${url.hostname}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -48530,13 +48571,12 @@ async function waitForDeviceActionRunWithOptions(runId, organizationId, options)
|
|
|
48530
48571
|
RETURNING id, action_key
|
|
48531
48572
|
`;
|
|
48532
48573
|
if (rows.length === 0) return rows;
|
|
48533
|
-
const actionKey = rows[0].action_key ?? "Operation";
|
|
48534
48574
|
await supersedeActionEvent(
|
|
48535
48575
|
runId,
|
|
48536
48576
|
organizationId,
|
|
48537
48577
|
"failed",
|
|
48538
|
-
`${
|
|
48539
|
-
`Operation ${callerAbortMessage == null ? "timed out" : "wait ended"}: ${
|
|
48578
|
+
(operation) => `${operation} \u2014 ${callerAbortMessage == null ? "timed out" : "caller wait ended"}`,
|
|
48579
|
+
(operation) => `Operation ${callerAbortMessage == null ? "timed out" : "wait ended"}: ${operation} \u2014 ${timeoutMessage}`,
|
|
48540
48580
|
{ error_message: timeoutMessage, run_status: "timeout" },
|
|
48541
48581
|
null,
|
|
48542
48582
|
tx
|
|
@@ -50821,7 +50861,7 @@ async function runConnectorQuery(p) {
|
|
|
50821
50861
|
...mergeExecutionConfig(conn.config, connectionCredentials, p.config),
|
|
50822
50862
|
...dbEgressConfig()
|
|
50823
50863
|
},
|
|
50824
|
-
env: dbEgressConfig(),
|
|
50864
|
+
env: { ...dbEgressConfig(), ...httpEgressAllowHostsEnv() },
|
|
50825
50865
|
sessionState,
|
|
50826
50866
|
credentials,
|
|
50827
50867
|
httpAuth,
|
|
@@ -51209,7 +51249,7 @@ async function readSourceFeedWithinDeadline(p, onBrowserLease) {
|
|
|
51209
51249
|
cursor: p.cursor,
|
|
51210
51250
|
window: p.window,
|
|
51211
51251
|
config,
|
|
51212
|
-
env: dbEgressConfig(),
|
|
51252
|
+
env: { ...dbEgressConfig(), ...httpEgressAllowHostsEnv() },
|
|
51213
51253
|
sessionState,
|
|
51214
51254
|
browser: await connectionBrowserGrant(p.scope.organizationId, feed.connection_id, feed.pinned_version ?? feed.definition_version),
|
|
51215
51255
|
credentials,
|
|
@@ -51246,6 +51286,7 @@ var init_connector_pushdown = __esm({
|
|
|
51246
51286
|
"use strict";
|
|
51247
51287
|
init_src();
|
|
51248
51288
|
init_browser_resource();
|
|
51289
|
+
init_env2();
|
|
51249
51290
|
init_runtime();
|
|
51250
51291
|
init_dist();
|
|
51251
51292
|
init_insert_event();
|
|
@@ -78399,7 +78440,7 @@ function IdentityDecisionResults(action2) {
|
|
|
78399
78440
|
)
|
|
78400
78441
|
];
|
|
78401
78442
|
}
|
|
78402
|
-
var EntityType, EntityReferenceType, EntityId2, EntityFields, Metadata, AutomationSource, DryRun, IncludeDeleted, EdgeEndpoints, RelationshipId, Confidence2, RelationshipSource, CreateEntityAction, UpdateEntityAction, ListEntitiesAction, GetEntityAction, DeleteEntityAction, IdentityPreview, LinkEntitiesAction, UnlinkEntitiesAction, UpdateLinkAction, ListLinksAction, DiscoverDuplicatesAction, ManageEntitySchema, RelationshipRowSchema, RelationshipCountByTypeSchema, EntityIdentitySchema, ManageEntityItemSchema, RelationshipReadFailureSchema, ManageEntityResultSchema;
|
|
78443
|
+
var EntityType, EntityReferenceType, EntityId2, EntityFields, Metadata, AutomationSource, DryRun, IncludeDeleted, EdgeEndpoints, RelationshipId, Confidence2, RelationshipSource, CreateEntityAction, MAX_EXPECTED_FIELDS, UpdateEntityAction, ListEntitiesAction, GetEntityAction, DeleteEntityAction, IdentityPreview, LinkEntitiesAction, UnlinkEntitiesAction, UpdateLinkAction, ListLinksAction, DiscoverDuplicatesAction, ManageEntitySchema, RelationshipRowSchema, RelationshipCountByTypeSchema, EntityIdentitySchema, ManageEntityItemSchema, RelationshipReadFailureSchema, ManageEntityResultSchema;
|
|
78403
78444
|
var init_manage_entity = __esm({
|
|
78404
78445
|
"../core/src/contracts/tools/manage-entity.ts"() {
|
|
78405
78446
|
"use strict";
|
|
@@ -78503,6 +78544,7 @@ var init_manage_entity = __esm({
|
|
|
78503
78544
|
metadata: Type23.Optional(Metadata),
|
|
78504
78545
|
automation_source: Type23.Optional(AutomationSource)
|
|
78505
78546
|
});
|
|
78547
|
+
MAX_EXPECTED_FIELDS = 50;
|
|
78506
78548
|
UpdateEntityAction = Type23.Object({
|
|
78507
78549
|
action: Type23.Literal("update", {
|
|
78508
78550
|
description: "Patch entity fields (human-owned fields queued for approval)."
|
|
@@ -78532,6 +78574,13 @@ var init_manage_entity = __esm({
|
|
|
78532
78574
|
description: "[update] Assert that the signed-in person made this change themselves, so it is recorded as their manual edit: the fields it sets (and affirm_fields) become theirs, and Automations then queue an approval instead of updating them. A wrong assertion takes the field away from Automations. Honoured for a person's own web-session edit, or for a token minted with the entities:manual_edit scope by a person in the web app, with no agent, MCP session or Automation behind the call; otherwise the update fails with 403 MANUAL_EDIT_NOT_ALLOWED and nothing is written. Defaults to false."
|
|
78533
78575
|
})
|
|
78534
78576
|
),
|
|
78577
|
+
// Optimistic concurrency: the values the caller read before writing
|
|
78578
|
+
expected: Type23.Optional(
|
|
78579
|
+
Type23.Record(Type23.String(), Type23.Unknown(), {
|
|
78580
|
+
maxProperties: MAX_EXPECTED_FIELDS,
|
|
78581
|
+
description: `[update] Metadata field name -> the value the caller last read. Checked against the live row under the update's row lock: if any field differs, nothing is written (no field changes, ownership markers, events or approvals) and the update fails with 409 PRECONDITION_FAILED listing the field names in mismatched_fields. Values compare structurally (object key order is ignored); null matches a field that was never set. Metadata fields only (not name, content, slug or parent_id); at most ${MAX_EXPECTED_FIELDS} keys.`
|
|
78582
|
+
})
|
|
78583
|
+
),
|
|
78535
78584
|
automation_source: Type23.Optional(AutomationSource)
|
|
78536
78585
|
});
|
|
78537
78586
|
ListEntitiesAction = Type23.Object({
|
|
@@ -80975,6 +81024,7 @@ async function handleUpdate2(args, env, ctx) {
|
|
|
80975
81024
|
if (args.affirm_fields !== void 0)
|
|
80976
81025
|
updateData.affirm_fields = args.affirm_fields;
|
|
80977
81026
|
if (args.manual_edit !== void 0) updateData.manual_edit = args.manual_edit;
|
|
81027
|
+
if (args.expected !== void 0) updateData.expected = args.expected;
|
|
80978
81028
|
const updateActor = await actingPrincipalFor2(args, ctx);
|
|
80979
81029
|
const updateAttribution = await resolveAutomationAttribution(
|
|
80980
81030
|
ctx,
|
|
@@ -84339,6 +84389,11 @@ var init_manage_feeds = __esm({
|
|
|
84339
84389
|
description: "Filter by runtime health for active feeds on non-paused connections; paused feeds and feeds on paused connections are excluded. 'failing' = last sync failed or the feed has one or more consecutive failures; 'healthy' = otherwise. Surfaces active-but-failing feeds the `status` filter cannot."
|
|
84340
84390
|
})
|
|
84341
84391
|
),
|
|
84392
|
+
include_event_count: Type26.Optional(
|
|
84393
|
+
Type26.Boolean({
|
|
84394
|
+
description: "Add `event_count`, each feed's stored events. Counting takes seconds on a busy connection, so it is off by default; ask for it only when you show the number."
|
|
84395
|
+
})
|
|
84396
|
+
),
|
|
84342
84397
|
...paginationFields(50)
|
|
84343
84398
|
});
|
|
84344
84399
|
ReadFeedAction = Type26.Object({
|
|
@@ -84926,10 +84981,8 @@ async function handleListFeeds(args, ctx) {
|
|
|
84926
84981
|
WHERE ${where}
|
|
84927
84982
|
ORDER BY f.created_at DESC LIMIT ${limit} OFFSET ${offset}
|
|
84928
84983
|
`;
|
|
84929
|
-
const
|
|
84930
|
-
|
|
84931
|
-
${pageQuery}
|
|
84932
|
-
),
|
|
84984
|
+
const countEvents = args.include_event_count === true;
|
|
84985
|
+
const eventCounts = countEvents ? sql2`,
|
|
84933
84986
|
event_counts AS (
|
|
84934
84987
|
SELECT e.connection_id, e.feed_key, COUNT(*)::int AS event_count
|
|
84935
84988
|
FROM events e
|
|
@@ -84944,7 +84997,14 @@ async function handleListFeeds(args, ctx) {
|
|
|
84944
84997
|
AND e.feed_key = ANY(ARRAY(SELECT DISTINCT feed_key FROM page WHERE feed_key IS NOT NULL))
|
|
84945
84998
|
AND e.superseded_by IS NULL
|
|
84946
84999
|
GROUP BY e.connection_id, e.feed_key
|
|
85000
|
+
)` : sql2``;
|
|
85001
|
+
const eventCountColumn = countEvents ? sql2`, COALESCE(ec.event_count, 0)::int AS event_count` : sql2``;
|
|
85002
|
+
const eventCountJoin = countEvents ? sql2`LEFT JOIN event_counts ec ON ec.connection_id = p.connection_id AND ec.feed_key = p.feed_key` : sql2``;
|
|
85003
|
+
const query = sql2`
|
|
85004
|
+
WITH page AS MATERIALIZED (
|
|
85005
|
+
${pageQuery}
|
|
84947
85006
|
)
|
|
85007
|
+
${eventCounts}
|
|
84948
85008
|
SELECT p.*, c.connector_key, c.display_name AS connection_name,
|
|
84949
85009
|
c.status AS connection_status,
|
|
84950
85010
|
c.external_tenant_id AS external_tenant_id,
|
|
@@ -84980,8 +85040,8 @@ async function handleListFeeds(args, ctx) {
|
|
|
84980
85040
|
WHERE subscription.organization_id = p.organization_id
|
|
84981
85041
|
AND subscription.connection_id = p.connection_id
|
|
84982
85042
|
AND subscription.channel_id = p.feed_key
|
|
84983
|
-
LIMIT 1) AS target_agent_id
|
|
84984
|
-
|
|
85043
|
+
LIMIT 1) AS target_agent_id
|
|
85044
|
+
${eventCountColumn}
|
|
84985
85045
|
FROM page p
|
|
84986
85046
|
JOIN connections c ON c.id = p.connection_id
|
|
84987
85047
|
JOIN "organization" o ON o.id = c.organization_id
|
|
@@ -85012,7 +85072,7 @@ async function handleListFeeds(args, ctx) {
|
|
|
85012
85072
|
})}
|
|
85013
85073
|
) cv ON TRUE
|
|
85014
85074
|
LEFT JOIN auth_profiles ap ON ap.id = c.auth_profile_id
|
|
85015
|
-
|
|
85075
|
+
${eventCountJoin}
|
|
85016
85076
|
ORDER BY p.created_at DESC
|
|
85017
85077
|
`;
|
|
85018
85078
|
const rows = await query;
|
|
@@ -93368,6 +93428,15 @@ var init_multi_tenant = __esm({
|
|
|
93368
93428
|
if (!requestedOrgId) {
|
|
93369
93429
|
return setContextAndContinue({ organizationId: null, memberRole: null });
|
|
93370
93430
|
}
|
|
93431
|
+
if (requestedOrgVisibility === "public" && requestedToolName) {
|
|
93432
|
+
const denial = publicToolDenial(requestedToolName);
|
|
93433
|
+
if (denial) {
|
|
93434
|
+
return c.json(
|
|
93435
|
+
{ error: "forbidden", error_description: denial },
|
|
93436
|
+
403
|
|
93437
|
+
);
|
|
93438
|
+
}
|
|
93439
|
+
}
|
|
93371
93440
|
if (!allowOrgLevelPublicRead && !allowAnonymousPublicOrgMcp) {
|
|
93372
93441
|
return c.json(
|
|
93373
93442
|
{
|
|
@@ -96123,8 +96192,8 @@ async function tryReconcileTerminalization(args, ctx, reviewer) {
|
|
|
96123
96192
|
content = `Builder action completed: ${desc}`;
|
|
96124
96193
|
message = `${handler.nounLabel} ${desc} approved and applied.`;
|
|
96125
96194
|
} else {
|
|
96126
|
-
title = `${
|
|
96127
|
-
content = `Operation completed: ${
|
|
96195
|
+
title = (operation) => `${operation} \u2014 completed`;
|
|
96196
|
+
content = (operation) => `Operation completed: ${operation}`;
|
|
96128
96197
|
message = "Operation approved and executed.";
|
|
96129
96198
|
}
|
|
96130
96199
|
const eventId = await terminalizeApprovalRunCompleted(
|
|
@@ -96934,7 +97003,7 @@ async function handleApprove(args, ctx, env) {
|
|
|
96934
97003
|
args.run_id,
|
|
96935
97004
|
ctx.organizationId,
|
|
96936
97005
|
"rejected",
|
|
96937
|
-
`${
|
|
97006
|
+
(operation) => `${operation} \u2014 blocked by policy`,
|
|
96938
97007
|
why,
|
|
96939
97008
|
{ reject_reason: why },
|
|
96940
97009
|
reviewer2,
|
|
@@ -96987,8 +97056,8 @@ async function handleApprove(args, ctx, env) {
|
|
|
96987
97056
|
args.run_id,
|
|
96988
97057
|
ctx.organizationId,
|
|
96989
97058
|
"confirmed",
|
|
96990
|
-
`${
|
|
96991
|
-
`Operation confirmed: ${
|
|
97059
|
+
(operation) => `${operation} \u2014 executing`,
|
|
97060
|
+
(operation) => `Operation confirmed: ${operation} \u2014 waiting for execution`,
|
|
96992
97061
|
args.input ? { approved_input: args.input } : {},
|
|
96993
97062
|
reviewer,
|
|
96994
97063
|
tx
|
|
@@ -97028,8 +97097,8 @@ async function handleApprove(args, ctx, env) {
|
|
|
97028
97097
|
ctx.organizationId,
|
|
97029
97098
|
result.output,
|
|
97030
97099
|
{
|
|
97031
|
-
title: `${
|
|
97032
|
-
content: `Operation completed: ${
|
|
97100
|
+
title: (operation) => `${operation} \u2014 completed`,
|
|
97101
|
+
content: (operation) => `Operation completed: ${operation}`
|
|
97033
97102
|
},
|
|
97034
97103
|
reviewer,
|
|
97035
97104
|
inlineOwner
|
|
@@ -97061,8 +97130,8 @@ async function handleApprove(args, ctx, env) {
|
|
|
97061
97130
|
args.run_id,
|
|
97062
97131
|
ctx.organizationId,
|
|
97063
97132
|
"failed",
|
|
97064
|
-
`${
|
|
97065
|
-
`Operation failed: ${
|
|
97133
|
+
(operation) => `${operation} \u2014 failed`,
|
|
97134
|
+
(operation) => `Operation failed: ${operation}${result.error_message ? ` \u2014 ${result.error_message}` : ""}`,
|
|
97066
97135
|
{ error_message: result.error_message },
|
|
97067
97136
|
reviewer,
|
|
97068
97137
|
tx
|
|
@@ -97105,13 +97174,12 @@ async function handleReject(args, ctx) {
|
|
|
97105
97174
|
RETURNING id, action_key
|
|
97106
97175
|
`;
|
|
97107
97176
|
if (updated.length === 0) return null;
|
|
97108
|
-
const operationKey = updated[0].action_key;
|
|
97109
97177
|
const eventId = await supersedeActionEvent(
|
|
97110
97178
|
args.run_id,
|
|
97111
97179
|
ctx.organizationId,
|
|
97112
97180
|
"rejected",
|
|
97113
|
-
`${
|
|
97114
|
-
`Operation rejected: ${
|
|
97181
|
+
(operation) => `${operation} \u2014 rejected`,
|
|
97182
|
+
(operation) => `Operation rejected: ${operation}${args.reason ? ` \u2014 ${args.reason}` : ""}`,
|
|
97115
97183
|
{ reject_reason: reason },
|
|
97116
97184
|
reviewer,
|
|
97117
97185
|
tx
|
|
@@ -97396,7 +97464,7 @@ async function handleCancel(args, ctx) {
|
|
|
97396
97464
|
args.run_id,
|
|
97397
97465
|
ctx.organizationId,
|
|
97398
97466
|
withdrawnApproval ? "rejected" : "failed",
|
|
97399
|
-
`${
|
|
97467
|
+
(operation) => `${operation} \u2014 cancelled`,
|
|
97400
97468
|
message,
|
|
97401
97469
|
withdrawnApproval ? {
|
|
97402
97470
|
run_status: "cancelled",
|
|
@@ -104924,6 +104992,10 @@ function toNumberOrNull(value) {
|
|
|
104924
104992
|
const n = Number(value);
|
|
104925
104993
|
return Number.isFinite(n) ? n : null;
|
|
104926
104994
|
}
|
|
104995
|
+
function connectorWebhookCallbackUrl(connectionId) {
|
|
104996
|
+
const baseUrl = resolvePublicGatewayUrl().replace(/\/+$/, "");
|
|
104997
|
+
return `${baseUrl}/api/v1/webhooks/${connectionId}`;
|
|
104998
|
+
}
|
|
104927
104999
|
function defaultSecretStore() {
|
|
104928
105000
|
return new PostgresSecretStore();
|
|
104929
105001
|
}
|
|
@@ -104969,8 +105041,7 @@ async function registerConnectorWebhook(params) {
|
|
|
104969
105041
|
logContext: { connection_id: connectionId },
|
|
104970
105042
|
logMessage: "Failed to resolve webhook registration credentials"
|
|
104971
105043
|
});
|
|
104972
|
-
const
|
|
104973
|
-
const callbackUrl = `${baseUrl}/api/v1/webhooks/${connectionId}`;
|
|
105044
|
+
const callbackUrl = connectorWebhookCallbackUrl(connectionId);
|
|
104974
105045
|
const envStrings = connectorRunEnv({
|
|
104975
105046
|
organizationSupplied: findBundledConnectorFile2(connection.connector_key) === null,
|
|
104976
105047
|
cloud: isCloudMode()
|
|
@@ -105146,8 +105217,8 @@ var init_webhook_registration = __esm({
|
|
|
105146
105217
|
init_postgres_secret_store();
|
|
105147
105218
|
init_org_context();
|
|
105148
105219
|
init_secrets();
|
|
105149
|
-
init_base_url();
|
|
105150
105220
|
init_cloud_mode();
|
|
105221
|
+
init_public_origin();
|
|
105151
105222
|
init_connector_catalog();
|
|
105152
105223
|
init_ensure_connector_installed();
|
|
105153
105224
|
init_execution_context();
|
|
@@ -111534,7 +111605,7 @@ async function runSourceFeedListener(task) {
|
|
|
111534
111605
|
credentials: auth.credentials,
|
|
111535
111606
|
sessionState: auth.sessionState,
|
|
111536
111607
|
httpAuth: auth.httpAuth,
|
|
111537
|
-
env: dbEgressConfig()
|
|
111608
|
+
env: { ...dbEgressConfig(), ...httpEgressAllowHostsEnv() }
|
|
111538
111609
|
},
|
|
111539
111610
|
hooks: {
|
|
111540
111611
|
onHttpFetch: auth.onHttpFetch,
|
|
@@ -111560,6 +111631,7 @@ var LISTENER_SETUP_TIMEOUT_MS;
|
|
|
111560
111631
|
var init_source_feed_listener = __esm({
|
|
111561
111632
|
"src/runs/source-feed-listener.ts"() {
|
|
111562
111633
|
"use strict";
|
|
111634
|
+
init_env2();
|
|
111563
111635
|
init_runtime();
|
|
111564
111636
|
init_client();
|
|
111565
111637
|
init_source_read_bridge();
|
|
@@ -113989,7 +114061,6 @@ async function completeActionRun(c) {
|
|
|
113989
114061
|
});
|
|
113990
114062
|
if (rows.length === 0) return rows;
|
|
113991
114063
|
const organizationId2 = rows[0]?.organization_id;
|
|
113992
|
-
const actionKey = rows[0]?.action_key ?? "Action";
|
|
113993
114064
|
const approvalStatus = rows[0]?.approval_status;
|
|
113994
114065
|
const cardBearingRun = approvalStatus === "approved" || rows[0]?.run_type === "action" && approvalStatus === "auto";
|
|
113995
114066
|
if (organizationId2 && cardBearingRun && !sourceRead) {
|
|
@@ -113998,8 +114069,8 @@ async function completeActionRun(c) {
|
|
|
113998
114069
|
req.run_id,
|
|
113999
114070
|
organizationId2,
|
|
114000
114071
|
newStatus,
|
|
114001
|
-
`${
|
|
114002
|
-
req.status === "success" ? `Action completed: ${
|
|
114072
|
+
(operation) => `${operation} \u2014 ${newStatus}`,
|
|
114073
|
+
(operation) => req.status === "success" ? `Action completed: ${operation}` : `Action failed: ${operation}${req.error_message ? ` \u2014 ${req.error_message}` : ""}`,
|
|
114003
114074
|
req.status === "success" ? { action_output: actionOutput } : { error_message: req.error_message },
|
|
114004
114075
|
null,
|
|
114005
114076
|
tx
|
|
@@ -122612,12 +122683,11 @@ async function handleDelete4(args, ctx) {
|
|
|
122612
122683
|
RETURNING action_key
|
|
122613
122684
|
`;
|
|
122614
122685
|
if (expired.length === 0) continue;
|
|
122615
|
-
const actionKey = expired[0].action_key ?? "Action";
|
|
122616
122686
|
const eventId = await supersedeActionEvent(
|
|
122617
122687
|
pendingApproval.id,
|
|
122618
122688
|
organizationId,
|
|
122619
122689
|
"rejected",
|
|
122620
|
-
`${
|
|
122690
|
+
(operation) => `${operation} \u2014 expired`,
|
|
122621
122691
|
approvalExpiryReason,
|
|
122622
122692
|
{
|
|
122623
122693
|
expiry_reason: approvalExpiryReason,
|
|
@@ -122663,12 +122733,11 @@ async function handleDelete4(args, ctx) {
|
|
|
122663
122733
|
RETURNING action_key, approval_status
|
|
122664
122734
|
`;
|
|
122665
122735
|
if (cancelled.length === 0) continue;
|
|
122666
|
-
const actionKey = cancelled[0].action_key ?? "Action";
|
|
122667
122736
|
const eventId = await supersedeActionEvent(
|
|
122668
122737
|
unclaimedRun.id,
|
|
122669
122738
|
organizationId,
|
|
122670
122739
|
"failed",
|
|
122671
|
-
`${
|
|
122740
|
+
(operation) => `${operation} \u2014 cancelled`,
|
|
122672
122741
|
unclaimedActionCancelReason,
|
|
122673
122742
|
{
|
|
122674
122743
|
error_message: unclaimedActionCancelReason,
|
|
@@ -137621,6 +137690,8 @@ async function checkToolAccess(toolName, args, authCtx) {
|
|
|
137621
137690
|
}
|
|
137622
137691
|
if (!role) {
|
|
137623
137692
|
if (!isPublicReadable(toolName, args)) {
|
|
137693
|
+
const denial = publicToolDenial(toolName);
|
|
137694
|
+
if (denial) throw new AccessDeniedError(denial);
|
|
137624
137695
|
if (authCtx.userId) {
|
|
137625
137696
|
throw new AccessDeniedError(
|
|
137626
137697
|
"This public workspace is read-only for your account. Join the workspace to unlock write access."
|
|
@@ -156082,6 +156153,23 @@ function formatWhyApprovalNeeded(reason) {
|
|
|
156082
156153
|
if (!reason) return fallback;
|
|
156083
156154
|
return reason.replace(/^Automation proposes updating /i, "Field is protected: ");
|
|
156084
156155
|
}
|
|
156156
|
+
function formatIdentityChangeTitle(operation, proposal) {
|
|
156157
|
+
const verb = operation === "link" ? "Link" : "Separate";
|
|
156158
|
+
const ids = [proposal?.from_entity_id, proposal?.to_entity_id].filter(
|
|
156159
|
+
(id) => typeof id === "number" && Number.isFinite(id)
|
|
156160
|
+
);
|
|
156161
|
+
if (ids.length < 2)
|
|
156162
|
+
return `Review ${operation === "link" ? "associating" : "separating"} identity records`;
|
|
156163
|
+
const records = Array.isArray(proposal?.records) ? proposal.records : [];
|
|
156164
|
+
const nameOf = (id) => {
|
|
156165
|
+
const record4 = records.find(
|
|
156166
|
+
(item) => typeof item === "object" && item !== null && item.id === id
|
|
156167
|
+
);
|
|
156168
|
+
const name = typeof record4?.name === "string" ? truncateNotificationLine(record4.name) : "";
|
|
156169
|
+
return name ? `${name} (#${id})` : `#${id}`;
|
|
156170
|
+
};
|
|
156171
|
+
return `${verb} ${nameOf(ids[0])} and ${nameOf(ids[1])}`;
|
|
156172
|
+
}
|
|
156085
156173
|
function formatActionApprovalTitle(actionKey, details) {
|
|
156086
156174
|
if (details?.kind === "entity_field_change") {
|
|
156087
156175
|
return formatFieldChangeAction(
|
|
@@ -156091,7 +156179,8 @@ function formatActionApprovalTitle(actionKey, details) {
|
|
|
156091
156179
|
}
|
|
156092
156180
|
if (details?.kind === "entity_change") {
|
|
156093
156181
|
const entityLabel = details.entityType ? formatLabel(details.entityType).toLowerCase() : "entity";
|
|
156094
|
-
if (details.operation === "link" || details.operation === "unlink")
|
|
156182
|
+
if (details.operation === "link" || details.operation === "unlink")
|
|
156183
|
+
return formatIdentityChangeTitle(details.operation, details.proposal);
|
|
156095
156184
|
return details.operation === "delete" ? `Review deleting ${entityLabel}` : `Review creating ${entityLabel}`;
|
|
156096
156185
|
}
|
|
156097
156186
|
return `Action "${actionKey}" needs approval`;
|
|
@@ -157333,6 +157422,14 @@ function stableStringify4(value) {
|
|
|
157333
157422
|
);
|
|
157334
157423
|
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify4(v)}`).join(",")}}`;
|
|
157335
157424
|
}
|
|
157425
|
+
function mismatchedExpectedFields(metadata, expected) {
|
|
157426
|
+
return Object.keys(expected).filter(
|
|
157427
|
+
(field) => !sameValue(
|
|
157428
|
+
Object.hasOwn(metadata, field) ? metadata[field] : void 0,
|
|
157429
|
+
expected[field]
|
|
157430
|
+
)
|
|
157431
|
+
);
|
|
157432
|
+
}
|
|
157336
157433
|
function computeFieldMerge(args) {
|
|
157337
157434
|
const {
|
|
157338
157435
|
metadata,
|
|
@@ -157515,6 +157612,26 @@ async function getEntityCountsByTypes(types, ctx) {
|
|
|
157515
157612
|
}
|
|
157516
157613
|
return counts;
|
|
157517
157614
|
}
|
|
157615
|
+
function assertExpectedNamesMetadata(expected) {
|
|
157616
|
+
const invalid2 = Object.keys(expected).filter(
|
|
157617
|
+
(key2) => NON_METADATA_EXPECTED_KEYS.has(key2) || key2.startsWith("$")
|
|
157618
|
+
);
|
|
157619
|
+
if (invalid2.length > 0) {
|
|
157620
|
+
throw new ToolUserError(
|
|
157621
|
+
`expected only takes metadata field names; ${invalid2.join(", ")} cannot be used as a precondition.`,
|
|
157622
|
+
400,
|
|
157623
|
+
"VALIDATION"
|
|
157624
|
+
);
|
|
157625
|
+
}
|
|
157626
|
+
}
|
|
157627
|
+
function preconditionFailed(mismatchedFields) {
|
|
157628
|
+
return new ToolUserError(
|
|
157629
|
+
`Precondition failed: ${mismatchedFields.join(", ")} changed since it was read, so nothing was written. Re-read the entity and retry with its current values.`,
|
|
157630
|
+
409,
|
|
157631
|
+
"PRECONDITION_FAILED",
|
|
157632
|
+
{ mismatched_fields: mismatchedFields }
|
|
157633
|
+
);
|
|
157634
|
+
}
|
|
157518
157635
|
function manualEditNotAllowed(refusal) {
|
|
157519
157636
|
return new ToolUserError(MANUAL_EDIT_REFUSAL_MESSAGES[refusal], 403, "MANUAL_EDIT_NOT_ALLOWED");
|
|
157520
157637
|
}
|
|
@@ -157889,6 +158006,8 @@ async function updateEntity(entityId, data, _env, ctx, opts) {
|
|
|
157889
158006
|
if (opts?.derivedName && data.name !== void 0) {
|
|
157890
158007
|
throw new ToolUserError("An explicit name cannot also be derived from metadata", 400, "VALIDATION");
|
|
157891
158008
|
}
|
|
158009
|
+
const expected = data.expected ?? null;
|
|
158010
|
+
if (expected) assertExpectedNamesMetadata(expected);
|
|
157892
158011
|
await requireWriteAccess(sql2, entityId, ctx);
|
|
157893
158012
|
if (data.parent_id !== void 0 && data.parent_id !== null) {
|
|
157894
158013
|
await preventEntityCycles(entityId, data.parent_id, sql2);
|
|
@@ -157952,6 +158071,10 @@ async function updateEntity(entityId, data, _env, ctx, opts) {
|
|
|
157952
158071
|
}
|
|
157953
158072
|
const existing = typeof current[0].metadata === "string" ? JSON.parse(current[0].metadata) : current[0].metadata ?? {};
|
|
157954
158073
|
const existingControls = typeof current[0].field_controls === "string" ? JSON.parse(current[0].field_controls) : current[0].field_controls ?? {};
|
|
158074
|
+
if (expected) {
|
|
158075
|
+
const mismatched = mismatchedExpectedFields(existing, expected);
|
|
158076
|
+
if (mismatched.length > 0) throw preconditionFailed(mismatched);
|
|
158077
|
+
}
|
|
157955
158078
|
const derivedName = opts?.derivedName && current[0].name === opts.derivedName.compute(existing) ? opts.derivedName : void 0;
|
|
157956
158079
|
const proposedName = data.name ?? derivedName?.compute({ ...existing, ...metadataUpdates });
|
|
157957
158080
|
let effectiveName = proposedName;
|
|
@@ -159117,7 +159240,7 @@ async function batchLoadRelationships(entityIds, specs, organizationId, readRest
|
|
|
159117
159240
|
}
|
|
159118
159241
|
return result;
|
|
159119
159242
|
}
|
|
159120
|
-
var MANUAL_EDIT_REFUSAL_MESSAGES, DERIVED_SLUG_ATTEMPTS, DERIVED_SLUG_COLUMNS;
|
|
159243
|
+
var MANUAL_EDIT_REFUSAL_MESSAGES, NON_METADATA_EXPECTED_KEYS, DERIVED_SLUG_ATTEMPTS, DERIVED_SLUG_COLUMNS;
|
|
159121
159244
|
var init_entity_management = __esm({
|
|
159122
159245
|
"src/utils/entity-management.ts"() {
|
|
159123
159246
|
"use strict";
|
|
@@ -159155,6 +159278,7 @@ var init_entity_management = __esm({
|
|
|
159155
159278
|
missing_scope: "manual_edit needs a token minted with the entities:manual_edit scope by a person in the Lobu web app, and this caller does not hold it. Nothing was written.",
|
|
159156
159279
|
delegated_caller: "manual_edit cannot be asserted by an agent, MCP session, chat turn or Automation; only a person's own edit relayed by a first-party backend qualifies. Nothing was written."
|
|
159157
159280
|
};
|
|
159281
|
+
NON_METADATA_EXPECTED_KEYS = /* @__PURE__ */ new Set(["name", "content", "slug", "parent_id"]);
|
|
159158
159282
|
DERIVED_SLUG_ATTEMPTS = 20;
|
|
159159
159283
|
DERIVED_SLUG_COLUMNS = ["slug", "id"];
|
|
159160
159284
|
}
|
|
@@ -163681,8 +163805,7 @@ async function handleOAuthCallback(c, tokenRow, code, redirectUri) {
|
|
|
163681
163805
|
if (tokenRow.connection_id) {
|
|
163682
163806
|
await registerConnectorWebhook({
|
|
163683
163807
|
organizationId: tokenRow.organization_id,
|
|
163684
|
-
connectionId: tokenRow.connection_id
|
|
163685
|
-
request: c.req.raw
|
|
163808
|
+
connectionId: tokenRow.connection_id
|
|
163686
163809
|
});
|
|
163687
163810
|
}
|
|
163688
163811
|
return c.redirect(await oauthResultUrl(tokenRow, baseUrl, "connected"));
|
|
@@ -164637,21 +164760,24 @@ function isExcludedSpaPath(requestPath) {
|
|
|
164637
164760
|
if (SPA_ALLOWED_PATHS.has(normalizedPath)) {
|
|
164638
164761
|
return false;
|
|
164639
164762
|
}
|
|
164763
|
+
if (SPA_EXCLUDED_PATHS.has(normalizedPath)) {
|
|
164764
|
+
return true;
|
|
164765
|
+
}
|
|
164640
164766
|
return SPA_EXCLUDED_PREFIXES.some(
|
|
164641
164767
|
(prefix) => normalizedPath === prefix || normalizedPath.startsWith(`${prefix}/`)
|
|
164642
164768
|
);
|
|
164643
164769
|
}
|
|
164644
|
-
var SPA_ALLOWED_PATHS, SPA_EXCLUDED_PREFIXES;
|
|
164770
|
+
var SPA_ALLOWED_PATHS, SPA_EXCLUDED_PATHS, SPA_EXCLUDED_PREFIXES;
|
|
164645
164771
|
var init_spa_route_filter = __esm({
|
|
164646
164772
|
"src/http/spa-route-filter.ts"() {
|
|
164647
164773
|
"use strict";
|
|
164648
164774
|
SPA_ALLOWED_PATHS = /* @__PURE__ */ new Set(["/oauth/consent", "/oauth/device"]);
|
|
164775
|
+
SPA_EXCLUDED_PATHS = /* @__PURE__ */ new Set(["/legal"]);
|
|
164649
164776
|
SPA_EXCLUDED_PREFIXES = [
|
|
164650
164777
|
"/.well-known",
|
|
164651
164778
|
"/api",
|
|
164652
164779
|
"/connect",
|
|
164653
164780
|
"/health",
|
|
164654
|
-
"/legal",
|
|
164655
164781
|
"/logo.png",
|
|
164656
164782
|
"/mcp",
|
|
164657
164783
|
"/openapi.json",
|
|
@@ -166674,6 +166800,7 @@ function createServerForContext(env, authCtx, mcpAppsSupported) {
|
|
|
166674
166800
|
}) : null;
|
|
166675
166801
|
const code = error?.code;
|
|
166676
166802
|
const structuredError = typeof code === "string" && typeof error?.retryable === "boolean" ? {
|
|
166803
|
+
...error instanceof ToolUserError ? error.details ?? {} : {},
|
|
166677
166804
|
code,
|
|
166678
166805
|
retryable: error.retryable,
|
|
166679
166806
|
...error.callId ? { call_id: error.callId } : {}
|
|
@@ -171023,6 +171150,8 @@ async function withPublicOrg(c, handler) {
|
|
|
171023
171150
|
}
|
|
171024
171151
|
function toolUserErrorBody(error) {
|
|
171025
171152
|
return {
|
|
171153
|
+
// Spread first so a detail can never overwrite the message or the code.
|
|
171154
|
+
...error.details ?? {},
|
|
171026
171155
|
error: error.message,
|
|
171027
171156
|
...error.code ? {
|
|
171028
171157
|
code: error.code,
|
|
@@ -173744,13 +173873,12 @@ async function failClaimedWorkerRun(params) {
|
|
|
173744
173873
|
});
|
|
173745
173874
|
}
|
|
173746
173875
|
if (row.run_type === "action" && (row.approval_status === "approved" || row.approval_status === "auto")) {
|
|
173747
|
-
const actionKey = row.action_key ?? "Action";
|
|
173748
173876
|
const eventId = await supersedeActionEvent(
|
|
173749
173877
|
params.runId,
|
|
173750
173878
|
row.organization_id,
|
|
173751
173879
|
"failed",
|
|
173752
|
-
`${
|
|
173753
|
-
`Action failed before worker dispatch: ${
|
|
173880
|
+
(operation) => `${operation} \u2014 failed`,
|
|
173881
|
+
(operation) => `Action failed before worker dispatch: ${operation} \u2014 ${params.errorMessage}`,
|
|
173754
173882
|
{ error_message: params.errorMessage },
|
|
173755
173883
|
null,
|
|
173756
173884
|
tx
|
|
@@ -176930,14 +177058,13 @@ async function reapStaleRuns() {
|
|
|
176930
177058
|
const runId = Number(candidate.id);
|
|
176931
177059
|
try {
|
|
176932
177060
|
if (candidate.action_output != null) {
|
|
176933
|
-
const actionKey = candidate.action_key ?? "Action";
|
|
176934
177061
|
const eventId = await terminalizeApprovalRunCompleted(
|
|
176935
177062
|
runId,
|
|
176936
177063
|
candidate.organization_id,
|
|
176937
177064
|
candidate.action_output,
|
|
176938
177065
|
{
|
|
176939
|
-
title: `${
|
|
176940
|
-
content: `Operation completed: ${
|
|
177066
|
+
title: (operation) => `${operation} \u2014 completed`,
|
|
177067
|
+
content: (operation) => `Operation completed: ${operation}`
|
|
176941
177068
|
},
|
|
176942
177069
|
null,
|
|
176943
177070
|
// Finalize the run exactly as read: if the gateway or another
|
|
@@ -176969,14 +177096,13 @@ async function reapStaleRuns() {
|
|
|
176969
177096
|
]
|
|
176970
177097
|
);
|
|
176971
177098
|
if (rows.length === 0) return false;
|
|
176972
|
-
const actionKey = rows[0].action_key ?? "Action";
|
|
176973
177099
|
const errorMessage2 = rows[0].error_message;
|
|
176974
177100
|
const eventId = await supersedeActionEvent(
|
|
176975
177101
|
runId,
|
|
176976
177102
|
rows[0].organization_id,
|
|
176977
177103
|
"failed",
|
|
176978
|
-
`${
|
|
176979
|
-
`Action timed out: ${
|
|
177104
|
+
(operation) => `${operation} \u2014 timed out`,
|
|
177105
|
+
(operation) => `Action timed out: ${operation} \u2014 ${errorMessage2}`,
|
|
176980
177106
|
{
|
|
176981
177107
|
error_message: errorMessage2,
|
|
176982
177108
|
run_status: "timeout"
|
|
@@ -177211,15 +177337,14 @@ async function reapStaleRuns() {
|
|
|
177211
177337
|
const timedOutActionsRaw = reapedRow?.timed_out_actions;
|
|
177212
177338
|
const timedOutActions = Array.isArray(timedOutActionsRaw) ? timedOutActionsRaw : typeof timedOutActionsRaw === "string" ? JSON.parse(timedOutActionsRaw) : [];
|
|
177213
177339
|
for (const row of timedOutActions) {
|
|
177214
|
-
const actionKey = row.actionKey ?? "Operation";
|
|
177215
177340
|
const reason = row.staleStatus === "pending" ? claimErrorMessage : heartbeatErrorMessage;
|
|
177216
177341
|
try {
|
|
177217
177342
|
await supersedeActionEvent(
|
|
177218
177343
|
row.runId,
|
|
177219
177344
|
row.organizationId,
|
|
177220
177345
|
"failed",
|
|
177221
|
-
`${
|
|
177222
|
-
`Operation timed out: ${
|
|
177346
|
+
(operation) => `${operation} \u2014 timed out`,
|
|
177347
|
+
(operation) => `Operation timed out: ${operation} \u2014 ${reason}`,
|
|
177223
177348
|
{
|
|
177224
177349
|
error_message: reason,
|
|
177225
177350
|
run_status: "timeout"
|
|
@@ -178051,7 +178176,7 @@ var init_client6 = __esm({
|
|
|
178051
178176
|
|
|
178052
178177
|
// ../connector-worker/dist/daemon/automation-process.js
|
|
178053
178178
|
import { execFileSync as execFileSync2, spawn } from "node:child_process";
|
|
178054
|
-
import { readFileSync as
|
|
178179
|
+
import { readFileSync as readFileSync5, readdirSync as readdirSync3 } from "node:fs";
|
|
178055
178180
|
function runCliSupervisor(spawnChild, treeTermGraceMs, argv) {
|
|
178056
178181
|
const [binary, ...args] = argv;
|
|
178057
178182
|
let targetFinished = false;
|
|
@@ -178228,7 +178353,7 @@ function defaultProcessTableReader() {
|
|
|
178228
178353
|
continue;
|
|
178229
178354
|
let stat7;
|
|
178230
178355
|
try {
|
|
178231
|
-
stat7 =
|
|
178356
|
+
stat7 = readFileSync5(`/proc/${entry}/stat`, "utf8");
|
|
178232
178357
|
} catch {
|
|
178233
178358
|
continue;
|
|
178234
178359
|
}
|
|
@@ -178517,9 +178642,9 @@ var init_log = __esm({
|
|
|
178517
178642
|
});
|
|
178518
178643
|
|
|
178519
178644
|
// ../connector-worker/dist/daemon/interactive-session.js
|
|
178520
|
-
import { createHash as createHash55, randomBytes as
|
|
178645
|
+
import { createHash as createHash55, randomBytes as randomBytes14 } from "node:crypto";
|
|
178521
178646
|
import { spawn as spawn2 } from "node:child_process";
|
|
178522
|
-
import { accessSync, chmodSync as chmodSync2, constants, lstatSync as lstatSync2, mkdtempSync, readFileSync as
|
|
178647
|
+
import { accessSync, chmodSync as chmodSync2, constants, lstatSync as lstatSync2, mkdtempSync, readFileSync as readFileSync6, rmSync, statSync, writeFileSync } from "node:fs";
|
|
178523
178648
|
import net3 from "node:net";
|
|
178524
178649
|
import { homedir as homedir5, tmpdir as tmpdir4 } from "node:os";
|
|
178525
178650
|
import path11 from "node:path";
|
|
@@ -178542,7 +178667,7 @@ function readSessionRecord(registryPath) {
|
|
|
178542
178667
|
if (!stat7.isFile() || uid != null && stat7.uid !== uid || (stat7.mode & 18) !== 0) {
|
|
178543
178668
|
return null;
|
|
178544
178669
|
}
|
|
178545
|
-
const parsed = JSON.parse(
|
|
178670
|
+
const parsed = JSON.parse(readFileSync6(registryPath, "utf8"));
|
|
178546
178671
|
return parsed != null && typeof parsed === "object" ? parsed : null;
|
|
178547
178672
|
} catch {
|
|
178548
178673
|
return null;
|
|
@@ -178933,7 +179058,7 @@ async function handoffToInteractiveSession(opts) {
|
|
|
178933
179058
|
let disconnectCheck;
|
|
178934
179059
|
let onShutdown;
|
|
178935
179060
|
let onTerminal;
|
|
178936
|
-
const nonce =
|
|
179061
|
+
const nonce = randomBytes14(32).toString("hex");
|
|
178937
179062
|
const helperSockets = /* @__PURE__ */ new Set();
|
|
178938
179063
|
const server = net3.createServer((socket) => {
|
|
178939
179064
|
helperSockets.add(socket);
|
|
@@ -182194,9 +182319,9 @@ var init_executor = __esm({
|
|
|
182194
182319
|
});
|
|
182195
182320
|
|
|
182196
182321
|
// ../connector-worker/dist/daemon/resources.js
|
|
182197
|
-
import { readFileSync as
|
|
182322
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
182198
182323
|
import { availableParallelism, freemem, totalmem } from "node:os";
|
|
182199
|
-
import { dirname as dirname8, join as join18, relative as
|
|
182324
|
+
import { dirname as dirname8, join as join18, relative as relative3 } from "node:path";
|
|
182200
182325
|
function hostMemory() {
|
|
182201
182326
|
const runtime = process;
|
|
182202
182327
|
return { limitBytes: totalmem(), availableBytes: runtime.availableMemory?.() ?? freemem() };
|
|
@@ -182246,7 +182371,7 @@ function groups(read) {
|
|
|
182246
182371
|
const member = entry.slice(entry.indexOf(":", entry.indexOf(":") + 1) + 1);
|
|
182247
182372
|
const suffix = mountedFrom === "/" ? member.slice(1) : member === mountedFrom ? "" : member.startsWith(`${mountedFrom}/`) ? member.slice(mountedFrom.length + 1) : member === "/" ? "" : member.slice(1);
|
|
182248
182373
|
const candidate = join18(root, suffix);
|
|
182249
|
-
const leaf =
|
|
182374
|
+
const leaf = relative3(root, candidate).startsWith("..") ? root : candidate;
|
|
182250
182375
|
result[controller] = { root, leaf, v2: kind === "cgroup2" };
|
|
182251
182376
|
}
|
|
182252
182377
|
}
|
|
@@ -182262,7 +182387,7 @@ function ancestors(group) {
|
|
|
182262
182387
|
}
|
|
182263
182388
|
return paths;
|
|
182264
182389
|
}
|
|
182265
|
-
function createResourceSampler(read = (path15) =>
|
|
182390
|
+
function createResourceSampler(read = (path15) => readFileSync7(path15, "utf8"), platform = process.platform, readHostMemory = hostMemory) {
|
|
182266
182391
|
const discovered = platform === "linux" ? groups(read) : {};
|
|
182267
182392
|
return () => {
|
|
182268
182393
|
const memory = [];
|
|
@@ -182317,7 +182442,7 @@ function createResourceSampler(read = (path15) => readFileSync8(path15, "utf8"),
|
|
|
182317
182442
|
if (!quota || !period)
|
|
182318
182443
|
continue;
|
|
182319
182444
|
const accounting = discovered.cpuacct;
|
|
182320
|
-
const usagePath = accounting ? join18(accounting.leaf,
|
|
182445
|
+
const usagePath = accounting ? join18(accounting.leaf, relative3(discovered.cpu.leaf, path15)) : path15;
|
|
182321
182446
|
const raw = discovered.cpu.v2 ? optional(read, join18(path15, "cpu.stat"))?.match(/^usage_usec (\d+)$/m)?.[1] : optional(read, join18(usagePath, "cpuacct.usage"));
|
|
182322
182447
|
const used = raw === void 0 ? Number.NaN : Number(raw);
|
|
182323
182448
|
if (!Number.isFinite(used) || used < 0)
|
|
@@ -182745,7 +182870,7 @@ var init_worker = __esm({
|
|
|
182745
182870
|
});
|
|
182746
182871
|
|
|
182747
182872
|
// ../connector-worker/dist/executor/runtime-dependency-loader.js
|
|
182748
|
-
import { existsSync as existsSync14, readFileSync as
|
|
182873
|
+
import { existsSync as existsSync14, readFileSync as readFileSync8 } from "node:fs";
|
|
182749
182874
|
import { mkdir as mkdir4, symlink as symlink2 } from "node:fs/promises";
|
|
182750
182875
|
import { createRequire as createRequire8, register } from "node:module";
|
|
182751
182876
|
import { basename as basename3, dirname as dirname9, join as join19 } from "node:path";
|
|
@@ -184998,7 +185123,7 @@ async function expirePendingApprovals(ttlDays = intervals.pendingApprovalTtlDays
|
|
|
184998
185123
|
Number(row.id),
|
|
184999
185124
|
row.organization_id,
|
|
185000
185125
|
"rejected",
|
|
185001
|
-
`${
|
|
185126
|
+
(operation) => `${operation} \u2014 expired`,
|
|
185002
185127
|
reason,
|
|
185003
185128
|
{ reason, expired: true, expired_after_days: ttlDays },
|
|
185004
185129
|
null,
|
|
@@ -186365,27 +186490,27 @@ function applyUserServerConfigToEnv(configPath, contextOverride) {
|
|
|
186365
186490
|
// src/server.ts
|
|
186366
186491
|
init_compile();
|
|
186367
186492
|
init_client();
|
|
186368
|
-
import { randomBytes as
|
|
186493
|
+
import { randomBytes as randomBytes15 } from "node:crypto";
|
|
186369
186494
|
import { createRequire as createRequire11 } from "node:module";
|
|
186370
186495
|
import path14 from "node:path";
|
|
186371
186496
|
import { fileURLToPath as fileURLToPath15 } from "node:url";
|
|
186372
186497
|
|
|
186373
186498
|
// src/embedded-runtime.ts
|
|
186374
186499
|
import { execFileSync, fork as fork2 } from "node:child_process";
|
|
186500
|
+
import { randomBytes as randomBytes13 } from "node:crypto";
|
|
186501
|
+
import { once } from "node:events";
|
|
186375
186502
|
import {
|
|
186376
186503
|
chmodSync,
|
|
186377
186504
|
chownSync,
|
|
186378
186505
|
existsSync as existsSync8,
|
|
186379
186506
|
lstatSync,
|
|
186380
186507
|
mkdirSync as mkdirSync2,
|
|
186381
|
-
|
|
186382
|
-
realpathSync as realpathSync2,
|
|
186383
|
-
symlinkSync
|
|
186508
|
+
realpathSync as realpathSync2
|
|
186384
186509
|
} from "node:fs";
|
|
186385
186510
|
import http2 from "node:http";
|
|
186386
186511
|
import { createRequire as createRequire5 } from "node:module";
|
|
186387
186512
|
import { homedir as homedir3 } from "node:os";
|
|
186388
|
-
import { dirname as dirname4, join as join14,
|
|
186513
|
+
import { dirname as dirname4, join as join14, resolve as resolve10 } from "node:path";
|
|
186389
186514
|
import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL3 } from "node:url";
|
|
186390
186515
|
import postgres4 from "postgres";
|
|
186391
186516
|
|
|
@@ -186616,6 +186741,24 @@ async function importPgvectorEmbedded() {
|
|
|
186616
186741
|
return await import(vendored);
|
|
186617
186742
|
}
|
|
186618
186743
|
}
|
|
186744
|
+
var LIFECYCLE_SIGNALS = ["SIGTERM", "SIGINT"];
|
|
186745
|
+
async function loadReleasingSignalHooks(load) {
|
|
186746
|
+
const before = new Map(
|
|
186747
|
+
LIFECYCLE_SIGNALS.map((signal) => [signal, new Set(process.listeners(signal))])
|
|
186748
|
+
);
|
|
186749
|
+
const loaded = await load();
|
|
186750
|
+
const added = LIFECYCLE_SIGNALS.flatMap(
|
|
186751
|
+
(signal) => process.listeners(signal).filter((listener) => !before.get(signal)?.has(listener)).map((listener) => ({ signal, listener }))
|
|
186752
|
+
);
|
|
186753
|
+
return {
|
|
186754
|
+
loaded,
|
|
186755
|
+
releaseSignalHooks: () => {
|
|
186756
|
+
for (const { signal, listener } of added) {
|
|
186757
|
+
process.removeListener(signal, listener);
|
|
186758
|
+
}
|
|
186759
|
+
}
|
|
186760
|
+
};
|
|
186761
|
+
}
|
|
186619
186762
|
function resolveDataRoot() {
|
|
186620
186763
|
const dbUrl = process.env.DATABASE_URL?.trim();
|
|
186621
186764
|
if (!dbUrl) {
|
|
@@ -186814,34 +186957,6 @@ function ensureEmbeddedPgTraversal(paths, identity, mutation = { chmod: chmodSyn
|
|
|
186814
186957
|
}
|
|
186815
186958
|
};
|
|
186816
186959
|
}
|
|
186817
|
-
function hydrateEmbeddedPgSymlinks(nativeDir) {
|
|
186818
|
-
const manifest = join14(nativeDir, "pg-symlinks.json");
|
|
186819
|
-
if (!existsSync8(manifest)) return;
|
|
186820
|
-
let entries;
|
|
186821
|
-
try {
|
|
186822
|
-
entries = JSON.parse(readFileSync5(manifest, "utf8"));
|
|
186823
|
-
} catch {
|
|
186824
|
-
return;
|
|
186825
|
-
}
|
|
186826
|
-
const pkgRoot = dirname4(nativeDir);
|
|
186827
|
-
let created = 0;
|
|
186828
|
-
for (const { source, target } of entries) {
|
|
186829
|
-
const targetPath = join14(pkgRoot, target);
|
|
186830
|
-
if (existsSync8(targetPath)) continue;
|
|
186831
|
-
const rel = relative3(dirname4(targetPath), join14(pkgRoot, source));
|
|
186832
|
-
try {
|
|
186833
|
-
symlinkSync(rel, targetPath);
|
|
186834
|
-
created++;
|
|
186835
|
-
} catch {
|
|
186836
|
-
}
|
|
186837
|
-
}
|
|
186838
|
-
if (created > 0) {
|
|
186839
|
-
logger_default.info(
|
|
186840
|
-
{ nativeDir, created },
|
|
186841
|
-
"Hydrated embedded Postgres library symlinks"
|
|
186842
|
-
);
|
|
186843
|
-
}
|
|
186844
|
-
}
|
|
186845
186960
|
async function startEmbeddedRuntime() {
|
|
186846
186961
|
const dataRoot = resolveDataRoot();
|
|
186847
186962
|
const pgDataDir = join14(dataRoot, ".lobu", "pgdata");
|
|
@@ -186850,12 +186965,20 @@ async function startEmbeddedRuntime() {
|
|
|
186850
186965
|
process.env.LOBU_SINGLE_USER = "1";
|
|
186851
186966
|
}
|
|
186852
186967
|
const componentEntry = process.env.LOBU_RUNTIME_POSTGRES_ENTRY;
|
|
186853
|
-
const
|
|
186854
|
-
|
|
186855
|
-
|
|
186968
|
+
const {
|
|
186969
|
+
loaded: { component, EmbeddedPostgres },
|
|
186970
|
+
releaseSignalHooks
|
|
186971
|
+
} = await loadReleasingSignalHooks(async () => {
|
|
186972
|
+
const component2 = componentEntry ? await import(pathToFileURL3(componentEntry).href) : null;
|
|
186973
|
+
const { default: EmbeddedPostgres2 } = component2 ?? await import("embedded-postgres");
|
|
186974
|
+
return { component: component2, EmbeddedPostgres: EmbeddedPostgres2 };
|
|
186975
|
+
});
|
|
186976
|
+
const { installPgvector, prepareEmbeddedNative, resolveEmbeddedNativeDir } = component ?? await importPgvectorEmbedded();
|
|
186856
186977
|
const nativeDir = resolveEmbeddedNativeDir();
|
|
186857
|
-
|
|
186858
|
-
|
|
186978
|
+
const { linksCreated } = prepareEmbeddedNative(nativeDir);
|
|
186979
|
+
if (linksCreated > 0) {
|
|
186980
|
+
logger_default.info({ nativeDir, linksCreated }, "Prepared embedded Postgres library links");
|
|
186981
|
+
}
|
|
186859
186982
|
const pgvectorDir = join14(dataRoot, ".lobu", "pgvector");
|
|
186860
186983
|
const pgvector = installPgvector(pgvectorDir);
|
|
186861
186984
|
const pgPort = parseInt(process.env.LOBU_PG_PORT || "", 10) || await findFreePort();
|
|
@@ -186908,19 +187031,19 @@ async function startEmbeddedRuntime() {
|
|
|
186908
187031
|
// Install-operator provisioning, shared with the external-DB
|
|
186909
187032
|
// `lobu run` path (see local-bootstrap.ts).
|
|
186910
187033
|
preListenHooks: buildLocalBootstrapHooks(),
|
|
187034
|
+
// The lifecycle has registered its SIGTERM/SIGINT handlers by now.
|
|
187035
|
+
postListenHooks: [releaseSignalHooks],
|
|
186911
187036
|
// Runs after stopLobuGateway + closeDbSingleton so gateway connections
|
|
186912
187037
|
// release before the embeddings child + PG child are stopped. Restore
|
|
186913
187038
|
// ancestor ownership/modes only after postgres no longer needs them.
|
|
186914
187039
|
extraTeardown: [
|
|
186915
|
-
() =>
|
|
186916
|
-
embeddingsChild?.kill();
|
|
186917
|
-
},
|
|
187040
|
+
() => stopEmbeddings(embeddingsChild),
|
|
186918
187041
|
() => pg.stop(),
|
|
186919
187042
|
() => restoreTraversal()
|
|
186920
187043
|
]
|
|
186921
187044
|
};
|
|
186922
187045
|
} catch (error) {
|
|
186923
|
-
embeddingsChild
|
|
187046
|
+
await stopEmbeddings(embeddingsChild);
|
|
186924
187047
|
const cleanupErrors = [];
|
|
186925
187048
|
if (postgresStarted) {
|
|
186926
187049
|
try {
|
|
@@ -187024,6 +187147,17 @@ async function runMigrations(databaseUrl) {
|
|
|
187024
187147
|
await sql2.end();
|
|
187025
187148
|
}
|
|
187026
187149
|
}
|
|
187150
|
+
async function stopEmbeddings(child) {
|
|
187151
|
+
if (!child || child.exitCode !== null || child.signalCode !== null) return;
|
|
187152
|
+
const exited = once(child, "exit");
|
|
187153
|
+
child.kill("SIGTERM");
|
|
187154
|
+
const force = setTimeout(() => child.kill("SIGKILL"), 5e3);
|
|
187155
|
+
try {
|
|
187156
|
+
await exited;
|
|
187157
|
+
} finally {
|
|
187158
|
+
clearTimeout(force);
|
|
187159
|
+
}
|
|
187160
|
+
}
|
|
187027
187161
|
async function startEmbeddings() {
|
|
187028
187162
|
if (process.env.EMBEDDINGS_SERVICE_URL?.trim()) return null;
|
|
187029
187163
|
const embeddingsPort = parseInt(process.env.EMBEDDINGS_PORT || "0", 10);
|
|
@@ -187047,6 +187181,9 @@ async function startEmbeddings() {
|
|
|
187047
187181
|
return null;
|
|
187048
187182
|
}
|
|
187049
187183
|
const port = embeddingsPort || await findFreePort();
|
|
187184
|
+
if (!process.env.EMBEDDINGS_SERVICE_TOKEN?.trim()) {
|
|
187185
|
+
process.env.EMBEDDINGS_SERVICE_TOKEN = randomBytes13(32).toString("hex");
|
|
187186
|
+
}
|
|
187050
187187
|
let execArgv2 = [];
|
|
187051
187188
|
if (serverPath.endsWith(".ts")) {
|
|
187052
187189
|
const tsxPackageJson = require4.resolve("tsx/package.json");
|
|
@@ -187215,15 +187352,16 @@ async function main() {
|
|
|
187215
187352
|
let databaseReadiness;
|
|
187216
187353
|
let preListenHooks = [];
|
|
187217
187354
|
let extraTeardown = [];
|
|
187355
|
+
let runtimePostListenHooks = [];
|
|
187218
187356
|
if (!external || process.env.LOBU_RUN_OWNS_DB === "1") {
|
|
187219
187357
|
if (!process.env.BETTER_AUTH_SECRET) {
|
|
187220
|
-
process.env.BETTER_AUTH_SECRET =
|
|
187358
|
+
process.env.BETTER_AUTH_SECRET = randomBytes15(32).toString("base64");
|
|
187221
187359
|
logger_default.info(
|
|
187222
187360
|
"Generated ephemeral BETTER_AUTH_SECRET \u2014 set in .env to persist sessions"
|
|
187223
187361
|
);
|
|
187224
187362
|
}
|
|
187225
187363
|
if (!process.env.JWT_SECRET) {
|
|
187226
|
-
process.env.JWT_SECRET = process.env.ENCRYPTION_KEY ? deriveJwtSecret(process.env.ENCRYPTION_KEY) :
|
|
187364
|
+
process.env.JWT_SECRET = process.env.ENCRYPTION_KEY ? deriveJwtSecret(process.env.ENCRYPTION_KEY) : randomBytes15(32).toString("base64");
|
|
187227
187365
|
}
|
|
187228
187366
|
if (!process.env.PUBLIC_GATEWAY_URL) {
|
|
187229
187367
|
process.env.PUBLIC_GATEWAY_URL = `http://localhost:${port}/lobu`;
|
|
@@ -187269,13 +187407,12 @@ async function main() {
|
|
|
187269
187407
|
databaseReadiness = rt.databaseReadiness;
|
|
187270
187408
|
preListenHooks = rt.preListenHooks;
|
|
187271
187409
|
extraTeardown = rt.extraTeardown;
|
|
187410
|
+
runtimePostListenHooks = rt.postListenHooks;
|
|
187272
187411
|
logger_default.info(`Data: ${rt.dataDir}`);
|
|
187273
187412
|
}
|
|
187274
187413
|
if (external && process.env.LOBU_RUN_OWNS_DB === "1") {
|
|
187275
187414
|
const embeddings = await startEmbeddings();
|
|
187276
|
-
if (embeddings) extraTeardown.push(() =>
|
|
187277
|
-
embeddings.kill();
|
|
187278
|
-
});
|
|
187415
|
+
if (embeddings) extraTeardown.push(() => stopEmbeddings(embeddings));
|
|
187279
187416
|
}
|
|
187280
187417
|
const { createServerLifecycle: createServerLifecycle2, reportBootFailure: reportBootFailure2 } = await Promise.resolve().then(() => (init_server_lifecycle(), server_lifecycle_exports));
|
|
187281
187418
|
const lifecycle = createServerLifecycle2({
|
|
@@ -187289,6 +187426,7 @@ async function main() {
|
|
|
187289
187426
|
// instead of letting feeds silently fail later. After listen() so the
|
|
187290
187427
|
// sync require.resolve walk doesn't add to readiness latency.
|
|
187291
187428
|
postListenHooks: [
|
|
187429
|
+
...runtimePostListenHooks,
|
|
187292
187430
|
() => {
|
|
187293
187431
|
try {
|
|
187294
187432
|
assertExternalDepsResolvable(createRequire11(import.meta.url).resolve);
|