@xopcai/xopc 0.0.366 → 0.0.367
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-SVmnh__i.js → activity-store-Cuf3JFFJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CS9lg5h2.js → agent-avatar-dicebear-DyATPNTe.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-gT9_j4tr.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CLXCJ6JN.js +1 -0
- package/dist/gateway/static/root/assets/agents-BAUfOMsq.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-CVdFV-cU.js → agents-admin-api-D842OcNo.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-4gpFbdsr.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CaxnUxvy.js → app-management-settings-panel-CoIFxQKH.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-6NKquG3v.js → appearance-settings-DQr0o6Lm.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BoB3MbsB.js → apps-page-CltMV4Xp.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BWtLZtK1.js → archive-plugin-DT8Nio-r.js} +1 -1
- package/dist/gateway/static/root/assets/automation-display-DCkjVzA0.js +2 -0
- package/dist/gateway/static/root/assets/{automations-page-CNngHw2c.js → automations-page-BIfWS_3Y.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BCGPjsdU.js +6 -0
- package/dist/gateway/static/root/assets/binary-plugins-7qs3qcW9.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-BhstSZNE.js → block-editor-BFPUlxJ6.js} +28 -28
- package/dist/gateway/static/root/assets/{browser-automation-inputs-B6sOBxVA.js → browser-automation-inputs-BUAIKIX0.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-HZAKkVVt.js → browser-automations-page-CSwu1U1F.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-C1ReMNqX.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-BzWFO_x_.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-CAIQmCrH.js → capabilities-K0Zb_lH0.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-BdTSqloI.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-BP2roWcM.js → capabilities-settings-panel-BUblBMZC.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-header-actions-BA1M7RRP.js → capability-header-actions-AMn_vTNv.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CXCf5qO6.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-KS_yk1H7.js → chat-terminal-dock-C7nAROhF.js} +2 -2
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-B5SuSZ3G.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-CY_3H_l9.js → connector-service-page-CTx1B8wx.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DfnK1crf.js +2 -0
- package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-Cx_xIKvN.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-CyNH4m20.js → dependency-picker-DYm96PDu.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BsZQsQ2_.js → desktop-pet-D90OzgeR.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DMgkUy6g.js → desktop-pet-settings-CmdCecjm.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-JjbUN8y-.js → device-pairing-wizard-s2ogSa4l.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CBTI3tKh.js → directory-picker-path-field-DZpaoeNa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-C7nSpOKj.js → extension-debug-page-Bv6QE8kC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BYUjAvsZ.js → extension-page-CEsq71Cm.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-DaLt3bC-.js → extension-provider-CX-sK0Tw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CRasspq0.js → extension-settings-page-UyOHF39P.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-BLJFYASE.js → fallback-models-CKv_Wqg8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DIIzvDLQ.js → gateway-config-swr-Cjnkle5J.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DD70L42G.js → gateway-realtime-DCCLdyQD.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-C_Th8kGg.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CZ73IpbP.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D_EwU7-6.js → gateway-startup-retry-CXKmdVzN.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BQWq4kYi.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BkK22JsL.js → image-generation-api-NLHzm4Nc.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-YJKcTKKr.js → imports-page-C7qvlBTQ.js} +1 -1
- package/dist/gateway/static/root/assets/index-BQgqzhQj.js +106 -0
- package/dist/gateway/static/root/assets/index-COB4QIJp.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BG_kM_Rm.js → keyboard-shortcuts-settings-pkgFWJb-.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-dMDhZXAi.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-jqthjcQO.js → local-apps-page-TpUAfOn2.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-C4et6msJ.js → local-session-drafts-Cvv7I0fw.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CvNO-hbt.js → locale-store-C8TMD2gn.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-B-Y9oZLh.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B2lzsw6X.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-Dse7rkio.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-C25mOgs2.js → media-plugins-BZrnzaBM.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dy26npMy.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-B1C86nRp.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DL__qP6U.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-CKLw9vjk.js → notes-api-DKiVeQKG.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-DTBbg9Hs.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-CC5KkSgG.js → oauth-api-BwpzpRwC.js} +1 -1
- package/dist/gateway/static/root/assets/open-route-MyZ2sB9C.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-KX9mrcJW.js → page-context-capture-button-Cxzd4QPB.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CzaTnHeD.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-D4hoEWiu.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-content-aR38El2E.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-D20QH4YB.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Bf3BIcT6.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CiN49wvk.js → registry-api-AdnxowbH.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CKxqncqW.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-wZjlSBiM.js → runtime-tools-settings-panel-CBN3raz1.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-Cv_5ozfX.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-CMB61TV1.js → schema-form-CxrMGsT9.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-jH6MQwdZ.js → send-session-input-CgOzhDZ0.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CW2X7g_U.js → session-api-_HIN8or3.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-CzCto5zT.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-DZcu6NLJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DazqeDQ7.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-Ch71KQjb.js → settings-page-D8Q3H3-o.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DvLMMiuS.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-DCSmx-Rl.js → share-link-dialog-Dg5os066.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-C93IM3QK.js → share-preview-page-DMvohAyr.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-B4rLfG3l.js → shares-api-C96IO4qJ.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-C_6idV8e.js → shares-settings-CsDATuCw.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-sKX8SSlQ.js → skill-api-C10ML0CH.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Ro-s69NW.js → skill-reload-api-DNbJzSfB.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DObMKvA6.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DIjaUlla.js → system-settings-panel-Bn3khdzb.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BR2L1L8l.js +2 -0
- package/dist/gateway/static/root/assets/task-expandable-content-DL2Q2gre.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-CH6KoBeY.js → tasks-DwKXgZ-I.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DbRLBHVY.js → theme-store-DQ6KJa4l.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-IgY26AYH.js → tracing-settings-page-Ed8_GYUT.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CgARwbus.js → tunnel-api-D3X8jDwo.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-CKju62Cm.js → usage-page-BqzRyyb9.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C889OTsP.js → use-autosave-CRFefpzO.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-OLrvSjn5.js +2 -0
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BOpcSApw.js → use-file-preview-expanded-CJvzfQvw.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-CG6wqIKP.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-evWflGY6.js → voice-api-key-field-R9zNWYR_.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CZoV2Lt4.js → voice-config-api-DLudE9Rc.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B2-2F39_.js → work-discovery-overlay-DVmQrolV.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-cOGM8Nug.js → workflow-run-setup-panel-DEkmuD3T.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-pqCB3sh4.js +6 -0
- package/dist/gateway/static/root/assets/workspace-api-CdVUhyPo.js +2 -0
- package/dist/gateway/static/root/index.html +32 -30
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +1 -0
- package/dist/packages/gateway-contract/src/home.js +14 -0
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/notifications.js +2 -1
- package/dist/packages/gateway-contract/src/personal-proactivity.js +139 -0
- package/dist/packages/image-providers/src/catalog.js +373 -0
- package/dist/packages/image-providers/src/execute.js +372 -0
- package/dist/packages/image-providers/src/http.js +94 -0
- package/dist/packages/image-providers/src/index.js +5 -0
- package/dist/packages/image-providers/src/types.d.ts +95 -0
- package/dist/packages/image-providers/src/validation.js +52 -0
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/failover-error.d.ts +1 -1
- package/dist/src/agent/failover-error.js +7 -0
- package/dist/src/agent/image/generation/native-provider.d.ts +2 -0
- package/dist/src/agent/image/generation/native-provider.js +118 -0
- package/dist/src/agent/image/generation/openai-images-provider.d.ts +1 -1
- package/dist/src/agent/image/generation/openai-images-provider.js +48 -32
- package/dist/src/agent/image/generation/provider-registry.js +4 -13
- package/dist/src/agent/image/generation/providers/xopc-cloud.js +5 -34
- package/dist/src/agent/image/generation/runtime-types.d.ts +2 -4
- package/dist/src/agent/image/generation/runtime.js +28 -23
- package/dist/src/agent/image/generation/types.d.ts +3 -50
- package/dist/src/agent/image/generation/validation.d.ts +6 -0
- package/dist/src/agent/image/generation/validation.js +16 -0
- package/dist/src/agent/tools/factory.js +5 -0
- package/dist/src/agent/tools/image-generate-tool.js +5 -19
- package/dist/src/agent/tools/personal-attention-tool.d.ts +21 -0
- package/dist/src/agent/tools/personal-attention-tool.js +191 -0
- package/dist/src/automations/capabilities/write.d.ts +2 -0
- package/dist/src/automations/domain/types.d.ts +1 -1
- package/dist/src/automations/domain/validation.d.ts +4 -0
- package/dist/src/automations/domain/validation.js +1 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/models.js +3 -8
- package/dist/src/config/models-json.d.ts +170 -0
- package/dist/src/config/models-json.js +23 -8
- package/dist/src/files/file-service.d.ts +6 -0
- package/dist/src/files/file-service.js +38 -1
- package/dist/src/gateway/custom-image-providers.d.ts +34 -0
- package/dist/src/gateway/file-path-classifier.js +12 -3
- package/dist/src/gateway/hono/routes/files.js +13 -2
- package/dist/src/gateway/hono/routes/personal-agent.js +41 -0
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +50 -11
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/notifications/planner.js +32 -0
- package/dist/src/notifications/service.d.ts +2 -0
- package/dist/src/personal-agent/notifications.d.ts +4 -0
- package/dist/src/personal-agent/notifications.js +40 -0
- package/dist/src/personal-agent/policy.d.ts +1 -1
- package/dist/src/personal-agent/policy.js +2 -0
- package/dist/src/personal-agent/proactivity/automation.d.ts +3 -0
- package/dist/src/personal-agent/proactivity/automation.js +41 -0
- package/dist/src/personal-agent/proactivity/follow-up-request.d.ts +5 -0
- package/dist/src/personal-agent/proactivity/follow-up-request.js +44 -0
- package/dist/src/personal-agent/proactivity/repository.d.ts +128 -0
- package/dist/src/personal-agent/proactivity/repository.js +403 -0
- package/dist/src/personal-agent/proactivity/routes.d.ts +3 -0
- package/dist/src/personal-agent/proactivity/routes.js +182 -0
- package/dist/src/personal-agent/proactivity/service.d.ts +32 -0
- package/dist/src/personal-agent/proactivity/service.js +496 -0
- package/dist/src/personal-agent/prompts.js +13 -2
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/unread.d.ts +10 -0
- package/dist/src/personal-agent/unread.js +43 -0
- package/dist/src/providers/env-keys.js +6 -0
- package/dist/src/providers/model-catalog-persistence.js +3 -22
- package/dist/src/providers/model-catalog-store.js +1 -8
- package/dist/src/providers/model-catalog-types.d.ts +1 -9
- package/dist/src/providers/xopc-cloud-model-source.js +4 -25
- package/dist/src/session/client-history.d.ts +2 -0
- package/dist/src/session/client-history.js +26 -0
- package/dist/src/session/session-context-for-llm.js +28 -0
- package/dist/src/storage/sqlite/migrations/236_personal_proactivity.sql +53 -0
- package/dist/src/storage/sqlite/migrations/237_personal_strategy_versions.sql +18 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/home-query-service.js +27 -1
- package/dist/src/voice/platform-catalog.d.ts +1 -9
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CvUPtxS4.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-1tRxDfjI.js +0 -1
- package/dist/gateway/static/root/assets/agents-gdT0whx9.js +0 -66
- package/dist/gateway/static/root/assets/app-link-DRL0YnPs.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BKHsdiQ8.js +0 -7
- package/dist/gateway/static/root/assets/binary-plugins-fIhH-wg6.js +0 -2
- package/dist/gateway/static/root/assets/browser-settings-page-D8IpVQI6.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-C4grvUkw.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-DK8FJRW4.js +0 -2
- package/dist/gateway/static/root/assets/channels-EQGCxr8W.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-CGBR0KFw.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CUOL6JX0.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-CDSZ-PWV.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DeUVEPPE.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-B9n5naCr.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BP6qAgBt.js +0 -1
- package/dist/gateway/static/root/assets/index-6JNNrzCq.js +0 -106
- package/dist/gateway/static/root/assets/index-CbJNcWAn.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-lHi21M1T.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CH7W-dm5.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-DVgI_KNm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-DDJlD5jR.js +0 -201
- package/dist/gateway/static/root/assets/messages-pGa2qMzG.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-DzFiL4xV.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-kyX-n1db.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CLZygZlm.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-DnXlcJNJ.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-D7pknlCh.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DhV9DPj8.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D181xkFw.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CQnBARQW.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DWt54veq.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-BDpdi3lF.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-DPEdjUdR.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B6WGnTLY.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C7sLy8Hl.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-TsrjLYcI.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-B4Lby289.js +0 -2
- package/dist/gateway/static/root/assets/use-composer-attachments-Dlm9EFTO.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-CTkCLRhE.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Csk8xrRk.js +0 -6
- package/dist/gateway/static/root/assets/workspace-api-B9M9ECTB.js +0 -2
- package/dist/src/agent/image/generation/normalization.d.ts +0 -38
- package/dist/src/agent/image/generation/normalization.js +0 -181
- package/dist/src/agent/image/generation/providers/dashscope.d.ts +0 -35
- package/dist/src/agent/image/generation/providers/dashscope.js +0 -257
- package/dist/src/agent/image/generation/providers/fal.d.ts +0 -15
- package/dist/src/agent/image/generation/providers/fal.js +0 -323
- package/dist/src/agent/image/generation/providers/google.d.ts +0 -16
- package/dist/src/agent/image/generation/providers/google.js +0 -244
- package/dist/src/agent/image/generation/providers/minimax.d.ts +0 -23
- package/dist/src/agent/image/generation/providers/minimax.js +0 -215
- package/dist/src/agent/image/generation/providers/openai.d.ts +0 -5
- package/dist/src/agent/image/generation/providers/openai.js +0 -134
|
@@ -31,6 +31,7 @@ import { init_providers, providers_exports } from "../providers/index.js";
|
|
|
31
31
|
import { AI_USAGE_RETENTION_MS, markStaleAiUsageEventsUnknown, pruneAiUsageEvents } from "../storage/sqlite/ai-usage-repository.js";
|
|
32
32
|
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
33
33
|
import "../knowledge-memory/index.js";
|
|
34
|
+
import { getPersonalAgentByConversation } from "../personal-agent/repository.js";
|
|
34
35
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
35
36
|
import { getEmbeddedExecutionSession } from "../agent/embedded/execution-context.js";
|
|
36
37
|
import { disposeAllSessionMcpRuntimes } from "../agent/mcp/bundle-mcp-runtime.js";
|
|
@@ -76,12 +77,6 @@ import { ChatPreviewService } from "../chat-previews/service.js";
|
|
|
76
77
|
import "../chat-previews/index.js";
|
|
77
78
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
78
79
|
import "../config/index.js";
|
|
79
|
-
import { DiscussionService } from "../discussions/service.js";
|
|
80
|
-
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
81
|
-
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
82
|
-
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
83
|
-
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
84
|
-
import "../discussions/index.js";
|
|
85
80
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
86
81
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
87
82
|
import "../knowledge/index.js";
|
|
@@ -89,17 +84,21 @@ import { PersonalReplyComposer } from "../personal-agent/reply-composer.js";
|
|
|
89
84
|
import { ConnectionRecoveryService } from "../connectors/connection-recovery-service.js";
|
|
90
85
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
91
86
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
87
|
+
import { DiscussionService } from "../discussions/service.js";
|
|
88
|
+
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
89
|
+
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
90
|
+
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
91
|
+
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
92
|
+
import "../discussions/index.js";
|
|
92
93
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
93
94
|
import "../endpoint-tools/index.js";
|
|
94
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
95
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
96
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
97
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
98
95
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
99
96
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
100
97
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
101
98
|
import { getGatewayFileSpaceService } from "./file-space-service.js";
|
|
102
99
|
import { reconcileHomeIntelligenceAutomation } from "./home-intelligence-automation-reconciler.js";
|
|
100
|
+
import { PersonalProactivityService } from "../personal-agent/proactivity/service.js";
|
|
101
|
+
import { reconcilePersonalProactivityAutomation } from "../personal-agent/proactivity/automation.js";
|
|
103
102
|
import { createBackgroundTask } from "../infra/background-task.js";
|
|
104
103
|
import { buildTaskAgentContext } from "../agent/source-context/task-context.js";
|
|
105
104
|
import { buildFileAgentContext } from "../agent/source-context/file-context.js";
|
|
@@ -153,10 +152,15 @@ import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
|
153
152
|
import { GatewaySceneHost } from "./scenes/host.js";
|
|
154
153
|
import { TaskCollaborationDelivery } from "../tasks/task-collaboration-delivery.js";
|
|
155
154
|
import { TaskMainUpdateDelivery } from "../tasks/task-main-update-delivery.js";
|
|
155
|
+
import { allowsPersonalTaskNotification, personalReplyNotification, personalRunDelegated } from "../personal-agent/notifications.js";
|
|
156
156
|
import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decision-service.js";
|
|
157
157
|
import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
|
|
158
158
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
159
159
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
160
|
+
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
161
|
+
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
162
|
+
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
163
|
+
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
160
164
|
import crypto from "node:crypto";
|
|
161
165
|
//#region src/gateway/service.ts
|
|
162
166
|
init_session_repository();
|
|
@@ -806,6 +810,7 @@ var GatewayService = class {
|
|
|
806
810
|
if (!this.notificationService) this.notificationService = new NotificationService({
|
|
807
811
|
publish: (type, payload) => this.realtime.broker.publish("gateway", type, payload),
|
|
808
812
|
allowsNotification: (notification) => {
|
|
813
|
+
if (!allowsPersonalTaskNotification(notification)) return false;
|
|
809
814
|
if (notification.target.kind !== "task") return true;
|
|
810
815
|
const taskId = notification.target.taskId;
|
|
811
816
|
return (this.sceneHost?.http.activationAdapters.list() ?? []).every((adapter) => adapter.allowsTaskNotification?.(taskId) !== false);
|
|
@@ -887,6 +892,16 @@ var GatewayService = class {
|
|
|
887
892
|
phase: "task_main_update_dispatch"
|
|
888
893
|
}, `Main Agent update dispatch failed: ${errorMessage}`);
|
|
889
894
|
});
|
|
895
|
+
personalProactivity = new PersonalProactivityService({
|
|
896
|
+
getConfig: () => this.config,
|
|
897
|
+
isAvailable: (conversationId) => !this.stopping && !this.agentRunner.hasActiveRun(conversationId) && !this.agentRunner.inputs.isAcceptingInput(conversationId) && (!this.voiceRealtime.hasConversation(conversationId) || this.voiceRealtime.canPublishReply(conversationId)),
|
|
898
|
+
notify: (conversationId, outreachId) => {
|
|
899
|
+
this.emit("session.transcript_updated", {
|
|
900
|
+
key: conversationId,
|
|
901
|
+
outreachId
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
});
|
|
890
905
|
taskResultDispatch = createBackgroundTask(async () => {
|
|
891
906
|
const notify = (conversationId, deliveryId) => {
|
|
892
907
|
this.realtime.broker.publish("sessions", "session.task-result", {
|
|
@@ -897,6 +912,8 @@ var GatewayService = class {
|
|
|
897
912
|
key: conversationId,
|
|
898
913
|
deliveryId
|
|
899
914
|
});
|
|
915
|
+
const reply = personalReplyNotification(conversationId, deliveryId);
|
|
916
|
+
if (reply) this.emit("personal.reply.delivered", reply);
|
|
900
917
|
};
|
|
901
918
|
await new TaskResultDeliveryService().drain(notify);
|
|
902
919
|
new PersonalReplyComposer().drain(notify, (conversationId) => !this.agentRunner.hasActiveRun(conversationId) && !this.agentRunner.inputs.isAcceptingInput(conversationId) && (!this.voiceRealtime.hasConversation(conversationId) || this.voiceRealtime.canPublishReply(conversationId))).catch((err) => {
|
|
@@ -1394,6 +1411,9 @@ var GatewayService = class {
|
|
|
1394
1411
|
});
|
|
1395
1412
|
await trace.measure("automations.initialize", () => this.automationService.initialize());
|
|
1396
1413
|
await trace.measure("homeIntelligence.reconcileAutomation", () => reconcileHomeIntelligenceAutomation(this.automationService));
|
|
1414
|
+
this.personalProactivity.start();
|
|
1415
|
+
await trace.measure("personalProactivity.reconcile", () => reconcilePersonalProactivityAutomation(this.automationService));
|
|
1416
|
+
this.personalProactivity.tick();
|
|
1397
1417
|
await trace.measure("memoryMaintenance.reconcile", () => this.reconcileMemoryMaintenanceAutomations());
|
|
1398
1418
|
await this.notesService.initialize();
|
|
1399
1419
|
this.discussionLiveWorker.start();
|
|
@@ -1587,6 +1607,7 @@ var GatewayService = class {
|
|
|
1587
1607
|
this.lastChannelConnectDeferSource = "off";
|
|
1588
1608
|
await this.channelManager.stop();
|
|
1589
1609
|
await this.extensionLoader?.shutdown();
|
|
1610
|
+
await this.personalProactivity.stop();
|
|
1590
1611
|
await this.automationService.stop();
|
|
1591
1612
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1592
1613
|
this.stopSessionTranscriptAutomationEvents = null;
|
|
@@ -1853,6 +1874,10 @@ var GatewayService = class {
|
|
|
1853
1874
|
});
|
|
1854
1875
|
}
|
|
1855
1876
|
executeSystemAutomationAction(input) {
|
|
1877
|
+
if (input.capability === "personal.proactivity.tick") {
|
|
1878
|
+
this.personalProactivity.tick();
|
|
1879
|
+
return { summary: "Personal attention checks queued" };
|
|
1880
|
+
}
|
|
1856
1881
|
if (input.capability === "home.advisor.refresh") {
|
|
1857
1882
|
const generationId = this.homeIntelligence.requestRefresh("scheduled_refresh", `automation:${input.runId}`);
|
|
1858
1883
|
return { summary: generationId === "disabled" ? "Home AI suggestions are disabled" : `Home advice refresh queued: ${generationId}` };
|
|
@@ -1931,7 +1956,20 @@ var GatewayService = class {
|
|
|
1931
1956
|
});
|
|
1932
1957
|
}
|
|
1933
1958
|
this.realtime.broker.publish("gateway", type, payload);
|
|
1934
|
-
|
|
1959
|
+
let notificationPayload = payload;
|
|
1960
|
+
if (type === "agent.run.ended" && payload && typeof payload === "object") {
|
|
1961
|
+
const event = payload;
|
|
1962
|
+
if (event.status === "success" && event.conversationId && event.runId && getPersonalAgentByConversation(event.conversationId) && personalRunDelegated(event.conversationId, event.runId)) return;
|
|
1963
|
+
if (event.conversationId && getPersonalAgentByConversation(event.conversationId)) notificationPayload = {
|
|
1964
|
+
...event,
|
|
1965
|
+
target: {
|
|
1966
|
+
kind: "chat",
|
|
1967
|
+
conversationId: event.conversationId,
|
|
1968
|
+
personal: true
|
|
1969
|
+
}
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
this.createNotificationService().handleGatewayEvent(type, notificationPayload);
|
|
1935
1973
|
}
|
|
1936
1974
|
async handleAutomationRunCompleted(run, context) {
|
|
1937
1975
|
this.emit("automation.run.completed", {
|
|
@@ -1965,6 +2003,7 @@ var GatewayService = class {
|
|
|
1965
2003
|
return this.automationService.ingestEvent(event, options?.targetAutomationIds);
|
|
1966
2004
|
}
|
|
1967
2005
|
projectAutomationEvent(event) {
|
|
2006
|
+
this.personalProactivity.ingestEvent(event);
|
|
1968
2007
|
if (event.source === "local_apps") this.emit(event.type, event.payload);
|
|
1969
2008
|
if (event.type === "project.deleted" && typeof event.payload.projectId === "string") {
|
|
1970
2009
|
const runIds = event.payload.deletedUnderstandingRunIds;
|
|
@@ -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 } from "./generator.js";
|
|
3
4
|
import { homePatternKey } from "./strategy.js";
|
|
5
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
4
6
|
import { HomeIntelligenceRepository } from "./repository.js";
|
|
5
7
|
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
6
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
7
|
-
import { HomeAdviceBudgetExceededError } 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
|
|
@@ -42,6 +42,37 @@ function chatPlan(payload) {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
function personalReplyPlan(payload) {
|
|
46
|
+
if (!payload || typeof payload !== "object") return null;
|
|
47
|
+
const event = payload;
|
|
48
|
+
if (typeof event.conversationId !== "string" || !event.conversationId || typeof event.deliveryId !== "string" || !event.deliveryId.startsWith("reply:")) return null;
|
|
49
|
+
const preview = markdownNotificationPreview(typeof event.text === "string" ? event.text : "", 180);
|
|
50
|
+
const displayName = typeof event.displayName === "string" ? event.displayName.trim().slice(0, 120) : "";
|
|
51
|
+
return {
|
|
52
|
+
dedupeKey: `personal.reply:${event.deliveryId}`,
|
|
53
|
+
notification: {
|
|
54
|
+
type: event.failed === true ? "chat.failed" : "chat.completed",
|
|
55
|
+
target: {
|
|
56
|
+
kind: "chat",
|
|
57
|
+
conversationId: event.conversationId,
|
|
58
|
+
personal: true
|
|
59
|
+
},
|
|
60
|
+
priority: event.failed === true ? "high" : "normal",
|
|
61
|
+
title: {
|
|
62
|
+
en: displayName || "Personal AI",
|
|
63
|
+
zh: displayName || "Personal AI"
|
|
64
|
+
},
|
|
65
|
+
body: preview ? {
|
|
66
|
+
en: preview,
|
|
67
|
+
zh: preview
|
|
68
|
+
} : {
|
|
69
|
+
en: "Your task result is ready.",
|
|
70
|
+
zh: "你的任务有了新结果。"
|
|
71
|
+
},
|
|
72
|
+
payload: { deliveryId: event.deliveryId }
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
45
76
|
function taskPlan(payload) {
|
|
46
77
|
if (!payload || typeof payload !== "object") return null;
|
|
47
78
|
const data = payload;
|
|
@@ -180,6 +211,7 @@ function homeOpportunityPlan(payload) {
|
|
|
180
211
|
};
|
|
181
212
|
}
|
|
182
213
|
function notificationPlanFromGatewayEvent(type, payload) {
|
|
214
|
+
if (type === "personal.reply.delivered") return personalReplyPlan(payload);
|
|
183
215
|
if (type === "agent.run.ended") return chatPlan(payload);
|
|
184
216
|
if (type === "task.attention_required.v2" || type === "task.phase_changed.v2") return taskPlan(payload);
|
|
185
217
|
if (type === "automation.run.completed") return automationPlan(payload);
|
|
@@ -39,6 +39,7 @@ export declare class NotificationService {
|
|
|
39
39
|
} | {
|
|
40
40
|
kind: "chat";
|
|
41
41
|
conversationId: string;
|
|
42
|
+
personal?: boolean;
|
|
42
43
|
} | {
|
|
43
44
|
kind: "task";
|
|
44
45
|
taskId: string;
|
|
@@ -79,6 +80,7 @@ export declare class NotificationService {
|
|
|
79
80
|
} | {
|
|
80
81
|
kind: "chat";
|
|
81
82
|
conversationId: string;
|
|
83
|
+
personal?: boolean;
|
|
82
84
|
} | {
|
|
83
85
|
kind: "task";
|
|
84
86
|
taskId: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProductNotification } from '@xopcai/gateway-contract';
|
|
2
|
+
export declare function allowsPersonalTaskNotification(notification: Pick<ProductNotification, 'target' | 'type'>): boolean;
|
|
3
|
+
export declare function personalReplyNotification(conversationId: string, deliveryId: string): Record<string, unknown> | null;
|
|
4
|
+
export declare function personalRunDelegated(conversationId: string, runId: string): boolean;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
2
|
+
import { getPersonalAgentByConversation } from "./repository.js";
|
|
3
|
+
//#region src/personal-agent/notifications.ts
|
|
4
|
+
init_transaction();
|
|
5
|
+
function personalTask(taskId) {
|
|
6
|
+
return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM task_origin_links o
|
|
7
|
+
JOIN sessions s ON s.conversation_id = o.conversation_id
|
|
8
|
+
WHERE o.task_id = ? AND json_extract(s.custom_data_json, '$.personalAgent') = 1`).get(taskId));
|
|
9
|
+
}
|
|
10
|
+
function allowsPersonalTaskNotification(notification) {
|
|
11
|
+
if (notification.target.kind === "task") return notification.type === "task.needs_input" || !personalTask(notification.target.taskId);
|
|
12
|
+
if (notification.target.kind === "chat") return !getSqliteDatabase().prepare(`SELECT o.task_id FROM task_sessions w
|
|
13
|
+
JOIN task_origin_links o ON o.task_id = w.task_id
|
|
14
|
+
JOIN sessions s ON s.conversation_id = o.conversation_id
|
|
15
|
+
WHERE w.conversation_id = ? AND json_extract(s.custom_data_json, '$.personalAgent') = 1 LIMIT 1`).get(notification.target.conversationId);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
function personalReplyNotification(conversationId, deliveryId) {
|
|
19
|
+
if (!deliveryId.startsWith("reply:")) return null;
|
|
20
|
+
const personal = getPersonalAgentByConversation(conversationId);
|
|
21
|
+
if (!personal) return null;
|
|
22
|
+
const row = getSqliteDatabase().prepare(`SELECT reply_text, reply_status, payload_json FROM task_result_deliveries
|
|
23
|
+
WHERE delivery_id = ? AND conversation_id = ?`).get(deliveryId.slice(6), conversationId);
|
|
24
|
+
if (!row || row.reply_status !== "delivered") return null;
|
|
25
|
+
const delivery = JSON.parse(row.payload_json);
|
|
26
|
+
return {
|
|
27
|
+
conversationId,
|
|
28
|
+
deliveryId,
|
|
29
|
+
text: row.reply_text,
|
|
30
|
+
displayName: personal.displayName,
|
|
31
|
+
failed: delivery.outcome.status === "failed" || delivery.outcome.status === "partial"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function personalRunDelegated(conversationId, runId) {
|
|
35
|
+
return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM task_origin_links o
|
|
36
|
+
JOIN session_inputs i ON i.id = o.request_input_id
|
|
37
|
+
WHERE o.conversation_id = ? AND i.run_id = ? LIMIT 1`).get(conversationId, runId));
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { allowsPersonalTaskNotification, personalReplyNotification, personalRunDelegated };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const PERSONAL_MAIN_TOOL_IDS: readonly ["personal_task", "personal_capability", "personal_request", "personal_preference", "session_recall", "read_media", "read_file", "session_search", "personal_read", "user_context_read", "knowledge_read"];
|
|
1
|
+
export declare const PERSONAL_MAIN_TOOL_IDS: readonly ["personal_task", "personal_attention", "personal_capability", "personal_request", "personal_preference", "session_recall", "read_media", "read_file", "session_search", "personal_read", "user_context_read", "knowledge_read"];
|
|
2
2
|
export declare const PERSONAL_TOOL_DESCRIPTIONS: Readonly<Record<string, string>>;
|
|
3
3
|
export declare const PERSONAL_READ_TOOL_ALIASES: Readonly<Record<string, string>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/personal-agent/policy.ts
|
|
2
2
|
const PERSONAL_MAIN_TOOL_IDS = [
|
|
3
3
|
"personal_task",
|
|
4
|
+
"personal_attention",
|
|
4
5
|
"personal_capability",
|
|
5
6
|
"personal_request",
|
|
6
7
|
"personal_preference",
|
|
@@ -16,6 +17,7 @@ const PERSONAL_TOOL_DESCRIPTIONS = {
|
|
|
16
17
|
personal_task: "Choose from the injected specialist snapshot; discover only when missing or after failure. Delegate work, inspect own Tasks, send instructions or answer worker questions. Use an available Agent. Announce intent before discovery; claim success only after confirmation.",
|
|
17
18
|
personal_capability: "Check verified app connection and specialist availability before connected-app work.",
|
|
18
19
|
personal_request: "Submit, inspect or cancel connected-app requests. Submit using the connectorId and agentId returned by personal_capability.",
|
|
20
|
+
personal_attention: "Save explicit requests to check later and proactively report useful developments. The running Gateway checks while the user is away and posts in this chat. Prefer nextCheckLocal; confirm the returned local time and claim saved only after success. No useful development means silence. Valid commands: follow, list, settings, pause, end, resume, interests, feedback, rollback. interests reads silent candidates. feedback applies explicit topic stop/defer/preparation preferences; rollback explicitly undoes the latest strategy version. Query list for IDs and versions. Requires running Gateway; no action authorization or guaranteed notification.",
|
|
19
21
|
personal_preference: "Save only explicitly requested lasting response preferences.",
|
|
20
22
|
session_recall: "Find exact facts in this conversation, including compacted history. Cannot access other chats.",
|
|
21
23
|
session_search: "Search other chats locally for short matching excerpts. No model or network calls.",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/personal-agent/proactivity/automation.ts
|
|
2
|
+
/** A quiet SQL admission tick; model work is owned by the Personal worker. */
|
|
3
|
+
async function reconcilePersonalProactivityAutomation(service) {
|
|
4
|
+
const id = "system-personal-proactivity";
|
|
5
|
+
const current = await service.get(id);
|
|
6
|
+
const definition = {
|
|
7
|
+
name: "Personal AI attention checks",
|
|
8
|
+
description: "Check due attention and resume pending Personal messages.",
|
|
9
|
+
enabled: current?.enabled ?? true,
|
|
10
|
+
trigger: current?.trigger ?? {
|
|
11
|
+
kind: "schedule",
|
|
12
|
+
schedule: {
|
|
13
|
+
kind: "interval",
|
|
14
|
+
everyMs: 6e4
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
action: {
|
|
18
|
+
kind: "system",
|
|
19
|
+
capability: "personal.proactivity.tick"
|
|
20
|
+
},
|
|
21
|
+
safety: { mode: "auto_apply" },
|
|
22
|
+
conversationMode: "continuous",
|
|
23
|
+
delivery: {
|
|
24
|
+
notificationPolicy: "none",
|
|
25
|
+
destinations: []
|
|
26
|
+
},
|
|
27
|
+
management: {
|
|
28
|
+
owner: "personal-proactivity",
|
|
29
|
+
editable: ["enabled", "trigger"],
|
|
30
|
+
runnable: true,
|
|
31
|
+
deletable: false
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (!current) await service.create({
|
|
35
|
+
id,
|
|
36
|
+
...definition
|
|
37
|
+
});
|
|
38
|
+
else if (JSON.stringify(current.action) !== JSON.stringify(definition.action) || current.delivery.notificationPolicy !== "none") await service.update(id, definition);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { reconcilePersonalProactivityAutomation };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Recognize user requests, excluding negated and hypothetical follow-ups. */
|
|
2
|
+
export declare function isExplicitFollowUp(text: string): boolean;
|
|
3
|
+
/** Resolve common relative periods from the user's statement, avoiding model epoch arithmetic. */
|
|
4
|
+
export declare function requestedCheckTime(text: string, observedAt: number, timezone: string): number | undefined;
|
|
5
|
+
export declare function parseLocalCheckTime(value: string, timezone: string): number;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
//#region src/personal-agent/proactivity/follow-up-request.ts
|
|
3
|
+
/** Recognize user requests, excluding negated and hypothetical follow-ups. */
|
|
4
|
+
function isExplicitFollowUp(text) {
|
|
5
|
+
return text.split(/[。!?!?\n;]/u).some((clause) => {
|
|
6
|
+
if (/(?:不要|不用|不需要|别|无需|不能|无法).*(?:提醒|跟进|关注|检查|主动|联系|告诉)|(?:don't|do not|no need|cannot|can't).*(?:remind|follow|watch|check|contact)|(?:如果|假如).*(?:我|用户).*(?:要求|说)|(?:if|suppose).*\b(?:ask|request|say)\b/iu.test(clause)) return false;
|
|
7
|
+
return /提醒我|跟进|帮我.*关注|继续关注|(?:主动|到时候|届时).*(?:告诉我|联系我|通知我)|(?:明天|后天|下周|稍后|晚点|之后).*(?:再|继续).*(?:检查|看看|讨论)|remind me|follow[ -]up|keep (?:an eye|watch)|(?:check (?:again|back)|(?:contact|tell|notify|message) me).*(?:tomorrow|later|next)/iu.test(clause);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
/** Resolve common relative periods from the user's statement, avoiding model epoch arithmetic. */
|
|
11
|
+
function requestedCheckTime(text, observedAt, timezone) {
|
|
12
|
+
const match = /(?:明天|后天)(上午|下午|晚上|中午)(?:\s*([0-9]{1,2})(?:[::]([0-9]{2})|点(?:([0-9]{1,2})分|半)?))?/u.exec(text);
|
|
13
|
+
if (!match) return void 0;
|
|
14
|
+
const period = match[1];
|
|
15
|
+
let hour = match[2] === void 0 ? {
|
|
16
|
+
上午: 9,
|
|
17
|
+
下午: 15,
|
|
18
|
+
晚上: 19,
|
|
19
|
+
中午: 12
|
|
20
|
+
}[period] : Number(match[2]);
|
|
21
|
+
if ([
|
|
22
|
+
"下午",
|
|
23
|
+
"晚上",
|
|
24
|
+
"中午"
|
|
25
|
+
].includes(period) && hour < 12) hour += 12;
|
|
26
|
+
const minute = Number(match[3] ?? match[4] ?? (match[0].endsWith("半") ? 30 : 0));
|
|
27
|
+
if (hour > 23 || minute > 59) throw new Error("Invalid requested follow-up time");
|
|
28
|
+
const date = DateTime.fromMillis(observedAt, { zone: timezone }).plus({ days: match[0].startsWith("后天") ? 2 : 1 }).set({
|
|
29
|
+
hour,
|
|
30
|
+
minute,
|
|
31
|
+
second: 0,
|
|
32
|
+
millisecond: 0
|
|
33
|
+
});
|
|
34
|
+
if (!date.isValid || date.hour !== hour || date.minute !== minute) throw new Error("Requested follow-up time does not exist in this timezone");
|
|
35
|
+
return date.toMillis();
|
|
36
|
+
}
|
|
37
|
+
function parseLocalCheckTime(value, timezone) {
|
|
38
|
+
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2})?$/u.test(value)) throw new Error("nextCheckLocal must be YYYY-MM-DDTHH:mm in the configured timezone");
|
|
39
|
+
const date = DateTime.fromISO(value, { zone: timezone });
|
|
40
|
+
if (!date.isValid || date.toFormat("yyyy-MM-dd'T'HH:mm") !== value.slice(0, 16)) throw new Error("Invalid local follow-up time");
|
|
41
|
+
return date.toMillis();
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { isExplicitFollowUp, parseLocalCheckTime, requestedCheckTime };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type PersonalFeedback, type PersonalProactivitySettings, type PersonalProvenanceDetail } from '@xopcai/gateway-contract';
|
|
2
|
+
export interface AttentionThread {
|
|
3
|
+
id: string;
|
|
4
|
+
owner_id: string;
|
|
5
|
+
agent_id: string;
|
|
6
|
+
conversation_id: string;
|
|
7
|
+
subject: string;
|
|
8
|
+
summary: string;
|
|
9
|
+
kind: 'outcome' | 'discussion' | 'interest';
|
|
10
|
+
status: 'candidate' | 'active' | 'paused' | 'completed' | 'expired';
|
|
11
|
+
authority: 'user_explicit' | 'inferred';
|
|
12
|
+
task_id: string | null;
|
|
13
|
+
project_id: string | null;
|
|
14
|
+
next_check_at: number | null;
|
|
15
|
+
pause_until: number | null;
|
|
16
|
+
expires_at: number;
|
|
17
|
+
last_meaningful_at: number;
|
|
18
|
+
revision: number;
|
|
19
|
+
created_at: number;
|
|
20
|
+
updated_at: number;
|
|
21
|
+
}
|
|
22
|
+
export interface AttentionSource {
|
|
23
|
+
entryId: string;
|
|
24
|
+
transcriptId: string;
|
|
25
|
+
conversationId: string;
|
|
26
|
+
excerpt: string;
|
|
27
|
+
processingPolicy: string | null;
|
|
28
|
+
version: string;
|
|
29
|
+
}
|
|
30
|
+
export interface Wakeup {
|
|
31
|
+
id: string;
|
|
32
|
+
thread_id: string;
|
|
33
|
+
trigger_kind: string;
|
|
34
|
+
source_event_id: string | null;
|
|
35
|
+
thread_revision: number;
|
|
36
|
+
lease_token: string | null;
|
|
37
|
+
attempts: number;
|
|
38
|
+
expires_at: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Outreach {
|
|
41
|
+
id: string;
|
|
42
|
+
wakeup_id: string;
|
|
43
|
+
thread_id: string;
|
|
44
|
+
conversation_id: string;
|
|
45
|
+
origin_transcript_id: string;
|
|
46
|
+
thread_revision: number;
|
|
47
|
+
context_revision: number;
|
|
48
|
+
policy_revision: number;
|
|
49
|
+
decision: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
state: string;
|
|
52
|
+
text: string | null;
|
|
53
|
+
provenance_json: string;
|
|
54
|
+
valid_until: number;
|
|
55
|
+
message_entry_id: string | null;
|
|
56
|
+
notified_at: number | null;
|
|
57
|
+
created_at: number;
|
|
58
|
+
published_at: number | null;
|
|
59
|
+
}
|
|
60
|
+
export declare function getProactivitySettings(ownerId: string): PersonalProactivitySettings;
|
|
61
|
+
export declare function patchProactivitySettings(ownerId: string, input: PersonalProactivitySettings): PersonalProactivitySettings;
|
|
62
|
+
export declare function localDay(now: number, timezone: string): string;
|
|
63
|
+
export declare function isQuiet(now: number, settings: PersonalProactivitySettings): boolean;
|
|
64
|
+
export declare function reserveModelCall(ownerId: string, now: number): boolean;
|
|
65
|
+
export declare function getAttention(id: string, ownerId?: string): AttentionThread | undefined;
|
|
66
|
+
export declare function listAttention(conversationId: string): AttentionThread[];
|
|
67
|
+
export declare function getAttentionSources(threadId: string, entryIds?: string[]): AttentionSource[];
|
|
68
|
+
export declare function userText(payload: {
|
|
69
|
+
content?: unknown;
|
|
70
|
+
}): string;
|
|
71
|
+
export declare function sourceFingerprint(sources: AttentionSource[]): string;
|
|
72
|
+
/** Only user transcript rows can establish attention; inferred attention never grants work authorization. */
|
|
73
|
+
export declare function saveAttention(input: {
|
|
74
|
+
conversationId: string;
|
|
75
|
+
subject: string;
|
|
76
|
+
summary: string;
|
|
77
|
+
kind: AttentionThread['kind'];
|
|
78
|
+
entryIds: string[];
|
|
79
|
+
explicit: boolean;
|
|
80
|
+
nextCheckAt: number;
|
|
81
|
+
taskId?: string;
|
|
82
|
+
projectId?: string;
|
|
83
|
+
}, now?: number): AttentionThread;
|
|
84
|
+
export declare function patchAttention(ownerId: string, id: string, revision: number, patch: {
|
|
85
|
+
status?: 'candidate' | 'active' | 'paused' | 'completed';
|
|
86
|
+
nextCheckAt?: number | null;
|
|
87
|
+
}, now?: number): AttentionThread;
|
|
88
|
+
export declare function enqueueWakeup(thread: AttentionThread, kind: string, identity: string, now?: number): void;
|
|
89
|
+
export declare function enqueueDue(now?: number): void;
|
|
90
|
+
export declare function getOutreach(id: string, ownerId?: string): Outreach | undefined;
|
|
91
|
+
export declare function provenanceDetail(ownerId: string, id: string): PersonalProvenanceDetail | undefined;
|
|
92
|
+
export declare function recordFeedback(ownerId: string, id: string, raw: PersonalFeedback, now?: number): void;
|
|
93
|
+
export declare function listInterestCandidates(conversationId: string, now?: number): {
|
|
94
|
+
lastSupportedAt: number;
|
|
95
|
+
expiresAt: number;
|
|
96
|
+
sources: {
|
|
97
|
+
excerpt: string;
|
|
98
|
+
entryId: string;
|
|
99
|
+
observedAt: number;
|
|
100
|
+
}[];
|
|
101
|
+
independentStatements: number;
|
|
102
|
+
independentDays: number;
|
|
103
|
+
confidence: number;
|
|
104
|
+
id: string;
|
|
105
|
+
subject: string;
|
|
106
|
+
summary: string;
|
|
107
|
+
status: "expired" | "completed" | "active" | "paused" | "candidate";
|
|
108
|
+
}[];
|
|
109
|
+
export declare function preparationStrategy(threadId: string, now?: number): 'brief' | 'thorough' | null;
|
|
110
|
+
export declare function strategyState(threadId: string, now?: number): {
|
|
111
|
+
preparation: "brief" | "thorough";
|
|
112
|
+
versions: {
|
|
113
|
+
id: string;
|
|
114
|
+
revision: number;
|
|
115
|
+
kind: "stop" | "defer" | "adjust" | "rollback";
|
|
116
|
+
createdAt: number;
|
|
117
|
+
preparation: "brief" | "thorough";
|
|
118
|
+
}[];
|
|
119
|
+
};
|
|
120
|
+
export declare function applyThreadFeedback(ownerId: string, threadId: string, revision: number, raw: PersonalFeedback, source?: {
|
|
121
|
+
feedbackId?: string;
|
|
122
|
+
entryId?: string;
|
|
123
|
+
}, now?: number): AttentionThread;
|
|
124
|
+
export declare function rollbackStrategy(ownerId: string, threadId: string, raw: {
|
|
125
|
+
versionId: string;
|
|
126
|
+
revision: number;
|
|
127
|
+
idempotencyKey: string;
|
|
128
|
+
}, sourceEntryId?: string, now?: number): AttentionThread;
|