@xopcai/xopc 0.0.321 → 0.0.323
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/browser-ext/dist/assets/{auth-DKo-NMUY.js → auth-DocRzRlS.js} +95 -21
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +18 -2
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-C69p1Gbr.js → agent-avatar-dicebear-DFzmThVi.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CAFHadiy.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-DYFYiuig.js +1 -0
- package/dist/gateway/static/root/assets/{agents-CWR3p3t3.js → agents-BqIlB5Co.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-nL8iPwEr.js → app-link-C6gA5Nck.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D98bt40S.js → app-management-settings-panel-BgvMRGWe.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-ChMUELAZ.js → appearance-settings-CliHU03A.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Drt3Foi9.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BIIiu6uP.js → archive-plugin-DnuPpm0u.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CDJpcsCp.js → attachment-load-BiwaK0ie.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Cb5a_WOk.js → automations-page-CJSISGQH.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B-Eduqwz.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-zp55zQPu.js → binary-plugins-KDjduQZO.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B0CTIZb-.js → block-editor-bclvgove.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-Bx3W4J4H.js → browser-automation-inputs-CfQ2T9t6.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D5Lr9b8a.js → browser-automations-page-Cxq38Nnp.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-Dwgir6mu.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-H5L5vynP.js +8 -0
- package/dist/gateway/static/root/assets/capabilities-uFKh3Hd0.js +1 -0
- package/dist/gateway/static/root/assets/channels-settings-RFBRYe5S.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-1I1PdIq0.js → chat-terminal-dock-DKQC62nQ.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-BT-EfoI6.js → computer-settings-page-D1whpIqL.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-mhQ-19tj.js → connector-service-page-BAuYTgf5.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Px-v3Q6Q.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-BqcldZoN.js → date-picker-CfCo3lqh.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DLDLJx3D.js → dependency-picker-DOuVO2M1.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-kSFeHyrt.js → desktop-pet-D9tu6Bhu.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BjY7DqD7.js → desktop-pet-settings-CQPXub2f.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DxkOYSut.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DbWJDT4X.js → extension-debug-page-CtWClPz-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-lAC_2xWA.js → extension-page-BHh9HLCz.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-jFy1NJg9.js → extension-settings-page-BdT3v5Uh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B7WpH3VW.js → gateway-config-swr-1eqyz9vZ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CZas_Ekx.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C8F_z865.js → gateway-startup-retry-C4rsW6vJ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-w3_aWeNt.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Dc7d0_7q.js → image-generation-api-B5DXMylk.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-_fMvJvzM.js → imports-page-B1JH0G5j.js} +1 -1
- package/dist/gateway/static/root/assets/index--3c0awkr.js +121 -0
- package/dist/gateway/static/root/assets/index-CNc4N4TX.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CHnZYx1U.js → keyboard-shortcuts-settings-DGrLJ8Yh.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BYKrJpFF.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-Bpja8nC6.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-DqjStqbL.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-D9krC43K.js → locale-store-BIkcRr3t.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-COxOJsgX.js → logs-page-Dl4kM4Na.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-gCfH4cwH.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-CurpvCbB.js → markdown-view-Ck_5MADq.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CYldyH6K.js → media-plugins-DTsZqgo6.js} +1 -1
- package/dist/gateway/static/root/assets/messages-7VAhscYe.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-j6sioeL1.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CMvvHv0f.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DZOiI84c.js → page-context-capture-button-DTI_g4tz.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-C-XCf9cR.js → page-tabs-CfW_Q-K5.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CvgeoEU8.js → preview-open-alternatives-CuPN-vAn.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-bv3z8Xkh.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-BHjxRz1E.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-C9K_e-EV.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Bk-es4i9.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-cK-g8BDq.js → registry-api-BAAZUGnU.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CLGJNA42.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DlUodTo-.js → runtime-tools-settings-panel-CHJBJKL1.js} +2 -2
- package/dist/gateway/static/root/assets/{scenes-page-DO8vGorm.js → scenes-page-ClLAD1pz.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BfboLCeN.js → schema-form-FQAit5HL.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Xj8MkXN1.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DwALV8mi.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BytEfCGo.js → settings-form-section-BDc6bw1q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Da2ql9KX.js → settings-page-DnhxBJjV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CBfB_7yz.js → settings-page-layout-D3KNSQ5g.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DElF2sgq.js → setup-status-panel-F0rCQ-2a.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-B8J0Saj5.js → share-preview-page-DVQCRxwK.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-C7hf6Cov.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-xPrFejRE.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CNQHhsiv.js → skills-page-RdDYu7Yj.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-B53tyGx5.js → skills-page.utils-mDwC9UJ-.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-0HAvlVtR.js → system-settings-panel-Bk7GrMij.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-2A966jFY.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DJsxU6q_.js → tunnel-api-D3Aquraj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-eIELzAOD.js → use-autosave-C1xQ-sHn.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CnBxPBVe.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BJ59ZCAn.js → voice-api-key-field-DCNECvcp.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DBXZJWLS.js → voice-config-api-B-_niUTU.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BpSxdIgB.js → work-discovery-overlay-BrGx_JS_.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Bhlv3VUX.js → workflow-run-setup-panel-CmmC2Pdr.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BZVpqw4T.js +6 -0
- package/dist/gateway/static/root/index.html +12 -11
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/capabilities.js +4 -110
- package/dist/packages/gateway-contract/src/chat-previews.js +73 -0
- package/dist/packages/gateway-contract/src/index.js +6 -0
- package/dist/packages/gateway-contract/src/local-apps.js +215 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +62 -17
- package/dist/packages/gateway-contract/src/user-turn-document.js +60 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/embedded/transcript-runtime.d.ts +3 -0
- package/dist/src/agent/embedded/transcript-runtime.js +6 -0
- package/dist/src/agent/external-tools/cliProvider.js +4 -1
- package/dist/src/agent/external-tools/composio-provider.js +9 -3
- package/dist/src/agent/external-tools/gateway-tools.js +17 -10
- package/dist/src/agent/external-tools/mcp-provider.d.ts +3 -1
- package/dist/src/agent/external-tools/mcp-provider.js +91 -6
- package/dist/src/agent/external-tools/service.d.ts +2 -1
- package/dist/src/agent/external-tools/service.js +8 -3
- package/dist/src/agent/external-tools/types.d.ts +9 -0
- package/dist/src/agent/mcp/bundle-mcp-config.js +37 -5
- package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +1 -0
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -0
- package/dist/src/agent/mcp/bundle-mcp-names.js +2 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +33 -1
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +4 -0
- package/dist/src/agent/mcp/index.js +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.d.ts +1 -0
- package/dist/src/agent/mcp/mcp-stdio-transport.js +10 -0
- package/dist/src/agent/mcp/mcp-transport.js +12 -8
- package/dist/src/agent/mcp/oauth/index.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.d.ts +6 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +70 -14
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.d.ts +2 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.js +12 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.d.ts +3 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +13 -1
- package/dist/src/agent/mcp/plugin-http-fetch.d.ts +2 -0
- package/dist/src/agent/mcp/plugin-http-fetch.js +56 -0
- package/dist/src/agent/service/process-direct-streaming.js +27 -12
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/skills/index.js +8 -1
- package/dist/src/agent/skills/skill-manager.d.ts +2 -0
- package/dist/src/agent/skills/skill-manager.js +8 -0
- package/dist/src/agent/skills/skill-sources.js +17 -0
- package/dist/src/agent/skills/types.d.ts +3 -1
- package/dist/src/agent/source-context/injector.js +10 -5
- package/dist/src/agent/source-context/types.d.ts +3 -0
- package/dist/src/agent/source-context/types.js +8 -2
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +12 -2
- package/dist/src/agent/tools/automation-tool.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +120 -12
- package/dist/src/chat-previews/index.d.ts +2 -0
- package/dist/src/chat-previews/index.js +3 -0
- package/dist/src/chat-previews/service.d.ts +27 -0
- package/dist/src/chat-previews/service.js +106 -0
- package/dist/src/chat-previews/store.d.ts +28 -0
- package/dist/src/chat-previews/store.js +77 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.d.ts +8 -0
- package/dist/src/cli/commands/extension-agent-plugin.js +82 -0
- package/dist/src/cli/commands/extension-marketplace.js +44 -4
- package/dist/src/cli/commands/extension.js +35 -3
- package/dist/src/connectors/account-selection.js +1 -1
- package/dist/src/connectors/connection-candidates.d.ts +4 -1
- package/dist/src/connectors/connection-candidates.js +8 -2
- package/dist/src/connectors/connection-capabilities.d.ts +2 -2
- package/dist/src/connectors/connection-capabilities.js +3 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +6 -1
- package/dist/src/connectors/connection-recovery-service.js +138 -26
- package/dist/src/connectors/plugin-mcp-recovery.d.ts +28 -0
- package/dist/src/connectors/plugin-mcp-recovery.js +90 -0
- package/dist/src/extensions/agent-plugins/auth.d.ts +39 -0
- package/dist/src/extensions/agent-plugins/auth.js +156 -0
- package/dist/src/extensions/agent-plugins/connection.d.ts +8 -0
- package/dist/src/extensions/agent-plugins/connection.js +41 -0
- package/dist/src/extensions/agent-plugins/health.d.ts +4 -0
- package/dist/src/extensions/agent-plugins/health.js +48 -0
- package/dist/src/extensions/agent-plugins/inventory.d.ts +53 -0
- package/dist/src/extensions/agent-plugins/inventory.js +34 -0
- package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +3 -0
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +47 -0
- package/dist/src/extensions/agent-plugins/sources.d.ts +5 -0
- package/dist/src/extensions/agent-plugins/sources.js +72 -0
- package/dist/src/extensions/agent-plugins/store.d.ts +61 -0
- package/dist/src/extensions/agent-plugins/store.js +305 -0
- package/dist/src/extensions/agent-plugins/validation.d.ts +59 -0
- package/dist/src/extensions/agent-plugins/validation.js +211 -0
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +10 -3
- package/dist/src/gateway/hono/routes/agent-plugins.d.ts +3 -0
- package/dist/src/gateway/hono/routes/agent-plugins.js +166 -0
- package/dist/src/gateway/hono/routes/agent-stream.js +14 -0
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +4 -2
- package/dist/src/gateway/hono/routes/chat-previews.d.ts +3 -0
- package/dist/src/gateway/hono/routes/chat-previews.js +41 -0
- package/dist/src/gateway/hono/routes/connection-waits.js +4 -2
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/local-apps.js +71 -39
- package/dist/src/gateway/hono/routes/mcp.js +48 -21
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +4 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +22 -0
- package/dist/src/gateway/hono/routes/side-chats.js +11 -0
- package/dist/src/gateway/service/agent-runner.js +7 -1
- package/dist/src/gateway/service/marketplace-service.d.ts +1 -0
- package/dist/src/gateway/service/marketplace-service.js +15 -1
- package/dist/src/gateway/service/session-input-coordinator.js +3 -3
- package/dist/src/gateway/service.d.ts +5 -1
- package/dist/src/gateway/service.js +14 -0
- package/dist/src/gateway/side-chat/index.d.ts +3 -1
- package/dist/src/gateway/side-chat/index.js +2 -1
- package/dist/src/gateway/side-chat/manager.d.ts +16 -0
- package/dist/src/gateway/side-chat/manager.js +40 -6
- package/dist/src/gateway/side-chat/promotion-service.d.ts +19 -0
- package/dist/src/gateway/side-chat/promotion-service.js +111 -0
- package/dist/src/gateway/side-chat/run-service.js +1 -0
- package/dist/src/gateway/side-chat/types.d.ts +1 -1
- package/dist/src/local-apps/artifact-files.d.ts +3 -0
- package/dist/src/local-apps/artifact-files.js +45 -0
- package/dist/src/local-apps/capabilities/write.js +1 -1
- package/dist/src/local-apps/fix-guidance.d.ts +3 -0
- package/dist/src/local-apps/fix-guidance.js +75 -0
- package/dist/src/local-apps/index.d.ts +2 -1
- package/dist/src/local-apps/scaffold.d.ts +5 -0
- package/dist/src/local-apps/scaffold.js +18 -5
- package/dist/src/local-apps/service.d.ts +18 -3
- package/dist/src/local-apps/service.js +106 -64
- package/dist/src/local-apps/snapshot-store.d.ts +8 -0
- package/dist/src/local-apps/snapshot-store.js +68 -0
- package/dist/src/local-apps/types.d.ts +4 -87
- package/dist/src/session/client-history.d.ts +3 -1
- package/dist/src/session/client-history.js +10 -3
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/manager.d.ts +4 -0
- package/dist/src/session/manager.js +6 -0
- package/dist/src/session/session-context-for-llm.d.ts +12 -1
- package/dist/src/session/session-context-for-llm.js +16 -2
- package/dist/src/session/store.d.ts +14 -0
- package/dist/src/session/store.js +17 -0
- package/dist/src/session/stored-rows-to-file-entries.js +10 -1
- package/dist/src/session/transcript-outline.js +10 -3
- package/dist/src/storage/sqlite/connection-wait-repository.js +9 -3
- package/dist/src/storage/sqlite/migrations/202_chat_previews.sql +26 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/row-mappers.js +6 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DWLXHWXg.js +0 -1
- package/dist/gateway/static/root/assets/api-Df2D6d3C.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BzytHIn1.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CtSV8tp-.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-DrvNA-G2.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-D0S3DuAD.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-c0k2virA.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Bkl9fDHc.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Dw_h-5Qh.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-C5f4FRpE.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-D7XbH6Hk.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CFJypY6Y.js +0 -1
- package/dist/gateway/static/root/assets/index-B4Vwh0H-.css +0 -1
- package/dist/gateway/static/root/assets/index-BNubE2Zi.js +0 -89
- package/dist/gateway/static/root/assets/local-app-workbench-page-BLKCFXvr.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-BNFmOkxs.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-BX5NtnQ2.js +0 -1
- package/dist/gateway/static/root/assets/messages-B1sTgIrE.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DZ0IWx1R.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-B9F1uue_.js +0 -8
- package/dist/gateway/static/root/assets/product-delivery-chCjIpvu.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-DEYWx__w.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-9qMDEKVd.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D4UTOpEm.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CPmOucUB.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-zu5P0dk5.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-ClEw-i1l.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-MLolJfoV.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DTPsW9TY.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Dc30oS9J.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Bq6ab5WJ.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Ci-4HAYm.js +0 -6
|
@@ -11,11 +11,14 @@ import { slugifyProjectName } from "../projects/project-store.js";
|
|
|
11
11
|
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
12
12
|
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
13
13
|
import { validateLocalAppCapabilityContracts } from "./capabilities/contracts.js";
|
|
14
|
+
import { buildLocalAppFixGuidance } from "./fix-guidance.js";
|
|
14
15
|
import { readLocalAppAcceptanceConfig } from "./acceptance.js";
|
|
16
|
+
import { hashLocalAppDirectory, localAppFileHashes, shouldCopyLocalAppPath } from "./artifact-files.js";
|
|
15
17
|
import { LOCAL_APP_RUNTIME_ENTRY, LOCAL_APP_RUNTIME_SOURCE } from "./runtime-entry.js";
|
|
16
18
|
import { readLocalAppPermissions, scaffoldLocalApp } from "./scaffold.js";
|
|
19
|
+
import { LocalAppSnapshotStore } from "./snapshot-store.js";
|
|
17
20
|
import { withLocalAppReleaseLock } from "./release-lock.js";
|
|
18
|
-
import {
|
|
21
|
+
import { join, resolve, sep } from "node:path";
|
|
19
22
|
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
20
23
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
21
24
|
//#region src/local-apps/service.ts
|
|
@@ -25,7 +28,6 @@ init_logger();
|
|
|
25
28
|
init_transaction();
|
|
26
29
|
init_operation_context();
|
|
27
30
|
const log = createLogger("LocalApps");
|
|
28
|
-
const RELEASE_COPY_EXCLUDED_NAMES = new Set([".git", "node_modules"]);
|
|
29
31
|
const UI_ONLY_PERMISSIONS = new Set([
|
|
30
32
|
"theme",
|
|
31
33
|
"storage",
|
|
@@ -85,40 +87,6 @@ function removeExtensionActivation(config, extensionId) {
|
|
|
85
87
|
}
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
|
-
function shouldCopyReleasePath(source) {
|
|
89
|
-
return !RELEASE_COPY_EXCLUDED_NAMES.has(basename(source));
|
|
90
|
-
}
|
|
91
|
-
function hashDirectory(root) {
|
|
92
|
-
const hash = createHash("sha256");
|
|
93
|
-
const visit = (dir) => {
|
|
94
|
-
const entries = readdirSync(dir, { withFileTypes: true }).filter((entry) => !RELEASE_COPY_EXCLUDED_NAMES.has(entry.name)).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
95
|
-
for (const entry of entries) {
|
|
96
|
-
const path = join(dir, entry.name);
|
|
97
|
-
const rel = relative(root, path);
|
|
98
|
-
hash.update(rel);
|
|
99
|
-
if (entry.isDirectory()) visit(path);
|
|
100
|
-
else if (entry.isFile()) hash.update(readFileSync(path));
|
|
101
|
-
else throw new Error(`Unsupported release entry: ${rel}`);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
visit(root);
|
|
105
|
-
return hash.digest("hex");
|
|
106
|
-
}
|
|
107
|
-
function fileHashes(root) {
|
|
108
|
-
const hashes = /* @__PURE__ */ new Map();
|
|
109
|
-
const visit = (dir) => {
|
|
110
|
-
const entries = readdirSync(dir, { withFileTypes: true }).filter((entry) => !RELEASE_COPY_EXCLUDED_NAMES.has(entry.name)).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
111
|
-
for (const entry of entries) {
|
|
112
|
-
const path = join(dir, entry.name);
|
|
113
|
-
const rel = relative(root, path);
|
|
114
|
-
if (entry.isDirectory()) visit(path);
|
|
115
|
-
else if (entry.isFile()) hashes.set(rel, createHash("sha256").update(readFileSync(path)).digest("hex"));
|
|
116
|
-
else throw new Error(`Unsupported release entry: ${rel}`);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
visit(root);
|
|
120
|
-
return hashes;
|
|
121
|
-
}
|
|
122
90
|
function changedFiles(current, active) {
|
|
123
91
|
const paths = new Set([...current.keys(), ...active.keys()]);
|
|
124
92
|
const changes = [];
|
|
@@ -169,9 +137,11 @@ function validateLocalAppPackage(root, extensionId) {
|
|
|
169
137
|
const html = readFileSync(join(root, manifest.ui.main), "utf8");
|
|
170
138
|
if (/<script\b(?![^>]*\bsrc=)[^>]*>/i.test(html)) throw new Error("Inline scripts are blocked in local app previews");
|
|
171
139
|
if (/(?:src|href)\s*=\s*["']https?:\/\//i.test(html)) throw new Error("Remote scripts, styles, and frames are blocked in Phase 1 local apps");
|
|
140
|
+
const acceptance = readLocalAppAcceptanceConfig(root);
|
|
172
141
|
return {
|
|
173
142
|
manifestJson,
|
|
174
|
-
|
|
143
|
+
entryPath: manifest.ui.main,
|
|
144
|
+
acceptanceScenarios: acceptance.scenarios.map((scenario) => ({
|
|
175
145
|
id: scenario.id,
|
|
176
146
|
name: scenario.name,
|
|
177
147
|
stepCount: scenario.steps.length
|
|
@@ -179,9 +149,10 @@ function validateLocalAppPackage(root, extensionId) {
|
|
|
179
149
|
};
|
|
180
150
|
}
|
|
181
151
|
var LocalAppService = class {
|
|
182
|
-
constructor(options, store = new LocalAppStore()) {
|
|
152
|
+
constructor(options, store = new LocalAppStore(), snapshots = new LocalAppSnapshotStore()) {
|
|
183
153
|
this.options = options;
|
|
184
154
|
this.store = store;
|
|
155
|
+
this.snapshots = snapshots;
|
|
185
156
|
}
|
|
186
157
|
recoveryRoot() {
|
|
187
158
|
return join(resolveStateDir(), "local-apps", "pending-releases");
|
|
@@ -208,13 +179,13 @@ var LocalAppService = class {
|
|
|
208
179
|
const release = app.activeReleaseId ? this.store.getRelease(id, app.activeReleaseId) : null;
|
|
209
180
|
if (!release || resolve(release.artifactPath) !== resolve(this.releaseRoot(id), `v${release.version}`)) throw new Error(`Local app recovery release is unavailable: ${id}`);
|
|
210
181
|
validateLocalAppPackage(release.artifactPath, app.extensionId);
|
|
211
|
-
if (
|
|
182
|
+
if (hashLocalAppDirectory(release.artifactPath) !== release.sourceHash) throw new Error(`Local app recovery integrity check failed: ${id}`);
|
|
212
183
|
const staging = mkdtempSync(join(extensionsDir, ".local-app-recover-"));
|
|
213
184
|
try {
|
|
214
185
|
const replacement = join(staging, app.extensionId);
|
|
215
186
|
cpSync(release.artifactPath, replacement, {
|
|
216
187
|
recursive: true,
|
|
217
|
-
filter:
|
|
188
|
+
filter: shouldCopyLocalAppPath
|
|
218
189
|
});
|
|
219
190
|
rmSync(target, {
|
|
220
191
|
recursive: true,
|
|
@@ -266,7 +237,7 @@ var LocalAppService = class {
|
|
|
266
237
|
if (!app || !token) return null;
|
|
267
238
|
return {
|
|
268
239
|
...app,
|
|
269
|
-
|
|
240
|
+
draftPreviewUrl: `/api/local-apps/preview/${token}/draft/ui/index.html`,
|
|
270
241
|
permissions: readLocalAppPermissions(app.workspaceRoot),
|
|
271
242
|
releases: this.store.listReleases(id).map(({ artifactPath: _artifactPath, manifestJson: _manifestJson, ...release }) => release),
|
|
272
243
|
acceptanceRuns: this.store.listAcceptanceRuns(id)
|
|
@@ -322,6 +293,16 @@ var LocalAppService = class {
|
|
|
322
293
|
});
|
|
323
294
|
}
|
|
324
295
|
create(input) {
|
|
296
|
+
return this.createInternal(input);
|
|
297
|
+
}
|
|
298
|
+
createFromPreview(input) {
|
|
299
|
+
return this.createInternal(input, {
|
|
300
|
+
markup: input.markup,
|
|
301
|
+
styles: input.styles,
|
|
302
|
+
script: input.script
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
createInternal(input, uiSource) {
|
|
325
306
|
const name = requireText(input.name, "App name");
|
|
326
307
|
const idea = requireText(input.idea, "App idea");
|
|
327
308
|
const suffix = randomBytes(4).toString("hex");
|
|
@@ -329,13 +310,23 @@ var LocalAppService = class {
|
|
|
329
310
|
const workspaceRoot = join(this.options.workspaceRoot, "local-apps", extensionId);
|
|
330
311
|
const previewToken = randomBytes(24).toString("base64url");
|
|
331
312
|
mkdirSync(workspaceRoot, { recursive: true });
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
313
|
+
try {
|
|
314
|
+
scaffoldLocalApp({
|
|
315
|
+
workspaceRoot,
|
|
316
|
+
extensionId,
|
|
317
|
+
name,
|
|
318
|
+
idea,
|
|
319
|
+
description: input.description?.trim() || void 0,
|
|
320
|
+
uiSource
|
|
321
|
+
});
|
|
322
|
+
validateLocalAppPackage(workspaceRoot, extensionId);
|
|
323
|
+
} catch (error) {
|
|
324
|
+
rmSync(workspaceRoot, {
|
|
325
|
+
recursive: true,
|
|
326
|
+
force: true
|
|
327
|
+
});
|
|
328
|
+
throw error;
|
|
329
|
+
}
|
|
339
330
|
const project = this.options.projects.create({
|
|
340
331
|
name,
|
|
341
332
|
slug: extensionId,
|
|
@@ -361,7 +352,7 @@ var LocalAppService = class {
|
|
|
361
352
|
});
|
|
362
353
|
return this.get(app.id);
|
|
363
354
|
}
|
|
364
|
-
|
|
355
|
+
resolveDraftPreview(previewToken) {
|
|
365
356
|
const app = this.store.findByPreviewToken(previewToken);
|
|
366
357
|
if (!app) return null;
|
|
367
358
|
return {
|
|
@@ -370,34 +361,42 @@ var LocalAppService = class {
|
|
|
370
361
|
uiRoot: app.workspaceRoot
|
|
371
362
|
};
|
|
372
363
|
}
|
|
373
|
-
|
|
374
|
-
const app = this.store.
|
|
375
|
-
if (!app)
|
|
364
|
+
resolveSnapshotPreview(previewToken, sourceHash) {
|
|
365
|
+
const app = this.store.findByPreviewToken(previewToken);
|
|
366
|
+
if (!app) return null;
|
|
367
|
+
const uiRoot = this.snapshots.packageRoot(app.id, sourceHash);
|
|
368
|
+
return uiRoot ? {
|
|
369
|
+
app,
|
|
370
|
+
previewToken,
|
|
371
|
+
uiRoot
|
|
372
|
+
} : null;
|
|
373
|
+
}
|
|
374
|
+
validateRoot(app, root, knownSourceHash, checkedAt = Date.now()) {
|
|
376
375
|
const issues = [];
|
|
377
376
|
let manifestJson;
|
|
378
377
|
let acceptanceScenarios = [];
|
|
379
|
-
let sourceHash;
|
|
378
|
+
let sourceHash = knownSourceHash;
|
|
380
379
|
let currentFiles = /* @__PURE__ */ new Map();
|
|
381
380
|
try {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
currentFiles = localAppFileHashes(root);
|
|
382
|
+
sourceHash ??= hashLocalAppDirectory(root);
|
|
383
|
+
({manifestJson, acceptanceScenarios} = validateLocalAppPackage(root, app.extensionId));
|
|
385
384
|
} catch (error) {
|
|
386
385
|
issues.push({
|
|
387
386
|
code: "package_validation_failed",
|
|
388
387
|
severity: "error",
|
|
389
|
-
message: error instanceof Error ? error.message : String(error)
|
|
388
|
+
message: (error instanceof Error ? error.message : String(error)).slice(0, 500)
|
|
390
389
|
});
|
|
391
390
|
}
|
|
392
391
|
const activeRelease = app.activeReleaseId ? this.store.getRelease(app.id, app.activeReleaseId) : null;
|
|
393
392
|
let files = [];
|
|
394
393
|
if (activeRelease?.artifactPath && existsSync(activeRelease.artifactPath) && currentFiles.size) try {
|
|
395
|
-
files = changedFiles(currentFiles,
|
|
394
|
+
files = changedFiles(currentFiles, localAppFileHashes(activeRelease.artifactPath));
|
|
396
395
|
} catch (error) {
|
|
397
396
|
issues.push({
|
|
398
397
|
code: "release_comparison_failed",
|
|
399
398
|
severity: "warning",
|
|
400
|
-
message: error instanceof Error ? error.message : String(error)
|
|
399
|
+
message: (error instanceof Error ? error.message : String(error)).slice(0, 500)
|
|
401
400
|
});
|
|
402
401
|
}
|
|
403
402
|
else if (!activeRelease && currentFiles.size) files = [...currentFiles.keys()].toSorted().map((path) => ({
|
|
@@ -408,7 +407,7 @@ var LocalAppService = class {
|
|
|
408
407
|
const activePermissions = permissionsFromManifestJson(activeRelease?.manifestJson);
|
|
409
408
|
return {
|
|
410
409
|
status: issues.some((issue) => issue.severity === "error") ? "failed" : "healthy",
|
|
411
|
-
checkedAt
|
|
410
|
+
checkedAt,
|
|
412
411
|
sourceHash,
|
|
413
412
|
hasDraftChanges: activeRelease ? sourceHash !== activeRelease.sourceHash : true,
|
|
414
413
|
changedFiles: files.slice(0, 50),
|
|
@@ -423,6 +422,49 @@ var LocalAppService = class {
|
|
|
423
422
|
issues
|
|
424
423
|
};
|
|
425
424
|
}
|
|
425
|
+
validate(id) {
|
|
426
|
+
const app = this.store.get(id);
|
|
427
|
+
if (!app) throw new Error("Local app not found");
|
|
428
|
+
return this.validateRoot(app, app.workspaceRoot);
|
|
429
|
+
}
|
|
430
|
+
materializeSnapshot(id) {
|
|
431
|
+
const app = this.store.get(id);
|
|
432
|
+
const token = app ? this.store.getPreviewToken(id) : null;
|
|
433
|
+
if (!app || !token) throw new Error("Local app not found");
|
|
434
|
+
const stored = this.snapshots.materialize(app.id, app.workspaceRoot, (packageRoot, sourceHash, createdAt) => {
|
|
435
|
+
const validation = this.validateRoot(app, packageRoot, sourceHash, createdAt);
|
|
436
|
+
const packageResult = validation.status === "healthy" ? validateLocalAppPackage(packageRoot, app.extensionId) : null;
|
|
437
|
+
return {
|
|
438
|
+
appId: app.id,
|
|
439
|
+
sourceHash,
|
|
440
|
+
status: packageResult ? "ready" : "invalid",
|
|
441
|
+
createdAt,
|
|
442
|
+
...packageResult ? { entryPath: packageResult.entryPath } : {},
|
|
443
|
+
validation
|
|
444
|
+
};
|
|
445
|
+
});
|
|
446
|
+
return this.withSnapshotPreviewUrl(stored, token);
|
|
447
|
+
}
|
|
448
|
+
getSnapshot(id, sourceHash) {
|
|
449
|
+
const app = this.store.get(id);
|
|
450
|
+
const token = app ? this.store.getPreviewToken(id) : null;
|
|
451
|
+
if (!app || !token) return null;
|
|
452
|
+
const snapshot = this.snapshots.get(app.id, sourceHash);
|
|
453
|
+
return snapshot ? this.withSnapshotPreviewUrl(snapshot, token) : null;
|
|
454
|
+
}
|
|
455
|
+
withSnapshotPreviewUrl(snapshot, token) {
|
|
456
|
+
if (snapshot.status !== "ready" || !snapshot.entryPath) return snapshot;
|
|
457
|
+
const entryPath = snapshot.entryPath.split("/").map(encodeURIComponent).join("/");
|
|
458
|
+
return {
|
|
459
|
+
...snapshot,
|
|
460
|
+
previewUrl: `/api/local-apps/preview/${token}/snapshots/${snapshot.sourceHash}/${entryPath}`
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
getFixGuidance(id, input) {
|
|
464
|
+
const app = this.store.get(id);
|
|
465
|
+
if (!app) throw new CapabilityError("NOT_FOUND", "Local app not found");
|
|
466
|
+
return buildLocalAppFixGuidance(app, this.validate(id), input);
|
|
467
|
+
}
|
|
426
468
|
recordAcceptance(id, input) {
|
|
427
469
|
const app = this.store.get(id);
|
|
428
470
|
if (!app) throw new Error("Local app not found");
|
|
@@ -507,7 +549,7 @@ var LocalAppService = class {
|
|
|
507
549
|
try {
|
|
508
550
|
cpSync(input.artifactPath, staged, {
|
|
509
551
|
recursive: true,
|
|
510
|
-
filter:
|
|
552
|
+
filter: shouldCopyLocalAppPath
|
|
511
553
|
});
|
|
512
554
|
if (existsSync(target)) {
|
|
513
555
|
renameSync(target, backup);
|
|
@@ -559,10 +601,10 @@ var LocalAppService = class {
|
|
|
559
601
|
try {
|
|
560
602
|
cpSync(app.workspaceRoot, stagedArtifact, {
|
|
561
603
|
recursive: true,
|
|
562
|
-
filter:
|
|
604
|
+
filter: shouldCopyLocalAppPath
|
|
563
605
|
});
|
|
564
606
|
const { manifestJson } = validateLocalAppPackage(stagedArtifact, app.extensionId);
|
|
565
|
-
const sourceHash =
|
|
607
|
+
const sourceHash = hashLocalAppDirectory(stagedArtifact);
|
|
566
608
|
if (this.store.getLatestAcceptanceForSource(app.id, sourceHash)?.status !== "passed") throw new Error("The current draft has not passed automatic acceptance");
|
|
567
609
|
renameSync(stagedArtifact, artifactPath);
|
|
568
610
|
artifactCreated = true;
|
|
@@ -612,7 +654,7 @@ var LocalAppService = class {
|
|
|
612
654
|
const release = this.store.getRelease(id, releaseId);
|
|
613
655
|
if (!release || !release.artifactPath || !existsSync(release.artifactPath)) throw new Error("Local app release artifact is unavailable");
|
|
614
656
|
validateLocalAppPackage(release.artifactPath, app.extensionId);
|
|
615
|
-
if (
|
|
657
|
+
if (hashLocalAppDirectory(release.artifactPath) !== release.sourceHash) throw new Error("Release artifact integrity check failed; rollback was not applied");
|
|
616
658
|
await this.activateArtifact({
|
|
617
659
|
app,
|
|
618
660
|
artifactPath: release.artifactPath,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LocalAppPreviewSnapshot } from '@xopcai/gateway-contract';
|
|
2
|
+
export declare class LocalAppSnapshotStore {
|
|
3
|
+
private appRoot;
|
|
4
|
+
private snapshotRoot;
|
|
5
|
+
get(appId: string, sourceHash: string): LocalAppPreviewSnapshot | null;
|
|
6
|
+
packageRoot(appId: string, sourceHash: string): string | null;
|
|
7
|
+
materialize(appId: string, sourceRoot: string, build: (packageRoot: string, sourceHash: string, createdAt: number) => LocalAppPreviewSnapshot): LocalAppPreviewSnapshot;
|
|
8
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { resolveStateDir } from "../config/paths-state.js";
|
|
2
|
+
import { LocalAppPreviewSnapshotSchema, LocalAppSourceHashSchema } from "../../packages/gateway-contract/src/local-apps.js";
|
|
3
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
4
|
+
import { init_paths } from "../config/paths.js";
|
|
5
|
+
import { hashLocalAppDirectory, shouldCopyLocalAppPath } from "./artifact-files.js";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
//#region src/local-apps/snapshot-store.ts
|
|
9
|
+
init_src();
|
|
10
|
+
init_paths();
|
|
11
|
+
function assertAppId(appId) {
|
|
12
|
+
if (!/^[a-zA-Z0-9-]+$/.test(appId)) throw new Error("Invalid local app id");
|
|
13
|
+
}
|
|
14
|
+
var LocalAppSnapshotStore = class {
|
|
15
|
+
appRoot(appId) {
|
|
16
|
+
assertAppId(appId);
|
|
17
|
+
return join(resolveStateDir(), "local-apps", "snapshots", appId);
|
|
18
|
+
}
|
|
19
|
+
snapshotRoot(appId, sourceHash) {
|
|
20
|
+
LocalAppSourceHashSchema.parse(sourceHash);
|
|
21
|
+
return join(this.appRoot(appId), sourceHash);
|
|
22
|
+
}
|
|
23
|
+
get(appId, sourceHash) {
|
|
24
|
+
const root = this.snapshotRoot(appId, sourceHash);
|
|
25
|
+
const metadataPath = join(root, "snapshot.json");
|
|
26
|
+
const packageRoot = join(root, "package");
|
|
27
|
+
if (!existsSync(metadataPath) || !existsSync(packageRoot)) return null;
|
|
28
|
+
const snapshot = LocalAppPreviewSnapshotSchema.parse(JSON.parse(readFileSync(metadataPath, "utf8")));
|
|
29
|
+
if (snapshot.appId !== appId || snapshot.sourceHash !== sourceHash) throw new Error("Local app snapshot metadata does not match its path");
|
|
30
|
+
return snapshot;
|
|
31
|
+
}
|
|
32
|
+
packageRoot(appId, sourceHash) {
|
|
33
|
+
return this.get(appId, sourceHash)?.status === "ready" ? join(this.snapshotRoot(appId, sourceHash), "package") : null;
|
|
34
|
+
}
|
|
35
|
+
materialize(appId, sourceRoot, build) {
|
|
36
|
+
const appRoot = this.appRoot(appId);
|
|
37
|
+
mkdirSync(appRoot, { recursive: true });
|
|
38
|
+
const stagingRoot = mkdtempSync(join(appRoot, ".snapshot-"));
|
|
39
|
+
const stagedPackage = join(stagingRoot, "package");
|
|
40
|
+
try {
|
|
41
|
+
cpSync(sourceRoot, stagedPackage, {
|
|
42
|
+
recursive: true,
|
|
43
|
+
filter: shouldCopyLocalAppPath
|
|
44
|
+
});
|
|
45
|
+
const sourceHash = hashLocalAppDirectory(stagedPackage);
|
|
46
|
+
const existing = this.get(appId, sourceHash);
|
|
47
|
+
if (existing) return existing;
|
|
48
|
+
const snapshot = LocalAppPreviewSnapshotSchema.parse(build(stagedPackage, sourceHash, Date.now()));
|
|
49
|
+
writeFileSync(join(stagingRoot, "snapshot.json"), `${JSON.stringify(snapshot)}\n`, { mode: 384 });
|
|
50
|
+
const target = this.snapshotRoot(appId, sourceHash);
|
|
51
|
+
try {
|
|
52
|
+
renameSync(stagingRoot, target);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const raced = this.get(appId, sourceHash);
|
|
55
|
+
if (raced) return raced;
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
return snapshot;
|
|
59
|
+
} finally {
|
|
60
|
+
if (existsSync(stagingRoot)) rmSync(stagingRoot, {
|
|
61
|
+
recursive: true,
|
|
62
|
+
force: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { LocalAppSnapshotStore };
|
|
@@ -1,40 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export
|
|
5
|
-
id: string;
|
|
6
|
-
appId: string;
|
|
7
|
-
version: number;
|
|
8
|
-
sourceHash: string;
|
|
9
|
-
healthStatus: LocalAppReleaseHealth;
|
|
10
|
-
createdAt: number;
|
|
11
|
-
activatedAt?: number;
|
|
12
|
-
isActive: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface LocalApp {
|
|
15
|
-
id: string;
|
|
16
|
-
extensionId: string;
|
|
17
|
-
projectId: string;
|
|
18
|
-
name: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
idea: string;
|
|
21
|
-
status: LocalAppStatus;
|
|
22
|
-
workspaceRoot: string;
|
|
23
|
-
draftVersion: number;
|
|
24
|
-
activeVersion?: number;
|
|
25
|
-
activeReleaseId?: string;
|
|
26
|
-
installationState: LocalAppInstallationState;
|
|
27
|
-
enabled: boolean;
|
|
28
|
-
createdAt: number;
|
|
29
|
-
updatedAt: number;
|
|
30
|
-
installedAt?: number;
|
|
31
|
-
}
|
|
32
|
-
export interface LocalAppDetail extends LocalApp {
|
|
33
|
-
previewUrl: string;
|
|
34
|
-
permissions: string[];
|
|
35
|
-
releases: LocalAppRelease[];
|
|
36
|
-
acceptanceRuns: LocalAppAcceptanceRun[];
|
|
37
|
-
}
|
|
1
|
+
import type { LocalAppAcceptanceInput, LocalAppAcceptanceRun, LocalAppAcceptanceScenarioSummary, LocalAppChangedFile, LocalAppDetail, LocalAppDiagnostic, LocalAppDiagnosticPhase, LocalAppFixGuidance, LocalAppFixGuidanceInput, LocalAppInstallationState, LocalAppRecord, LocalAppRelease, LocalAppReleaseHealth, LocalAppStatus, LocalAppValidationIssue, LocalAppValidationResult } from '@xopcai/gateway-contract';
|
|
2
|
+
export type LocalApp = LocalAppRecord;
|
|
3
|
+
export type RecordLocalAppAcceptanceInput = LocalAppAcceptanceInput;
|
|
4
|
+
export type { LocalAppAcceptanceRun, LocalAppAcceptanceScenarioSummary, LocalAppChangedFile, LocalAppDetail, LocalAppDiagnostic, LocalAppDiagnosticPhase, LocalAppFixGuidance, LocalAppFixGuidanceInput, LocalAppInstallationState, LocalAppRelease, LocalAppReleaseHealth, LocalAppStatus, LocalAppValidationIssue, LocalAppValidationResult, };
|
|
38
5
|
export interface LocalAppUiGrant {
|
|
39
6
|
granted: boolean;
|
|
40
7
|
extensionId: string;
|
|
@@ -43,56 +10,6 @@ export interface LocalAppUiGrant {
|
|
|
43
10
|
permissions: string[];
|
|
44
11
|
grantedAt?: number;
|
|
45
12
|
}
|
|
46
|
-
export interface LocalAppAcceptanceCheck {
|
|
47
|
-
id: 'document' | 'content' | 'interaction' | 'criteria';
|
|
48
|
-
status: 'passed' | 'failed' | 'skipped';
|
|
49
|
-
message: string;
|
|
50
|
-
}
|
|
51
|
-
export interface LocalAppAcceptanceRun {
|
|
52
|
-
id: string;
|
|
53
|
-
appId: string;
|
|
54
|
-
sourceHash: string;
|
|
55
|
-
status: 'passed' | 'failed';
|
|
56
|
-
checks: LocalAppAcceptanceCheck[];
|
|
57
|
-
interactiveCount: number;
|
|
58
|
-
createdAt: number;
|
|
59
|
-
}
|
|
60
|
-
export interface RecordLocalAppAcceptanceInput {
|
|
61
|
-
sourceHash: string;
|
|
62
|
-
status: 'passed' | 'failed';
|
|
63
|
-
checks: LocalAppAcceptanceCheck[];
|
|
64
|
-
interactiveCount: number;
|
|
65
|
-
}
|
|
66
|
-
export interface LocalAppValidationIssue {
|
|
67
|
-
code: string;
|
|
68
|
-
severity: 'error' | 'warning';
|
|
69
|
-
message: string;
|
|
70
|
-
}
|
|
71
|
-
export interface LocalAppChangedFile {
|
|
72
|
-
path: string;
|
|
73
|
-
status: 'added' | 'modified' | 'deleted';
|
|
74
|
-
}
|
|
75
|
-
export interface LocalAppAcceptanceScenarioSummary {
|
|
76
|
-
id: string;
|
|
77
|
-
name: string;
|
|
78
|
-
stepCount: number;
|
|
79
|
-
}
|
|
80
|
-
export interface LocalAppValidationResult {
|
|
81
|
-
status: 'healthy' | 'failed';
|
|
82
|
-
checkedAt: number;
|
|
83
|
-
sourceHash?: string;
|
|
84
|
-
hasDraftChanges: boolean;
|
|
85
|
-
changedFiles: LocalAppChangedFile[];
|
|
86
|
-
changedFileCount: number;
|
|
87
|
-
permissions: string[];
|
|
88
|
-
permissionDelta: {
|
|
89
|
-
added: string[];
|
|
90
|
-
removed: string[];
|
|
91
|
-
};
|
|
92
|
-
acceptanceScenarioCount: number;
|
|
93
|
-
acceptanceScenarios: LocalAppAcceptanceScenarioSummary[];
|
|
94
|
-
issues: LocalAppValidationIssue[];
|
|
95
|
-
}
|
|
96
13
|
export interface CreateLocalAppInput {
|
|
97
14
|
name: string;
|
|
98
15
|
idea: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TurnOutcome } from '@xopcai/gateway-contract';
|
|
1
|
+
import { type TurnOutcome, type UserTurnDocument } from '@xopcai/gateway-contract';
|
|
2
2
|
import type { Message } from './types.js';
|
|
3
3
|
import type { TranscriptStoredRow } from './session-context-for-llm.js';
|
|
4
4
|
/** Transcript row for TUI and HTTP clients (flattened from persisted session messages). */
|
|
@@ -15,6 +15,7 @@ export interface ClientHistoryMessage {
|
|
|
15
15
|
/** Whitelisted display metadata; never includes source snapshot text. */
|
|
16
16
|
metadata?: {
|
|
17
17
|
sourceContexts?: Array<{
|
|
18
|
+
refId?: string;
|
|
18
19
|
kind: 'note' | 'task' | 'file' | 'session' | 'browser_tab' | 'browser_page' | 'mcp_resource';
|
|
19
20
|
sourceId: string;
|
|
20
21
|
version: string;
|
|
@@ -26,6 +27,7 @@ export interface ClientHistoryMessage {
|
|
|
26
27
|
documentId?: string;
|
|
27
28
|
fileKind?: 'file' | 'directory';
|
|
28
29
|
}>;
|
|
30
|
+
userTurnDocument?: UserTurnDocument;
|
|
29
31
|
turnOutcome?: TurnOutcome;
|
|
30
32
|
};
|
|
31
33
|
kind?: 'message' | 'compaction' | 'context' | 'bash' | 'custom' | 'branch';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseTurnOutcome } from "../../packages/gateway-contract/src/turn-outcome.js";
|
|
2
|
+
import { isUserTurnDocument } from "../../packages/gateway-contract/src/user-turn-document.js";
|
|
2
3
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
3
4
|
import { stripRuntimeContextFromUserMessage } from "./user-message-display.js";
|
|
4
5
|
import { buildTranscriptOutline } from "./transcript-outline.js";
|
|
@@ -6,13 +7,16 @@ import { buildTranscriptOutline } from "./transcript-outline.js";
|
|
|
6
7
|
init_src();
|
|
7
8
|
function sourceContextDisplayMetadata(metadata) {
|
|
8
9
|
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) return void 0;
|
|
9
|
-
const
|
|
10
|
-
|
|
10
|
+
const record = metadata;
|
|
11
|
+
const rows = record.sourceContexts;
|
|
12
|
+
const userTurnDocument = isUserTurnDocument(record.userTurnDocument) ? record.userTurnDocument : void 0;
|
|
13
|
+
if (!Array.isArray(rows)) return userTurnDocument ? { userTurnDocument } : void 0;
|
|
11
14
|
const sourceContexts = rows.flatMap((value) => {
|
|
12
15
|
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
13
16
|
const row = value;
|
|
14
17
|
if (row.kind !== "note" && row.kind !== "task" && row.kind !== "file" && row.kind !== "session" && row.kind !== "browser_tab" && row.kind !== "browser_page" && row.kind !== "mcp_resource" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
|
|
15
18
|
return [{
|
|
19
|
+
...typeof row.refId === "string" ? { refId: row.refId } : {},
|
|
16
20
|
kind: row.kind,
|
|
17
21
|
sourceId: row.sourceId,
|
|
18
22
|
version: row.version,
|
|
@@ -25,7 +29,10 @@ function sourceContextDisplayMetadata(metadata) {
|
|
|
25
29
|
...row.kind === "file" && (row.fileKind === "file" || row.fileKind === "directory") ? { fileKind: row.fileKind } : {}
|
|
26
30
|
}];
|
|
27
31
|
});
|
|
28
|
-
return sourceContexts.length ? {
|
|
32
|
+
return sourceContexts.length || userTurnDocument ? {
|
|
33
|
+
...sourceContexts.length ? { sourceContexts } : {},
|
|
34
|
+
...userTurnDocument ? { userTurnDocument } : {}
|
|
35
|
+
} : void 0;
|
|
29
36
|
}
|
|
30
37
|
function flattenMessageContent(content) {
|
|
31
38
|
if (typeof content === "string") return content;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { SessionIndex, type SessionIndexConfig } from './manager.js';
|
|
2
2
|
export { onSessionTranscriptUpdate, emitSessionTranscriptUpdate, type SessionTranscriptUpdate, } from './transcript-events.js';
|
|
3
3
|
export { SessionStore } from './store.js';
|
|
4
|
-
export type { SessionStoreOptions, ForkSessionAtTurnOptions, ForkSessionResult, } from './store.js';
|
|
4
|
+
export type { SessionStoreOptions, ForkSessionAtTurnOptions, ForkSessionResult, CreateSessionFromRowsOptions, } from './store.js';
|
|
5
5
|
export { SessionConfigStore, resolveThinkingLevel, resolveReasoningLevel, resolveVerboseLevel } from './config-store.js';
|
|
6
6
|
export { DEFAULT_ACTIVITY_DETAIL_LEVEL, resolveConfiguredActivityDetailDefault, resolveEffectiveThinkingLevel, resolveEffectiveReasoningLevel, } from './thinking-resolve.js';
|
|
7
7
|
export type { SessionAgentConfig } from './config-types.js';
|
|
@@ -83,6 +83,10 @@ export declare class SessionIndex extends EventEmitter {
|
|
|
83
83
|
conversationId: string;
|
|
84
84
|
rowCount: number;
|
|
85
85
|
}>;
|
|
86
|
+
createSessionFromRows(options: import('./store.js').CreateSessionFromRowsOptions): Promise<{
|
|
87
|
+
conversationId: string;
|
|
88
|
+
rowCount: number;
|
|
89
|
+
}>;
|
|
86
90
|
forkSessionRows(sourceKey: string, targetKey: string, options?: {
|
|
87
91
|
throughRow?: number;
|
|
88
92
|
}): Promise<{
|
|
@@ -165,6 +165,12 @@ var SessionIndex = class extends EventEmitter$1 {
|
|
|
165
165
|
if (metadata) this.emit("sessionCreated", metadata);
|
|
166
166
|
return result;
|
|
167
167
|
}
|
|
168
|
+
async createSessionFromRows(options) {
|
|
169
|
+
const result = await this.store.createSessionFromRows(options);
|
|
170
|
+
const metadata = await this.store.getMetadata(result.conversationId);
|
|
171
|
+
if (metadata) this.emit("sessionCreated", metadata);
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
168
174
|
async forkSessionRows(sourceKey, targetKey, options = {}) {
|
|
169
175
|
const result = await this.store.forkSessionRows(sourceKey, targetKey, options);
|
|
170
176
|
const metadata = await this.store.getMetadata(result.conversationId);
|
|
@@ -17,6 +17,16 @@ export interface XopcTranscriptContextEntry {
|
|
|
17
17
|
data?: Record<string, unknown>;
|
|
18
18
|
createdAt?: string;
|
|
19
19
|
}
|
|
20
|
+
/** Immutable hidden context captured when an ephemeral side chat becomes a session. */
|
|
21
|
+
export interface XopcTranscriptSideChatOriginEntry {
|
|
22
|
+
type: 'side_chat_origin';
|
|
23
|
+
version: 1;
|
|
24
|
+
parentConversationId: string;
|
|
25
|
+
parentTranscriptId: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
contentHash: string;
|
|
28
|
+
contextMessages: AgentMessage[];
|
|
29
|
+
}
|
|
20
30
|
/** Persisted-only row for replaying local shell executions in clients. */
|
|
21
31
|
export interface XopcTranscriptBashExecutionEntry {
|
|
22
32
|
role: 'bashExecution';
|
|
@@ -119,8 +129,9 @@ export interface XopcTranscriptSessionInfoEntry {
|
|
|
119
129
|
name?: string;
|
|
120
130
|
timestamp?: string | number;
|
|
121
131
|
}
|
|
122
|
-
export type TranscriptStoredRow = AgentMessage | XopcTranscriptContextEntry | XopcTranscriptBashExecutionEntry | XopcTranscriptCustomMessageEntry | XopcTranscriptCustomMessageFileEntry | XopcTranscriptCustomStateEntry | XopcTranscriptBranchSummaryEntry | XopcTranscriptCompactionSummaryEntry | XopcTranscriptCompactionEntry | XopcTranscriptLabelEntry | XopcTranscriptThinkingLevelChangeEntry | XopcTranscriptModelChangeEntry | XopcTranscriptSessionInfoEntry;
|
|
132
|
+
export type TranscriptStoredRow = AgentMessage | XopcTranscriptContextEntry | XopcTranscriptSideChatOriginEntry | XopcTranscriptBashExecutionEntry | XopcTranscriptCustomMessageEntry | XopcTranscriptCustomMessageFileEntry | XopcTranscriptCustomStateEntry | XopcTranscriptBranchSummaryEntry | XopcTranscriptCompactionSummaryEntry | XopcTranscriptCompactionEntry | XopcTranscriptLabelEntry | XopcTranscriptThinkingLevelChangeEntry | XopcTranscriptModelChangeEntry | XopcTranscriptSessionInfoEntry;
|
|
123
133
|
export declare function isTranscriptContextEntry(x: unknown): x is XopcTranscriptContextEntry;
|
|
134
|
+
export declare function isTranscriptSideChatOriginEntry(x: unknown): x is XopcTranscriptSideChatOriginEntry;
|
|
124
135
|
export declare function isTranscriptBashExecutionEntry(x: unknown): x is XopcTranscriptBashExecutionEntry;
|
|
125
136
|
export declare function isTranscriptCustomMessageEntry(x: unknown): x is XopcTranscriptCustomMessageEntry | XopcTranscriptCustomMessageFileEntry;
|
|
126
137
|
export declare function isTranscriptCustomStateEntry(x: unknown): x is XopcTranscriptCustomStateEntry;
|
|
@@ -6,6 +6,11 @@ function isTranscriptContextEntry(x) {
|
|
|
6
6
|
if (!x || typeof x !== "object") return false;
|
|
7
7
|
return x.kind === "context";
|
|
8
8
|
}
|
|
9
|
+
function isTranscriptSideChatOriginEntry(x) {
|
|
10
|
+
if (!x || typeof x !== "object") return false;
|
|
11
|
+
const row = x;
|
|
12
|
+
return row.type === "side_chat_origin" && row.version === 1 && typeof row.parentConversationId === "string" && typeof row.parentTranscriptId === "string" && typeof row.createdAt === "string" && typeof row.contentHash === "string" && Array.isArray(row.contextMessages) && row.contextMessages.every(isLikelyAgentMessage);
|
|
13
|
+
}
|
|
9
14
|
function isTranscriptBashExecutionEntry(x) {
|
|
10
15
|
if (!x || typeof x !== "object") return false;
|
|
11
16
|
return x.role === "bashExecution";
|
|
@@ -228,6 +233,10 @@ function sanitizeToolPairs(messages) {
|
|
|
228
233
|
function transcriptRowsFromJsonArray(arr) {
|
|
229
234
|
const out = [];
|
|
230
235
|
for (const x of arr) {
|
|
236
|
+
if (isTranscriptSideChatOriginEntry(x)) {
|
|
237
|
+
out.push(x);
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
231
240
|
if (isTranscriptContextEntry(x)) {
|
|
232
241
|
out.push(x);
|
|
233
242
|
continue;
|
|
@@ -268,6 +277,11 @@ function transcriptRowsFromJsonArray(arr) {
|
|
|
268
277
|
function buildSessionContextForLlm(rows) {
|
|
269
278
|
const out = [];
|
|
270
279
|
for (const r of rows) {
|
|
280
|
+
if (isTranscriptSideChatOriginEntry(r)) {
|
|
281
|
+
out.length = 0;
|
|
282
|
+
out.push(...r.contextMessages);
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
271
285
|
if (isTranscriptCompactionEntry(r)) {
|
|
272
286
|
out.length = 0;
|
|
273
287
|
out.push(...r.messages);
|
|
@@ -315,7 +329,7 @@ function buildSessionDisplayMessages(rows) {
|
|
|
315
329
|
function mergeLlmMessagesPreservingContextRows(prevRows, llmMessages) {
|
|
316
330
|
let i = 0;
|
|
317
331
|
const out = [];
|
|
318
|
-
for (const r of prevRows) if (isTranscriptContextEntry(r) || isTranscriptBashExecutionEntry(r) || isTranscriptCustomMessageEntry(r) || isTranscriptCustomStateEntry(r) || isTranscriptSummaryMessageEntry(r) || isTranscriptLabelEntry(r) || isTranscriptMetadataEntry(r)) out.push(r);
|
|
332
|
+
for (const r of prevRows) if (isTranscriptContextEntry(r) || isTranscriptSideChatOriginEntry(r) || isTranscriptBashExecutionEntry(r) || isTranscriptCustomMessageEntry(r) || isTranscriptCustomStateEntry(r) || isTranscriptSummaryMessageEntry(r) || isTranscriptLabelEntry(r) || isTranscriptMetadataEntry(r)) out.push(r);
|
|
319
333
|
else if (i < llmMessages.length) {
|
|
320
334
|
out.push(llmMessages[i]);
|
|
321
335
|
i += 1;
|
|
@@ -340,4 +354,4 @@ var init_session_context_for_llm = __esmMin((() => {
|
|
|
340
354
|
}));
|
|
341
355
|
//#endregion
|
|
342
356
|
init_session_context_for_llm();
|
|
343
|
-
export { buildSessionContextForLlm, buildSessionDisplayMessages, init_session_context_for_llm, isRuntimeOnlyTranscriptMessage, isTranscriptBashExecutionEntry, isTranscriptCompactionEntry, isTranscriptContextEntry, isTranscriptCustomMessageEntry, isTranscriptCustomStateEntry, isTranscriptLabelEntry, isTranscriptMetadataEntry, isTranscriptSummaryMessageEntry, mergeLlmMessagesPreservingContextRows, transcriptRowsFromJsonArray };
|
|
357
|
+
export { buildSessionContextForLlm, buildSessionDisplayMessages, init_session_context_for_llm, isRuntimeOnlyTranscriptMessage, isTranscriptBashExecutionEntry, isTranscriptCompactionEntry, isTranscriptContextEntry, isTranscriptCustomMessageEntry, isTranscriptCustomStateEntry, isTranscriptLabelEntry, isTranscriptMetadataEntry, isTranscriptSideChatOriginEntry, isTranscriptSummaryMessageEntry, mergeLlmMessagesPreservingContextRows, transcriptRowsFromJsonArray };
|