@lobu/runtime-server 24.0.0 → 24.1.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/component.json +1 -1
- package/dist/connectors/x-dm-adapter.js +65 -30
- package/dist/db/migrations/20261021010000_views_compile_config_hash.sql +16 -0
- package/dist/dependencies.bun.lock +1 -1
- package/dist/owletto/dist/assets/{_-CC8cTmRg.js → _-BorucF19.js} +3 -3
- package/dist/owletto/dist/assets/_-CkGyNi0G.js +2 -0
- package/dist/owletto/dist/assets/_agentId-BrhcaxUk.js +2 -0
- package/dist/owletto/dist/assets/{_agentId-DWUFSrVp.js → _agentId-DgRrCE2B.js} +2 -2
- package/dist/owletto/dist/assets/{_automationId-BnHqdXOC.js → _automationId-DSrZIYcs.js} +2 -2
- package/dist/owletto/dist/assets/{_connectorKey._connectionId-CefXIqy2.js → _connectorKey._connectionId-DWxv1uoi.js} +2 -2
- package/dist/owletto/dist/assets/{_connectorKey.index-C1QPGf9E.js → _connectorKey.index-BTP5ijdT.js} +2 -2
- package/dist/owletto/dist/assets/{_conversationId-DinuPCUp.js → _conversationId-98Y3RuRO.js} +2 -2
- package/dist/owletto/dist/assets/{_deploymentId-BeyzVjRm.js → _deploymentId-B1UWPY0i.js} +2 -2
- package/dist/owletto/dist/assets/{_eventId-3L_qeL_l.js → _eventId-BAnr8g8z.js} +2 -2
- package/dist/owletto/dist/assets/_name-BUfFO_A0.js +2 -0
- package/dist/owletto/dist/assets/{_owner-DbrKma4e.js → _owner-C79BwQ0I.js} +3 -3
- package/dist/owletto/dist/assets/_shape-Ep6JpyFX.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-B24alBfT.js +2 -0
- package/dist/owletto/dist/assets/{_slug-ndDr_CUg.js → _slug-DbPdDc-5.js} +2 -2
- package/dist/owletto/dist/assets/_viewKey-DDUxjjFD.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-hdpq3RoX.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-CRKbM2Xy.js → accept-invitation-UXU5Fx2G.js} +2 -2
- package/dist/owletto/dist/assets/{activity-route-view-CFLNukhD.js → activity-route-view-D7ORHntE.js} +2 -2
- package/dist/owletto/dist/assets/{agent-card-controls-Be1Okb2C.js → agent-card-controls-CplnPhbv.js} +2 -2
- package/dist/owletto/dist/assets/{agent-client-setup-list-BA8dU_C6.js → agent-client-setup-list-BlXB4SE5.js} +2 -2
- package/dist/owletto/dist/assets/{agent-connect-pages-CAV-yXus.js → agent-connect-pages-BmknviTI.js} +2 -2
- package/dist/owletto/dist/assets/{agent-editor-form-Bi6WvYX-.js → agent-editor-form-DsSoeQeF.js} +2 -2
- package/dist/owletto/dist/assets/{agent-guardrails-route-DMOjG1D4.js → agent-guardrails-route-TdvvIc_J.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-De_2d8Lr.js → agent-loading-shells-B7v6Cffw.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-gZWl6mAe.js → agent-permissions-matrix-BkZu1LYE.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-JLaTamGR.js → agent-skill-context-DFucg4c4.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skills-route-DcK41PWj.js → agent-skills-route-B3vvvZZe.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-BBJoyTuC.js → agent-subpage-shell-CZJvnjNC.js} +2 -2
- package/dist/owletto/dist/assets/agent-thread-D38STyeu.js +6 -0
- package/dist/owletto/dist/assets/agents-DAOln24A.js +2 -0
- package/dist/owletto/dist/assets/{agents-workbench-CqaKGggb.js → agents-workbench-DJ67GZ93.js} +2 -2
- package/dist/owletto/dist/assets/{app._appId-Cl1fTuIt.js → app._appId-Cp78oEZ9.js} +2 -2
- package/dist/owletto/dist/assets/{automation-detail-content-BMLL4lxO.js → automation-detail-content-DSwbRpbx.js} +2 -2
- package/dist/owletto/dist/assets/automations-DAOln24A.js +2 -0
- package/dist/owletto/dist/assets/{callback-DTKKsfkz.js → callback-CBexCo3F.js} +2 -2
- package/dist/owletto/dist/assets/{card-yU0TmNRH.js → card-jzhQrMDP.js} +2 -2
- package/dist/owletto/dist/assets/{claim-DJfTvlT2.js → claim-B-wq745Q.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows--FrZfJol.js → client-rows-BYbsXGy9.js} +2 -2
- package/dist/owletto/dist/assets/{clients-L4K1UT8c.js → clients-BhNl1tVq.js} +2 -2
- package/dist/owletto/dist/assets/{code-editor-U54Gwjit.js → code-editor-CEqoCky-.js} +2 -2
- package/dist/owletto/dist/assets/connect-wx-qqLir.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-kk0_4Svo.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-QR8o-7M5.js +2 -0
- package/dist/owletto/dist/assets/{connected._clientId.activity-DTpSW1Xy.js → connected._clientId.activity-BqprYeOX.js} +2 -2
- package/dist/owletto/dist/assets/{connected._clientId.index-h9X5H1x8.js → connected._clientId.index-DhRoSzBr.js} +2 -2
- package/dist/owletto/dist/assets/{connection-ByvKkyFm.js → connection-CNm2ukrI.js} +2 -2
- package/dist/owletto/dist/assets/{connection-feed-detail-DWM9lTao.js → connection-feed-detail-WcGCA6qY.js} +2 -2
- package/dist/owletto/dist/assets/{connections-browser-CEwYrYqt.js → connections-browser-CrtnAs0Q.js} +2 -2
- package/dist/owletto/dist/assets/{connector-provenance-BocTm__v.js → connector-provenance-D-ECOlMJ.js} +2 -2
- package/dist/owletto/dist/assets/{connector-scope-lists-OYDOydtz.js → connector-scope-lists-CRFEpSvk.js} +2 -2
- package/dist/owletto/dist/assets/{connectors-CyZpcE5f.js → connectors-CH4KBZyT.js} +2 -2
- package/dist/owletto/dist/assets/{consent-DdfINrVp.js → consent-C9ZpHb7V.js} +2 -2
- package/dist/owletto/dist/assets/{conversations-table-BSznfdYt.js → conversations-table-D_HOe1jN.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-Dr7tcIB-.js → core.esm-BupT3V0i.js} +2 -2
- package/dist/owletto/dist/assets/create-C4lptGWj.js +2 -0
- package/dist/owletto/dist/assets/{create-CBGwASon.js → create-CCjZxIkK.js} +2 -2
- package/dist/owletto/dist/assets/create-DkgUQAbB.js +2 -0
- package/dist/owletto/dist/assets/{create-automation-form-9T5WnoUs.js → create-automation-form-Bpy92SM5.js} +2 -2
- package/dist/owletto/dist/assets/create._connectorKey-D6Kc-YQ3.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-BWFEyy_P.js → cronstrue-CWImw-kf.js} +2 -2
- package/dist/owletto/dist/assets/{deployments-wG_8QzOF.js → deployments-C5hvipQh.js} +2 -2
- package/dist/owletto/dist/assets/deployments-CPpFAd_w.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-2xKS8gRo.js → deployments-body-DGII20dQ.js} +2 -2
- package/dist/owletto/dist/assets/{device-6z-xgsoW.js → device-D-7WBe9E.js} +2 -2
- package/dist/owletto/dist/assets/{device-pin-tombstone-Cwq88RMU.js → device-pin-tombstone-2U0UMu3_.js} +2 -2
- package/dist/owletto/dist/assets/{device._deviceId-BDerBfD9.js → device._deviceId-Bn37UpWH.js} +2 -2
- package/dist/owletto/dist/assets/{entity-avatar-Cc1CuI-0.js → entity-avatar-mdh7Kq5D.js} +2 -2
- package/dist/owletto/dist/assets/{entity-options-DHdMC1Lx.js → entity-options-Clz_WXK-.js} +2 -2
- package/dist/owletto/dist/assets/{entity-page--OkXmlNP.js → entity-page-D3e4iPle.js} +2 -2
- package/dist/owletto/dist/assets/{entity-type-page-89RoK_-P.js → entity-type-page-DebN1vCM.js} +2 -2
- package/dist/owletto/dist/assets/{event-detail-D4YZRtrA.js → event-detail-DV_zfWnC.js} +2 -2
- package/dist/owletto/dist/assets/events-feed-DO3IiJO2.js +2 -0
- package/dist/owletto/dist/assets/{filter-editors-B1_QUpg_.js → filter-editors-Bwhqj7lY.js} +2 -2
- package/dist/owletto/dist/assets/{full-page-spinner-Cqih-8IW.js → full-page-spinner-BVbcpW3R.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-BiJollCA.js +2 -0
- package/dist/owletto/dist/assets/identity-HCFWtdaI.js +2 -0
- package/dist/owletto/dist/assets/index-8wxsyxqt.js +2 -0
- package/dist/owletto/dist/assets/{index-DYCqXaMf.js → index-9YuSRymd.js} +4 -4
- package/dist/owletto/dist/assets/index-B3c-0eZG.js +2 -0
- package/dist/owletto/dist/assets/{index-TgRS2v_F.js → index-B64PGxQm.js} +2 -2
- package/dist/owletto/dist/assets/{index-DfyDUpuI.js → index-BTlx9K_t.js} +2 -2
- package/dist/owletto/dist/assets/index-BX0EA_oB.js +2 -0
- package/dist/owletto/dist/assets/index-CdJJaQDX.js +2 -0
- package/dist/owletto/dist/assets/index-CfT_W8Vo.js +2 -0
- package/dist/owletto/dist/assets/{index-DYzWV5_z.js → index-CxF2XXzl.js} +2 -2
- package/dist/owletto/dist/assets/index-D3WHeGql.js +2 -0
- package/dist/owletto/dist/assets/{index-ZNlrDc_f.js → index-D7gHOpfg.js} +2 -2
- package/dist/owletto/dist/assets/{index-DKPwCasf.js → index-DB1iWI_a.js} +2 -2
- package/dist/owletto/dist/assets/index-DMNzF8Lf.js +2 -0
- package/dist/owletto/dist/assets/index-DyB3IzOA.js +2 -0
- package/dist/owletto/dist/assets/{index-DAOyXG1X.js → index-fgAJydgX.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-DFvYINBT.js → json-diff-DIN5Jhfx.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-DFsEqLU1.js → list-skeleton-CepswBka.js} +2 -2
- package/dist/owletto/dist/assets/{login-DO0j-AYr.js → login-DxGYyE4n.js} +2 -2
- package/dist/owletto/dist/assets/{logout-BmNwoAf7.js → logout-Bkzc7J44.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-B2LrMWBU.js → member-scope-gate-DD4YBFn-.js} +2 -2
- package/dist/owletto/dist/assets/{memory-browse-page-Cjpl8EbB.js → memory-browse-page-D_UlBa27.js} +2 -2
- package/dist/owletto/dist/assets/{model-selector-TQcA93xm.js → model-selector-CDrAjH31.js} +2 -2
- package/dist/owletto/dist/assets/models-BAVeysNq.js +2 -0
- package/dist/owletto/dist/assets/{new-BMrFy5Qa.js → new-C2av0diq.js} +2 -2
- package/dist/owletto/dist/assets/{new-ByBhteWA.js → new-ktz9Cs_P.js} +2 -2
- package/dist/owletto/dist/assets/{new-DWp3deoW.js → new-snm1ctHn.js} +2 -2
- package/dist/owletto/dist/assets/{oauth-workspace-access-D_5uESuz.js → oauth-workspace-access-lZNZ9gul.js} +2 -2
- package/dist/owletto/dist/assets/{organization-DTFoYP4V.js → organization-Cb0W823y.js} +2 -2
- package/dist/owletto/dist/assets/{peek-pane-content-DF5iGC3c.js → peek-pane-content-BNR9ImQY.js} +2 -2
- package/dist/owletto/dist/assets/{permissions-C_auqxfP.js → permissions-Dv39zWKt.js} +2 -2
- package/dist/owletto/dist/assets/{proposal-review-shell-DsNiavG_.js → proposal-review-shell-CFhOqCLf.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-DqX8AXfw.js +2 -0
- package/dist/owletto/dist/assets/{recent-3d99S2IE.js → recent-QhnLDU1_.js} +2 -2
- package/dist/owletto/dist/assets/{record-activity-C9KfBkXb.js → record-activity-ZJntBfN_.js} +2 -2
- package/dist/owletto/dist/assets/{record-field-peek-BBZcRuGT.js → record-field-peek-Brh1IQGy.js} +2 -2
- package/dist/owletto/dist/assets/{record-session-BizRugWs.js → record-session-Pbr5czGw.js} +2 -2
- package/dist/owletto/dist/assets/{reset-password-DqfcSn8M.js → reset-password-CzZw6RcC.js} +2 -2
- package/dist/owletto/dist/assets/{runs-panel-T1ZxTVz6.js → runs-panel-C0_DNTcq.js} +2 -2
- package/dist/owletto/dist/assets/{runs-table-D_8QlCCN.js → runs-table-B1APZv7d.js} +2 -2
- package/dist/owletto/dist/assets/{schema-value-normalization-CylKX3PK.js → schema-value-normalization-CKdPjdPC.js} +2 -2
- package/dist/owletto/dist/assets/settings-CgZ5Z7wD.js +2 -0
- package/dist/owletto/dist/assets/{settings-B_ClYztB.js → settings-VDNiffKU.js} +2 -2
- package/dist/owletto/dist/assets/skills-DgDGscm5.js +2 -0
- package/dist/owletto/dist/assets/{source-record-panels-Cg249m1S.js → source-record-panels-BdfOVPWn.js} +2 -2
- package/dist/owletto/dist/assets/{use-mention-search-BYbFvHbJ.js → use-mention-search-Dcunv4L0.js} +2 -2
- package/dist/owletto/dist/assets/{view-param-filters-DMSqkN2J.js → view-param-filters-B0quibBi.js} +2 -2
- package/dist/owletto/dist/index.html +1 -1
- package/dist/server-main.bundle.mjs +354 -142
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/contracts/tools/view-runtime.d.ts +74 -0
- package/vendor/core/dist/contracts/tools/view-runtime.js +86 -0
- package/vendor/core/package.json +6 -1
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-ksFp4zVf.js +0 -2
- package/dist/owletto/dist/assets/_agentId-MENLoohA.js +0 -2
- package/dist/owletto/dist/assets/_name-Dgedji78.js +0 -2
- package/dist/owletto/dist/assets/_shape-DtVfRFz_.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-CqLHzm7L.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-3CH5w8mr.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DHQY9A8u.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-Buz3naVF.js +0 -6
- package/dist/owletto/dist/assets/agents-C-ReckCa.js +0 -2
- package/dist/owletto/dist/assets/automations-C-ReckCa.js +0 -2
- package/dist/owletto/dist/assets/connect-4zqtnDHb.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-Dj0SqgbE.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-sgtocSvf.js +0 -2
- package/dist/owletto/dist/assets/create-Cf5hp6Z8.js +0 -2
- package/dist/owletto/dist/assets/create-CwThQtd3.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +0 -2
- package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +0 -2
- package/dist/owletto/dist/assets/events-feed-DsrkV2ix.js +0 -2
- package/dist/owletto/dist/assets/guardrails-B8Rs1be3.js +0 -2
- package/dist/owletto/dist/assets/identity-B0nH4yiC.js +0 -2
- package/dist/owletto/dist/assets/index-4TSkcsth.js +0 -2
- package/dist/owletto/dist/assets/index-BgkhXElB.js +0 -2
- package/dist/owletto/dist/assets/index-CoW4Bz3w.js +0 -2
- package/dist/owletto/dist/assets/index-Codw-Qqi.js +0 -2
- package/dist/owletto/dist/assets/index-DMyXd3bJ.js +0 -2
- package/dist/owletto/dist/assets/index-DYYZLcJ0.js +0 -2
- package/dist/owletto/dist/assets/index-Da6CrGEu.js +0 -2
- package/dist/owletto/dist/assets/index-DneshLbf.js +0 -2
- package/dist/owletto/dist/assets/models-D7aED5Sa.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-B2NUI89V.js +0 -2
- package/dist/owletto/dist/assets/settings-DgX1-xo7.js +0 -2
- package/dist/owletto/dist/assets/skills-Drw5tcZw.js +0 -2
|
@@ -3404,14 +3404,6 @@ function packageAt(file) {
|
|
|
3404
3404
|
root = parent;
|
|
3405
3405
|
}
|
|
3406
3406
|
}
|
|
3407
|
-
function sourceDependencies(files) {
|
|
3408
|
-
return Object.fromEntries(files.map((file) => {
|
|
3409
|
-
const pkg = packageAt(file);
|
|
3410
|
-
if (!pkg)
|
|
3411
|
-
throw new Error("Cannot determine source dependency version");
|
|
3412
|
-
return [pkg.name, pkg.version];
|
|
3413
|
-
}));
|
|
3414
|
-
}
|
|
3415
3407
|
function createSourceCapture(entry, projectRoot) {
|
|
3416
3408
|
const root = realpathSync(projectRoot);
|
|
3417
3409
|
const entrypoint = relative(root, realpathSync(entry)).split(sep).join("/");
|
|
@@ -81524,12 +81516,81 @@ var init_view_content_hash = __esm({
|
|
|
81524
81516
|
}
|
|
81525
81517
|
});
|
|
81526
81518
|
|
|
81519
|
+
// ../core/src/contracts/tools/view-runtime.ts
|
|
81520
|
+
function viewMountEntry(specifier) {
|
|
81521
|
+
return `import { mountView } from "@lobu/views";
|
|
81522
|
+
import * as mod from ${JSON.stringify(specifier)};
|
|
81523
|
+
mountView(mod.view, mod.default);
|
|
81524
|
+
`;
|
|
81525
|
+
}
|
|
81526
|
+
function viewRuntimeEntry() {
|
|
81527
|
+
const imports = VIEW_RUNTIME_MODULES.map(
|
|
81528
|
+
(specifier, i) => `import * as m${i} from ${JSON.stringify(specifier)};`
|
|
81529
|
+
);
|
|
81530
|
+
const entries = VIEW_RUNTIME_MODULES.map(
|
|
81531
|
+
(specifier, i) => `${JSON.stringify(specifier)}: m${i}`
|
|
81532
|
+
);
|
|
81533
|
+
return `${imports.join("\n")}
|
|
81534
|
+
globalThis[${JSON.stringify(VIEW_RUNTIME_GLOBAL)}] = Object.freeze({ ${entries.join(", ")} });
|
|
81535
|
+
`;
|
|
81536
|
+
}
|
|
81537
|
+
function viewRuntimePlugin() {
|
|
81538
|
+
return {
|
|
81539
|
+
name: "lobu-view-runtime",
|
|
81540
|
+
setup(build5) {
|
|
81541
|
+
build5.onResolve(
|
|
81542
|
+
{ filter: /.*/ },
|
|
81543
|
+
(args) => VIEW_RUNTIME_MODULES.includes(args.path) ? { path: args.path, namespace: RUNTIME_NAMESPACE } : void 0
|
|
81544
|
+
);
|
|
81545
|
+
build5.onLoad({ filter: /.*/, namespace: RUNTIME_NAMESPACE }, (args) => ({
|
|
81546
|
+
contents: `module.exports = globalThis[${JSON.stringify(VIEW_RUNTIME_GLOBAL)}][${JSON.stringify(args.path)}];`,
|
|
81547
|
+
loader: "js"
|
|
81548
|
+
}));
|
|
81549
|
+
}
|
|
81550
|
+
};
|
|
81551
|
+
}
|
|
81552
|
+
var VIEW_RUNTIME_GLOBAL, VIEW_RUNTIME_MODULES, VIEW_RUNTIME_PACKAGES, RUNTIME_NAMESPACE, VIEW_BUILD_OPTIONS;
|
|
81553
|
+
var init_view_runtime = __esm({
|
|
81554
|
+
"../core/src/contracts/tools/view-runtime.ts"() {
|
|
81555
|
+
"use strict";
|
|
81556
|
+
VIEW_RUNTIME_GLOBAL = "__lobuViews";
|
|
81557
|
+
VIEW_RUNTIME_MODULES = [
|
|
81558
|
+
"react",
|
|
81559
|
+
"react/jsx-runtime",
|
|
81560
|
+
"react-dom",
|
|
81561
|
+
"react-dom/client",
|
|
81562
|
+
"@lobu/views",
|
|
81563
|
+
"@lobu/views/components"
|
|
81564
|
+
];
|
|
81565
|
+
VIEW_RUNTIME_PACKAGES = [
|
|
81566
|
+
"react",
|
|
81567
|
+
"react-dom",
|
|
81568
|
+
"@lobu/views"
|
|
81569
|
+
];
|
|
81570
|
+
RUNTIME_NAMESPACE = "lobu-view-runtime";
|
|
81571
|
+
VIEW_BUILD_OPTIONS = {
|
|
81572
|
+
bundle: true,
|
|
81573
|
+
write: false,
|
|
81574
|
+
format: "iife",
|
|
81575
|
+
platform: "browser",
|
|
81576
|
+
target: "es2022",
|
|
81577
|
+
jsx: "automatic",
|
|
81578
|
+
minify: true,
|
|
81579
|
+
sourcemap: false,
|
|
81580
|
+
legalComments: "none",
|
|
81581
|
+
define: { "process.env.NODE_ENV": '"production"' },
|
|
81582
|
+
logLevel: "silent"
|
|
81583
|
+
};
|
|
81584
|
+
}
|
|
81585
|
+
});
|
|
81586
|
+
|
|
81527
81587
|
// src/views/views.ts
|
|
81588
|
+
import { createHash as createHash32 } from "node:crypto";
|
|
81528
81589
|
import { existsSync as existsSync7, mkdirSync } from "node:fs";
|
|
81529
81590
|
import { createRequire as createRequire3 } from "node:module";
|
|
81530
81591
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
81531
81592
|
import { join as join13, posix } from "node:path";
|
|
81532
|
-
import { build as build3, transform } from "esbuild";
|
|
81593
|
+
import { build as build3, transform, version as esbuildVersion } from "esbuild";
|
|
81533
81594
|
function isShellOwnedParam(name) {
|
|
81534
81595
|
return name === COLLECTION_QUERY_KEY || name === COLLECTION_PRESET_QUERY_KEY || name === COLLECTION_TABLE_QUERY_KEY || name === "peek" || name.startsWith("peek_");
|
|
81535
81596
|
}
|
|
@@ -81555,6 +81616,7 @@ function mapViewRow(row) {
|
|
|
81555
81616
|
source_files: row.source_files ?? null,
|
|
81556
81617
|
dependencies: row.dependencies ?? null,
|
|
81557
81618
|
source_complete: row.source_complete === true,
|
|
81619
|
+
compile_config_hash: row.compile_config_hash ?? null,
|
|
81558
81620
|
attach: row.attach ?? [],
|
|
81559
81621
|
params: row.params ?? {},
|
|
81560
81622
|
actions: row.actions ?? {},
|
|
@@ -81566,7 +81628,7 @@ async function getView(organizationId, key2) {
|
|
|
81566
81628
|
const sql = getDb();
|
|
81567
81629
|
const rows = await sql`
|
|
81568
81630
|
SELECT key, name, description, source_code, compiled_code, content_hash,
|
|
81569
|
-
source_files, dependencies, source_complete,
|
|
81631
|
+
source_files, dependencies, source_complete, compile_config_hash,
|
|
81570
81632
|
attach, params, actions, last_writer, updated_at
|
|
81571
81633
|
FROM views
|
|
81572
81634
|
WHERE organization_id = ${organizationId} AND key = ${key2}
|
|
@@ -81578,7 +81640,7 @@ async function listViews(organizationId) {
|
|
|
81578
81640
|
const sql = getDb();
|
|
81579
81641
|
const rows = await sql`
|
|
81580
81642
|
SELECT key, name, description, source_code, compiled_code, content_hash,
|
|
81581
|
-
source_files, dependencies, source_complete,
|
|
81643
|
+
source_files, dependencies, source_complete, compile_config_hash,
|
|
81582
81644
|
attach, params, actions, last_writer, updated_at
|
|
81583
81645
|
FROM views
|
|
81584
81646
|
WHERE organization_id = ${organizationId}
|
|
@@ -81589,18 +81651,20 @@ async function listViews(organizationId) {
|
|
|
81589
81651
|
async function setView(organizationId, input) {
|
|
81590
81652
|
const sql = getDb();
|
|
81591
81653
|
const existing = await getView(organizationId, input.key);
|
|
81592
|
-
if (existing && existing.content_hash === input.content_hash && existing.compiled_code === input.compiled_code) {
|
|
81654
|
+
if (existing && existing.content_hash === input.content_hash && existing.compiled_code === input.compiled_code && existing.compile_config_hash === (input.compile_config_hash ?? null)) {
|
|
81593
81655
|
return { view: existing, written: false };
|
|
81594
81656
|
}
|
|
81595
81657
|
const rows = await sql`
|
|
81596
81658
|
INSERT INTO views (
|
|
81597
81659
|
organization_id, key, name, description, source_code, compiled_code,
|
|
81598
|
-
content_hash, source_files, dependencies, source_complete,
|
|
81660
|
+
content_hash, source_files, dependencies, source_complete, compile_config_hash,
|
|
81661
|
+
attach, params, actions, last_writer, updated_at
|
|
81599
81662
|
) VALUES (
|
|
81600
81663
|
${organizationId}, ${input.key}, ${input.name}, ${input.description},
|
|
81601
81664
|
${input.source_code}, ${input.compiled_code}, ${input.content_hash},
|
|
81602
81665
|
${input.source_files ? sql.json(input.source_files) : null},
|
|
81603
81666
|
${input.dependencies ? sql.json(input.dependencies) : null}, ${input.source_complete ?? false},
|
|
81667
|
+
${input.compile_config_hash ?? null},
|
|
81604
81668
|
${sql.json(input.attach)}, ${sql.json(input.params)},
|
|
81605
81669
|
${sql.json(input.actions)}, ${input.last_writer}, NOW()
|
|
81606
81670
|
)
|
|
@@ -81613,13 +81677,14 @@ async function setView(organizationId, input) {
|
|
|
81613
81677
|
source_files = EXCLUDED.source_files,
|
|
81614
81678
|
dependencies = EXCLUDED.dependencies,
|
|
81615
81679
|
source_complete = EXCLUDED.source_complete,
|
|
81680
|
+
compile_config_hash = EXCLUDED.compile_config_hash,
|
|
81616
81681
|
attach = EXCLUDED.attach,
|
|
81617
81682
|
params = EXCLUDED.params,
|
|
81618
81683
|
actions = EXCLUDED.actions,
|
|
81619
81684
|
last_writer = EXCLUDED.last_writer,
|
|
81620
81685
|
updated_at = NOW()
|
|
81621
81686
|
RETURNING key, name, description, source_code, compiled_code, content_hash,
|
|
81622
|
-
source_files, dependencies, source_complete,
|
|
81687
|
+
source_files, dependencies, source_complete, compile_config_hash,
|
|
81623
81688
|
attach, params, actions, last_writer, updated_at
|
|
81624
81689
|
`;
|
|
81625
81690
|
return { view: mapViewRow(rows[0]), written: true };
|
|
@@ -81634,15 +81699,31 @@ async function removeView(organizationId, key2) {
|
|
|
81634
81699
|
return rows.length > 0;
|
|
81635
81700
|
}
|
|
81636
81701
|
function projectView(view) {
|
|
81637
|
-
const {
|
|
81702
|
+
const {
|
|
81703
|
+
compiled_code,
|
|
81704
|
+
source_code,
|
|
81705
|
+
source_files: _files,
|
|
81706
|
+
dependencies: _deps,
|
|
81707
|
+
source_complete: _complete,
|
|
81708
|
+
compile_config_hash: _compiler,
|
|
81709
|
+
...rest
|
|
81710
|
+
} = view;
|
|
81638
81711
|
return {
|
|
81639
81712
|
...rest,
|
|
81713
|
+
content_hash: servedContentHash(view),
|
|
81640
81714
|
compiled_bytes: Buffer.byteLength(compiled_code, "utf8"),
|
|
81641
81715
|
source_bytes: Buffer.byteLength(source_code, "utf8")
|
|
81642
81716
|
};
|
|
81643
81717
|
}
|
|
81644
|
-
function
|
|
81645
|
-
|
|
81718
|
+
function runtimeFunds() {
|
|
81719
|
+
const funds = {};
|
|
81720
|
+
for (const specifier of VIEW_RUNTIME_MODULES) {
|
|
81721
|
+
try {
|
|
81722
|
+
funds[specifier] = require3.resolve(specifier);
|
|
81723
|
+
} catch {
|
|
81724
|
+
}
|
|
81725
|
+
}
|
|
81726
|
+
return funds;
|
|
81646
81727
|
}
|
|
81647
81728
|
function fundPackageDir(file) {
|
|
81648
81729
|
const idx = file.lastIndexOf("/node_modules/");
|
|
@@ -81656,71 +81737,94 @@ function fundPackageDir(file) {
|
|
|
81656
81737
|
}
|
|
81657
81738
|
return null;
|
|
81658
81739
|
}
|
|
81659
|
-
function
|
|
81660
|
-
const funds =
|
|
81661
|
-
for (const specifier of VIEW_ALLOWED_BARE_SPECIFIERS) {
|
|
81662
|
-
try {
|
|
81663
|
-
funds[specifier] = require3.resolve(specifier);
|
|
81664
|
-
} catch {
|
|
81665
|
-
}
|
|
81666
|
-
}
|
|
81740
|
+
function runtimeResolvePlugin() {
|
|
81741
|
+
const funds = runtimeFunds();
|
|
81667
81742
|
const fundDirs = /* @__PURE__ */ new Set();
|
|
81668
81743
|
for (const file of Object.values(funds)) {
|
|
81669
81744
|
const dir = fundPackageDir(file);
|
|
81670
81745
|
if (dir) fundDirs.add(dir);
|
|
81671
81746
|
}
|
|
81672
81747
|
return {
|
|
81673
|
-
name: "lobu-view-resolve",
|
|
81748
|
+
name: "lobu-view-runtime-resolve",
|
|
81674
81749
|
setup(b) {
|
|
81675
81750
|
b.onResolve({ filter: /.*/ }, (args) => {
|
|
81676
81751
|
const importer = args.importer ? posix.normalize(args.importer) : null;
|
|
81677
|
-
if (importer && [...fundDirs].some(
|
|
81678
|
-
(root) => importer === root || importer.startsWith(`${root}/`)
|
|
81679
|
-
)) {
|
|
81752
|
+
if (importer && [...fundDirs].some((root) => importer === root || importer.startsWith(`${root}/`))) {
|
|
81680
81753
|
return void 0;
|
|
81681
81754
|
}
|
|
81682
|
-
|
|
81683
|
-
|
|
81755
|
+
const resolved = funds[args.path];
|
|
81756
|
+
return resolved ? { path: resolved } : null;
|
|
81757
|
+
});
|
|
81758
|
+
}
|
|
81759
|
+
};
|
|
81760
|
+
}
|
|
81761
|
+
function inertResolveDir() {
|
|
81762
|
+
const dir = join13(tmpdir3(), "lobu-views-inert-resolve");
|
|
81763
|
+
mkdirSync(dir, { recursive: true });
|
|
81764
|
+
return dir;
|
|
81765
|
+
}
|
|
81766
|
+
function viewRuntimeScript() {
|
|
81767
|
+
runtimeScript ??= build3({
|
|
81768
|
+
...VIEW_BUILD_OPTIONS,
|
|
81769
|
+
stdin: { contents: viewRuntimeEntry(), loader: "js", resolveDir: inertResolveDir() },
|
|
81770
|
+
plugins: [runtimeResolvePlugin()]
|
|
81771
|
+
}).then((result) => {
|
|
81772
|
+
const code = result.outputFiles?.[0]?.text ?? "";
|
|
81773
|
+
if (!code) throw new Error("View runtime compiled to an empty bundle");
|
|
81774
|
+
return code;
|
|
81775
|
+
}).catch((error) => {
|
|
81776
|
+
runtimeScript = null;
|
|
81777
|
+
throw error;
|
|
81778
|
+
});
|
|
81779
|
+
return runtimeScript;
|
|
81780
|
+
}
|
|
81781
|
+
function viewSourceFilesPlugin(sourceFiles) {
|
|
81782
|
+
const files = sourceFiles.files;
|
|
81783
|
+
return {
|
|
81784
|
+
name: "lobu-view-source",
|
|
81785
|
+
setup(b) {
|
|
81786
|
+
b.onResolve({ filter: /.*/ }, (args) => {
|
|
81787
|
+
if (args.namespace !== VIEW_SOURCE_NAMESPACE && args.path === VIEW_SOURCE_NAMESPACE) {
|
|
81788
|
+
return { path: sourceFiles.entrypoint, namespace: VIEW_SOURCE_NAMESPACE };
|
|
81684
81789
|
}
|
|
81685
|
-
if (args.path.startsWith("
|
|
81790
|
+
if (args.namespace !== VIEW_SOURCE_NAMESPACE || !args.path.startsWith("./") && !args.path.startsWith("../")) {
|
|
81686
81791
|
return {
|
|
81687
81792
|
errors: [
|
|
81688
81793
|
{
|
|
81689
|
-
text: `
|
|
81794
|
+
text: `Unknown view import "${args.path}": the server builds a view from its own source files and the shell runtime (${VIEW_RUNTIME_MODULES.join(", ")}); other dependencies ship through lobu apply`
|
|
81690
81795
|
}
|
|
81691
81796
|
]
|
|
81692
81797
|
};
|
|
81693
81798
|
}
|
|
81694
|
-
|
|
81695
|
-
|
|
81696
|
-
|
|
81799
|
+
const base = posix.normalize(posix.join(posix.dirname(args.importer), args.path));
|
|
81800
|
+
const extension = posix.extname(base);
|
|
81801
|
+
const substitutions = extension === ".js" || extension === ".jsx" ? [".ts", ".tsx"] : extension === ".mjs" ? [".mts"] : extension === ".cjs" ? [".cts"] : [];
|
|
81802
|
+
const candidates = [
|
|
81803
|
+
base,
|
|
81804
|
+
...VIEW_SOURCE_EXTENSIONS.map((ext) => `${base}${ext}`),
|
|
81805
|
+
...substitutions.map((ext) => `${base.slice(0, -extension.length)}${ext}`),
|
|
81806
|
+
...VIEW_SOURCE_EXTENSIONS.map((ext) => `${base}/index${ext}`)
|
|
81807
|
+
];
|
|
81808
|
+
const found = candidates.find(
|
|
81809
|
+
(path15) => Object.hasOwn(files, path15)
|
|
81810
|
+
);
|
|
81811
|
+
if (!found) {
|
|
81812
|
+
return { errors: [{ text: `View import "${args.path}" is not among the view's source files` }] };
|
|
81697
81813
|
}
|
|
81698
|
-
return {
|
|
81699
|
-
|
|
81700
|
-
|
|
81701
|
-
|
|
81702
|
-
|
|
81703
|
-
]
|
|
81704
|
-
}
|
|
81814
|
+
return { path: found, namespace: VIEW_SOURCE_NAMESPACE };
|
|
81815
|
+
});
|
|
81816
|
+
b.onLoad({ filter: /.*/, namespace: VIEW_SOURCE_NAMESPACE }, (args) => {
|
|
81817
|
+
const loader = VIEW_SOURCE_LOADERS[posix.extname(args.path).slice(1)];
|
|
81818
|
+
if (!loader) {
|
|
81819
|
+
return { errors: [{ text: `View source file "${args.path}" has an unsupported extension` }] };
|
|
81820
|
+
}
|
|
81821
|
+
return { contents: files[args.path], loader };
|
|
81705
81822
|
});
|
|
81706
81823
|
}
|
|
81707
81824
|
};
|
|
81708
81825
|
}
|
|
81709
|
-
function
|
|
81710
|
-
return
|
|
81711
|
-
name: "lobu-view-source",
|
|
81712
|
-
setup(b) {
|
|
81713
|
-
b.onLoad(
|
|
81714
|
-
{ filter: /.*/, namespace: "lobu-view-source" },
|
|
81715
|
-
() => ({ contents: source, loader: "tsx" })
|
|
81716
|
-
);
|
|
81717
|
-
}
|
|
81718
|
-
};
|
|
81719
|
-
}
|
|
81720
|
-
function inertResolveDir() {
|
|
81721
|
-
const dir = join13(tmpdir3(), "lobu-views-inert-resolve");
|
|
81722
|
-
mkdirSync(dir, { recursive: true });
|
|
81723
|
-
return dir;
|
|
81826
|
+
function isServerBuildable(dependencies) {
|
|
81827
|
+
return Object.keys(dependencies).every((name) => VIEW_RUNTIME_PACKAGES.includes(name));
|
|
81724
81828
|
}
|
|
81725
81829
|
async function readViewModule(source) {
|
|
81726
81830
|
let js;
|
|
@@ -81736,23 +81840,17 @@ async function readViewModule(source) {
|
|
|
81736
81840
|
throw new ToolUserError(err.message, 400);
|
|
81737
81841
|
}
|
|
81738
81842
|
}
|
|
81739
|
-
async function compileView(
|
|
81843
|
+
async function compileView(sourceFiles, opts) {
|
|
81740
81844
|
let compiled;
|
|
81741
81845
|
try {
|
|
81742
81846
|
const result = await build3({
|
|
81847
|
+
...VIEW_BUILD_OPTIONS,
|
|
81743
81848
|
stdin: {
|
|
81744
|
-
contents:
|
|
81745
|
-
loader: "
|
|
81849
|
+
contents: viewMountEntry(VIEW_SOURCE_NAMESPACE),
|
|
81850
|
+
loader: "js",
|
|
81746
81851
|
resolveDir: inertResolveDir()
|
|
81747
81852
|
},
|
|
81748
|
-
|
|
81749
|
-
platform: "browser",
|
|
81750
|
-
format: "iife",
|
|
81751
|
-
minify: true,
|
|
81752
|
-
jsx: "automatic",
|
|
81753
|
-
logLevel: "silent",
|
|
81754
|
-
write: false,
|
|
81755
|
-
plugins: [viewResolvePlugin(), viewSourcePlugin(source)]
|
|
81853
|
+
plugins: [viewRuntimePlugin(), viewSourceFilesPlugin(sourceFiles)]
|
|
81756
81854
|
});
|
|
81757
81855
|
compiled = result.outputFiles?.[0]?.text ?? "";
|
|
81758
81856
|
} catch (err) {
|
|
@@ -81772,6 +81870,92 @@ async function compileView(source, opts) {
|
|
|
81772
81870
|
}
|
|
81773
81871
|
return compiled;
|
|
81774
81872
|
}
|
|
81873
|
+
function viewCompileFingerprint() {
|
|
81874
|
+
compileFingerprint ??= createHash32("sha256").update(
|
|
81875
|
+
JSON.stringify({
|
|
81876
|
+
pipeline: VIEW_COMPILE_PIPELINE_VERSION,
|
|
81877
|
+
esbuild: esbuildVersion,
|
|
81878
|
+
entry: viewMountEntry(VIEW_SOURCE_NAMESPACE),
|
|
81879
|
+
options: VIEW_BUILD_OPTIONS,
|
|
81880
|
+
runtime: [VIEW_RUNTIME_GLOBAL, ...VIEW_RUNTIME_MODULES]
|
|
81881
|
+
})
|
|
81882
|
+
).digest("hex");
|
|
81883
|
+
return compileFingerprint;
|
|
81884
|
+
}
|
|
81885
|
+
function serverCompileStamp(compiled, fingerprint = viewCompileFingerprint()) {
|
|
81886
|
+
const digest3 = createHash32("sha256").update(compiled).digest("hex").slice(0, 32);
|
|
81887
|
+
return `${fingerprint}:${digest3}`;
|
|
81888
|
+
}
|
|
81889
|
+
function isStaleServerBuild(view) {
|
|
81890
|
+
if (view.compile_config_hash === null || view.source_files === null) return false;
|
|
81891
|
+
const separator = view.compile_config_hash.lastIndexOf(":");
|
|
81892
|
+
if (separator < 0) return false;
|
|
81893
|
+
const fingerprint = view.compile_config_hash.slice(0, separator);
|
|
81894
|
+
if (fingerprint === viewCompileFingerprint()) return false;
|
|
81895
|
+
return view.compile_config_hash === serverCompileStamp(view.compiled_code, fingerprint);
|
|
81896
|
+
}
|
|
81897
|
+
function servedContentHash(view) {
|
|
81898
|
+
if (!isStaleServerBuild(view)) return view.content_hash;
|
|
81899
|
+
return createHash32("sha256").update(`${view.content_hash}\0${viewCompileFingerprint()}`).digest("hex").slice(0, view.content_hash.length || 16);
|
|
81900
|
+
}
|
|
81901
|
+
async function getServedView(organizationId, key2) {
|
|
81902
|
+
const view = await getView(organizationId, key2);
|
|
81903
|
+
if (!view || !isStaleServerBuild(view)) return view;
|
|
81904
|
+
const fingerprint = viewCompileFingerprint();
|
|
81905
|
+
const attempt = `${organizationId}\0${key2}\0${view.content_hash}\0${fingerprint}`;
|
|
81906
|
+
if (failedRebuilds.has(attempt)) return view;
|
|
81907
|
+
let rebuild = inflightRebuilds.get(attempt);
|
|
81908
|
+
if (!rebuild) {
|
|
81909
|
+
rebuild = rebuildView(organizationId, view, fingerprint, attempt).finally(
|
|
81910
|
+
() => inflightRebuilds.delete(attempt)
|
|
81911
|
+
);
|
|
81912
|
+
inflightRebuilds.set(attempt, rebuild);
|
|
81913
|
+
}
|
|
81914
|
+
return rebuild;
|
|
81915
|
+
}
|
|
81916
|
+
async function rebuildView(organizationId, view, fingerprint, attempt) {
|
|
81917
|
+
let compiled;
|
|
81918
|
+
try {
|
|
81919
|
+
compiled = await compileView(view.source_files);
|
|
81920
|
+
} catch (err) {
|
|
81921
|
+
failedRebuilds.add(attempt);
|
|
81922
|
+
if (failedRebuilds.size > MAX_FAILED_REBUILDS) {
|
|
81923
|
+
failedRebuilds.delete(failedRebuilds.values().next().value);
|
|
81924
|
+
}
|
|
81925
|
+
logger_default.warn(
|
|
81926
|
+
{ organization_id: organizationId, view_key: view.key, err },
|
|
81927
|
+
"[views] Stale view bundle failed to rebuild; serving the stored bundle"
|
|
81928
|
+
);
|
|
81929
|
+
return view;
|
|
81930
|
+
}
|
|
81931
|
+
const hash = contentHash(
|
|
81932
|
+
view.source_code,
|
|
81933
|
+
{
|
|
81934
|
+
name: view.name,
|
|
81935
|
+
description: view.description,
|
|
81936
|
+
attach: view.attach,
|
|
81937
|
+
params: view.params,
|
|
81938
|
+
actions: view.actions
|
|
81939
|
+
},
|
|
81940
|
+
compiled,
|
|
81941
|
+
{ sourceFiles: view.source_files, dependencies: view.dependencies }
|
|
81942
|
+
);
|
|
81943
|
+
const sql = getDb();
|
|
81944
|
+
const rows = await sql`
|
|
81945
|
+
UPDATE views SET
|
|
81946
|
+
compiled_code = ${compiled},
|
|
81947
|
+
content_hash = ${hash},
|
|
81948
|
+
compile_config_hash = ${serverCompileStamp(compiled, fingerprint)},
|
|
81949
|
+
updated_at = NOW()
|
|
81950
|
+
WHERE organization_id = ${organizationId} AND key = ${view.key}
|
|
81951
|
+
AND content_hash = ${view.content_hash}
|
|
81952
|
+
AND compile_config_hash = ${view.compile_config_hash}
|
|
81953
|
+
RETURNING key, name, description, source_code, compiled_code, content_hash,
|
|
81954
|
+
source_files, dependencies, source_complete, compile_config_hash,
|
|
81955
|
+
attach, params, actions, last_writer, updated_at
|
|
81956
|
+
`;
|
|
81957
|
+
return rows.length > 0 ? mapViewRow(rows[0]) : getView(organizationId, view.key);
|
|
81958
|
+
}
|
|
81775
81959
|
function viewResourceMeta(view) {
|
|
81776
81960
|
return {
|
|
81777
81961
|
name: view.name,
|
|
@@ -81781,8 +81965,8 @@ function viewResourceMeta(view) {
|
|
|
81781
81965
|
prefersBorder: true
|
|
81782
81966
|
};
|
|
81783
81967
|
}
|
|
81784
|
-
function renderViewShell(view, workspaceUrl) {
|
|
81785
|
-
const
|
|
81968
|
+
function renderViewShell(view, workspaceUrl, runtime) {
|
|
81969
|
+
const inline = (code) => code.replaceAll("</script", "<\\/script");
|
|
81786
81970
|
const workspace = workspaceUrl.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<");
|
|
81787
81971
|
return `<!doctype html>
|
|
81788
81972
|
<html lang="en">
|
|
@@ -81797,7 +81981,8 @@ function renderViewShell(view, workspaceUrl) {
|
|
|
81797
81981
|
</head>
|
|
81798
81982
|
<body>
|
|
81799
81983
|
<div id="root"></div>
|
|
81800
|
-
<script>${
|
|
81984
|
+
<script>${inline(runtime)}</script>
|
|
81985
|
+
<script>${inline(view.compiled_code)}</script>
|
|
81801
81986
|
</body>
|
|
81802
81987
|
</html>`;
|
|
81803
81988
|
}
|
|
@@ -81970,16 +82155,18 @@ function renderViewsLoaderShell() {
|
|
|
81970
82155
|
</body>
|
|
81971
82156
|
</html>`;
|
|
81972
82157
|
}
|
|
81973
|
-
var require3, VIEW_KEY_RE, VIEW_ACTION_NAME_RE, LOBU_VIEWS_RESOURCE_URI, VIEW_RESOURCE_PREFIX, VIEW_COMPILED_MAX_BYTES, VIEW_SOURCE_MAX_CHARS,
|
|
82158
|
+
var require3, VIEW_KEY_RE, VIEW_ACTION_NAME_RE, LOBU_VIEWS_RESOURCE_URI, VIEW_RESOURCE_PREFIX, VIEW_COMPILED_MAX_BYTES, VIEW_SOURCE_MAX_CHARS, runtimeScript, VIEW_SOURCE_NAMESPACE, VIEW_SOURCE_EXTENSIONS, VIEW_SOURCE_LOADERS, VIEW_COMPILE_PIPELINE_VERSION, compileFingerprint, MAX_FAILED_REBUILDS, failedRebuilds, inflightRebuilds, BASE_CSS;
|
|
81974
82159
|
var init_views = __esm({
|
|
81975
82160
|
"src/views/views.ts"() {
|
|
81976
82161
|
"use strict";
|
|
81977
82162
|
init_collection_selection();
|
|
81978
82163
|
init_collection_presentation();
|
|
81979
82164
|
init_view_definition();
|
|
81980
|
-
|
|
82165
|
+
init_view_content_hash();
|
|
82166
|
+
init_view_runtime();
|
|
81981
82167
|
init_client();
|
|
81982
82168
|
init_errors2();
|
|
82169
|
+
init_logger2();
|
|
81983
82170
|
init_view_content_hash();
|
|
81984
82171
|
require3 = createRequire3(import.meta.url);
|
|
81985
82172
|
VIEW_KEY_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
@@ -81988,28 +82175,24 @@ var init_views = __esm({
|
|
|
81988
82175
|
VIEW_RESOURCE_PREFIX = "ui://lobu/views/";
|
|
81989
82176
|
VIEW_COMPILED_MAX_BYTES = 2 * 1024 * 1024;
|
|
81990
82177
|
VIEW_SOURCE_MAX_CHARS = 1e6;
|
|
81991
|
-
|
|
81992
|
-
|
|
81993
|
-
|
|
81994
|
-
|
|
81995
|
-
"
|
|
81996
|
-
"
|
|
81997
|
-
"
|
|
81998
|
-
|
|
81999
|
-
|
|
82000
|
-
|
|
82001
|
-
|
|
82002
|
-
|
|
82003
|
-
|
|
82004
|
-
|
|
82005
|
-
|
|
82006
|
-
|
|
82007
|
-
|
|
82008
|
-
|
|
82009
|
-
React.createElement(LobuViewProvider, { def: viewDef }, React.createElement(View))
|
|
82010
|
-
);
|
|
82011
|
-
}
|
|
82012
|
-
`;
|
|
82178
|
+
runtimeScript = null;
|
|
82179
|
+
VIEW_SOURCE_NAMESPACE = "lobu-view-source";
|
|
82180
|
+
VIEW_SOURCE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".json"];
|
|
82181
|
+
VIEW_SOURCE_LOADERS = {
|
|
82182
|
+
tsx: "tsx",
|
|
82183
|
+
ts: "ts",
|
|
82184
|
+
mts: "ts",
|
|
82185
|
+
cts: "ts",
|
|
82186
|
+
jsx: "jsx",
|
|
82187
|
+
js: "js",
|
|
82188
|
+
mjs: "js",
|
|
82189
|
+
cjs: "js",
|
|
82190
|
+
json: "json"
|
|
82191
|
+
};
|
|
82192
|
+
VIEW_COMPILE_PIPELINE_VERSION = 2;
|
|
82193
|
+
MAX_FAILED_REBUILDS = 256;
|
|
82194
|
+
failedRebuilds = /* @__PURE__ */ new Set();
|
|
82195
|
+
inflightRebuilds = /* @__PURE__ */ new Map();
|
|
82013
82196
|
BASE_CSS = `
|
|
82014
82197
|
:root{color-scheme:light;--fg:var(--color-text-primary,#0a0a0a);--muted:var(--color-text-secondary,#6b7280);--border:var(--color-border-primary,#e5e7eb);--accent:var(--color-text-info,#2563eb);--font:var(--font-sans,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif);--radius:var(--border-radius-md,6px);--radius-lg:var(--border-radius-lg,8px)}
|
|
82015
82198
|
html.dark{color-scheme:dark;--fg:var(--color-text-primary,#fafafa);--muted:var(--color-text-secondary,#9ca3af);--border:var(--color-border-primary,#27272a);--accent:var(--color-text-info,#60a5fa)}
|
|
@@ -82950,7 +83133,7 @@ var init_template_action_capability = __esm({
|
|
|
82950
83133
|
});
|
|
82951
83134
|
|
|
82952
83135
|
// src/utils/source-record-reads.ts
|
|
82953
|
-
import { createHash as
|
|
83136
|
+
import { createHash as createHash33 } from "node:crypto";
|
|
82954
83137
|
function matchablePath(rule, matchPaths) {
|
|
82955
83138
|
return rule.target.identities?.find(
|
|
82956
83139
|
(identity) => matchPaths.includes(identity.eventPath)
|
|
@@ -83357,7 +83540,7 @@ async function readSourceRecordLinks(scope, record4, options) {
|
|
|
83357
83540
|
}
|
|
83358
83541
|
}
|
|
83359
83542
|
}
|
|
83360
|
-
const request2 =
|
|
83543
|
+
const request2 = createHash33("sha256").update(JSON.stringify([
|
|
83361
83544
|
scope.organizationId,
|
|
83362
83545
|
scope.principal,
|
|
83363
83546
|
scope.agentId ?? null,
|
|
@@ -87781,7 +87964,7 @@ var init_judge_runner = __esm({
|
|
|
87781
87964
|
});
|
|
87782
87965
|
|
|
87783
87966
|
// src/gateway/proxy/egress-judge/text-judge.ts
|
|
87784
|
-
import { createHash as
|
|
87967
|
+
import { createHash as createHash34 } from "node:crypto";
|
|
87785
87968
|
function buildUserPrompt(policy, text) {
|
|
87786
87969
|
return `Policy:
|
|
87787
87970
|
${policy.trim()}
|
|
@@ -87790,14 +87973,14 @@ Text:
|
|
|
87790
87973
|
${text}`;
|
|
87791
87974
|
}
|
|
87792
87975
|
function hashTextJudgeKey(policy, text) {
|
|
87793
|
-
const h =
|
|
87976
|
+
const h = createHash34("sha256");
|
|
87794
87977
|
h.update(policy);
|
|
87795
87978
|
h.update(HASH_SEPARATOR);
|
|
87796
87979
|
h.update(text);
|
|
87797
87980
|
return h.digest("hex");
|
|
87798
87981
|
}
|
|
87799
87982
|
function hashPolicy(policy) {
|
|
87800
|
-
return
|
|
87983
|
+
return createHash34("sha256").update(policy).digest("hex");
|
|
87801
87984
|
}
|
|
87802
87985
|
var HASH_SEPARATOR, TEXT_JUDGE_SYSTEM_PROMPT, TextJudge;
|
|
87803
87986
|
var init_text_judge = __esm({
|
|
@@ -87923,13 +88106,13 @@ var init_stage_text = __esm({
|
|
|
87923
88106
|
});
|
|
87924
88107
|
|
|
87925
88108
|
// src/gateway/guardrails/judge-factory.ts
|
|
87926
|
-
import { createHash as
|
|
88109
|
+
import { createHash as createHash35 } from "node:crypto";
|
|
87927
88110
|
function getSharedJudge() {
|
|
87928
88111
|
if (!sharedJudge) sharedJudge = new TextJudge();
|
|
87929
88112
|
return sharedJudge;
|
|
87930
88113
|
}
|
|
87931
88114
|
function inlineJudgeHash(policy, tools) {
|
|
87932
|
-
const h =
|
|
88115
|
+
const h = createHash35("sha256");
|
|
87933
88116
|
h.update(policy);
|
|
87934
88117
|
const normalizedTools = tools && tools.length > 0 ? [...tools].sort().join(",") : "";
|
|
87935
88118
|
h.update("");
|
|
@@ -88614,7 +88797,7 @@ var init_config_audit = __esm({
|
|
|
88614
88797
|
|
|
88615
88798
|
// src/catalog/connector-definitions.ts
|
|
88616
88799
|
import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
|
|
88617
|
-
import { createHash as
|
|
88800
|
+
import { createHash as createHash36 } from "node:crypto";
|
|
88618
88801
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
88619
88802
|
function getOAuthMethods(authSchema) {
|
|
88620
88803
|
const parsedAuthSchema = typeof authSchema === "string" ? (() => {
|
|
@@ -88839,7 +89022,7 @@ async function installConnectorFromMcpUrl(params) {
|
|
|
88839
89022
|
connectorKey,
|
|
88840
89023
|
name: metadata.name,
|
|
88841
89024
|
version: metadata.version,
|
|
88842
|
-
codeHash:
|
|
89025
|
+
codeHash: createHash36("sha256").update(params.mcpUrl).digest("hex").slice(0, 16),
|
|
88843
89026
|
updated,
|
|
88844
89027
|
authSchema,
|
|
88845
89028
|
mcpConfig: metadata.mcpConfig,
|
|
@@ -103302,7 +103485,9 @@ async function handleSet(args, ctx) {
|
|
|
103302
103485
|
}
|
|
103303
103486
|
const retained = args.source_files ? { sourceFiles: args.source_files, dependencies: args.dependencies } : args.compiled_code ? void 0 : {
|
|
103304
103487
|
sourceFiles: { entrypoint: "index.tsx", files: { "index.tsx": args.source_code } },
|
|
103305
|
-
|
|
103488
|
+
// The runtime comes from the shell, so a source-only view bundles
|
|
103489
|
+
// nothing but its own file.
|
|
103490
|
+
dependencies: {}
|
|
103306
103491
|
};
|
|
103307
103492
|
if (retained) {
|
|
103308
103493
|
try {
|
|
@@ -103311,7 +103496,7 @@ async function handleSet(args, ctx) {
|
|
|
103311
103496
|
throw new ToolUserError(error.message, 400);
|
|
103312
103497
|
}
|
|
103313
103498
|
}
|
|
103314
|
-
const compiled = args.compiled_code ? checkCompiledCode(args.compiled_code) : await
|
|
103499
|
+
const compiled = args.compiled_code ? checkCompiledCode(args.compiled_code) : await compileRetained(retained);
|
|
103315
103500
|
const hash = contentHash(
|
|
103316
103501
|
args.source_code,
|
|
103317
103502
|
{
|
|
@@ -103324,8 +103509,9 @@ async function handleSet(args, ctx) {
|
|
|
103324
103509
|
compiled,
|
|
103325
103510
|
retained
|
|
103326
103511
|
);
|
|
103512
|
+
const compileConfigHash = args.compiled_code ? null : serverCompileStamp(compiled);
|
|
103327
103513
|
const current = await getView(ctx.organizationId, key2);
|
|
103328
|
-
if (current && current.content_hash === hash) {
|
|
103514
|
+
if (current && current.content_hash === hash && current.compile_config_hash === compileConfigHash) {
|
|
103329
103515
|
return { action: "set", view: projectView(current), written: false };
|
|
103330
103516
|
}
|
|
103331
103517
|
const { view, written } = await setView(ctx.organizationId, {
|
|
@@ -103337,6 +103523,7 @@ async function handleSet(args, ctx) {
|
|
|
103337
103523
|
source_files: retained?.sourceFiles ?? null,
|
|
103338
103524
|
dependencies: retained?.dependencies ?? null,
|
|
103339
103525
|
source_complete: retained !== void 0,
|
|
103526
|
+
compile_config_hash: compileConfigHash,
|
|
103340
103527
|
content_hash: hash,
|
|
103341
103528
|
attach,
|
|
103342
103529
|
params,
|
|
@@ -103348,6 +103535,15 @@ async function handleSet(args, ctx) {
|
|
|
103348
103535
|
}
|
|
103349
103536
|
return { action: "set", view: projectView(view), written };
|
|
103350
103537
|
}
|
|
103538
|
+
async function compileRetained(retained) {
|
|
103539
|
+
if (!isServerBuildable(retained.dependencies)) {
|
|
103540
|
+
throw new ToolUserError(
|
|
103541
|
+
`View depends on ${Object.keys(retained.dependencies).join(", ")}; save it with lobu apply, which bundles npm dependencies`,
|
|
103542
|
+
400
|
|
103543
|
+
);
|
|
103544
|
+
}
|
|
103545
|
+
return compileView(retained.sourceFiles);
|
|
103546
|
+
}
|
|
103351
103547
|
function checkCompiledCode(compiledCode) {
|
|
103352
103548
|
if (compiledCode.length === 0) {
|
|
103353
103549
|
throw new ToolUserError("set requires compiled_code to be non-empty", 400);
|
|
@@ -106191,7 +106387,7 @@ var init_reaction_enqueue = __esm({
|
|
|
106191
106387
|
});
|
|
106192
106388
|
|
|
106193
106389
|
// src/automations/digest.ts
|
|
106194
|
-
import { createHash as
|
|
106390
|
+
import { createHash as createHash37 } from "node:crypto";
|
|
106195
106391
|
function materialDigestChanges(changes) {
|
|
106196
106392
|
return changes.filter((c) => c.kind === "created" || c.kind === "updated");
|
|
106197
106393
|
}
|
|
@@ -106200,7 +106396,7 @@ function fingerprintMaterialDigestChanges(changes) {
|
|
|
106200
106396
|
const canonical = [...material].sort(
|
|
106201
106397
|
(a, b) => a.entityId - b.entityId || (a.kind < b.kind ? -1 : a.kind > b.kind ? 1 : 0) || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)
|
|
106202
106398
|
).map((c) => [c.entityId, c.kind, c.name]);
|
|
106203
|
-
return
|
|
106399
|
+
return createHash37("sha256").update(JSON.stringify(canonical)).digest("hex");
|
|
106204
106400
|
}
|
|
106205
106401
|
function automationChangeSetIdempotencyKey(automationId, runId) {
|
|
106206
106402
|
return `automation:${automationId}:run:${runId}:change_set`;
|
|
@@ -111323,7 +111519,7 @@ var init_query_sql = __esm({
|
|
|
111323
111519
|
QuerySqlSchema = Type43.Object({
|
|
111324
111520
|
title: Type43.Optional(
|
|
111325
111521
|
Type43.String({
|
|
111326
|
-
description: '
|
|
111522
|
+
description: 'Human-friendly heading for this result (e.g. "Recent support tickets"). The UI shows it on the result summary and on this call in the activity feed. Set it whenever a person will read the result.',
|
|
111327
111523
|
maxLength: 200
|
|
111328
111524
|
})
|
|
111329
111525
|
),
|
|
@@ -114210,7 +114406,7 @@ var init_audit_args = __esm({
|
|
|
114210
114406
|
});
|
|
114211
114407
|
|
|
114212
114408
|
// src/tools/audit.ts
|
|
114213
|
-
import { createHash as
|
|
114409
|
+
import { createHash as createHash38, randomUUID as randomUUID24 } from "node:crypto";
|
|
114214
114410
|
function captureRequest(params) {
|
|
114215
114411
|
if (!REQUEST_EVENT_TOOLS.has(params.toolName)) return null;
|
|
114216
114412
|
try {
|
|
@@ -114236,7 +114432,7 @@ function captureRequest(params) {
|
|
|
114236
114432
|
}
|
|
114237
114433
|
}
|
|
114238
114434
|
function sha2562(value) {
|
|
114239
|
-
return
|
|
114435
|
+
return createHash38("sha256").update(value).digest("hex");
|
|
114240
114436
|
}
|
|
114241
114437
|
function redactSensitiveText(value) {
|
|
114242
114438
|
return value.replace(HEADER_CREDENTIAL_RE, (_match, key2) => `${key2}=[redacted]`).replace(AUTH_SCHEME_RE, (_match, scheme) => `${scheme} [redacted]`).replace(SENSITIVE_ASSIGNMENT_RE, (_match, key2) => `${key2}=[redacted]`).replace(KNOWN_SECRET_SHAPE_RE, "[redacted]");
|
|
@@ -114391,7 +114587,10 @@ async function recordToolInvocationAudit(params) {
|
|
|
114391
114587
|
const payload = buildPayload(params);
|
|
114392
114588
|
if (!payload) return;
|
|
114393
114589
|
const request2 = captureRequest(params);
|
|
114394
|
-
if (request2)
|
|
114590
|
+
if (request2) {
|
|
114591
|
+
Object.assign(payload, request2);
|
|
114592
|
+
payload.title = typeof params.args?.title === "string" ? redactPreview(params.args.title.trim()) || null : null;
|
|
114593
|
+
}
|
|
114395
114594
|
const success = payload.success === true;
|
|
114396
114595
|
const identity = params.toolName === "manage_automations" ? manageAutomationsIdentity(params.args) : null;
|
|
114397
114596
|
await insertEvent({
|
|
@@ -115353,7 +115552,7 @@ var init_sdk_run = __esm({
|
|
|
115353
115552
|
),
|
|
115354
115553
|
title: Type51.Optional(
|
|
115355
115554
|
Type51.String({
|
|
115356
|
-
description: 'Human-friendly heading for this result (e.g. "Companies missing a domain"). In run_sdk, it also labels browser tab groups opened by the script. The UI
|
|
115555
|
+
description: 'Human-friendly heading for this result (e.g. "Companies missing a domain"). In run_sdk, it also labels browser tab groups opened by the script. The UI shows it above the execution status and on this call in the activity feed; without it the result card has no subject line and the feed reads only the tool name. Set it whenever a person will read the result.',
|
|
115357
115556
|
maxLength: 200
|
|
115358
115557
|
})
|
|
115359
115558
|
)
|
|
@@ -119332,7 +119531,7 @@ var init_pending_interaction_store = __esm({
|
|
|
119332
119531
|
});
|
|
119333
119532
|
|
|
119334
119533
|
// src/gateway/connections/interaction-bridge.ts
|
|
119335
|
-
import { createHash as
|
|
119534
|
+
import { createHash as createHash39, randomUUID as randomUUID27 } from "node:crypto";
|
|
119336
119535
|
import {
|
|
119337
119536
|
Actions as Actions5,
|
|
119338
119537
|
Button as Button3,
|
|
@@ -119351,7 +119550,7 @@ function canonicalJson2(value) {
|
|
|
119351
119550
|
}
|
|
119352
119551
|
function interactionDeliveryId(event) {
|
|
119353
119552
|
if (!event?.raw) return `interaction-${randomUUID27()}`;
|
|
119354
|
-
const digest3 =
|
|
119553
|
+
const digest3 = createHash39("sha256").update(
|
|
119355
119554
|
canonicalJson2({
|
|
119356
119555
|
actionId: event.actionId,
|
|
119357
119556
|
messageId: event.messageId,
|
|
@@ -122621,13 +122820,13 @@ var init_slack3 = __esm({
|
|
|
122621
122820
|
});
|
|
122622
122821
|
|
|
122623
122822
|
// src/gateway/connections/platform-strategies/connector-chat.ts
|
|
122624
|
-
import { createHash as
|
|
122823
|
+
import { createHash as createHash40 } from "node:crypto";
|
|
122625
122824
|
async function postOnce(platform, ctx, target, messageId, content) {
|
|
122626
122825
|
const adapter = ctx.instance.chat.getAdapter(
|
|
122627
122826
|
platform
|
|
122628
122827
|
);
|
|
122629
122828
|
const threadId = `${platform}:${stripPlatformPrefix(platform, target)}`;
|
|
122630
|
-
const contentHash2 =
|
|
122829
|
+
const contentHash2 = createHash40("sha256").update(JSON.stringify(content)).digest("hex");
|
|
122631
122830
|
await adapter.postMessage(
|
|
122632
122831
|
threadId,
|
|
122633
122832
|
content,
|
|
@@ -143477,7 +143676,7 @@ var init_social_login_provisioning = __esm({
|
|
|
143477
143676
|
});
|
|
143478
143677
|
|
|
143479
143678
|
// src/auth/index.tsx
|
|
143480
|
-
import { createHash as
|
|
143679
|
+
import { createHash as createHash41 } from "node:crypto";
|
|
143481
143680
|
import { passkey } from "@better-auth/passkey";
|
|
143482
143681
|
import { APIError as APIError3, betterAuth } from "better-auth";
|
|
143483
143682
|
import { magicLink, organization, phoneNumber } from "better-auth/plugins";
|
|
@@ -143485,7 +143684,7 @@ import { bearer } from "better-auth/plugins/bearer";
|
|
|
143485
143684
|
import { genericOAuth } from "better-auth/plugins/generic-oauth";
|
|
143486
143685
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
143487
143686
|
function gravatarUrl(email) {
|
|
143488
|
-
const hash =
|
|
143687
|
+
const hash = createHash41("md5").update(email.trim().toLowerCase()).digest("hex");
|
|
143489
143688
|
return `https://www.gravatar.com/avatar/${hash}?d=retro&s=256`;
|
|
143490
143689
|
}
|
|
143491
143690
|
async function createAuth(env, request2) {
|
|
@@ -146924,7 +147123,7 @@ var init_triggers2 = __esm({
|
|
|
146924
147123
|
});
|
|
146925
147124
|
|
|
146926
147125
|
// src/tools/admin/entity-field-approval.ts
|
|
146927
|
-
import { createHash as
|
|
147126
|
+
import { createHash as createHash42 } from "node:crypto";
|
|
146928
147127
|
function entityChangeOperation(proposal) {
|
|
146929
147128
|
const operation = proposal.operation ?? "update";
|
|
146930
147129
|
switch (operation) {
|
|
@@ -146986,7 +147185,7 @@ function entityChangeIdempotencyKey(organizationId, parentRunId, proposal) {
|
|
|
146986
147185
|
change = { entityData: asCreateProposal(proposal).entity_data };
|
|
146987
147186
|
break;
|
|
146988
147187
|
}
|
|
146989
|
-
const digest3 =
|
|
147188
|
+
const digest3 = createHash42("sha256").update(stableJson({ organizationId, parentRunId, operation, change })).digest("hex");
|
|
146990
147189
|
return `entity-change:${digest3}`;
|
|
146991
147190
|
}
|
|
146992
147191
|
async function loadAutomationLabel(ctx, automationId, attribution) {
|
|
@@ -152625,7 +152824,7 @@ var init_permission_policy_write = __esm({
|
|
|
152625
152824
|
});
|
|
152626
152825
|
|
|
152627
152826
|
// src/http/connector-policy-collection.ts
|
|
152628
|
-
import { createHash as
|
|
152827
|
+
import { createHash as createHash43 } from "node:crypto";
|
|
152629
152828
|
function authorize(c) {
|
|
152630
152829
|
const org = c.get("organizationId");
|
|
152631
152830
|
if (!org || !c.get("user")?.id) return c.json({ error: "unauthorized" }, 401);
|
|
@@ -152650,7 +152849,7 @@ function serializeRule(policy) {
|
|
|
152650
152849
|
}
|
|
152651
152850
|
async function readSnapshot(org, tx) {
|
|
152652
152851
|
const policies = (await listEntityApprovalPolicies(org, "connector_action", tx)).filter((p) => p.principalKind === null && p.effects.execute !== void 0).sort((a, b) => scopeKey(a).localeCompare(scopeKey(b)));
|
|
152653
|
-
const revision =
|
|
152852
|
+
const revision = createHash43("sha256").update(JSON.stringify(policies.map(serializeEntityApprovalPolicy))).digest("hex");
|
|
152654
152853
|
return { policies, revision, rules: policies.map(serializeRule) };
|
|
152655
152854
|
}
|
|
152656
152855
|
async function readConnectorPolicyCollection(c) {
|
|
@@ -156268,7 +156467,7 @@ var init_lobu_skill_generated = __esm({
|
|
|
156268
156467
|
});
|
|
156269
156468
|
|
|
156270
156469
|
// src/utils/mcp-app-bundle.ts
|
|
156271
|
-
import { createHash as
|
|
156470
|
+
import { createHash as createHash44 } from "node:crypto";
|
|
156272
156471
|
import { readFile as readFile12, stat as stat6 } from "node:fs/promises";
|
|
156273
156472
|
import path7 from "node:path";
|
|
156274
156473
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
@@ -156284,7 +156483,7 @@ function bundleFileCandidates(appDir, relPath) {
|
|
|
156284
156483
|
].filter((p) => typeof p === "string");
|
|
156285
156484
|
}
|
|
156286
156485
|
function mcpAppAssetVersion(bytes) {
|
|
156287
|
-
return
|
|
156486
|
+
return createHash44("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
156288
156487
|
}
|
|
156289
156488
|
function withAbsoluteAssetUrls(html, assetBase) {
|
|
156290
156489
|
const headOpen = HEAD_OPEN.exec(html);
|
|
@@ -156818,7 +157017,7 @@ function createServerForContext(env, authCtx, mcpAppsSupported) {
|
|
|
156818
157017
|
if (!hasRequiredMcpScope("read", authCtx.scopes)) {
|
|
156819
157018
|
throw new Error("Reading views requires an MCP session with read access.");
|
|
156820
157019
|
}
|
|
156821
|
-
const storedView = await
|
|
157020
|
+
const storedView = await getServedView(authCtx.organizationId, viewKey);
|
|
156822
157021
|
if (storedView) {
|
|
156823
157022
|
const meta = viewResourceMeta(storedView);
|
|
156824
157023
|
return {
|
|
@@ -156828,7 +157027,8 @@ function createServerForContext(env, authCtx, mcpAppsSupported) {
|
|
|
156828
157027
|
mimeType: MCP_APP_MIME_TYPE,
|
|
156829
157028
|
text: renderViewShell(
|
|
156830
157029
|
storedView,
|
|
156831
|
-
await viewWorkspaceUrl(authCtx.organizationId, authCtx.requestUrl)
|
|
157030
|
+
await viewWorkspaceUrl(authCtx.organizationId, authCtx.requestUrl),
|
|
157031
|
+
await viewRuntimeScript()
|
|
156832
157032
|
),
|
|
156833
157033
|
_meta: mcpAppResourceMeta(authCtx, meta)
|
|
156834
157034
|
}
|
|
@@ -161917,13 +162117,14 @@ async function restGetViewShell(c) {
|
|
|
161917
162117
|
if (!isValidViewKey(key2)) {
|
|
161918
162118
|
throw new ToolUserError("Invalid view key", 400);
|
|
161919
162119
|
}
|
|
161920
|
-
const view = await
|
|
162120
|
+
const view = await getServedView(ctx.organizationId, key2);
|
|
161921
162121
|
if (!view) {
|
|
161922
162122
|
throw new ToolUserError(`Unknown view: ${key2}`, 404);
|
|
161923
162123
|
}
|
|
161924
162124
|
const html = renderViewShell(
|
|
161925
162125
|
view,
|
|
161926
|
-
await viewWorkspaceUrl(ctx.organizationId, c.req.url)
|
|
162126
|
+
await viewWorkspaceUrl(ctx.organizationId, c.req.url),
|
|
162127
|
+
await viewRuntimeScript()
|
|
161927
162128
|
);
|
|
161928
162129
|
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
161929
162130
|
c.header("Cache-Control", "no-store");
|
|
@@ -169052,7 +169253,7 @@ var init_log = __esm({
|
|
|
169052
169253
|
});
|
|
169053
169254
|
|
|
169054
169255
|
// ../connector-worker/dist/daemon/interactive-session.js
|
|
169055
|
-
import { createHash as
|
|
169256
|
+
import { createHash as createHash45, randomBytes as randomBytes12 } from "node:crypto";
|
|
169056
169257
|
import { spawn as spawn2 } from "node:child_process";
|
|
169057
169258
|
import { accessSync, chmodSync as chmodSync2, constants, lstatSync as lstatSync2, mkdtempSync, readFileSync as readFileSync7, rmSync, statSync, writeFileSync } from "node:fs";
|
|
169058
169259
|
import net3 from "node:net";
|
|
@@ -169770,14 +169971,30 @@ async function runAcpTurn(options) {
|
|
|
169770
169971
|
else
|
|
169771
169972
|
events.push({ kind: "assistant", messageId, text });
|
|
169772
169973
|
} else if (update.sessionUpdate === "tool_call") {
|
|
169773
|
-
|
|
169774
|
-
|
|
169775
|
-
|
|
169974
|
+
const tool = { ...update };
|
|
169975
|
+
tools.set(update.toolCallId, tool);
|
|
169976
|
+
events.push({ kind: "tool", tool });
|
|
169977
|
+
} else if (update.sessionUpdate === "tool_call_update") {
|
|
169978
|
+
const tool = tools.get(update.toolCallId);
|
|
169979
|
+
if (tool) {
|
|
169980
|
+
if (update.name != null)
|
|
169981
|
+
tool.name = update.name;
|
|
169982
|
+
if (update.title != null)
|
|
169983
|
+
tool.title = update.title;
|
|
169984
|
+
if (update.content != null)
|
|
169985
|
+
tool.content = update.content;
|
|
169986
|
+
if (update.rawInput !== void 0)
|
|
169987
|
+
tool.rawInput = update.rawInput;
|
|
169988
|
+
if (update.rawOutput !== void 0)
|
|
169989
|
+
tool.rawOutput = update.rawOutput;
|
|
169990
|
+
}
|
|
169991
|
+
if (update.status !== "completed" && update.status !== "failed")
|
|
169992
|
+
return;
|
|
169776
169993
|
events.push({
|
|
169777
169994
|
kind: "tool-result",
|
|
169778
169995
|
toolCallId: update.toolCallId,
|
|
169779
169996
|
failed: update.status === "failed",
|
|
169780
|
-
output: update.rawOutput ?? update.content ??
|
|
169997
|
+
output: update.rawOutput ?? update.content ?? tool?.rawOutput ?? tool?.content ?? null
|
|
169781
169998
|
});
|
|
169782
169999
|
}
|
|
169783
170000
|
});
|
|
@@ -169978,12 +170195,7 @@ var init_automation_acp = __esm({
|
|
|
169978
170195
|
type: "tool_use",
|
|
169979
170196
|
id: event.tool.toolCallId,
|
|
169980
170197
|
name: event.tool.name ?? event.tool.title,
|
|
169981
|
-
input: cappedJsonValue({
|
|
169982
|
-
title: event.tool.title,
|
|
169983
|
-
kind: event.tool.kind,
|
|
169984
|
-
status: event.tool.status,
|
|
169985
|
-
rawInput: event.tool.rawInput
|
|
169986
|
-
})
|
|
170198
|
+
input: cappedJsonValue(event.tool.rawInput ?? {})
|
|
169987
170199
|
}
|
|
169988
170200
|
]);
|
|
169989
170201
|
continue;
|