@xopcai/xopc 0.0.375 → 0.0.377
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-BeYLqqr8.js → activity-store-BVtU6S1w.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B2Popl59.js → agent-avatar-dicebear-BD63ce58.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Ch07F4uX.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CdCVOg5e.js +1 -0
- package/dist/gateway/static/root/assets/agents-D2__mhy8.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-B4tgTbWG.js → agents-admin-api-DgQph1Pu.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DNkXIPxK.js → app-management-settings-panel-B0yP8rNC.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-p1_NpH8a.js → appearance-settings-Bnq1nzDX.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CP2u5iEh.js → apps-page-CSIFuEnj.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-bI9OLnXj.js → archive-plugin-FBVMH4ym.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CjYiGOov.js → automations-page-qsg6pZlF.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DqBWLl61.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-dOwLzjeH.js → binary-plugins-B0qGhVNs.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DiOou1HO.js → block-editor-CjQv4zlo.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-automation-inputs-i7h1Svpf.js → browser-automation-inputs-DSbRHrG7.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CzEWM_ie.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-CsDck88G.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-D4KFLtqM.js → capabilities-HaRLmYU1.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CquUV0DP.js → capabilities-LpGa-olH.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-BeQ-Yj3_.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BQ-I3L-C.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-AeBubNQK.js → capability-header-actions-DuBac0EK.js} +1 -1
- package/dist/gateway/static/root/assets/channels-1wUJcCxP.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DrVlbq_P.js → chat-terminal-dock-CQc1mqZM.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-TUzZnurj.js → computer-settings-page-BIwOemaK.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BlpwjGW7.js → connector-service-page-CG9KKuXq.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BFzjGpKE.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CjKRpA8X.js → date-picker-DoZGE2hF.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-J9_0obij.js → dependency-picker-hrz7p1Lv.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DySwgreF.js → desktop-pet-C1bTu_dG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B1-oyKBG.js → desktop-pet-settings-C2xCFimg.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-C5rjPAyc.js → device-pairing-wizard-CZ5Wmq5U.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BY7MwiZd.js → directory-picker-path-field-BaHQhI4z.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CbgEonkK.js → extension-debug-page-B1uMVNGe.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-JoSFhfb6.js → extension-page-850m5tOc.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-DxlAZ2iy.js → extension-provider-B-_CkaD2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B7LtTNx7.js → extension-settings-page-P3FNAW0n.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-DKSWcBt_.js → fallback-models-BoJZA9Cm.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BoRkBnsw.js → gateway-config-swr-siY2J0hx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-C3WQQY10.js → gateway-realtime-Biz18NiE.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BazlseY_.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BG1zXG8B.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-TYSQEQcG.js → gateway-startup-retry-CeL1OFDZ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B8RmZbDw.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-_pKiNfSq.js → image-generation-api-CeDrok06.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DS_RFtWf.js → imports-page-C9FTl2dW.js} +1 -1
- package/dist/gateway/static/root/assets/index-CGVecvp4.css +1 -0
- package/dist/gateway/static/root/assets/index-DU5FmDQh.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BxwXR2qA.js → keyboard-shortcuts-settings-Dx-36I-c.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BWd4RMBE.js → local-app-workbench-page-Cg4gdTwm.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BsgcA6-N.js → local-apps-page-3GKgu7at.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Cg9RdsNN.js → local-session-drafts-DnSw14fE.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-rWFLl-p4.js → locale-store-DSsLH7JO.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CApZnDPi.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-CZAZwCpE.js → management-settings-DcgCzPd-.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BHFFusQs.js → markdown-view-2rwSrMXW.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BVPTMWJI.js → media-plugins-CjGiKLFo.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cn25s55n.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-DaqiLHPe.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CncL3xmy.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-CSLVCZBn.js → notes-api-D9fGUbkK.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-D9romxNU.js +8 -0
- package/dist/gateway/static/root/assets/number-input-DDeqHK-G.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BZADmKcV.js → page-context-capture-button-CKqYL9AQ.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-DoG-2fru.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CBnKsW4p.js → product-open-page-DFu_ZT2h.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-B0gGexdG.js → product-preview-content-tPBCFa7L.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-ZjQSv_NG.js → project-detail-page-C9Bt5toA.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Bf7Sd_Ck.js → projects-page-Bu3jZa3A.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CoMBYjHD.js → registry-api-ZhIt79wL.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9MNGl2t.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CQZ1c-re.js → runtime-tools-settings-panel-BYQuPsWk.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-1xGRBOJO.js → scenes-page-7LjR8Aek.js} +2 -2
- package/dist/gateway/static/root/assets/schema-form-GwVc8KsT.js +1 -0
- package/dist/gateway/static/root/assets/{send-session-input-CLhR1uEp.js → send-session-input-B64q4_6R.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-u_4_kFQt.js → session-api-BUa3BaGX.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BWLIDok4.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-CzbNB_RT.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CmNe5RJ4.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CSqi5fmN.js → settings-page-DAvi3P8Q.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DoAn6P_k.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-XhiuPKF4.js → share-link-dialog-CbkS1cj-.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Vc0TQuZ8.js → share-preview-page-DicRCB4L.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-BVSb1vh4.js → shares-api-BUGeqXCG.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Bbkz0xuD.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CFtEHy5e.js → skill-api-DpTUuYWk.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BsLx_FXd.js → skill-reload-api-CII18PA5.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-BuBSAOOd.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DBMR9ks_.js → system-settings-panel-DlNaQp-l.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CGe34vxR.js → task-detail-page-DeElbs6T.js} +2 -2
- package/dist/gateway/static/root/assets/{task-expandable-content-DxeBTJvh.js → task-expandable-content-sONbgbwR.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-KcQhCg1-.js → theme-store-Kz0VUMSb.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-CZHhm1Nn.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-CzNIlgdJ.js → tunnel-api-sUbAaSX6.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-O3abwewp.js → usage-page-NPLApyNj.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C-IWxbzm.js → use-autosave-CZzYhcAl.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Dxphaxk-.js → use-composer-attachments-Bb_Hqqry.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-Du37Gofn.js → use-file-preview-expanded-D4WI5JDn.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-DAEiJzNV.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-7BImy8Jc.js → voice-api-key-field-CIIGmtHR.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-6MINytQl.js → voice-config-api-BtWFziQc.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D967-fVj.js → work-discovery-overlay-DxRDLQvs.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BJ945m7G.js → workflow-run-setup-panel-Be_Rey6d.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-wJk7l1_H.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-CXiyhTwv.js → workspace-api-B5ssQs4p.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Bq9ubffP.js → xopc-cloud-account-card-D7Rtu5eI.js} +1 -1
- package/dist/gateway/static/root/index.html +27 -27
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/mcp/connection-setup.d.ts +21 -0
- package/dist/src/agent/mcp/connection-setup.js +214 -0
- package/dist/src/agent/mcp/tool-catalog.d.ts +18 -0
- package/dist/src/agent/mcp/tool-catalog.js +120 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-config-service.js +2 -4
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent/workspace-runtime/registry.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/service/action-executor.js +1 -1
- package/dist/src/bootstrap/application-state.js +2 -2
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +2 -2
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/health.js +35 -2
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/hono/app.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +4 -4
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +89 -0
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service/session-command-service.js +1 -1
- package/dist/src/gateway/service.js +13 -3
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/infra/update-restart.d.ts +5 -0
- package/dist/src/infra/update-restart.js +38 -31
- package/dist/src/infra/update-runner.d.ts +1 -0
- package/dist/src/infra/update-runner.js +47 -18
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/prompt-context.js +3 -3
- package/dist/src/personal-agent/reply-composer.d.ts +1 -1
- package/dist/src/personal-agent/reply-composer.js +8 -1
- package/dist/src/personal-agent/service.js +3 -13
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/prompt-cache-payload.js +18 -22
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/session/config-store.js +1 -2
- package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
- package/dist/src/storage/sqlite/migrations/246_personal_session_thinking.sql +22 -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/schema.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/voice/platform-streams.js +1 -1
- package/dist/src/voice/realtime/agentEngine.js +21 -5
- package/dist/src/voice/realtime/engine.d.ts +4 -0
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.d.ts +5 -0
- package/dist/src/voice/realtime/runtime.js +4 -0
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BnF3HrHY.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CwP6OrUs.js +0 -1
- package/dist/gateway/static/root/assets/agents-n3IremKl.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-BAHiUQbe.js +0 -6
- package/dist/gateway/static/root/assets/browser-automations-page-nArl2uwX.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-Bd8tF-gg.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-Cx4cdgse.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DpWceNd0.js +0 -8
- package/dist/gateway/static/root/assets/channels-Cd1Rf0Vk.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-j8VFMD4o.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-cLCDEe4D.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CGm-lbsX.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CX3uWkyH.js +0 -2
- package/dist/gateway/static/root/assets/index-BGBkIIzM.css +0 -1
- package/dist/gateway/static/root/assets/index-CgvOIDy_.js +0 -106
- package/dist/gateway/static/root/assets/logs-page-CLP5pu2j.js +0 -2
- package/dist/gateway/static/root/assets/messages-C1SUo4gG.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-Jj8dvYcv.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-BeAHgdtw.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-MP21Zf_R.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-BbaTGmE-.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Bl8aPuXU.js +0 -1
- package/dist/gateway/static/root/assets/schema-form-BYqugMox.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-B06ZCie_.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-DjMSVXU3.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BJuMTtyI.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D5bM0TvA.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C-V9WllF.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-B-olXUVH.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-DJRAP3nb.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Bx2JlCpj.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DUpVeIuw.js +0 -6
- package/dist/src/personal-agent/model-config.d.ts +0 -5
- package/dist/src/personal-agent/model-config.js +0 -59
package/dist/src/gateway/lock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import net from "node:net";
|
|
5
4
|
import fs$1 from "node:fs/promises";
|
|
5
|
+
import net from "node:net";
|
|
6
6
|
import { homedir } from "os";
|
|
7
7
|
//#region src/gateway/lock.ts
|
|
8
8
|
/**
|
|
@@ -28,7 +28,7 @@ async function receiveSessionCommand(service, conversationId, principalId, comma
|
|
|
28
28
|
const receive = () => withModelConfigLock(conversationId, async () => {
|
|
29
29
|
const personal = getPersonalAgentByConversation(conversationId);
|
|
30
30
|
if (personal && "creation" in command && command.creation.agentId !== personal.agentId) throw new SessionCommandError("BAD_REQUEST", "Personal AI identity is fixed");
|
|
31
|
-
const configuredThinking = ("creation" in command ? resolveEffectiveAgentConfigForAgent(command.creation.agentId) : resolveEffectiveAgentConfigForSession(conversationId)).config.runtime.thinkingLevel;
|
|
31
|
+
const configuredThinking = personal ? void 0 : ("creation" in command ? resolveEffectiveAgentConfigForAgent(command.creation.agentId) : resolveEffectiveAgentConfigForSession(conversationId)).config.runtime.thinkingLevel;
|
|
32
32
|
if (configuredThinking && "creation" in command && command.creation.thinkingLevel !== configuredThinking) throw new SessionCommandError("BAD_REQUEST", `This agent uses thinking ${configuredThinking}`);
|
|
33
33
|
const clientMessageId = "commandId" in command ? command.commandId : command.clientMessageId;
|
|
34
34
|
const existing = matchSessionInputReceipt(conversationId, clientMessageId, principalId, sessionCommandHash(command));
|
|
@@ -20,13 +20,13 @@ import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js
|
|
|
20
20
|
import { init_session_repository, listSessionMetadata, patchSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
21
21
|
import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
|
|
22
22
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
23
|
+
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
24
|
+
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
23
25
|
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
24
26
|
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
25
27
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
26
28
|
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
27
29
|
import "../knowledge-memory/index.js";
|
|
28
|
-
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
29
|
-
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
30
30
|
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
31
31
|
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
32
32
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
@@ -910,7 +910,17 @@ var GatewayService = class {
|
|
|
910
910
|
if (reply) this.emit("personal.reply.delivered", reply);
|
|
911
911
|
};
|
|
912
912
|
await new TaskResultDeliveryService().drain(notify);
|
|
913
|
-
new PersonalReplyComposer().drain(
|
|
913
|
+
new PersonalReplyComposer().drain(async (conversationId, deliveryId) => {
|
|
914
|
+
const reply = personalReplyNotification(conversationId, deliveryId);
|
|
915
|
+
notify(conversationId, deliveryId);
|
|
916
|
+
if (reply && typeof reply.text === "string" && reply.text.trim() && this.voiceRealtime.hasConversation(conversationId)) {
|
|
917
|
+
if (!await this.voiceRealtime.offerReply({
|
|
918
|
+
conversationId,
|
|
919
|
+
deliveryId,
|
|
920
|
+
text: reply.text
|
|
921
|
+
})) throw new Error("Personal voice reply deferred");
|
|
922
|
+
}
|
|
923
|
+
}, (conversationId) => !this.agentRunner.hasActiveRun(conversationId) && !this.agentRunner.inputs.isAcceptingInput(conversationId) && (!this.voiceRealtime.hasConversation(conversationId) || this.voiceRealtime.canPublishReply(conversationId))).catch((err) => {
|
|
914
924
|
log.error({
|
|
915
925
|
err,
|
|
916
926
|
phase: "task_result_reply"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
2
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
2
3
|
import { getModelCatalogStore, init_model_catalog_store } from "../providers/model-catalog-store.js";
|
|
3
4
|
import { getAvailableModels, init_providers } from "../providers/index.js";
|
|
4
5
|
import { compareCatalogModels } from "../providers/model-catalog-ranking.js";
|
|
5
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
6
6
|
import { prepareUpdateGlobalDefaults } from "./global-defaults-admin.js";
|
|
7
7
|
//#region src/gateway/xopc-cloud-capability-setup.ts
|
|
8
8
|
init_repository();
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Gateway restart after xopc update — daemon, unmanaged, or in-process respawn.
|
|
3
3
|
*/
|
|
4
|
+
import type { GatewayService } from '../daemon/types.js';
|
|
4
5
|
export type UpdateRestartResult = {
|
|
5
6
|
ok: boolean;
|
|
6
7
|
mode: 'in-process' | 'daemon' | 'unmanaged' | 'skipped' | 'disabled' | 'failed';
|
|
7
8
|
message?: string;
|
|
9
|
+
warning?: string;
|
|
8
10
|
};
|
|
9
11
|
export type InProcessRestartTrigger = () => {
|
|
10
12
|
ok: boolean;
|
|
@@ -12,10 +14,13 @@ export type InProcessRestartTrigger = () => {
|
|
|
12
14
|
message?: string;
|
|
13
15
|
};
|
|
14
16
|
export declare function isRunningInsideGatewayService(env?: Record<string, string | undefined>): boolean;
|
|
17
|
+
/** Load platform modules before the installer replaces files used by this process. */
|
|
18
|
+
export declare function prepareGatewayRestart(shouldRestart?: boolean): Promise<GatewayService | undefined>;
|
|
15
19
|
export declare function maybeRestartGatewayAfterUpdate(params: {
|
|
16
20
|
shouldRestart?: boolean;
|
|
17
21
|
expectedVersion?: string;
|
|
18
22
|
updatedPackageRoot?: string;
|
|
19
23
|
configPath?: string;
|
|
20
24
|
triggerInProcessRestart?: InProcessRestartTrigger;
|
|
25
|
+
preparedService?: GatewayService;
|
|
21
26
|
}): Promise<UpdateRestartResult>;
|
|
@@ -19,6 +19,11 @@ const DEFAULT_HEALTH_DELAY_MS = 500;
|
|
|
19
19
|
function isRunningInsideGatewayService(env = process.env) {
|
|
20
20
|
return env.XOPC_SERVICE_MARKER?.trim() === "1";
|
|
21
21
|
}
|
|
22
|
+
/** Load platform modules before the installer replaces files used by this process. */
|
|
23
|
+
async function prepareGatewayRestart(shouldRestart) {
|
|
24
|
+
if (shouldRestart === false || !isRestartEnabled(loadConfig(resolveConfigPath()))) return;
|
|
25
|
+
return resolveGatewayService();
|
|
26
|
+
}
|
|
22
27
|
function resolveGatewayPort(configPath) {
|
|
23
28
|
const config = loadConfig(configPath ?? resolveConfigPath());
|
|
24
29
|
return typeof config.gateway?.port === "number" ? config.gateway.port : 18790;
|
|
@@ -42,27 +47,31 @@ async function resolveRestartPort(service) {
|
|
|
42
47
|
return parsePortFromArgs((await service.readCommand(process.env).catch(() => null))?.programArguments) ?? resolveGatewayPort();
|
|
43
48
|
}
|
|
44
49
|
async function waitForGatewayHealth(port, expectedVersion) {
|
|
45
|
-
|
|
50
|
+
const config = loadConfig(resolveConfigPath());
|
|
51
|
+
const credential = process.env.XOPC_GATEWAY_TOKEN || process.env.XOPC_GATEWAY_PASSWORD || config.gateway?.auth?.token || config.gateway?.auth?.password;
|
|
52
|
+
for (let attempt = 0; attempt < DEFAULT_HEALTH_ATTEMPTS; attempt += 1) {
|
|
46
53
|
const controller = new AbortController();
|
|
47
54
|
const timeout = setTimeout(() => controller.abort(), 1500);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
try {
|
|
56
|
+
const response = await fetch(`http://127.0.0.1:${port}/api/health`, {
|
|
57
|
+
method: "GET",
|
|
58
|
+
signal: controller.signal
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok) throw new Error("Gateway health unavailable");
|
|
61
|
+
const health = await response.json();
|
|
62
|
+
if (health.ready !== true || health.status !== "ok") throw new Error("Gateway is still starting");
|
|
63
|
+
if (expectedVersion) {
|
|
64
|
+
const status = await fetch(`http://127.0.0.1:${port}/api/status`, {
|
|
65
|
+
headers: credential ? { Authorization: `Bearer ${credential}` } : void 0,
|
|
66
|
+
signal: controller.signal
|
|
67
|
+
});
|
|
68
|
+
if (!status.ok) throw new Error("Gateway version unavailable");
|
|
69
|
+
if ((await status.json()).version !== expectedVersion) throw new Error("Gateway version mismatch");
|
|
62
70
|
}
|
|
71
|
+
return true;
|
|
72
|
+
} catch {} finally {
|
|
73
|
+
clearTimeout(timeout);
|
|
63
74
|
}
|
|
64
|
-
return true;
|
|
65
|
-
} catch {
|
|
66
75
|
await new Promise((r) => setTimeout(r, DEFAULT_HEALTH_DELAY_MS));
|
|
67
76
|
}
|
|
68
77
|
return false;
|
|
@@ -111,9 +120,9 @@ async function restartDaemonGateway(service, port, expectedVersion) {
|
|
|
111
120
|
expectedVersion
|
|
112
121
|
}, "Gateway restart completed but health check timed out");
|
|
113
122
|
return {
|
|
114
|
-
ok:
|
|
115
|
-
mode: "
|
|
116
|
-
message: "Gateway service restarted
|
|
123
|
+
ok: false,
|
|
124
|
+
mode: "failed",
|
|
125
|
+
message: "Gateway service restarted, but readiness and installed version could not be verified."
|
|
117
126
|
};
|
|
118
127
|
}
|
|
119
128
|
return {
|
|
@@ -145,9 +154,10 @@ async function maybeRestartGatewayAfterUpdate(params) {
|
|
|
145
154
|
mode: "disabled",
|
|
146
155
|
message: "Gateway restart is disabled (commands.restart=false). Restart manually: xopc gateway restart"
|
|
147
156
|
};
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
if (params.triggerInProcessRestart) {
|
|
158
|
+
let warning;
|
|
159
|
+
if (isRunningInsideGatewayService() && params.updatedPackageRoot && params.expectedVersion) try {
|
|
160
|
+
const service = params.preparedService ?? await resolveGatewayService();
|
|
151
161
|
if (await service.isLoaded({ env: process.env })) await refreshGatewayServiceAfterUpdate({
|
|
152
162
|
service,
|
|
153
163
|
packageRoot: params.updatedPackageRoot,
|
|
@@ -159,11 +169,7 @@ async function maybeRestartGatewayAfterUpdate(params) {
|
|
|
159
169
|
err,
|
|
160
170
|
expectedVersion: params.expectedVersion
|
|
161
171
|
}, `Gateway service refresh failed after update: ${message}`);
|
|
162
|
-
|
|
163
|
-
ok: false,
|
|
164
|
-
mode: "failed",
|
|
165
|
-
message: `Installed ${params.expectedVersion}, but failed to refresh the gateway service: ${message}`
|
|
166
|
-
};
|
|
172
|
+
warning = `Installed ${params.expectedVersion}, but failed to refresh the gateway service: ${message}`;
|
|
167
173
|
}
|
|
168
174
|
const result = params.triggerInProcessRestart();
|
|
169
175
|
if (!result.ok) return {
|
|
@@ -175,11 +181,12 @@ async function maybeRestartGatewayAfterUpdate(params) {
|
|
|
175
181
|
return {
|
|
176
182
|
ok: true,
|
|
177
183
|
mode: "in-process",
|
|
178
|
-
message: result.message ?? "Gateway restart scheduled."
|
|
184
|
+
message: result.message ?? "Gateway restart scheduled.",
|
|
185
|
+
warning
|
|
179
186
|
};
|
|
180
187
|
}
|
|
181
|
-
const service = await resolveGatewayService();
|
|
188
|
+
const service = params.preparedService ?? await resolveGatewayService();
|
|
182
189
|
return restartDaemonGateway(service, await resolveRestartPort(service), params.expectedVersion);
|
|
183
190
|
}
|
|
184
191
|
//#endregion
|
|
185
|
-
export { isRunningInsideGatewayService, maybeRestartGatewayAfterUpdate };
|
|
192
|
+
export { isRunningInsideGatewayService, maybeRestartGatewayAfterUpdate, prepareGatewayRestart };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PACKAGE_VERSION, init_package_version } from "../package-version.js";
|
|
1
2
|
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
2
3
|
import "./update-channels.js";
|
|
3
4
|
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
@@ -7,10 +8,11 @@ import { XOPC_PACKAGE_NAME, cleanupGlobalRenameDirs, createGlobalInstallEnv, det
|
|
|
7
8
|
import { runGlobalPackageUpdateSteps } from "./package-update-steps.js";
|
|
8
9
|
import { resolveStableNodePath } from "./stable-node-path.js";
|
|
9
10
|
import { trimLogTail } from "./update-log.js";
|
|
10
|
-
import { maybeRestartGatewayAfterUpdate } from "./update-restart.js";
|
|
11
|
+
import { maybeRestartGatewayAfterUpdate, prepareGatewayRestart } from "./update-restart.js";
|
|
11
12
|
import path from "node:path";
|
|
12
13
|
import fs from "node:fs/promises";
|
|
13
14
|
//#region src/infra/update-runner.ts
|
|
15
|
+
init_package_version();
|
|
14
16
|
const DEFAULT_TIMEOUT_MS = 2700 * 1e3;
|
|
15
17
|
const MAX_LOG_CHARS = 8e3;
|
|
16
18
|
const CORE_PACKAGE_NAMES = new Set([XOPC_PACKAGE_NAME]);
|
|
@@ -522,30 +524,55 @@ async function runGatewayUpdate(opts = {}) {
|
|
|
522
524
|
}
|
|
523
525
|
async function runGatewayUpdateWithPostSteps(opts = {}) {
|
|
524
526
|
const channel = opts.channel ?? "stable";
|
|
527
|
+
let preparedService;
|
|
528
|
+
try {
|
|
529
|
+
preparedService = await prepareGatewayRestart(opts.shouldRestart);
|
|
530
|
+
} catch (err) {
|
|
531
|
+
return {
|
|
532
|
+
status: "error",
|
|
533
|
+
mode: "unknown",
|
|
534
|
+
reason: "restart-preparation-failed",
|
|
535
|
+
steps: [],
|
|
536
|
+
durationMs: 0,
|
|
537
|
+
postUpdate: { restart: {
|
|
538
|
+
ok: false,
|
|
539
|
+
mode: "failed",
|
|
540
|
+
message: err instanceof Error ? err.message : String(err)
|
|
541
|
+
} }
|
|
542
|
+
};
|
|
543
|
+
}
|
|
525
544
|
const result = await runGatewayUpdate(opts);
|
|
526
|
-
|
|
545
|
+
const needsRuntimeRestart = result.status === "skipped" && result.reason === "up-to-date" && Boolean(opts.triggerInProcessRestart) && Boolean(result.after?.version) && result.after.version !== PACKAGE_VERSION;
|
|
546
|
+
if (result.status !== "ok" && !needsRuntimeRestart) return result;
|
|
527
547
|
const postUpdate = {};
|
|
528
|
-
if (!opts.skipExtensionSync) {
|
|
529
|
-
|
|
548
|
+
if (!opts.skipExtensionSync && !needsRuntimeRestart) try {
|
|
549
|
+
postUpdate.extensions = await runPostUpdateExtensionSync({
|
|
530
550
|
channel,
|
|
531
551
|
timeoutMs: opts.timeoutMs
|
|
532
552
|
});
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
553
|
+
} catch (err) {
|
|
554
|
+
postUpdate.extensionsError = err instanceof Error ? err.message : String(err);
|
|
555
|
+
}
|
|
556
|
+
try {
|
|
557
|
+
postUpdate.restart = await maybeRestartGatewayAfterUpdate({
|
|
558
|
+
shouldRestart: opts.shouldRestart,
|
|
559
|
+
expectedVersion: result.after?.version ?? void 0,
|
|
560
|
+
updatedPackageRoot: result.mode === "npm" || result.mode === "pnpm" ? result.root : void 0,
|
|
561
|
+
triggerInProcessRestart: opts.triggerInProcessRestart,
|
|
562
|
+
preparedService
|
|
563
|
+
});
|
|
564
|
+
} catch (err) {
|
|
565
|
+
postUpdate.restart = {
|
|
566
|
+
ok: false,
|
|
567
|
+
mode: "failed",
|
|
568
|
+
message: err instanceof Error ? err.message : String(err)
|
|
539
569
|
};
|
|
540
570
|
}
|
|
541
|
-
postUpdate.restart
|
|
542
|
-
shouldRestart: opts.shouldRestart,
|
|
543
|
-
expectedVersion: result.after?.version ?? void 0,
|
|
544
|
-
updatedPackageRoot: result.mode === "npm" || result.mode === "pnpm" ? result.root : void 0,
|
|
545
|
-
triggerInProcessRestart: opts.triggerInProcessRestart
|
|
546
|
-
});
|
|
571
|
+
const reason = !postUpdate.restart.ok ? "post-update-restart" : postUpdate.extensions?.status === "error" || postUpdate.extensionsError ? "post-update-extensions" : void 0;
|
|
547
572
|
return {
|
|
548
573
|
...result,
|
|
574
|
+
status: reason ? "error" : "ok",
|
|
575
|
+
reason,
|
|
549
576
|
postUpdate
|
|
550
577
|
};
|
|
551
578
|
}
|
|
@@ -571,8 +598,10 @@ function formatUpdateApiResult(result, channel) {
|
|
|
571
598
|
status: "error",
|
|
572
599
|
reason: result.reason ?? "update-failed",
|
|
573
600
|
mode: result.mode,
|
|
574
|
-
message: failed?.stderrTail ?? failed?.stdoutTail ?? result.reason,
|
|
575
|
-
stderrTail: failed?.stderrTail ?? void 0
|
|
601
|
+
message: result.postUpdate?.restart?.ok === false ? result.postUpdate.restart.message : result.postUpdate?.extensionsError ?? failed?.stderrTail ?? failed?.stdoutTail ?? result.reason,
|
|
602
|
+
stderrTail: failed?.stderrTail ?? void 0,
|
|
603
|
+
installedVersion: result.after?.version ?? void 0,
|
|
604
|
+
postUpdate: result.postUpdate ?? void 0
|
|
576
605
|
};
|
|
577
606
|
}
|
|
578
607
|
async function runAutoUpdateCommand(params) {
|
|
@@ -5,10 +5,10 @@ import { currentOperationId, init_operation_context } from "../infra/operation-c
|
|
|
5
5
|
import { afterSqliteCommit, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
6
6
|
import { ExtensionCapabilityBindingsSchema, extensionCapabilityPermissions } from "../../packages/gateway-contract/src/extension-capabilities.js";
|
|
7
7
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
8
|
+
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
8
9
|
import { init_paths, resolveExtensionsDir } from "../config/paths.js";
|
|
9
10
|
import { slugifyProjectName } from "../projects/project-store.js";
|
|
10
11
|
import { LocalAppStore } from "./store.js";
|
|
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
14
|
import { buildLocalAppFixGuidance } from "./fix-guidance.js";
|
|
@@ -5,8 +5,8 @@ import { PersonalProactiveMessageSchema } from "../../../packages/gateway-contra
|
|
|
5
5
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
6
6
|
import { init_session_instance_repository, readCurrentTranscriptId } from "../../storage/sqlite/session-instance-repository.js";
|
|
7
7
|
import { appendTranscriptEntry, init_transcript_repository } from "../../storage/sqlite/transcript-repository.js";
|
|
8
|
-
import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
|
|
9
8
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
9
|
+
import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
|
|
10
10
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
11
11
|
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
12
12
|
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
|
|
@@ -2,12 +2,12 @@ import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
|
2
2
|
import { getSqliteDatabase } from "../storage/sqlite/transaction.js";
|
|
3
3
|
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
4
4
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
5
|
-
import { isKnowledgeCurrent, knowledgeItemAllowed, listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
6
|
-
import { resolveUserContextSessionAccess } from "../user-context/access-policy.js";
|
|
7
|
-
import "../knowledge-memory/index.js";
|
|
8
5
|
import { resolveEffectiveAgentConfig } from "../agent-config/resolver.js";
|
|
9
6
|
import { init_agent_config } from "../agent-config/index.js";
|
|
10
7
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
8
|
+
import { isKnowledgeCurrent, knowledgeItemAllowed, listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
9
|
+
import { resolveUserContextSessionAccess } from "../user-context/access-policy.js";
|
|
10
|
+
import "../knowledge-memory/index.js";
|
|
11
11
|
import { getActiveAssertionForSlot } from "../user-model/repository.js";
|
|
12
12
|
import { getProjectForSession } from "../projects/workspace.js";
|
|
13
13
|
import { canUseAssertion } from "../user-model/usage-policy.js";
|
|
@@ -17,6 +17,6 @@ export declare class PersonalReplyComposer {
|
|
|
17
17
|
private readonly compose;
|
|
18
18
|
private readonly timeoutMs;
|
|
19
19
|
constructor(compose?: typeof completeReply, timeoutMs?: number);
|
|
20
|
-
drain(notify: (conversationId: string, deliveryId: string) => void
|
|
20
|
+
drain(notify: (conversationId: string, deliveryId: string) => void | Promise<void>, isAvailable?: (conversationId: string) => boolean): Promise<void>;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -286,7 +286,14 @@ var PersonalReplyComposer = class {
|
|
|
286
286
|
})) return;
|
|
287
287
|
}
|
|
288
288
|
emitSessionTranscriptUpdate({ conversationId: packet.delivery.conversationId });
|
|
289
|
-
|
|
289
|
+
const notificationLease = setInterval(() => {
|
|
290
|
+
db.prepare("UPDATE task_result_deliveries SET reply_lease_until = ? WHERE delivery_id = ? AND reply_lease_token = ?").run(Date.now() + this.timeoutMs + 5e3, row.delivery_id, row.lease_token);
|
|
291
|
+
}, 5e3);
|
|
292
|
+
try {
|
|
293
|
+
await notify(packet.delivery.conversationId, `reply:${packet.delivery.deliveryId}`);
|
|
294
|
+
} finally {
|
|
295
|
+
clearInterval(notificationLease);
|
|
296
|
+
}
|
|
290
297
|
db.prepare("UPDATE task_result_deliveries SET reply_notified_at = ?, reply_lease_until = 0 WHERE delivery_id = ?").run(Date.now(), row.delivery_id);
|
|
291
298
|
if (packet.requestId) db.prepare("UPDATE personal_requests SET notified_at = ? WHERE request_id = ?").run(Date.now(), packet.requestId);
|
|
292
299
|
} catch (err) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
2
2
|
import { init_session_repository, patchSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
3
3
|
import { init_config_repository, setSessionConfig } from "../storage/sqlite/config-repository.js";
|
|
4
|
-
import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
|
|
5
4
|
import { ResponsePreferencesSchema } from "../agent-config/schema.js";
|
|
6
5
|
import { init_agent_config } from "../agent-config/index.js";
|
|
7
6
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
7
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
8
|
+
import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
|
|
8
9
|
import { getAvailableModels, init_providers } from "../providers/index.js";
|
|
9
10
|
import { DEFAULT_PERSONAL_PREFERENCES, getPersonalAgent, personalAgentId } from "./repository.js";
|
|
10
11
|
import { PERSONAL_MAIN_TOOL_IDS, PERSONAL_READ_TOOL_ALIASES } from "./policy.js";
|
|
11
12
|
import { getModelThinking } from "../providers/model-thinking.js";
|
|
12
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
13
13
|
import { personalInstructions, upgradePersonalInstructions } from "./prompts.js";
|
|
14
14
|
import { completePersonalOnboarding } from "./onboarding.js";
|
|
15
15
|
import { z } from "zod";
|
|
@@ -120,22 +120,12 @@ async function provisionPersonalAgent(service, ownerId, requestedModel, availabl
|
|
|
120
120
|
mode: "replace",
|
|
121
121
|
include: []
|
|
122
122
|
},
|
|
123
|
-
runtime: { thinkingLevel: "off" },
|
|
124
123
|
models: { chat: {
|
|
125
124
|
primary: chosen.id,
|
|
126
125
|
fallbacks: []
|
|
127
126
|
} }
|
|
128
127
|
});
|
|
129
|
-
else if (existing.provisioningState !== "ready"
|
|
130
|
-
models: { chat: {
|
|
131
|
-
primary: chosen.id,
|
|
132
|
-
fallbacks: []
|
|
133
|
-
} },
|
|
134
|
-
runtime: {
|
|
135
|
-
...existing.runtime,
|
|
136
|
-
thinkingLevel: "off"
|
|
137
|
-
}
|
|
138
|
-
});
|
|
128
|
+
else if (existing.provisioningState !== "ready") await catalog.update(agentId, {});
|
|
139
129
|
const record = getPersonalAgent(ownerId);
|
|
140
130
|
if (!record) throw new Error("Personal Agent provisioning did not complete");
|
|
141
131
|
const conversationId = record.conversationId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths_state, resolveXopcCloudCatalogCachePath } from "../config/paths-state.js";
|
|
3
|
-
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
4
3
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
|
+
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
5
5
|
import { ImageGenerationCapabilitiesSchema, init_models_json } from "../config/models-json.js";
|
|
6
6
|
import { voiceManifestSchema } from "../../packages/realtime-protocol/src/voice-catalog.js";
|
|
7
7
|
import { init_voice } from "../../packages/realtime-protocol/src/voice.js";
|
|
@@ -180,7 +180,7 @@ function addOpenAIHistoryBreakpoint(items) {
|
|
|
180
180
|
};
|
|
181
181
|
return next;
|
|
182
182
|
}
|
|
183
|
-
if (!("content" in item)) continue;
|
|
183
|
+
if (item.role === "system" || item.role === "developer" || !("content" in item)) continue;
|
|
184
184
|
if (index === next.length - 1 && item.role === "user") continue;
|
|
185
185
|
const content = addBreakpointToContent(item.content);
|
|
186
186
|
if (content === item.content) continue;
|
|
@@ -198,30 +198,25 @@ function applyOpenAIExplicitCache(payload, context, cacheKey) {
|
|
|
198
198
|
const split = splitPromptCacheBoundary(context.systemPrompt ?? "");
|
|
199
199
|
const stablePrompt = split?.stablePrefix ?? stripPromptCacheBoundary(context.systemPrompt ?? "");
|
|
200
200
|
const dynamicPrompt = split?.dynamicSuffix ?? "";
|
|
201
|
-
const stableContent = [{
|
|
202
|
-
type: "input_text",
|
|
203
|
-
text: stablePrompt,
|
|
204
|
-
prompt_cache_breakpoint: { mode: "explicit" }
|
|
205
|
-
}];
|
|
206
|
-
const dynamicContent = [{
|
|
207
|
-
type: "input_text",
|
|
208
|
-
text: dynamicPrompt
|
|
209
|
-
}];
|
|
210
201
|
if (Array.isArray(record.input)) {
|
|
211
|
-
const
|
|
212
|
-
const
|
|
202
|
+
const input = [...record.input];
|
|
203
|
+
const initialMessage = asRecord(input[0]);
|
|
204
|
+
const content = initialMessage?.content;
|
|
205
|
+
const initialText = typeof content === "string" ? content : Array.isArray(content) && content.length === 1 && asRecord(content[0])?.type === "input_text" ? asRecord(content[0])?.text : void 0;
|
|
206
|
+
if ((initialMessage?.role === "system" || initialMessage?.role === "developer") && initialText === stripPromptCacheBoundary(context.systemPrompt ?? "") && stablePrompt) input[0] = {
|
|
207
|
+
...initialMessage,
|
|
208
|
+
content: [{
|
|
209
|
+
type: "input_text",
|
|
210
|
+
text: stablePrompt,
|
|
211
|
+
prompt_cache_breakpoint: { mode: "explicit" }
|
|
212
|
+
}, ...dynamicPrompt ? [{
|
|
213
|
+
type: "input_text",
|
|
214
|
+
text: dynamicPrompt
|
|
215
|
+
}] : []]
|
|
216
|
+
};
|
|
213
217
|
return {
|
|
214
218
|
...record,
|
|
215
|
-
|
|
216
|
-
type: "message",
|
|
217
|
-
role: "system",
|
|
218
|
-
content: stableContent
|
|
219
|
-
}, ...dynamicPrompt ? [{
|
|
220
|
-
type: "message",
|
|
221
|
-
role: "system",
|
|
222
|
-
content: dynamicContent
|
|
223
|
-
}] : []] } : {},
|
|
224
|
-
input: addOpenAIHistoryBreakpoint(record.input),
|
|
219
|
+
input: addOpenAIHistoryBreakpoint(input),
|
|
225
220
|
prompt_cache_key: cacheKey,
|
|
226
221
|
prompt_cache_options: {
|
|
227
222
|
mode: "explicit",
|
|
@@ -259,6 +254,7 @@ function preparePromptCacheContext(model, context) {
|
|
|
259
254
|
}
|
|
260
255
|
function withPromptCachePayloadTransform(model, context, options, policyInput) {
|
|
261
256
|
const plan = buildPromptCachePlan(model, context, policyInput, options?.reasoning);
|
|
257
|
+
if (plan.providerMode === "explicit" && model.provider === "openai" && model.baseUrl === "https://api.openai.com/v1" && options?.apiKey !== void 0 && !options.apiKey.startsWith("sk-")) plan.providerMode = "implicit";
|
|
262
258
|
const upstream = options?.onPayload;
|
|
263
259
|
const cacheRetention = model.api === "anthropic-messages" || model.api === "bedrock-converse-stream" ? plan.providerMode === "none" ? "none" : plan.policy.lifetime : "none";
|
|
264
260
|
return {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_account_id, normalizeAccountId } from "./account-id.js";
|
|
3
|
+
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
3
4
|
import { getConversationRouting } from "../storage/sqlite/conversation-repository.js";
|
|
4
5
|
import { init_agent_session_key, resolveAgentPeerConversationId } from "./agent-session-key.js";
|
|
5
6
|
import { init_session_key, resolveConversationId } from "./session-key.js";
|
|
6
|
-
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
7
7
|
import { init_bindings, parseBindingRules, resolveRoute as resolveRoute$1 } from "./bindings.js";
|
|
8
8
|
//#region src/routing/resolve-route.ts
|
|
9
9
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { validateConversationId } from "../../packages/gateway-contract/src/conversation-identity.js";
|
|
2
2
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
3
|
-
import { init_agent_session_key, normalizeAgentId } from "./agent-session-key.js";
|
|
4
3
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
5
4
|
import { init_agent_scope, listAgentEntries, resolveAgentIdByWorkspacePath, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
5
|
+
import { init_agent_session_key, normalizeAgentId } from "./agent-session-key.js";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
//#region src/routing/resolve-tui-session-key.ts
|
|
8
8
|
init_src();
|
|
@@ -3,7 +3,6 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { requireXopcDatabase } from "../storage/sqlite/connection.js";
|
|
4
4
|
import { deleteSessionConfig, getSessionConfig, hasSessionConfig, setSessionConfig, updateSessionConfig } from "../storage/sqlite/config-repository.js";
|
|
5
5
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
6
|
-
import { syncPersonalModelConfig } from "../personal-agent/model-config.js";
|
|
7
6
|
//#region src/session/config-store.ts
|
|
8
7
|
init_sqlite();
|
|
9
8
|
init_logger();
|
|
@@ -22,7 +21,7 @@ var SessionConfigStore = class {
|
|
|
22
21
|
}
|
|
23
22
|
async get(conversationId) {
|
|
24
23
|
this.requireDatabase();
|
|
25
|
-
return
|
|
24
|
+
return getSessionConfig(conversationId);
|
|
26
25
|
}
|
|
27
26
|
async set(conversationId, config) {
|
|
28
27
|
this.requireDatabase();
|
|
@@ -5,8 +5,8 @@ import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
|
5
5
|
import { init_gateway_scopes } from "../../gateway/security/gateway-scopes.js";
|
|
6
6
|
import { createDevice, getDevice, init_device_access_repository, registerInitialDeviceRefreshToken, revokeDevice } from "./device-access-repository.js";
|
|
7
7
|
import { getOrCreateGatewayIdentity, init_gateway_identity_repository } from "./gateway-identity-repository.js";
|
|
8
|
-
import { browserEnrollmentPublicKeyThumbprint } from "../../browser/enrollment.js";
|
|
9
8
|
import "../../browser/extension-identity.js";
|
|
9
|
+
import { browserEnrollmentPublicKeyThumbprint } from "../../browser/enrollment.js";
|
|
10
10
|
import crypto from "node:crypto";
|
|
11
11
|
//#region src/storage/sqlite/device-pairing-approval.ts
|
|
12
12
|
init_src();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Personal thinking preferences belong to the dedicated conversation, not its Agent.
|
|
2
|
+
INSERT INTO session_config (conversation_id, thinking_level, updated_at)
|
|
3
|
+
SELECT s.conversation_id, json_extract(a.overrides_json, '$.runtime.thinkingLevel'),
|
|
4
|
+
MAX(a.updated_at, s.updated_at)
|
|
5
|
+
FROM sessions s JOIN agents a ON a.id = s.agent_id
|
|
6
|
+
WHERE json_extract(s.custom_data_json, '$.personalAgent') = 1
|
|
7
|
+
AND json_type(a.overrides_json, '$.runtime.thinkingLevel') = 'text'
|
|
8
|
+
ON CONFLICT(conversation_id) DO UPDATE SET
|
|
9
|
+
thinking_level = COALESCE(session_config.thinking_level, excluded.thinking_level),
|
|
10
|
+
updated_at = CASE WHEN session_config.thinking_level IS NULL
|
|
11
|
+
THEN MAX(session_config.updated_at + 1, excluded.updated_at) ELSE session_config.updated_at END;
|
|
12
|
+
|
|
13
|
+
UPDATE agents SET
|
|
14
|
+
overrides_json = json_remove(overrides_json, '$.runtime.thinkingLevel'),
|
|
15
|
+
revision = revision + 1,
|
|
16
|
+
updated_at = MAX(updated_at + 1, CAST(unixepoch('subsec') * 1000 AS INTEGER))
|
|
17
|
+
WHERE id IN (SELECT agent_id FROM sessions WHERE json_extract(custom_data_json, '$.personalAgent') = 1)
|
|
18
|
+
AND json_type(overrides_json, '$.runtime.thinkingLevel') IS NOT NULL;
|
|
19
|
+
|
|
20
|
+
UPDATE agent_catalog_settings SET revision = revision + 1,
|
|
21
|
+
updated_at = MAX(updated_at + 1, CAST(unixepoch('subsec') * 1000 AS INTEGER))
|
|
22
|
+
WHERE singleton_id = 1 AND changes() > 0;
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 246;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -59,7 +59,7 @@ function applySingleMigration(db, migration, discardOldScenes = false) {
|
|
|
59
59
|
function applyPendingMigrations(db, options = {}) {
|
|
60
60
|
db.function("xopc_memory_search_text", { deterministic: true }, (value) => memorySearchText(String(value ?? "")));
|
|
61
61
|
db.function("xopc_operation_id", () => currentOperationId() ?? null);
|
|
62
|
-
const targetVersion = options.targetVersion ??
|
|
62
|
+
const targetVersion = options.targetVersion ?? 246;
|
|
63
63
|
let currentVersion = readSchemaVersion(db);
|
|
64
64
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
65
65
|
if (!options.migrationsDir && currentVersion < 165) throw new DatabaseSchemaTooOldError(currentVersion, 165);
|
|
@@ -97,7 +97,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
97
97
|
}
|
|
98
98
|
/** Inspect schema version without mutating the database. */
|
|
99
99
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
100
|
-
const appVersion = options.targetVersion ??
|
|
100
|
+
const appVersion = options.targetVersion ?? 246;
|
|
101
101
|
const dbVersion = readSchemaVersion(db);
|
|
102
102
|
if (dbVersion > appVersion) return {
|
|
103
103
|
dbVersion,
|
|
@@ -140,7 +140,7 @@ var init_runner = __esmMin((() => {
|
|
|
140
140
|
init_errors();
|
|
141
141
|
log = createLogger("Sqlite:Migrations");
|
|
142
142
|
XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
143
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
143
|
+
XOPC_DB_SCHEMA_VERSION = 246;
|
|
144
144
|
}));
|
|
145
145
|
//#endregion
|
|
146
146
|
init_runner();
|