@xopcai/xopc 0.0.375 → 0.0.376
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-CvR3rjdp.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B2Popl59.js → agent-avatar-dicebear-B6OsxiBw.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-MB_QmjX-.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-Bpcf0zhP.js +1 -0
- package/dist/gateway/static/root/assets/agents-BQ7ag_R3.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-B4tgTbWG.js → agents-admin-api-DsXvJeqd.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DNkXIPxK.js → app-management-settings-panel-9JzhRHSD.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-p1_NpH8a.js → appearance-settings-CoyZuGAt.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CP2u5iEh.js → apps-page-CcbCxZaw.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-bI9OLnXj.js → archive-plugin-kfDRSd7K.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CjYiGOov.js → automations-page-DZJKbmlm.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-ChKT1JN6.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-dOwLzjeH.js → binary-plugins-d4QP_iyy.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DiOou1HO.js → block-editor-DraiSml9.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-automation-inputs-i7h1Svpf.js → browser-automation-inputs-BAiaU9gl.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-Bo40qRor.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-Dg4S7ph5.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-D4KFLtqM.js → capabilities-B-vsqiw2.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-CquUV0DP.js → capabilities-DQEeiNq_.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-CuHSjBDG.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-bxxADxzW.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-AeBubNQK.js → capability-header-actions-CaH0L2sV.js} +1 -1
- package/dist/gateway/static/root/assets/channels-Drx78hEY.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DrVlbq_P.js → chat-terminal-dock-hZnKhClF.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-TUzZnurj.js → computer-settings-page-CYEA9B-G.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BlpwjGW7.js → connector-service-page-DXi2Bx2u.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BCWPY5hs.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CjKRpA8X.js → date-picker-BW_xBw2L.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-J9_0obij.js → dependency-picker-ByRPupfC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DySwgreF.js → desktop-pet-DTcVMPlC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B1-oyKBG.js → desktop-pet-settings-BkMP5pdR.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-C5rjPAyc.js → device-pairing-wizard-5kYuK9oW.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BY7MwiZd.js → directory-picker-path-field-DIYIejyX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CbgEonkK.js → extension-debug-page-QCUvXcP2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-JoSFhfb6.js → extension-page-BMeQveJ_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-DxlAZ2iy.js → extension-provider-CDOEBj7F.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B7LtTNx7.js → extension-settings-page-D-M7P4HQ.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-DKSWcBt_.js → fallback-models-5DaUVrLS.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BoRkBnsw.js → gateway-config-swr-CWIVt5XM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-C3WQQY10.js → gateway-realtime-DC8N3fNU.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BkE2mHog.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-DK2NzPkL.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-TYSQEQcG.js → gateway-startup-retry-pVqdX0dO.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-A3oTV3Vq.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-_pKiNfSq.js → image-generation-api-CX6__We2.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DS_RFtWf.js → imports-page-b0ILSTz1.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cz75qf5b.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BxwXR2qA.js → keyboard-shortcuts-settings-DGl7wSHG.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BWd4RMBE.js → local-app-workbench-page--W2QjBqz.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BsgcA6-N.js → local-apps-page-8SQ85WLr.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Cg9RdsNN.js → local-session-drafts-LCEmswHW.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-rWFLl-p4.js → locale-store-UEl-U1DO.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BAQeHGd4.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-CZAZwCpE.js → management-settings-DoXDsSSN.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BHFFusQs.js → markdown-view-DUo9Tl3H.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BVPTMWJI.js → media-plugins-8zr2wlMR.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-C1SUo4gG.js → messages-Uqz0xpsK.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-cache-3HOFy11k.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Cg65uYJ3.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-CSLVCZBn.js → notes-api-bDQOslzF.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-DDUlWJOk.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-o-i2_7Jz.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-E9-LBR1_.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CBnKsW4p.js → product-open-page-DWgjStlK.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-B0gGexdG.js → product-preview-content-BWQRI242.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-ZjQSv_NG.js → project-detail-page-FjGobz6n.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Bf7Sd_Ck.js → projects-page-CVhXJp7f.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CoMBYjHD.js → registry-api-CftkuRz7.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B2AcKWlb.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CQZ1c-re.js → runtime-tools-settings-panel-DmOfq9ay.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-1xGRBOJO.js → scenes-page-QQ2CiTee.js} +2 -2
- package/dist/gateway/static/root/assets/schema-form-TbUx_9NF.js +1 -0
- package/dist/gateway/static/root/assets/{send-session-input-CLhR1uEp.js → send-session-input-D4c72mD6.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-u_4_kFQt.js → session-api-DtpzfFNw.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-De46GeR0.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-CquSXQHo.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BOHKIN4t.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CSqi5fmN.js → settings-page-NncRVc1e.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-t1vcGUsK.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-XhiuPKF4.js → share-link-dialog-DGUiTTZ3.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Vc0TQuZ8.js → share-preview-page-BDl6XGKm.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-BVSb1vh4.js → shares-api-BIx5ji2U.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DVM6xJuW.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CFtEHy5e.js → skill-api-Crld1PEV.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BsLx_FXd.js → skill-reload-api-D2HAboLP.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DdD6C_Z8.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DBMR9ks_.js → system-settings-panel-DUro5X0b.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CGe34vxR.js → task-detail-page-BYNcWubZ.js} +2 -2
- package/dist/gateway/static/root/assets/{task-expandable-content-DxeBTJvh.js → task-expandable-content-BKa2YEJy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-KcQhCg1-.js → theme-store-ByAapAD7.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-Dv-XBvpD.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-CzNIlgdJ.js → tunnel-api-C2_SEpMa.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-O3abwewp.js → usage-page-CqMzyGiK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C-IWxbzm.js → use-autosave-BhsYFV0o.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Dxphaxk-.js → use-composer-attachments-Bv4umde0.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-Du37Gofn.js → use-file-preview-expanded-CBVymo3h.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-EMn_nA9w.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-7BImy8Jc.js → voice-api-key-field-DRoGFFs6.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-6MINytQl.js → voice-config-api-BwLiaw5J.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D967-fVj.js → work-discovery-overlay-DbH62mtI.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BJ945m7G.js → workflow-run-setup-panel-BYfytB9q.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-rJqJ9dQo.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-CXiyhTwv.js → workspace-api-BHy2a_hm.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Bq9ubffP.js → xopc-cloud-account-card-DrAX_9m_.js} +1 -1
- package/dist/gateway/static/root/index.html +26 -26
- 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/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/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/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/onboard.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/lib/config-payload.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.js +17 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- 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 +2 -2
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.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-CgvOIDy_.js +0 -106
- package/dist/gateway/static/root/assets/logs-page-CLP5pu2j.js +0 -2
- 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
|
@@ -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,10 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
4
3
|
import { homePatternKey } from "./strategy.js";
|
|
5
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
6
4
|
import { HomeIntelligenceRepository } from "./repository.js";
|
|
7
5
|
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
6
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
7
|
+
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
8
8
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
//#region src/home-intelligence/host.ts
|
|
@@ -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";
|
|
@@ -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";
|
|
@@ -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();
|
|
@@ -2,10 +2,10 @@ import { ProductReadContracts } from "../../../packages/gateway-contract/src/cap
|
|
|
2
2
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { TaskRepository, init_task_repository } from "../task-repository.js";
|
|
4
4
|
import { TaskRunRepository, init_task_run_repository } from "../task-run-repository.js";
|
|
5
|
-
import { TaskConversationRepository } from "../task-conversation-repository.js";
|
|
6
|
-
import { TaskReadModelProjector } from "../task-read-model-projector.js";
|
|
7
5
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
8
6
|
import { defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
7
|
+
import { TaskConversationRepository } from "../task-conversation-repository.js";
|
|
8
|
+
import { TaskReadModelProjector } from "../task-read-model-projector.js";
|
|
9
9
|
import { TaskContextRepository } from "../task-context-repository.js";
|
|
10
10
|
import { TaskDependencyService } from "../task-dependency-service.js";
|
|
11
11
|
import { TaskCriterionReviewRepository } from "../task-criterion-review-repository.js";
|
|
@@ -2,9 +2,9 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { TaskRepository, init_task_repository } from "./task-repository.js";
|
|
4
4
|
import { TaskRunRepository, init_task_run_repository } from "./task-run-repository.js";
|
|
5
|
-
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
6
5
|
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
7
6
|
import { init_agent_scope, listAgentEntries } from "../agent/agent-scope.js";
|
|
7
|
+
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
8
8
|
import { TaskConversationRepository } from "./task-conversation-repository.js";
|
|
9
9
|
import { TaskContextRepository } from "./task-context-repository.js";
|
|
10
10
|
//#region src/tasks/task-handoff-service.ts
|
|
@@ -8,9 +8,10 @@ import { cancelQueuedSessionInput, claimNextSessionInput, finishSessionInputRun,
|
|
|
8
8
|
import { appendComposerInputHistory, listComposerInputHistory } from "../../storage/sqlite/composer-input-history-repository.js";
|
|
9
9
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
10
10
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
11
|
-
import { init_agent_session_key, resolveAgentIdFromConversationId } from "../../routing/agent-session-key.js";
|
|
12
11
|
import { normalizeAgentId } from "../../agent-catalog/id.js";
|
|
13
12
|
import { init_agent_scope, listAgentEntries } from "../../agent/agent-scope.js";
|
|
13
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
14
|
+
import { init_agent_session_key, resolveAgentIdFromConversationId } from "../../routing/agent-session-key.js";
|
|
14
15
|
import { resolveEffectiveAgentProfile } from "../../config/agent-profile.js";
|
|
15
16
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
16
17
|
import { init_paths } from "../../config/paths.js";
|
|
@@ -23,7 +24,6 @@ import { buildSessionTimeline } from "../../session/transcript-outline.js";
|
|
|
23
24
|
import { transcriptRowsToClientHistory } from "../../session/client-history.js";
|
|
24
25
|
import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
|
|
25
26
|
import { evictEmbeddedSessionRunner } from "../../agent/embedded/session-runner.js";
|
|
26
|
-
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
27
27
|
import { SessionIndex } from "../../session/manager.js";
|
|
28
28
|
import "../../session/index.js";
|
|
29
29
|
import { parseModelRef } from "../../agent/models/selection.js";
|
|
@@ -81,7 +81,7 @@ function connect(url, token, signal, onEvent, onFailure) {
|
|
|
81
81
|
response.once("aborted", reject);
|
|
82
82
|
});
|
|
83
83
|
socket.on("error", fail);
|
|
84
|
-
socket.on("close", () => fail(
|
|
84
|
+
socket.on("close", (code, reason) => fail(new PlatformVoiceError(`Platform voice disconnected before completion (close ${code}${reason.length ? `: ${reason.toString("utf8").slice(0, 256)}` : ""})`, void 0, "provider_disconnected")));
|
|
85
85
|
return {
|
|
86
86
|
socket,
|
|
87
87
|
close,
|
|
@@ -43,6 +43,7 @@ function createAgentVoiceEngine(options) {
|
|
|
43
43
|
let pendingTurn;
|
|
44
44
|
let turnReceivedAtMs;
|
|
45
45
|
let taskUpdateQueued = false;
|
|
46
|
+
const deliveredReplies = /* @__PURE__ */ new Set();
|
|
46
47
|
let lastUserSpeechAt = 0;
|
|
47
48
|
let openingInputSeen = false;
|
|
48
49
|
const turn = new TurnCoordinator(claim.silenceDurationMs, (text, decision, turnId) => {
|
|
@@ -314,7 +315,7 @@ function createAgentVoiceEngine(options) {
|
|
|
314
315
|
if (response.speechWorker) prefetchNextSpeech(response);
|
|
315
316
|
else startSpeechWorker(response);
|
|
316
317
|
}
|
|
317
|
-
async function runAssistantTurn(text, turnId, updateClientMessageId, receivedAtMs = Date.now(), committedAtMs = receivedAtMs, opening) {
|
|
318
|
+
async function runAssistantTurn(text, turnId, updateClientMessageId, receivedAtMs = Date.now(), committedAtMs = receivedAtMs, opening, directReply = false) {
|
|
318
319
|
if (!claim.tts || !claim.request.conversationId || !text.trim() || closed) return false;
|
|
319
320
|
cancelActiveResponse("barge_in");
|
|
320
321
|
const response = {
|
|
@@ -337,7 +338,7 @@ function createAgentVoiceEngine(options) {
|
|
|
337
338
|
taskDone: false,
|
|
338
339
|
pcm: new PcmFrameBuffer()
|
|
339
340
|
};
|
|
340
|
-
const taskUpdateExposed = () => Boolean(updateClientMessageId && response.text.trim());
|
|
341
|
+
const taskUpdateExposed = () => directReply ? response.firstFrameSent : Boolean(updateClientMessageId && response.text.trim());
|
|
341
342
|
activeResponse = response;
|
|
342
343
|
send("response.created", { responseId: response.id });
|
|
343
344
|
if (opening) response.openingTimer = setTimeout(() => {
|
|
@@ -364,14 +365,14 @@ function createAgentVoiceEngine(options) {
|
|
|
364
365
|
}, (error) => ({ error }));
|
|
365
366
|
await interruptionWrites;
|
|
366
367
|
if (response.abortController.signal.aborted || closed) return taskUpdateExposed();
|
|
367
|
-
if (opening) {
|
|
368
|
+
if (opening || directReply) {
|
|
368
369
|
response.text = text;
|
|
369
370
|
response.firstTextAtMs = Date.now();
|
|
370
371
|
send("response.text.delta", {
|
|
371
372
|
responseId: response.id,
|
|
372
373
|
delta: text
|
|
373
374
|
});
|
|
374
|
-
queuePhrases(response, [text]);
|
|
375
|
+
queuePhrases(response, directReply ? response.segmenter.push(text) : [text]);
|
|
375
376
|
} else {
|
|
376
377
|
if (!claim.conversationSessionId) throw new Error("Conversation identity is unavailable");
|
|
377
378
|
const task = await options.runtime.agentBroker.delegate({
|
|
@@ -487,7 +488,7 @@ function createAgentVoiceEngine(options) {
|
|
|
487
488
|
});
|
|
488
489
|
if (opening) opening.result = response.audioStarted ? "completed" : "failed";
|
|
489
490
|
activeResponse = void 0;
|
|
490
|
-
return !updateClientMessageId || taskUpdateExposed();
|
|
491
|
+
return directReply ? response.firstFrameSent : !updateClientMessageId || taskUpdateExposed();
|
|
491
492
|
} catch (error) {
|
|
492
493
|
if (response.abortController.signal.aborted || closed) return taskUpdateExposed();
|
|
493
494
|
log.warn({
|
|
@@ -694,6 +695,21 @@ function createAgentVoiceEngine(options) {
|
|
|
694
695
|
}
|
|
695
696
|
return {
|
|
696
697
|
isConversationIdle,
|
|
698
|
+
offerReply(input) {
|
|
699
|
+
if (deliveredReplies.has(input.deliveryId)) return Promise.resolve(true);
|
|
700
|
+
if (taskUpdateQueued || !canOfferTaskUpdateInput() || !input.text.trim() || input.text.length > 32e3 || deliveredReplies.size >= 256) return Promise.resolve(false);
|
|
701
|
+
taskUpdateQueued = true;
|
|
702
|
+
const attempt = conversationTail.then(async () => {
|
|
703
|
+
if (!canOfferTaskUpdateInput() || options.runtime.sessionBusy(claim.request.conversationId)) return false;
|
|
704
|
+
const delivered = await runAssistantTurn(input.text, input.deliveryId, void 0, Date.now(), Date.now(), void 0, true);
|
|
705
|
+
if (delivered) deliveredReplies.add(input.deliveryId);
|
|
706
|
+
return delivered;
|
|
707
|
+
});
|
|
708
|
+
conversationTail = attempt.then(() => {}, () => {});
|
|
709
|
+
return attempt.finally(() => {
|
|
710
|
+
taskUpdateQueued = false;
|
|
711
|
+
});
|
|
712
|
+
},
|
|
697
713
|
async offerOpeningGreeting(input) {
|
|
698
714
|
if (openingInputSeen || !canOfferTaskUpdateInput() || options.runtime.sessionBusy(claim.request.conversationId)) return "skipped";
|
|
699
715
|
const opening = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_agent_scope, resolveAgentProfileDir } from "../../agent/agent-scope.js";
|
|
2
|
-
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
3
2
|
import { DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
|
|
3
|
+
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
4
4
|
import { loadProfileBootstrapFiles } from "../../agent/bootstrap/load-bootstrap-files.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { statSync } from "node:fs";
|
|
@@ -29,6 +29,11 @@ export declare class VoiceRealtimeRuntime {
|
|
|
29
29
|
hasConversation(conversationId: string): boolean;
|
|
30
30
|
canPublishReply(conversationId: string): boolean;
|
|
31
31
|
canOfferTaskUpdate(conversationId: string): boolean;
|
|
32
|
+
offerReply(input: {
|
|
33
|
+
conversationId: string;
|
|
34
|
+
deliveryId: string;
|
|
35
|
+
text: string;
|
|
36
|
+
}): Promise<boolean>;
|
|
32
37
|
offerTaskUpdate(input: {
|
|
33
38
|
conversationId: string;
|
|
34
39
|
clientMessageId: string;
|
|
@@ -333,6 +333,10 @@ var VoiceRealtimeRuntime = class {
|
|
|
333
333
|
const sessionId = this.conversationReservations.get(conversationId);
|
|
334
334
|
return (sessionId ? this.activeSessions.get(sessionId) : void 0)?.engine?.canOfferTaskUpdate?.() === true;
|
|
335
335
|
}
|
|
336
|
+
async offerReply(input) {
|
|
337
|
+
const sessionId = this.conversationReservations.get(input.conversationId);
|
|
338
|
+
return (sessionId ? this.activeSessions.get(sessionId) : void 0)?.engine?.offerReply?.(input) ?? false;
|
|
339
|
+
}
|
|
336
340
|
async offerTaskUpdate(input) {
|
|
337
341
|
const sessionId = this.conversationReservations.get(input.conversationId);
|
|
338
342
|
const session = sessionId ? this.activeSessions.get(sessionId) : void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.376",
|
|
4
4
|
"description": "Local-first personal AI with Ada, task delegation, files, projects, workflows, and automations. Use cloud or local models.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -166,11 +166,11 @@
|
|
|
166
166
|
"vitest": "4.1.5",
|
|
167
167
|
"vue": "^3.5.35",
|
|
168
168
|
"@xopcai/browser-control-contract": "0.1.0",
|
|
169
|
-
"@xopcai/
|
|
169
|
+
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
170
170
|
"@xopcai/endpoint-tools-protocol": "0.0.0",
|
|
171
171
|
"@xopcai/image-providers": "0.1.0",
|
|
172
|
+
"@xopcai/computer-control-contract": "0.1.0",
|
|
172
173
|
"@xopcai/gateway-contract": "0.0.0",
|
|
173
|
-
"@xopcai/endpoint-tools-client": "0.0.0",
|
|
174
174
|
"@xopcai/realtime-client": "0.0.0",
|
|
175
175
|
"@xopcai/realtime-protocol": "0.0.0"
|
|
176
176
|
},
|