@xopcai/xopc 0.0.359 → 0.0.361
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-CnmHVy1D.js → activity-store-tpFInIoh.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D-yhlYSG.js → agent-avatar-dicebear-DUhFW_Go.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BNILmgey.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CnWci4JJ.js +1 -0
- package/dist/gateway/static/root/assets/agents-CKS5LUUs.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-BtnYiq7O.js → agents-admin-api-CiAjB2iQ.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CiSdkzuX.js → app-management-settings-panel-DEig00YU.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-SdlCHKg8.js → appearance-settings-CccnRRrL.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-ntyBe6mP.js → apps-page-CkT6UNZW.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-DZCN9m71.js → archive-plugin-CIlmZBe5.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DU0R5C65.js → automations-page-8kZugDcf.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-3V54ShL0.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-U63xxRgh.js → binary-plugins-BuQiee_b.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CLejMPkV.js → block-editor-BFFRbsKX.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-MmkUGn9W.js → browser-automation-inputs-CWujpdCx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BjGswNM0.js → browser-automations-page-HVXiBKXE.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DpxAXNvM.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-BXG_5wIg.js → capabilities-CngwB2JU.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Bigu28Z6.js → capabilities-RMlKKfGF.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-BBi4ef3u.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-IxszGl-Q.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-B0Xiav_-.js → capability-header-actions-BLOIJvIZ.js} +1 -1
- package/dist/gateway/static/root/assets/channels-Ced5nFBc.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C9pMFB6k.js → chat-terminal-dock-BskUzDCS.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-De-pjlvn.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-OyQKwHNr.js → connector-service-page-Qc1mVfp9.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CPqeY1x5.js +2 -0
- package/dist/gateway/static/root/assets/{constants-Co2_smKQ.js → constants-Dy8Gw0sF.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-DxGsweV_.js → date-picker-7ppMIGfQ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D9ZfAJwn.js → dependency-picker-DfYC22si.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DFgK1z5i.js → desktop-pet-GKEfqHDF.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CyFW0raW.js → desktop-pet-settings-qoFZBKe9.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-C6Co5dT3.js → device-pairing-wizard-D8sTDd5s.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-2nrl6Exh.js → directory-picker-path-field-BC87CZa2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BodxNAys.js → extension-debug-page-VxCq29jC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMb2YFlb.js → extension-page-DypBVBTt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-aigS3RJu.js → extension-provider-wlvxPese.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D3hvXtxi.js → extension-settings-page-DzzkBN9y.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-DsXySQVF.js → fallback-models-s4qTRcPJ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-EZxaKXdC.js → gateway-config-swr-ZM72jovc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DBRa17u3.js → gateway-realtime-B-hrykag.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-B6B1fw_K.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-CubM1m6Z.js → gateway-settings--M7ZH_37.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Wtxq_y2f.js → gateway-startup-retry-DjWuTj8B.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-KFs5suD1.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Bnl0CH4n.js → image-generation-api-C9cwrqCr.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Czzsa_Eu.js → imports-page-BKy0ImXk.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DUgsBdV3.css → index-B7AHDHSO.css} +1 -1
- package/dist/gateway/static/root/assets/index-C0JT9Ja4.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DqsFlXlp.js → keyboard-shortcuts-settings-CexiL-Ey.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BcDFXc1k.js → local-app-workbench-page-CcU1OLWQ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BaxqXA1-.js → local-apps-page-BcLijQx4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CeHhcudO.js → local-session-drafts-C7QjBMNp.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-ChN_vjs2.js → locale-store-5sV3dDRG.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DmJjZ0Uk.js → logs-page-48nrZNQe.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-B_gzl_Vh.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DKlJx4eo.js → markdown-view-V0f5NW7D.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-JWzrPQwt.js → media-plugins-_obxSZmT.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CnM6Qfr7.js → messages-CaURu8bb.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-cache-Cs3E5pEA.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-BLvVlQG8.js → note-detail-panel-B9AeX98W.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-api-D8nvWMMC.js → notes-api-CBnMq6Nc.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-CKTTfxw-.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-BXn1a9qx.js → oauth-api-Bu2RoLF2.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-gL3453SU.js → page-context-capture-button-BsxBAWD_.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-Cfl1FR3i.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-Dw8JPizo.js → product-open-page-D1ARqS3r.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-Zg4KZ0vK.js → project-detail-page-Cro1OE8P.js} +1 -1
- package/dist/gateway/static/root/assets/projects-page-CdEmmBCz.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BM_81rLe.js → registry-api-j1rNFkP2.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9_ea_4p.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BLNXzyeh.js → runtime-tools-settings-panel-DtmQbC72.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-D868Zuj9.js → scenes-page-DeFdMf2q.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-5z33VTce.js → schema-form-ByEHHW6n.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-OaBPDJ9E.js → send-session-input-CO_vUCb8.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-UkGomZfv.js → session-api-CYPGi01d.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BdJThQQ6.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-CV0JlaXS.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D9sW0hKa.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-BG_dOYMq.js → settings-page-CHKsZFAN.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DNj1hD_H.js → setup-status-panel-CC58OVOe.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-BvSRHs1P.js → share-link-dialog-ZOdnHkmb.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-M_rAQR60.js → share-preview-page-BPDWUuH_.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DwqLga5H.js → shares-api-T5gR8yqz.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DaXvdH8c.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BBaKs-Xx.js → skill-api-CHCLMcfO.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-C1hzIawD.js → skill-reload-api-C-RoiUJi.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-a9UQQnqn.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DKjsZo49.js → system-settings-panel-Dho_dlBS.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DSvaiKGb.js → task-detail-page-B5JyH4z7.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DTYk7Gll.js → theme-store-CEl74p7l.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DR8Qu6R_.js → tunnel-api-BDqCyf8G.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-CAIqAduR.js → usage-page-DKwKfszc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-R3hEHQQq.js → use-autosave-D09eZTLp.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-CUaywGe0.js → use-composer-attachments-CkvJM8Km.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-D809I8ur.js → use-file-preview-expanded-J3HnG8OH.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-BsgADrGL.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-C-AF-IcO.js → voice-api-key-field-DH-to9Rd.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CxGsCDoW.js → voice-config-api-CmCfVy3H.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-wGFcle2p.js → work-discovery-overlay-x1vZDBhu.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CewS2IbN.js → workflow-run-setup-panel-DGatvmK1.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DgNy6mBQ.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-BtXzxf_w.js → workspace-api-DzPw92Kx.js} +2 -2
- package/dist/gateway/static/root/index.html +29 -30
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/task-result-delivery.js +30 -0
- package/dist/src/agent/context/workspace-templates/SOUL.md +2 -0
- package/dist/src/agent/embedded/run-for-session.js +70 -4
- package/dist/src/agent/external-tools/gateway-tools.js +41 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +13 -0
- package/dist/src/agent/memory/compaction-policy.d.ts +4 -0
- package/dist/src/agent/memory/compaction-policy.js +3 -0
- package/dist/src/agent/memory/idle-compaction-scheduler.d.ts +28 -0
- package/dist/src/agent/memory/idle-compaction-scheduler.js +127 -0
- package/dist/src/agent/prompt/sections/behavior.js +4 -1
- package/dist/src/agent/prompt/sections/memory-skills.js +2 -0
- package/dist/src/agent/service/process-direct-one-shot.js +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -0
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/session/session-config-service.js +11 -3
- package/dist/src/agent/tools/delegation-policy.js +1 -0
- package/dist/src/agent/tools/factory.js +48 -8
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/media-read-tool.d.ts +5 -1
- package/dist/src/agent/tools/media-read-tool.js +44 -5
- package/dist/src/agent/tools/personal-preference-tool.js +11 -0
- package/dist/src/agent/tools/personal-read-tool.d.ts +3 -0
- package/dist/src/agent/tools/personal-read-tool.js +155 -0
- package/dist/src/agent/tools/personal-request-result-tool.d.ts +22 -0
- package/dist/src/agent/tools/personal-request-result-tool.js +84 -0
- package/dist/src/agent/tools/personal-request-tool.d.ts +3 -0
- package/dist/src/agent/tools/personal-request-tool.js +100 -0
- package/dist/src/agent/tools/personal-task-tool.d.ts +6 -0
- package/dist/src/agent/tools/personal-task-tool.js +13 -11
- package/dist/src/agent/tools/read.d.ts +3 -0
- package/dist/src/agent/tools/read.js +26 -8
- package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
- package/dist/src/agent/tools/session-search-tool.js +39 -5
- package/dist/src/agent/tools/tool-media.js +2 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/templates.js +4 -0
- package/dist/src/config/schema.d.ts +10 -0
- package/dist/src/connectors/connection-recovery-service.d.ts +2 -0
- package/dist/src/connectors/connection-recovery-service.js +23 -5
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +10 -0
- package/dist/src/gateway/hono/routes/media.js +4 -3
- package/dist/src/gateway/hono/routes/personal-agent.js +69 -1
- package/dist/src/gateway/hono/routes/sessions.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/service/agent-runner.js +1 -0
- package/dist/src/gateway/service/session-command-service.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
- package/dist/src/gateway/service/session-input-coordinator.js +2 -0
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +45 -4
- package/dist/src/media/index.js +2 -2
- package/dist/src/media/session-references.d.ts +2 -0
- package/dist/src/media/session-references.js +22 -2
- package/dist/src/media/store.d.ts +1 -0
- package/dist/src/media/store.js +7 -2
- package/dist/src/personal-agent/capability-service.d.ts +14 -0
- package/dist/src/personal-agent/capability-service.js +63 -0
- package/dist/src/personal-agent/communication.d.ts +4 -0
- package/dist/src/personal-agent/communication.js +24 -0
- package/dist/src/personal-agent/model-config.d.ts +5 -0
- package/dist/src/personal-agent/model-config.js +59 -0
- package/dist/src/personal-agent/policy.d.ts +1 -1
- package/dist/src/personal-agent/policy.js +6 -0
- package/dist/src/personal-agent/repository.d.ts +1 -0
- package/dist/src/personal-agent/repository.js +3 -1
- package/dist/src/personal-agent/request-delivery.d.ts +4 -0
- package/dist/src/personal-agent/request-delivery.js +159 -0
- package/dist/src/personal-agent/request-repository.d.ts +33 -0
- package/dist/src/personal-agent/request-repository.js +71 -0
- package/dist/src/personal-agent/request-result.d.ts +21 -0
- package/dist/src/personal-agent/request-result.js +45 -0
- package/dist/src/personal-agent/request-service.d.ts +18 -0
- package/dist/src/personal-agent/request-service.js +308 -0
- package/dist/src/personal-agent/service.js +32 -7
- package/dist/src/session/client-history.d.ts +2 -1
- package/dist/src/session/client-history.js +40 -0
- package/dist/src/session/compact-history.js +9 -5
- package/dist/src/session/config-store.js +2 -1
- package/dist/src/session/session-context-for-llm.js +55 -0
- package/dist/src/session/store.d.ts +12 -1
- package/dist/src/session/store.js +35 -0
- package/dist/src/session/types.d.ts +2 -0
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +5 -1
- package/dist/src/storage/sqlite/connection-wait-repository.js +38 -8
- package/dist/src/storage/sqlite/migrations/231_task_result_deliveries.sql +32 -0
- package/dist/src/storage/sqlite/migrations/232_personal_requests.sql +28 -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/storage/sqlite/session-repository.js +33 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -1
- package/dist/src/storage/sqlite/transcript-repository.js +15 -1
- package/dist/src/tasks/task-application-service.d.ts +1 -0
- package/dist/src/tasks/task-application-service.js +7 -0
- package/dist/src/tasks/task-context-assembler.js +1 -0
- package/dist/src/tasks/task-main-update-decision-service.js +1 -1
- package/dist/src/tasks/task-main-update-delivery.js +32 -1
- package/dist/src/tasks/task-result-delivery-repository.d.ts +18 -0
- package/dist/src/tasks/task-result-delivery-repository.js +144 -0
- package/dist/src/tasks/task-result-delivery-service.d.ts +4 -0
- package/dist/src/tasks/task-result-delivery-service.js +128 -0
- package/dist/src/tasks/task-run-coordinator.js +6 -1
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
- package/dist/src/tasks/task-run-dispatcher.js +22 -3
- package/dist/src/user-context/config.d.ts +48 -0
- package/dist/src/user-context/config.js +23 -3
- package/dist/src/voice/realtime/runtime.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CYq-3pbE.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-Cx3UbhqT.js +0 -1
- package/dist/gateway/static/root/assets/agents-Ce9uvui7.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-BaHJml4R.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-DBcYssNQ.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-CsTpcrPP.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BXlVwnMr.js +0 -8
- package/dist/gateway/static/root/assets/channels-TPqwcbZ4.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-BJOn14Ow.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DBWH5bVr.js +0 -2
- package/dist/gateway/static/root/assets/gateway-realtime-store-7glMlD2l.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CQ9y_LMT.js +0 -1
- package/dist/gateway/static/root/assets/index-DUU_2HF0.js +0 -106
- package/dist/gateway/static/root/assets/management-settings-1O7zsu4t.js +0 -1
- package/dist/gateway/static/root/assets/model-display-name-DXhO9rcM.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-DnIOzcvn.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-AWU_G61i.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-BPy5m3QR.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B33uj1lz.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BZoUVzgS.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-BK5IvdGz.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-Du7ueBFc.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CaxCsIIZ.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Cr_Ut6FE.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DU7fV5pc.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-C--t6SLp.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CxfsWFL5.js +0 -6
|
@@ -3,9 +3,10 @@ import { init_agent_config } from "../../agent-config/index.js";
|
|
|
3
3
|
import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
|
|
4
4
|
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
5
5
|
import { init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
6
|
+
import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
6
7
|
import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
|
|
7
8
|
import { createXopcUseTool } from "./xopc-use-tool.js";
|
|
8
|
-
import {
|
|
9
|
+
import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
|
|
9
10
|
import { randomUUID } from "node:crypto";
|
|
10
11
|
import { Type } from "@sinclair/typebox";
|
|
11
12
|
//#region src/agent/tools/personal-task-tool.ts
|
|
@@ -49,14 +50,16 @@ const DISCOVERY_TOOLS = [
|
|
|
49
50
|
"workflow",
|
|
50
51
|
"xopc_use",
|
|
51
52
|
"xopc_tool_search",
|
|
53
|
+
"xopc_tool_describe",
|
|
54
|
+
"xopc_tool_execute",
|
|
52
55
|
"computer_use",
|
|
53
56
|
"send_message",
|
|
54
57
|
"text_to_speech"
|
|
55
58
|
];
|
|
56
|
-
function
|
|
59
|
+
function getAvailablePersonalAgentTools(config, deps) {
|
|
57
60
|
return (config.toolAllowlist ? [...new Set([...DISCOVERY_TOOLS, ...config.toolAllowlist])] : DISCOVERY_TOOLS).filter((name) => (name !== "browser_use" || deps.getConfig?.()?.browser?.enabled !== false) && (!config.toolAllowlist || config.toolAllowlist.includes(name)) && config.tools[name]?.mode !== "deny");
|
|
58
61
|
}
|
|
59
|
-
function
|
|
62
|
+
function personalAgentModelAvailability(config) {
|
|
60
63
|
for (const ref of [config.models.chat.primary, ...config.models.chat.fallbacks]) try {
|
|
61
64
|
if (isProviderConfiguredSync(resolveModel(ref).provider)) return { available: true };
|
|
62
65
|
} catch {}
|
|
@@ -72,11 +75,10 @@ function buildPersonalTaskBrief(input) {
|
|
|
72
75
|
const title = firstClause.length > MAX_PERSONAL_TASK_TITLE ? `${firstClause.slice(0, MAX_PERSONAL_TASK_TITLE - 1).trimEnd()}…` : firstClause;
|
|
73
76
|
const objective = fullObjective.length > 120 ? title : fullObjective;
|
|
74
77
|
const description = input.description?.trim();
|
|
75
|
-
const body = fullObjective !== objective ? [fullObjective, description].filter(Boolean).join("\n\n") : description;
|
|
76
78
|
return {
|
|
77
79
|
title,
|
|
78
80
|
objective,
|
|
79
|
-
|
|
81
|
+
body: [fullObjective !== objective ? [fullObjective, description].filter(Boolean).join("\n\n") : description, PERSONAL_WORKER_RESULT_GUIDANCE].filter(Boolean).join("\n\n")
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
/** A narrow Task surface for the fast personal conversation. */
|
|
@@ -89,7 +91,7 @@ function createPersonalTaskTool(deps) {
|
|
|
89
91
|
parameters: PersonalTaskSchema,
|
|
90
92
|
mutatesWorkspace: true,
|
|
91
93
|
mutationScope: "external",
|
|
92
|
-
requiresExclusiveWorkspaceLock:
|
|
94
|
+
requiresExclusiveWorkspaceLock: false,
|
|
93
95
|
finalGuardRelevant: true,
|
|
94
96
|
async execute(toolCallId, input, signal) {
|
|
95
97
|
const conversationId = deps.getCurrentConversationId?.();
|
|
@@ -103,13 +105,13 @@ function createPersonalTaskTool(deps) {
|
|
|
103
105
|
defaults: catalog.defaults,
|
|
104
106
|
agent
|
|
105
107
|
}).config;
|
|
106
|
-
const availableTools =
|
|
108
|
+
const availableTools = getAvailablePersonalAgentTools(config, deps);
|
|
107
109
|
return {
|
|
108
110
|
id: agent.id,
|
|
109
111
|
name: agent.profile?.name ?? agent.id,
|
|
110
112
|
description: agent.profile?.description ?? "",
|
|
111
113
|
availableTools,
|
|
112
|
-
model:
|
|
114
|
+
model: personalAgentModelAvailability(config)
|
|
113
115
|
};
|
|
114
116
|
}).filter((agent) => requiredTools.every((tool) => agent.availableTools.includes(tool)));
|
|
115
117
|
return {
|
|
@@ -130,9 +132,9 @@ function createPersonalTaskTool(deps) {
|
|
|
130
132
|
const specialist = new AgentCatalogRepository().get(agentId);
|
|
131
133
|
if (!specialist || specialist.enabled === false || specialist.provisioningState !== "ready") throw new Error(`Specialist Agent is unavailable: ${agentId}`);
|
|
132
134
|
const config = resolveEffectiveAgentConfigForAgent(agentId).config;
|
|
133
|
-
const model =
|
|
135
|
+
const model = personalAgentModelAvailability(config);
|
|
134
136
|
if (!model.available) throw new Error(`Agent ${agentId} cannot start: ${model.reason}. Find another available Agent.`);
|
|
135
|
-
const availableTools =
|
|
137
|
+
const availableTools = getAvailablePersonalAgentTools(config, deps);
|
|
136
138
|
const missingTools = (input.requiredTools ?? []).filter((tool) => !availableTools.includes(tool));
|
|
137
139
|
if (missingTools.length > 0) throw new Error(`Agent ${agentId} lacks required tools: ${missingTools.join(", ")}. Find another Agent or approach.`);
|
|
138
140
|
args = {
|
|
@@ -181,4 +183,4 @@ function createPersonalTaskTool(deps) {
|
|
|
181
183
|
};
|
|
182
184
|
}
|
|
183
185
|
//#endregion
|
|
184
|
-
export { buildPersonalTaskBrief, createPersonalTaskTool };
|
|
186
|
+
export { buildPersonalTaskBrief, createPersonalTaskTool, getAvailablePersonalAgentTools, personalAgentModelAvailability };
|
|
@@ -2,5 +2,8 @@ import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
|
2
2
|
export interface CreateReadFileToolOptions {
|
|
3
3
|
/** When set and the path is a bare profile filename (e.g. SOUL.md), try this root if not in workspace. */
|
|
4
4
|
profileMarkdownRoot?: string;
|
|
5
|
+
defaultMaxLines?: number;
|
|
6
|
+
maxOutputBytes?: number;
|
|
7
|
+
maxReadBytes?: number;
|
|
5
8
|
}
|
|
6
9
|
export declare function createReadFileTool(workspace: string, options?: CreateReadFileToolOptions): AgentTool;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { checkedFilePath, readWorkspaceFileAsync } from "../sandbox/fileAccess.js";
|
|
2
2
|
import { dataScheduler } from "../data-acquisition/scheduler.js";
|
|
3
3
|
import { checkFileSafety } from "../prompt/safety.js";
|
|
4
|
-
import {
|
|
4
|
+
import { formatSize, truncateHead } from "./truncate.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolvePathUnderWorkspace, resolveProfileMarkdownPathIfBareName } from "./tool-paths.js";
|
|
6
6
|
import { stat } from "fs/promises";
|
|
7
7
|
import { Type } from "@sinclair/typebox";
|
|
@@ -29,11 +29,13 @@ function createReadFileTool(workspace, options) {
|
|
|
29
29
|
supportsParallel: true,
|
|
30
30
|
idempotent: true,
|
|
31
31
|
async execute(_toolCallId, params, signal) {
|
|
32
|
-
return dataScheduler.run(workspace, signal, () => executeReadFile(workspace, options
|
|
32
|
+
return dataScheduler.run(workspace, signal, () => executeReadFile(workspace, options, params, signal));
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
async function executeReadFile(workspace,
|
|
36
|
+
async function executeReadFile(workspace, options, params, signal) {
|
|
37
|
+
const profileMarkdownRoot = options?.profileMarkdownRoot;
|
|
38
|
+
const maxOutputBytes = options?.maxOutputBytes ?? 51200;
|
|
37
39
|
try {
|
|
38
40
|
const safety = checkFileSafety("read", params.path);
|
|
39
41
|
if (!safety.allowed) return {
|
|
@@ -60,6 +62,18 @@ async function executeReadFile(workspace, profileMarkdownRoot, params, signal) {
|
|
|
60
62
|
}
|
|
61
63
|
} else throw e;
|
|
62
64
|
}
|
|
65
|
+
if (options?.maxReadBytes && stats.size > options.maxReadBytes) return {
|
|
66
|
+
content: [{
|
|
67
|
+
type: "text",
|
|
68
|
+
text: `File is large (${formatSize(stats.size)}; local read limit ${formatSize(options.maxReadBytes)}). Tell the user briefly, then delegate reading and processing. Path: ${normalized}`
|
|
69
|
+
}],
|
|
70
|
+
details: {
|
|
71
|
+
path: normalized,
|
|
72
|
+
size: stats.size,
|
|
73
|
+
requiresSpecialist: true,
|
|
74
|
+
reason: "large_file"
|
|
75
|
+
}
|
|
76
|
+
};
|
|
63
77
|
if (stats.size > MAX_FILE_SIZE) return {
|
|
64
78
|
content: [{
|
|
65
79
|
type: "text",
|
|
@@ -72,12 +86,12 @@ async function executeReadFile(workspace, profileMarkdownRoot, params, signal) {
|
|
|
72
86
|
const lines = content.split("\n");
|
|
73
87
|
if (offset > lines.length) throw new Error(`Offset ${offset} exceeds ${lines.length} lines`);
|
|
74
88
|
const truncation = truncateHead(lines.slice(offset - 1).join("\n"), {
|
|
75
|
-
maxLines: params.limit || DEFAULT_MAX_LINES,
|
|
76
|
-
maxBytes:
|
|
89
|
+
maxLines: params.limit || options?.defaultMaxLines || DEFAULT_MAX_LINES,
|
|
90
|
+
maxBytes: maxOutputBytes
|
|
77
91
|
});
|
|
78
92
|
let outputText = truncation.content;
|
|
79
|
-
if (truncation.truncated) if (truncation.firstLineExceedsLimit) outputText = `(Line exceeds ${formatSize(
|
|
80
|
-
else outputText += `\n\n[Lines ${offset}-${offset + truncation.outputLines - 1} of ${lines.length}; continue with offset=${offset + truncation.outputLines}]`;
|
|
93
|
+
if (truncation.truncated) if (truncation.firstLineExceedsLimit) outputText = `(Line exceeds ${formatSize(maxOutputBytes)})`;
|
|
94
|
+
else outputText += options?.maxReadBytes ? `\n\n[File excerpt only. Tell the user briefly and delegate full reading and processing. Path: ${normalized}]` : `\n\n[Lines ${offset}-${offset + truncation.outputLines - 1} of ${lines.length}; continue with offset=${offset + truncation.outputLines}]`;
|
|
81
95
|
return {
|
|
82
96
|
content: [{
|
|
83
97
|
type: "text",
|
|
@@ -87,7 +101,11 @@ async function executeReadFile(workspace, profileMarkdownRoot, params, signal) {
|
|
|
87
101
|
path: normalized,
|
|
88
102
|
offset,
|
|
89
103
|
totalLines: lines.length,
|
|
90
|
-
truncated: truncation.truncated
|
|
104
|
+
truncated: truncation.truncated,
|
|
105
|
+
...options?.maxReadBytes && truncation.truncated ? {
|
|
106
|
+
requiresSpecialist: true,
|
|
107
|
+
reason: "large_file"
|
|
108
|
+
} : {}
|
|
91
109
|
}
|
|
92
110
|
};
|
|
93
111
|
} catch (error) {
|
|
@@ -6,5 +6,6 @@ export interface SessionSearchToolDeps {
|
|
|
6
6
|
getPrimaryModel: () => Model<Api>;
|
|
7
7
|
getCurrentConversationId?: () => string | undefined;
|
|
8
8
|
canAccess?: () => boolean;
|
|
9
|
+
localOnly?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare function createSessionSearchTool(deps: SessionSearchToolDeps): AgentTool;
|
|
@@ -91,8 +91,10 @@ function createSessionSearchTool(deps) {
|
|
|
91
91
|
return {
|
|
92
92
|
name: "session_search",
|
|
93
93
|
label: "Session search",
|
|
94
|
-
description: "Search other chat sessions by keywords and get short summaries, or omit `query` to list recent sessions (no LLM cost). Uses the same session store as the gateway. Narrow with roleFilter if needed.",
|
|
94
|
+
description: deps.localOnly ? "Search other chats locally and return short matching transcript excerpts. Omit query to list recent chats. No model or network calls." : "Search other chat sessions by keywords and get short summaries, or omit `query` to list recent sessions (no LLM cost). Uses the same session store as the gateway. Narrow with roleFilter if needed.",
|
|
95
95
|
parameters: SessionSearchSchema,
|
|
96
|
+
supportsParallel: true,
|
|
97
|
+
idempotent: true,
|
|
96
98
|
async execute(_toolCallId, params, signal) {
|
|
97
99
|
if (deps.canAccess && !deps.canAccess()) return {
|
|
98
100
|
content: [{
|
|
@@ -103,7 +105,7 @@ function createSessionSearchTool(deps) {
|
|
|
103
105
|
};
|
|
104
106
|
const p = params;
|
|
105
107
|
const store = deps.getSessionStore();
|
|
106
|
-
const limit = Math.min(15, Math.max(1, p.limit ?? 5));
|
|
108
|
+
const limit = Math.min(deps.localOnly ? 5 : 15, Math.max(1, p.limit ?? (deps.localOnly ? 3 : 5)));
|
|
107
109
|
const query = p.query?.trim() ?? "";
|
|
108
110
|
try {
|
|
109
111
|
if (!query) {
|
|
@@ -114,7 +116,7 @@ function createSessionSearchTool(deps) {
|
|
|
114
116
|
});
|
|
115
117
|
const items = listed.items.slice(0, limit).map((s) => ({
|
|
116
118
|
key: s.key,
|
|
117
|
-
name: s.name,
|
|
119
|
+
name: deps.localOnly ? s.name?.slice(0, 200) : s.name,
|
|
118
120
|
updatedAt: s.updatedAt,
|
|
119
121
|
messageCount: s.messageCount,
|
|
120
122
|
sourceChannel: s.sourceChannel
|
|
@@ -135,18 +137,50 @@ function createSessionSearchTool(deps) {
|
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
const listed = await store.list({
|
|
139
141
|
search: query,
|
|
140
142
|
limit: limit + 10,
|
|
141
143
|
sortBy: "updatedAt",
|
|
142
144
|
sortOrder: "desc"
|
|
143
|
-
})
|
|
145
|
+
});
|
|
146
|
+
let matches = listed.items.map((item) => ({
|
|
144
147
|
key: item.key,
|
|
145
148
|
score: 1
|
|
146
149
|
}));
|
|
147
150
|
const exclude = p.excludeConversationId?.trim() || deps.getCurrentConversationId?.() || "";
|
|
148
151
|
if (exclude) matches = matches.filter((m) => m.key !== exclude);
|
|
149
152
|
const top = matches.slice(0, limit);
|
|
153
|
+
if (deps.localOnly) {
|
|
154
|
+
const results = top.map(({ key }) => ({
|
|
155
|
+
conversationId: key,
|
|
156
|
+
name: listed.items.find((item) => item.key === key)?.name?.slice(0, 200),
|
|
157
|
+
excerpts: store.recallSession(key, query, { limit: 2 }).filter((match) => !p.roleFilter || match.role === p.roleFilter).map((match) => {
|
|
158
|
+
const at = match.content.toLowerCase().indexOf(query.toLowerCase());
|
|
159
|
+
const start = Math.max(0, at - 200);
|
|
160
|
+
return {
|
|
161
|
+
seq: match.seq,
|
|
162
|
+
role: match.role,
|
|
163
|
+
content: match.content.slice(start, start + 800),
|
|
164
|
+
truncated: start > 0 || match.content.length > start + 800
|
|
165
|
+
};
|
|
166
|
+
})
|
|
167
|
+
}));
|
|
168
|
+
return {
|
|
169
|
+
content: [{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: JSON.stringify({
|
|
172
|
+
success: true,
|
|
173
|
+
mode: "keyword",
|
|
174
|
+
query,
|
|
175
|
+
results
|
|
176
|
+
})
|
|
177
|
+
}],
|
|
178
|
+
details: {
|
|
179
|
+
localOnly: true,
|
|
180
|
+
count: results.length
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
150
184
|
const summaries = await Promise.all(top.map(async ({ key, score }) => {
|
|
151
185
|
let messages = await store.load(key);
|
|
152
186
|
if (p.roleFilter) messages = messages.filter((m) => m.role === p.roleFilter);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { sniffImageMimeType } from "../image/generation/image-assets.js";
|
|
2
|
-
import { mimeTypeFromMediaPath, saveMediaBuffer } from "../../media/store.js";
|
|
2
|
+
import { MEDIA_ARTIFACT_MAX_BYTES, mimeTypeFromMediaPath, saveMediaBuffer } from "../../media/store.js";
|
|
3
3
|
import { basename } from "node:path";
|
|
4
4
|
//#region src/agent/tools/tool-media.ts
|
|
5
|
-
const MAX_TOOL_MEDIA_BYTES = 50 * 1024 * 1024;
|
|
6
5
|
function hasImageMagic(buffer) {
|
|
7
6
|
if (buffer.length >= 8 && buffer.subarray(0, 8).equals(Buffer.from([
|
|
8
7
|
137,
|
|
@@ -41,7 +40,7 @@ async function persistToolMedia(params) {
|
|
|
41
40
|
bucket: "outbound",
|
|
42
41
|
contentType: mimeType,
|
|
43
42
|
originalFilename: name,
|
|
44
|
-
maxBytes:
|
|
43
|
+
maxBytes: MEDIA_ARTIFACT_MAX_BYTES
|
|
45
44
|
});
|
|
46
45
|
return {
|
|
47
46
|
id: saved.id,
|
|
@@ -53,7 +53,7 @@ async function checkDatabaseSchema(ctx) {
|
|
|
53
53
|
id: "database-schema",
|
|
54
54
|
label: "Database schema",
|
|
55
55
|
status: "pass",
|
|
56
|
-
message: `SQLite schema v${status.dbVersion} (current release
|
|
56
|
+
message: `SQLite schema v${status.dbVersion} (current release v232).`,
|
|
57
57
|
hints: []
|
|
58
58
|
};
|
|
59
59
|
}
|
|
@@ -97,6 +97,10 @@ _You're not a chatbot. You're becoming someone._
|
|
|
97
97
|
- Earn trust through competence
|
|
98
98
|
- Remember you're a guest
|
|
99
99
|
|
|
100
|
+
## Vibe
|
|
101
|
+
|
|
102
|
+
Speak like an attentive, reliable collaborator who understands the conversation. Use your own judgment and say what is useful now. Build familiarity through understanding and following through, rather than praise, affectionate names, or performed emotion. Explain when explanation helps; keep simple exchanges simple. Follow the user's language and communication preferences.
|
|
103
|
+
|
|
100
104
|
## Boundaries
|
|
101
105
|
|
|
102
106
|
- Private things stay private
|
|
@@ -1309,6 +1309,16 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1309
1309
|
maxKnowledge: z.ZodDefault<z.ZodNumber>;
|
|
1310
1310
|
maxChars: z.ZodDefault<z.ZodNumber>;
|
|
1311
1311
|
compaction: z.ZodDefault<z.ZodObject<{
|
|
1312
|
+
personalIdle: z.ZodDefault<z.ZodObject<{
|
|
1313
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1314
|
+
idleMs: z.ZodDefault<z.ZodNumber>;
|
|
1315
|
+
triggerThreshold: z.ZodDefault<z.ZodNumber>;
|
|
1316
|
+
cooldownMs: z.ZodDefault<z.ZodNumber>;
|
|
1317
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
1318
|
+
keepRecentTokens: z.ZodDefault<z.ZodNumber>;
|
|
1319
|
+
summaryMaxTokens: z.ZodDefault<z.ZodNumber>;
|
|
1320
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1321
|
+
}, z.core.$strict>>;
|
|
1312
1322
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1313
1323
|
triggerThreshold: z.ZodDefault<z.ZodNumber>;
|
|
1314
1324
|
reserveTokens: z.ZodDefault<z.ZodNumber>;
|
|
@@ -20,6 +20,7 @@ export declare class ConnectionRecoveryService {
|
|
|
20
20
|
private readonly deps;
|
|
21
21
|
private readonly busy;
|
|
22
22
|
private timer?;
|
|
23
|
+
private deliveryTimer?;
|
|
23
24
|
private polling;
|
|
24
25
|
start(): void;
|
|
25
26
|
stop(): void;
|
|
@@ -31,6 +32,7 @@ export declare class ConnectionRecoveryService {
|
|
|
31
32
|
error?: string;
|
|
32
33
|
}>;
|
|
33
34
|
drain: (conversationId: string) => void;
|
|
35
|
+
onPersonalRequestDelivered?: (conversationId: string, requestId: string) => void;
|
|
34
36
|
adapter?: ComposioSessionsAdapter;
|
|
35
37
|
pluginMcp?: PluginMcpRecovery;
|
|
36
38
|
});
|
|
@@ -3,6 +3,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
4
4
|
import { readCurrentTranscriptId } from "../storage/sqlite/session-instance-repository.js";
|
|
5
5
|
import { getSessionInputState, init_session_input_repository } from "../storage/sqlite/session-input-repository.js";
|
|
6
|
+
import { init_request_repository, personalRequestForWait } from "../personal-agent/request-repository.js";
|
|
6
7
|
import { getConnectorAccount, init_connector_account_repository } from "../storage/sqlite/connector-account-repository.js";
|
|
7
8
|
import { getConnectorConnection, getConnectorInstallation, init_connector_repository, listConnectorConnections, upsertConnectorInstallation } from "../storage/sqlite/connector-repository.js";
|
|
8
9
|
import { cancelConnectionObjective, getActiveConnectionWait, getConnectionWait, init_connection_wait_repository, listConnectionWaitsToCheck, publishConnectionWait, queueConnectionResolution, updateConnectionWait } from "../storage/sqlite/connection-wait-repository.js";
|
|
@@ -18,7 +19,9 @@ import { connectorPrincipalForSession } from "./principal.js";
|
|
|
18
19
|
import { capabilityActions, isToolInputSchema, missingConnectionCapabilities } from "./connection-capabilities.js";
|
|
19
20
|
import { installConnector } from "./install.js";
|
|
20
21
|
import { resolveConnectionCandidate } from "./connection-candidates.js";
|
|
22
|
+
import { cancelPersonalRequest, resolvePersonalRequestConnection } from "../personal-agent/request-service.js";
|
|
21
23
|
import { persistConfigMutation } from "../config/config-mutation.js";
|
|
24
|
+
import { drainPersonalRequestContinuations, drainPersonalRequestResults } from "../personal-agent/request-delivery.js";
|
|
22
25
|
import { HostPluginMcpRecovery } from "./plugin-mcp-recovery.js";
|
|
23
26
|
import { randomUUID } from "node:crypto";
|
|
24
27
|
//#region src/connectors/connection-recovery-service.ts
|
|
@@ -29,6 +32,7 @@ init_connection_wait_repository();
|
|
|
29
32
|
init_connector_repository();
|
|
30
33
|
init_connector_account_repository();
|
|
31
34
|
init_logger();
|
|
35
|
+
init_request_repository();
|
|
32
36
|
const log = createLogger("Connectors:Recovery");
|
|
33
37
|
const SCOPE_ORDER = {
|
|
34
38
|
read: 1,
|
|
@@ -44,6 +48,7 @@ function isConnectorNeed(need) {
|
|
|
44
48
|
var ConnectionRecoveryService = class {
|
|
45
49
|
busy = /* @__PURE__ */ new Set();
|
|
46
50
|
timer;
|
|
51
|
+
deliveryTimer;
|
|
47
52
|
polling = false;
|
|
48
53
|
start() {
|
|
49
54
|
if (this.timer) return;
|
|
@@ -51,16 +56,25 @@ var ConnectionRecoveryService = class {
|
|
|
51
56
|
this.poll();
|
|
52
57
|
}, 5e3);
|
|
53
58
|
this.timer.unref();
|
|
59
|
+
this.deliveryTimer = setInterval(() => {
|
|
60
|
+
drainPersonalRequestContinuations(this.deps.onPersonalRequestDelivered);
|
|
61
|
+
drainPersonalRequestResults(this.deps.onPersonalRequestDelivered);
|
|
62
|
+
}, 1e3);
|
|
63
|
+
this.deliveryTimer.unref();
|
|
54
64
|
this.poll();
|
|
55
65
|
}
|
|
56
66
|
stop() {
|
|
57
67
|
clearInterval(this.timer);
|
|
58
68
|
this.timer = void 0;
|
|
69
|
+
clearInterval(this.deliveryTimer);
|
|
70
|
+
this.deliveryTimer = void 0;
|
|
59
71
|
}
|
|
60
72
|
async poll() {
|
|
61
73
|
if (this.polling) return;
|
|
62
74
|
this.polling = true;
|
|
63
75
|
try {
|
|
76
|
+
drainPersonalRequestContinuations(this.deps.onPersonalRequestDelivered);
|
|
77
|
+
drainPersonalRequestResults(this.deps.onPersonalRequestDelivered);
|
|
64
78
|
for (const wait of listConnectionWaitsToCheck()) {
|
|
65
79
|
if (this.busy.has(wait.conversationId)) continue;
|
|
66
80
|
await this.act(wait.conversationId, {
|
|
@@ -383,8 +397,11 @@ var ConnectionRecoveryService = class {
|
|
|
383
397
|
action: action.action
|
|
384
398
|
}
|
|
385
399
|
};
|
|
386
|
-
if (action.action === "cancel")
|
|
387
|
-
|
|
400
|
+
if (action.action === "cancel") {
|
|
401
|
+
const request = personalRequestForWait(wait.id);
|
|
402
|
+
if (request) cancelPersonalRequest(request);
|
|
403
|
+
else cancelConnectionObjective(conversationId);
|
|
404
|
+
} else if (action.action === "replace_source") {
|
|
388
405
|
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
389
406
|
if (!need || !this.view(wait).needs.find((item) => item.key === need.key)?.alternatives?.some((item) => item.candidateRef === action.candidateRef)) throw new Error("Unsupported replacement.");
|
|
390
407
|
const replacement = resolveConnectionCandidate(action.candidateRef);
|
|
@@ -399,7 +416,7 @@ var ConnectionRecoveryService = class {
|
|
|
399
416
|
queueConnectionResolution({
|
|
400
417
|
...wait,
|
|
401
418
|
intent: void 0
|
|
402
|
-
}, "skipped");
|
|
419
|
+
}, "skipped", resolvePersonalRequestConnection);
|
|
403
420
|
this.deps.drain(conversationId);
|
|
404
421
|
} else if (action.action === "install_complete") {
|
|
405
422
|
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
@@ -436,7 +453,7 @@ var ConnectionRecoveryService = class {
|
|
|
436
453
|
queueConnectionResolution({
|
|
437
454
|
...wait,
|
|
438
455
|
needs: view.needs.map(({ phase: _phase, accounts: _accounts, reason: _reason, alternatives: _alternatives, ...item }) => item)
|
|
439
|
-
}, "continued");
|
|
456
|
+
}, "continued", resolvePersonalRequestConnection);
|
|
440
457
|
log.info({
|
|
441
458
|
conversationId,
|
|
442
459
|
waitId: wait.id,
|
|
@@ -648,7 +665,7 @@ var ConnectionRecoveryService = class {
|
|
|
648
665
|
wait = queueConnectionResolution({
|
|
649
666
|
...wait,
|
|
650
667
|
needs: view.needs.map(({ phase: _phase, accounts: _accounts, reason: _reason, alternatives: _alternatives, ...need }) => need)
|
|
651
|
-
}, "continued");
|
|
668
|
+
}, "continued", resolvePersonalRequestConnection);
|
|
652
669
|
log.info({
|
|
653
670
|
conversationId,
|
|
654
671
|
waitId: wait.id,
|
|
@@ -658,6 +675,7 @@ var ConnectionRecoveryService = class {
|
|
|
658
675
|
this.deps.drain(conversationId);
|
|
659
676
|
}
|
|
660
677
|
}
|
|
678
|
+
drainPersonalRequestContinuations(this.deps.onPersonalRequestDelivered);
|
|
661
679
|
publishConnectionWait(conversationId);
|
|
662
680
|
return { snapshot: this.snapshot(conversationId) };
|
|
663
681
|
} catch (error) {
|
|
@@ -277,4 +277,4 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
277
277
|
readonly zh: "使用已验证的参数执行选定的外部工具。";
|
|
278
278
|
};
|
|
279
279
|
}];
|
|
280
|
-
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "clarify" | "xopc_tool_execute" | "web_extract" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "
|
|
280
|
+
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "clarify" | "xopc_tool_execute" | "web_extract" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "computer_use" | "session_status" | "memory_maintenance" | "tool_manual" | "skill_install" | "send_message" | "send_media" | "read_media" | "create_share" | "text_to_speech" | "delegate_task" | "execute_code" | "create_desktop_pet" | "xopc_tool_search" | "xopc_tool_describe")[];
|
|
@@ -252,6 +252,16 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
252
252
|
maxKnowledge: number;
|
|
253
253
|
maxChars: number;
|
|
254
254
|
compaction: {
|
|
255
|
+
personalIdle: {
|
|
256
|
+
enabled: boolean;
|
|
257
|
+
idleMs: number;
|
|
258
|
+
triggerThreshold: number;
|
|
259
|
+
cooldownMs: number;
|
|
260
|
+
timeoutMs: number;
|
|
261
|
+
keepRecentTokens: number;
|
|
262
|
+
summaryMaxTokens: number;
|
|
263
|
+
model?: string;
|
|
264
|
+
};
|
|
255
265
|
enabled: boolean;
|
|
256
266
|
triggerThreshold: number;
|
|
257
267
|
reserveTokens: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mimeTypeFromMediaPath, saveMediaBuffer } from "../../../media/store.js";
|
|
1
|
+
import { MEDIA_ARTIFACT_MAX_BYTES, mimeTypeFromMediaPath, saveMediaBuffer } from "../../../media/store.js";
|
|
2
2
|
import { readMediaReference } from "../../../media/media-reference.js";
|
|
3
3
|
import { MAX_WEBCHAT_ATTACHMENT_FILE_BYTES } from "../../chat-limits.js";
|
|
4
4
|
import { createGatewayRouteLogger } from "../lib/route-logger.js";
|
|
@@ -70,10 +70,11 @@ function registerMediaRoutes(authenticated, deps) {
|
|
|
70
70
|
error: { message: "Missing media scope" }
|
|
71
71
|
}, 400);
|
|
72
72
|
try {
|
|
73
|
-
const
|
|
73
|
+
const parsed = await resolveScopedMediaReference(deps.service, uriRaw.trim(), {
|
|
74
74
|
conversationId,
|
|
75
75
|
taskId
|
|
76
|
-
})
|
|
76
|
+
});
|
|
77
|
+
const { buffer, path } = await readMediaReference(parsed.uri, parsed.bucket === "outbound" ? MEDIA_ARTIFACT_MAX_BYTES : MAX_WEBCHAT_ATTACHMENT_FILE_BYTES);
|
|
77
78
|
const contentType = mimeTypeFromMediaPath(path);
|
|
78
79
|
const range = parseByteRange(c.req.header("Range"), buffer.byteLength);
|
|
79
80
|
const commonHeaders = {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { getDevice, init_device_access_repository } from "../../../storage/sqlite/device-access-repository.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getPersonalRequest, init_request_repository, listPersonalRequests } from "../../../personal-agent/request-repository.js";
|
|
3
3
|
import { getPersonalAgent } from "../../../personal-agent/repository.js";
|
|
4
|
+
import { TaskOriginRepository } from "../../../tasks/task-origin-repository.js";
|
|
5
|
+
import { cancelPersonalRequest, personalRequestSnapshot, publishPersonalRequest } from "../../../personal-agent/request-service.js";
|
|
4
6
|
import { PersonalOnboardingDraftSchema, PersonalOnboardingStepSchema, finishPersonalWelcome, getPersonalOnboarding, savePersonalOnboarding } from "../../../personal-agent/onboarding.js";
|
|
5
7
|
import { PersonalAppearanceSchema, PersonalPreferencesSchema, createOrResumePersonalAgent, ensurePersonalConversationVisibility, listPersonalModels, patchPersonalProfile, refreshPersonalDelegationGuidance } from "../../../personal-agent/service.js";
|
|
6
8
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
7
9
|
import { z } from "zod";
|
|
8
10
|
//#region src/gateway/hono/routes/personal-agent.ts
|
|
9
11
|
init_device_access_repository();
|
|
12
|
+
init_request_repository();
|
|
10
13
|
const CreateSchema = z.object({
|
|
11
14
|
model: z.string().trim().min(3).optional(),
|
|
12
15
|
displayName: z.string().trim().min(1).max(60).optional(),
|
|
@@ -71,6 +74,71 @@ function registerPersonalAgentRoutes(authenticated, deps) {
|
|
|
71
74
|
payload: await listPersonalModels()
|
|
72
75
|
});
|
|
73
76
|
});
|
|
77
|
+
authenticated.get("/api/personal-agent/requests", (c) => {
|
|
78
|
+
const ownerId = owner(c);
|
|
79
|
+
if (!ownerId) return c.json({
|
|
80
|
+
ok: false,
|
|
81
|
+
error: "Owner access is required"
|
|
82
|
+
}, 403);
|
|
83
|
+
const record = getPersonalAgent(ownerId);
|
|
84
|
+
return c.json({
|
|
85
|
+
ok: true,
|
|
86
|
+
payload: record ? listPersonalRequests(record.conversationId).map(personalRequestSnapshot) : []
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
authenticated.get("/api/personal-agent/requests/:requestId", (c) => {
|
|
90
|
+
const ownerId = owner(c);
|
|
91
|
+
if (!ownerId) return c.json({
|
|
92
|
+
ok: false,
|
|
93
|
+
error: "Owner access is required"
|
|
94
|
+
}, 403);
|
|
95
|
+
const request = getPersonalRequest(c.req.param("requestId"));
|
|
96
|
+
if (!request || request.conversationId !== getPersonalAgent(ownerId)?.conversationId) return c.json({
|
|
97
|
+
ok: false,
|
|
98
|
+
error: "Request not found"
|
|
99
|
+
}, 404);
|
|
100
|
+
return c.json({
|
|
101
|
+
ok: true,
|
|
102
|
+
payload: personalRequestSnapshot(request)
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
authenticated.post("/api/personal-agent/requests/:requestId/cancel", deps.strictRateLimitMiddleware, async (c) => {
|
|
106
|
+
const ownerId = owner(c);
|
|
107
|
+
if (!ownerId) return c.json({
|
|
108
|
+
ok: false,
|
|
109
|
+
error: "Owner access is required"
|
|
110
|
+
}, 403);
|
|
111
|
+
const request = getPersonalRequest(c.req.param("requestId"));
|
|
112
|
+
if (!request || request.conversationId !== getPersonalAgent(ownerId)?.conversationId) return c.json({
|
|
113
|
+
ok: false,
|
|
114
|
+
error: "Request not found"
|
|
115
|
+
}, 404);
|
|
116
|
+
const body = z.object({ expectedVersion: z.number().int().positive() }).strict().safeParse(await c.req.json().catch(() => null));
|
|
117
|
+
if (!body.success) return c.json({
|
|
118
|
+
ok: false,
|
|
119
|
+
error: "expectedVersion is required"
|
|
120
|
+
}, 400);
|
|
121
|
+
if (body.data.expectedVersion !== request.version) return c.json({
|
|
122
|
+
ok: false,
|
|
123
|
+
error: "Request changed"
|
|
124
|
+
}, 409);
|
|
125
|
+
try {
|
|
126
|
+
const cancelled = cancelPersonalRequest(request);
|
|
127
|
+
publishPersonalRequest(cancelled);
|
|
128
|
+
return c.json({
|
|
129
|
+
ok: true,
|
|
130
|
+
payload: {
|
|
131
|
+
...cancelled,
|
|
132
|
+
executionStopConfirmed: false
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
} catch (error) {
|
|
136
|
+
return c.json({
|
|
137
|
+
ok: false,
|
|
138
|
+
error: error instanceof Error ? error.message : String(error)
|
|
139
|
+
}, 409);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
74
142
|
authenticated.get("/api/personal-agent/onboarding", (c) => {
|
|
75
143
|
const ownerId = owner(c);
|
|
76
144
|
if (!ownerId) return c.json({
|
|
@@ -5,9 +5,9 @@ import "../../../session/types.js";
|
|
|
5
5
|
import { SidebarLayoutConflictError, getSidebarLayout, init_sidebar_layout_repository, replaceSidebarLayout, sortBySidebarLayout } from "../../../storage/sqlite/sidebar-layout-repository.js";
|
|
6
6
|
import { summarizeAiUsageByConversations } from "../../../storage/sqlite/ai-usage-repository.js";
|
|
7
7
|
import { messagesToClientHistory } from "../../../session/client-history.js";
|
|
8
|
+
import { isPersonalConversation } from "../../../personal-agent/repository.js";
|
|
8
9
|
import { evictEmbeddedSessionRunner } from "../../../agent/embedded/session-runner.js";
|
|
9
10
|
import { SessionEnvironmentService } from "../../../execution-environments/session-environment-service.js";
|
|
10
|
-
import { isPersonalConversation } from "../../../personal-agent/repository.js";
|
|
11
11
|
import { deleteMediaUrisNoLongerReferenced } from "../../../media/session-references.js";
|
|
12
12
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
13
13
|
import { createGatewayRouteLogger, logRouteError } from "../lib/route-logger.js";
|
|
@@ -2,12 +2,12 @@ import { voiceSelectionSchema } from "../../../../packages/realtime-protocol/src
|
|
|
2
2
|
import { createVoiceSessionRequestSchema, init_voice } from "../../../../packages/realtime-protocol/src/voice.js";
|
|
3
3
|
import { getDefaultModelSync, init_providers, resolveModel } from "../../../providers/index.js";
|
|
4
4
|
import { completeWithResolvedCredentials } from "../../../providers/model-call.js";
|
|
5
|
+
import { isPersonalConversation } from "../../../personal-agent/repository.js";
|
|
5
6
|
import { resolveSttProviderConfigSlice } from "../../../voice/stt/config-slice.js";
|
|
6
7
|
import { STTTranscriptionError, transcribe } from "../../../voice/stt/transcribe-core.js";
|
|
7
8
|
import { isSTTAvailable } from "../../../voice/stt/availability.js";
|
|
8
9
|
import { mergeSttConfigFromAppConfig } from "../../../voice/stt/config.js";
|
|
9
10
|
import "../../../voice/stt/index.js";
|
|
10
|
-
import { isPersonalConversation } from "../../../personal-agent/repository.js";
|
|
11
11
|
import { resolveTtsProviderConfigSlice } from "../../../voice/tts/config-slice.js";
|
|
12
12
|
import { isTTSAvailable, resolveSpeechProvider } from "../../../voice/tts/factory.js";
|
|
13
13
|
import { speak, speakStream } from "../../../voice/tts/speak-core.js";
|
|
@@ -3,7 +3,7 @@ import { FileServiceError } from "../files/file-service.js";
|
|
|
3
3
|
import { resolveMediaReference } from "../media/media-reference.js";
|
|
4
4
|
import { pendingTranscriptReferencesMediaUri } from "../agent/inbound/attachment-pipeline.js";
|
|
5
5
|
import { TaskContextRepository } from "../tasks/task-context-repository.js";
|
|
6
|
-
import { messagesReferenceMediaUri } from "../media/session-references.js";
|
|
6
|
+
import { messagesReferenceMediaUri, taskResultReferencesMediaUri } from "../media/session-references.js";
|
|
7
7
|
//#region src/gateway/media-access.ts
|
|
8
8
|
init_task_repository();
|
|
9
9
|
/** Resolve media only when the supplied session or task references it. */
|
|
@@ -11,7 +11,7 @@ async function resolveScopedMediaReference(service, uri, scope) {
|
|
|
11
11
|
const { conversationId, taskId } = scope;
|
|
12
12
|
if (!conversationId && !taskId) throw new FileServiceError(400, "Missing media scope");
|
|
13
13
|
const media = await resolveMediaReference(uri);
|
|
14
|
-
const sessionReferencesUri = conversationId ? messagesReferenceMediaUri(await service.sessionIndexInstance.loadMessages(conversationId), media.uri) || pendingTranscriptReferencesMediaUri(conversationId, media.uri) : false;
|
|
14
|
+
const sessionReferencesUri = conversationId ? messagesReferenceMediaUri(await service.sessionIndexInstance.loadMessages(conversationId), media.uri) || pendingTranscriptReferencesMediaUri(conversationId, media.uri) || taskResultReferencesMediaUri(conversationId, media.uri) : false;
|
|
15
15
|
const taskReferencesUri = taskId && new TaskRepository().get(taskId) ? new TaskContextRepository().list(taskId).some((edge) => edge.targetKind === "file" && edge.targetId === media.uri) : false;
|
|
16
16
|
if (!sessionReferencesUri && !taskReferencesUri) throw new FileServiceError(404, "Not found");
|
|
17
17
|
return media;
|
|
@@ -75,6 +75,7 @@ var GatewayAgentRunner = class {
|
|
|
75
75
|
}
|
|
76
76
|
return result;
|
|
77
77
|
},
|
|
78
|
+
onInputReceived: (conversationId) => opts.getAgentService().sessionStore.idleCompaction.interrupt(conversationId),
|
|
78
79
|
prepareAttachments: async (conversationId, attachments) => {
|
|
79
80
|
const media = await opts.getAgentService().prepareInboundAttachments(conversationId, attachments);
|
|
80
81
|
if (!media?.length) return void 0;
|