@xopcai/xopc 0.0.175 → 0.0.177
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-CM6mQUS2.js → activity-store-Wu2ikfbM.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-eckyE9AY.js → agent-avatar-dicebear-B0_biISn.js} +1 -1
- package/dist/gateway/static/root/assets/agents-TpIpJk59.js +2 -0
- package/dist/gateway/static/root/assets/{api-BfMRS6FX.js → api-DljBt-N5.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DYkzZQzZ.js → app-management-settings-panel-CKoZRi7Y.js} +1 -1
- package/dist/gateway/static/root/assets/appearance-settings-DOdXhNDo.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-Cxbn5hy8.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-k909a76t.js → archive-plugin-D18gyP76.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CqNzyhdJ.js → attachment-load-CZh9fc8u.js} +2 -2
- package/dist/gateway/static/root/assets/{attachment-preview-renderer-DonnL2dL.js → attachment-preview-renderer-Cmo-5BP5.js} +2 -2
- package/dist/gateway/static/root/assets/{attachment-process-heavy-RnGYy9bC.js → attachment-process-heavy-B2_kr5EA.js} +3 -3
- package/dist/gateway/static/root/assets/{automation-suggestion-card-snNG6u0v.js → automation-suggestion-card-DKrVoiiK.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-DYv16QMU.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-PfQ9ZHDF.js → binary-plugins-DdSyGL6M.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-Xrw-DnE_.js → block-editor-BOpNApiX.js} +6 -6
- package/dist/gateway/static/root/assets/{browser-settings-page-G92AdEnX.js → browser-settings-page-DlcqaGu1.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DJPF2lUY.js → browser-workflow-inputs-C0SnSj_R.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BoXs4pgc.js → browser-workflows-page-CzlzH7HA.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-QPX4wsGZ.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BgY-Ysmi.js → capability-presets-api-RM6S7ES5.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DmCeusO8.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-D32T1EJM.js → channel-recipient-api-B4sha-30.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-HcKoP1wm.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-C-l8haIK.js → connector-logo-BPsKIyoM.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DwbThFvd.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-DjL1GWON.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Cldo_pA3.js → desktop-pet-settings-u_abAXh7.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CMASXbgJ.js → directory-picker-path-field-BoZGualI.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BnMx02w0.js → dreaming-settings-s3gn3f9h.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-mUFs3ign.js → extension-debug-page-DIbMngCF.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BsFBOZ5N.js → extension-page-D94f2bWQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CTEoovnV.js → extension-settings-page-B7TI13ex.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Bwx-EetD.js → gateway-config-api-Do77rV8R.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CvgyqhR_.js → gateway-settings-Dt1PNJmb.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C8f5KwkT.js → gateway-startup-retry-WaXTw3fi.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-Bhynl9LN.js → goal-create-dialog-DEiOOLGU.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C1Qj4o1K.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-CUnfbgHa.js → goals-config-api-BL0fAEns.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-BAS_liXl.js → goals-page-qJDcEDzc.js} +2 -2
- package/dist/gateway/static/root/assets/{goals-settings-Bkk-tOcf.js → goals-settings-DV3ZlrdI.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D9Pldf5E.js → heartbeat-settings-C3kzg6ai.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-D7aCMgOv.js → image-generation-api-BgISY8i-.js} +1 -1
- package/dist/gateway/static/root/assets/index-C1h0zkNo.js +212 -0
- package/dist/gateway/static/root/assets/index-Da36E3WH.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CBhtXhHb.js → keyboard-shortcuts-settings-0KSmaPu0.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DcD4mVId.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BtJGF3M8.js → local-apps-page-BMrU8u7w.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DO-u1yS7.js → locale-store-DVGhFXRz.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-0lvwfLAA.js → logs-page-CW5m9Cov.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-BGPaeTch.js → markdown-split-BVqbtN9o.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C_Cx8v6u.js → media-plugins-Dr_wtkNJ.js} +1 -1
- package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-CIYy5BKF.js → notes-page-BWZRXsq6.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DdnwNz9x.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-C2vsdfJO.js → page-tabs-DWWgy0bF.js} +1 -1
- package/dist/gateway/static/root/assets/pdf-D4PI9qAw.js +54 -0
- package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-D_VT83bW.js → preview-open-alternatives-Bnfs93ZP.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BNP9kZ3Q.js → product-open-page-BR7QFmT-.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-B8GeS4dl.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DOeu1Hk_.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-De94rxnE.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BJL6Xb-F.js → save-bar-controls-BzS-rRTP.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CxCPSLbu.js → schedule-field-Cl2IIDAN.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Cao1wGbk.js → schema-form-BjKjp5eZ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-A7p8G0OJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-9pgClEud.js → settings-form-section-BSDNBfHn.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CQz0gEUK.js → settings-loading-skeleton-BD4peoAv.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DgsMzZLm.js → settings-page-S-P3U7at.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BhqupMfG.js → settings-page-layout-BQTLh-86.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-B7BsWxJt.js → setup-status-panel-W3p6kNyA.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CC4dQsQN.js → share-preview-page-DQjMxyvw.js} +2 -2
- package/dist/gateway/static/root/assets/shares-settings-Xo3N99PO.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C019Ml5q.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-CF4AYPQg.js → skills-page.utils-CXnpudm6.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CzZHWI4u.js → system-settings-panel-BhFwdYJP.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BZWNdSZC.js → theme-store-DQI-HPL-.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-BC922Mdg.js → time-picker-C0DCya4U.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C1S-B1pk.js → typed-models-lib-C-M3Fv2N.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DTiLxcLF.js → use-channel-catalog-Bndq4y4I.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-fYBzpus-.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CtIYRNfI.js → voice-api-key-field-p_g4UI1-.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DI0gCZRw.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +1 -0
- package/dist/gateway/static/root/assets/work-page-Z-nUaS_n.js +3 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CHEXVvhH.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BDfwnM-Y.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +7 -7
- package/dist/src/agent/context/execution-scope.d.ts +26 -0
- package/dist/src/agent/context/execution-scope.js +84 -0
- package/dist/src/agent/context/project-context.d.ts +3 -1
- package/dist/src/agent/context/project-context.js +26 -8
- package/dist/src/agent/embedded/model-runtime.d.ts +1 -2
- package/dist/src/agent/embedded/model-runtime.js +17 -29
- package/dist/src/agent/embedded/session-runner.js +2 -3
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
- package/dist/src/agent/prompt/system-prompt.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +7 -4
- package/dist/src/agent/session/session-config-service.d.ts +4 -1
- package/dist/src/agent/session/session-config-service.js +5 -3
- package/dist/src/agent/session/session-inspector.d.ts +6 -0
- package/dist/src/agent/session/session-inspector.js +9 -2
- package/dist/src/agent/workflow/subagent-runner.js +2 -0
- package/dist/src/agent/workflow/types.d.ts +1 -0
- package/dist/src/auth/model-credential-store.d.ts +17 -0
- package/dist/src/auth/model-credential-store.js +110 -0
- package/dist/src/auth/oauth/github-copilot.js +2 -2
- package/dist/src/auth/oauth/openai-codex.js +98 -7
- package/dist/src/auth/oauth/types.d.ts +4 -1
- package/dist/src/auth/oauth/xopc-cloud.js +124 -6
- package/dist/src/automations/service/automation-service.d.ts +3 -0
- package/dist/src/automations/service/automation-service.js +37 -7
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/schema.d.ts +21 -0
- package/dist/src/config/schema.js +12 -2
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -0
- package/dist/src/gateway/hono/oauth-async.d.ts +5 -0
- package/dist/src/gateway/hono/oauth-async.js +20 -8
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +9 -0
- package/dist/src/gateway/hono/routes/goals.js +13 -0
- package/dist/src/gateway/hono/routes/home.d.ts +18 -2
- package/dist/src/gateway/hono/routes/home.js +19 -0
- package/dist/src/gateway/hono/routes/index.js +2 -2
- package/dist/src/gateway/hono/routes/proactive.d.ts +4 -0
- package/dist/src/gateway/hono/routes/proactive.js +157 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/service/sessions-api.d.ts +2 -1
- package/dist/src/gateway/service.d.ts +10 -1
- package/dist/src/gateway/service.js +31 -31
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/mobile/notification-service.d.ts +1 -0
- package/dist/src/mobile/notification-service.js +38 -18
- package/dist/src/mobile/notification-types.d.ts +2 -2
- package/dist/src/proactive/events/envelope.d.ts +2 -0
- package/dist/src/proactive/events/envelope.js +54 -0
- package/dist/src/proactive/events/publisher.d.ts +4 -0
- package/dist/src/proactive/events/repository.d.ts +9 -0
- package/dist/src/proactive/events/repository.js +62 -0
- package/dist/src/proactive/events/types.d.ts +44 -0
- package/dist/src/proactive/events/types.js +15 -0
- package/dist/src/proactive/execution/agent-executor.d.ts +16 -0
- package/dist/src/proactive/execution/agent-executor.js +104 -0
- package/dist/src/proactive/execution/context.d.ts +31 -0
- package/dist/src/proactive/execution/context.js +72 -0
- package/dist/src/proactive/execution/insight.d.ts +4 -0
- package/dist/src/proactive/execution/insight.js +74 -0
- package/dist/src/proactive/execution/repository.d.ts +23 -0
- package/dist/src/proactive/execution/repository.js +122 -0
- package/dist/src/proactive/execution/types.d.ts +54 -0
- package/dist/src/proactive/execution/types.js +1 -0
- package/dist/src/proactive/execution/worker.d.ts +15 -0
- package/dist/src/proactive/execution/worker.js +96 -0
- package/dist/src/proactive/inbox/repository.d.ts +24 -0
- package/dist/src/proactive/inbox/repository.js +117 -0
- package/dist/src/proactive/inbox/service.d.ts +17 -0
- package/dist/src/proactive/inbox/service.js +22 -0
- package/dist/src/proactive/inbox/types.d.ts +38 -0
- package/dist/src/proactive/inbox/types.js +1 -0
- package/dist/src/proactive/inbox/worker.d.ts +12 -0
- package/dist/src/proactive/inbox/worker.js +56 -0
- package/dist/src/proactive/index.d.ts +17 -0
- package/dist/src/proactive/index.js +11 -0
- package/dist/src/proactive/routing/batch-repository.d.ts +27 -0
- package/dist/src/proactive/routing/batch-repository.js +56 -0
- package/dist/src/proactive/routing/matcher.d.ts +5 -0
- package/dist/src/proactive/routing/matcher.js +56 -0
- package/dist/src/proactive/routing/types.d.ts +44 -0
- package/dist/src/proactive/routing/types.js +1 -0
- package/dist/src/proactive/scenarios/prompt-composer.d.ts +14 -0
- package/dist/src/proactive/scenarios/prompt-composer.js +24 -0
- package/dist/src/proactive/scenarios/repository.d.ts +23 -0
- package/dist/src/proactive/scenarios/repository.js +162 -0
- package/dist/src/proactive/scenarios/service.d.ts +15 -0
- package/dist/src/proactive/scenarios/service.js +26 -0
- package/dist/src/proactive/scenarios/types.d.ts +36 -0
- package/dist/src/proactive/scenarios/types.js +1 -0
- package/dist/src/proactive/service.d.ts +18 -0
- package/dist/src/proactive/service.js +61 -0
- package/dist/src/projects/project-service.d.ts +3 -1
- package/dist/src/projects/project-service.js +62 -32
- package/dist/src/providers/index.js +4 -2
- package/dist/src/providers/provider-auth-service.d.ts +22 -0
- package/dist/src/providers/provider-auth-service.js +66 -0
- package/dist/src/providers/register-runtime-providers.d.ts +6 -0
- package/dist/src/providers/register-runtime-providers.js +55 -0
- package/dist/src/providers/xopc-cloud-account-service.d.ts +2 -2
- package/dist/src/providers/xopc-cloud-account-service.js +6 -5
- package/dist/src/providers/xopc-cloud-config.d.ts +3 -0
- package/dist/src/providers/xopc-cloud-config.js +13 -0
- package/dist/src/providers/xopc-cloud-model-source.d.ts +2 -2
- package/dist/src/providers/xopc-cloud-model-source.js +6 -5
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/thinking-resolve.d.ts +8 -0
- package/dist/src/session/thinking-resolve.js +6 -3
- package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +71 -0
- package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +69 -0
- package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +55 -0
- package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +45 -0
- package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +14 -0
- package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +13 -0
- package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +5 -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/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/tui/xopc-tui-keybindings.d.ts +44 -4
- package/dist/src/work-discovery/thread-service.d.ts +1 -3
- package/dist/src/work-discovery/thread-service.js +13 -25
- package/dist/src/work-items/work-item-service.d.ts +3 -1
- package/dist/src/work-items/work-item-service.js +67 -36
- package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
- package/dist/src/workflows/engine/workflow-engine.js +2 -0
- package/dist/src/workflows/service/workflow-run-service.js +12 -6
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/agents-D-OIB_r0.js +0 -2
- package/dist/gateway/static/root/assets/api-2SLLStKp.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-CDXXN57j.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CuvFyvuu.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DetGVTjI.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-settings-panel-nS_AMN1K.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DIO8ZNHW.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-4Im3vtnO.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CMctpuqb.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-vL3SjHSc.js +0 -2
- package/dist/gateway/static/root/assets/copy-VueTIC2x.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-CwOI_Hei.js +0 -1
- package/dist/gateway/static/root/assets/focus-detail-page-CCaZthpU.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-ChS2rU0w.js +0 -4
- package/dist/gateway/static/root/assets/index-DJ5vdaHk.css +0 -1
- package/dist/gateway/static/root/assets/index-TnouSpay.js +0 -212
- package/dist/gateway/static/root/assets/local-app-workbench-page-HQeu_F1C.js +0 -2
- package/dist/gateway/static/root/assets/messages-BP8aQX-5.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-_FgNPlOx.js +0 -4
- package/dist/gateway/static/root/assets/pdf-epILhEOn.js +0 -54
- package/dist/gateway/static/root/assets/pdf.worker.min-iDqQPrd3.mjs +0 -31
- package/dist/gateway/static/root/assets/project-detail-page-MNi-3mZU.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-xx8nUKZO.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-H5DSn2bR.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CMQsupwM.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-OBUdG6bV.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bhz21P05.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CBP-UB88.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-A0rNObNB.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-8XdpiAyP.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DBer86NF.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-BUPyfYaq.js +0 -1
- package/dist/gateway/static/root/assets/work-page-G8phwwI1.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-IKxqDAXw.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-CNls7g6v.js +0 -11
- package/dist/src/focuses/candidate-repository.d.ts +0 -15
- package/dist/src/focuses/candidate-repository.js +0 -91
- package/dist/src/focuses/index.d.ts +0 -7
- package/dist/src/focuses/index.js +0 -7
- package/dist/src/focuses/insight-repository.d.ts +0 -22
- package/dist/src/focuses/insight-repository.js +0 -77
- package/dist/src/focuses/prompts.d.ts +0 -2
- package/dist/src/focuses/prompts.js +0 -18
- package/dist/src/focuses/reconciler.d.ts +0 -5
- package/dist/src/focuses/reconciler.js +0 -26
- package/dist/src/focuses/repository.d.ts +0 -61
- package/dist/src/focuses/repository.js +0 -214
- package/dist/src/focuses/run-processor.d.ts +0 -18
- package/dist/src/focuses/run-processor.js +0 -162
- package/dist/src/focuses/service.d.ts +0 -42
- package/dist/src/focuses/service.js +0 -241
- package/dist/src/focuses/types.d.ts +0 -89
- package/dist/src/gateway/hono/routes/focuses.d.ts +0 -3
- package/dist/src/gateway/hono/routes/focuses.js +0 -319
- /package/dist/src/{focuses/types.js → proactive/events/publisher.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { listEvents } from './events/repository.js';
|
|
2
|
+
import type { PublishEventInput, PublishedEvent } from './events/types.js';
|
|
3
|
+
import { listBatches, markReadyBatches } from './routing/batch-repository.js';
|
|
4
|
+
import type { ScenarioRoute } from './routing/types.js';
|
|
5
|
+
export declare class ProactiveEventService {
|
|
6
|
+
private readonly routes;
|
|
7
|
+
constructor(routes?: () => readonly ScenarioRoute[]);
|
|
8
|
+
publish(input: PublishEventInput, now?: Date): PublishedEvent;
|
|
9
|
+
listEvents: typeof listEvents;
|
|
10
|
+
listBatches: typeof listBatches;
|
|
11
|
+
markReadyBatches: typeof markReadyBatches;
|
|
12
|
+
health(): {
|
|
13
|
+
events: number;
|
|
14
|
+
collecting: number;
|
|
15
|
+
ready: number;
|
|
16
|
+
oldestReadyAt: string | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getSqliteDatabase } from "../storage/sqlite/transaction.js";
|
|
2
|
+
import { normalizeEventEnvelope } from "./events/envelope.js";
|
|
3
|
+
import { matchScenario } from "./routing/matcher.js";
|
|
4
|
+
import { getEventByDedupeKey, insertEvent, isEventRouted, listEvents, markEventRouted } from "./events/repository.js";
|
|
5
|
+
import { addEventToBatch, listBatches, markReadyBatches } from "./routing/batch-repository.js";
|
|
6
|
+
//#region src/proactive/service.ts
|
|
7
|
+
var ProactiveEventService = class {
|
|
8
|
+
constructor(routes = () => []) {
|
|
9
|
+
this.routes = routes;
|
|
10
|
+
}
|
|
11
|
+
publish(input, now = /* @__PURE__ */ new Date()) {
|
|
12
|
+
let event = normalizeEventEnvelope(input, now);
|
|
13
|
+
const inserted = insertEvent(event);
|
|
14
|
+
if (!inserted) {
|
|
15
|
+
const existing = getEventByDedupeKey(event.dedupeKey);
|
|
16
|
+
if (!existing) throw new Error(`Proactive event dedupe lookup failed: ${event.dedupeKey}`);
|
|
17
|
+
event = existing;
|
|
18
|
+
if (isEventRouted(event.id)) return {
|
|
19
|
+
event,
|
|
20
|
+
inserted: false,
|
|
21
|
+
batchIds: []
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const batchIds = this.routes().flatMap((scenario) => {
|
|
25
|
+
const key = matchScenario(event, scenario);
|
|
26
|
+
if (!key) return [];
|
|
27
|
+
return [addEventToBatch({
|
|
28
|
+
event,
|
|
29
|
+
scenario,
|
|
30
|
+
aggregationKey: key,
|
|
31
|
+
now
|
|
32
|
+
}).id];
|
|
33
|
+
});
|
|
34
|
+
markEventRouted(event.id, now.toISOString());
|
|
35
|
+
return {
|
|
36
|
+
event,
|
|
37
|
+
inserted,
|
|
38
|
+
batchIds
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
listEvents = listEvents;
|
|
42
|
+
listBatches = listBatches;
|
|
43
|
+
markReadyBatches = markReadyBatches;
|
|
44
|
+
health() {
|
|
45
|
+
const db = getSqliteDatabase();
|
|
46
|
+
const events = db.prepare("SELECT COUNT(*) AS count FROM proactive_events").get();
|
|
47
|
+
const batches = db.prepare(`SELECT
|
|
48
|
+
SUM(CASE WHEN status = 'collecting' THEN 1 ELSE 0 END) AS collecting,
|
|
49
|
+
SUM(CASE WHEN status = 'ready' THEN 1 ELSE 0 END) AS ready,
|
|
50
|
+
MIN(CASE WHEN status = 'ready' THEN ready_at END) AS oldest_ready_at
|
|
51
|
+
FROM proactive_signal_batches`).get();
|
|
52
|
+
return {
|
|
53
|
+
events: events.count,
|
|
54
|
+
collecting: batches.collecting ?? 0,
|
|
55
|
+
ready: batches.ready ?? 0,
|
|
56
|
+
oldestReadyAt: batches.oldest_ready_at
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { ProactiveEventService };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProactiveSignalPublisher } from '../proactive/events/publisher.js';
|
|
1
2
|
import { ProjectStore } from './project-store.js';
|
|
2
3
|
import type { CreateProjectInput, Project, ProjectListQuery, ProjectListResult, ProjectWithDetails, SidebarProjectListQuery, UpdateProjectInput } from './types.js';
|
|
3
4
|
import { type WorkspaceProjectMatch } from './workspace-project.js';
|
|
@@ -9,7 +10,8 @@ export type ProjectSuggestion = {
|
|
|
9
10
|
};
|
|
10
11
|
export declare class ProjectService {
|
|
11
12
|
private readonly store;
|
|
12
|
-
|
|
13
|
+
private readonly signals?;
|
|
14
|
+
constructor(store?: ProjectStore, signals?: ProactiveSignalPublisher);
|
|
13
15
|
private listAllProjects;
|
|
14
16
|
create(input: CreateProjectInput): Project;
|
|
15
17
|
get(id: string): Project | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
1
2
|
import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
2
3
|
import "../storage/sqlite/index.js";
|
|
3
4
|
import { changedFieldsFromPatch, emitActivity, systemActivityActor, systemActivitySource } from "../activity/emitter.js";
|
|
@@ -5,10 +6,12 @@ import { ProjectStore } from "./project-store.js";
|
|
|
5
6
|
import { bindGoalToProject, listProjectGoalIds, unbindGoalFromProject } from "./goal-bind.js";
|
|
6
7
|
import { bindSessionToProject, listProjectSessionKeys, unbindSessionFromProject } from "./session-bind.js";
|
|
7
8
|
import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError, canonicalWorkspacePath, ensureWorkspaceDirectory, inferProjectNameFromWorkspaceRoot, isPathSameOrInsideWorkspace, isSafeAutoCreateWorkspaceRoot, resolveWorkspaceProjectRoot, workspaceDirectoryExists } from "./workspace-project.js";
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
8
10
|
//#region src/projects/project-service.ts
|
|
9
11
|
var ProjectService = class {
|
|
10
|
-
constructor(store = new ProjectStore()) {
|
|
12
|
+
constructor(store = new ProjectStore(), signals) {
|
|
11
13
|
this.store = store;
|
|
14
|
+
this.signals = signals;
|
|
12
15
|
}
|
|
13
16
|
listAllProjects() {
|
|
14
17
|
const items = [];
|
|
@@ -144,38 +147,65 @@ var ProjectService = class {
|
|
|
144
147
|
else throw new ProjectWorkspaceMissingError(workspaceRoot);
|
|
145
148
|
patch.workspaceRoot = workspaceRoot;
|
|
146
149
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
150
|
+
return runSqliteWriteTransaction(() => {
|
|
151
|
+
const before = this.store.get(id);
|
|
152
|
+
const project = this.store.update(id, patch);
|
|
153
|
+
const changes = changedFieldsFromPatch(patch, ["createWorkspaceRoot"]);
|
|
154
|
+
const type = before?.status !== project.status ? "project.status_changed" : before?.workspaceRoot !== project.workspaceRoot ? "project.workspace_changed" : "project.updated";
|
|
155
|
+
emitActivity({
|
|
156
|
+
type,
|
|
157
|
+
primaryObject: {
|
|
158
|
+
kind: "project",
|
|
159
|
+
id: project.id,
|
|
160
|
+
title: project.name
|
|
161
|
+
},
|
|
162
|
+
actor: systemActivityActor(),
|
|
163
|
+
source: systemActivitySource(),
|
|
164
|
+
payload: {
|
|
165
|
+
changes,
|
|
166
|
+
...type === "project.status_changed" ? {
|
|
167
|
+
from: before?.status,
|
|
168
|
+
to: project.status
|
|
169
|
+
} : {},
|
|
170
|
+
...type === "project.workspace_changed" ? {
|
|
171
|
+
from: before?.workspaceRoot,
|
|
172
|
+
to: project.workspaceRoot
|
|
173
|
+
} : {}
|
|
174
|
+
},
|
|
175
|
+
scopes: [{
|
|
176
|
+
scopeKind: "project",
|
|
177
|
+
scopeId: project.id,
|
|
178
|
+
reason: "object_owner"
|
|
179
|
+
}],
|
|
180
|
+
nowMs: project.updatedAt
|
|
181
|
+
});
|
|
182
|
+
this.signals?.publish({
|
|
183
|
+
type: "project.updated.v1",
|
|
184
|
+
schemaVersion: 1,
|
|
185
|
+
source: {
|
|
186
|
+
kind: "projects",
|
|
187
|
+
id: "local"
|
|
188
|
+
},
|
|
189
|
+
subject: {
|
|
190
|
+
kind: "project",
|
|
191
|
+
id: project.id
|
|
192
|
+
},
|
|
193
|
+
actor: { kind: "system" },
|
|
194
|
+
scope: {
|
|
195
|
+
workspaceId: "default",
|
|
196
|
+
projectId: project.id
|
|
197
|
+
},
|
|
198
|
+
occurredAt: new Date(project.updatedAt).toISOString(),
|
|
199
|
+
dedupeKey: `project:${project.id}:${project.updatedAt}:${createHash("sha256").update(JSON.stringify(patch)).digest("hex")}`,
|
|
200
|
+
sensitivity: "personal",
|
|
201
|
+
payload: {
|
|
202
|
+
before,
|
|
203
|
+
after: project,
|
|
204
|
+
changes
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
return project;
|
|
177
208
|
});
|
|
178
|
-
return project;
|
|
179
209
|
}
|
|
180
210
|
pin(id) {
|
|
181
211
|
return this.update(id, { pinnedAt: Date.now() });
|
|
@@ -5,10 +5,11 @@ import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync
|
|
|
5
5
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
6
6
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
7
7
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
8
|
-
import { CredentialResolver, hasCredentials, init_credentials
|
|
8
|
+
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
9
9
|
import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
|
|
10
10
|
import { getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
11
11
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
12
|
+
import { init_provider_auth_service, resolveProviderApiKey } from "./provider-auth-service.js";
|
|
12
13
|
import { getModel, getModels, getProviders } from "@earendil-works/pi-ai/compat";
|
|
13
14
|
//#region src/providers/index.ts
|
|
14
15
|
/**
|
|
@@ -144,7 +145,7 @@ function getAllProviders() {
|
|
|
144
145
|
}
|
|
145
146
|
async function getApiKey(provider, credentialOptions) {
|
|
146
147
|
if (getProviderRegistry().has(provider)) return "extension-managed";
|
|
147
|
-
const credentialKey = await
|
|
148
|
+
const credentialKey = await resolveProviderApiKey(provider, credentialOptions);
|
|
148
149
|
if (credentialKey) return credentialKey;
|
|
149
150
|
const registryKey = getModelRegistry().getApiKey(provider);
|
|
150
151
|
if (registryKey) return registryKey;
|
|
@@ -320,6 +321,7 @@ var init_providers = __esmMin((() => {
|
|
|
320
321
|
init_model_supplements();
|
|
321
322
|
init_model_ref();
|
|
322
323
|
init_plugin_registry();
|
|
324
|
+
init_provider_auth_service();
|
|
323
325
|
OPENAI_CODEX_CANONICAL_BASE_URL = "https://chatgpt.com/backend-api/codex";
|
|
324
326
|
PROVIDER_META = {
|
|
325
327
|
"xopc-cloud": {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ModelRuntime } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { CredentialResolver, type CredentialResolverOptions } from '../auth/credentials.js';
|
|
3
|
+
import { XopcModelCredentialStore } from '../auth/model-credential-store.js';
|
|
4
|
+
type ApiKeyResolver = Pick<CredentialResolver, 'resolveApiKey'>;
|
|
5
|
+
export interface ProviderAuthServiceOptions {
|
|
6
|
+
credentials?: XopcModelCredentialStore;
|
|
7
|
+
resolver?: ApiKeyResolver;
|
|
8
|
+
runtimeFactory?: (credentials: XopcModelCredentialStore) => Promise<ModelRuntime>;
|
|
9
|
+
}
|
|
10
|
+
/** Resolves request credentials while keeping OAuth refresh inside the shared persistent store. */
|
|
11
|
+
export declare class ProviderAuthService {
|
|
12
|
+
private readonly credentials;
|
|
13
|
+
private readonly resolver;
|
|
14
|
+
private readonly runtimeFactory;
|
|
15
|
+
private runtime;
|
|
16
|
+
constructor(options?: ProviderAuthServiceOptions);
|
|
17
|
+
resolveApiKey(providerId: string, signal?: AbortSignal): Promise<string | null>;
|
|
18
|
+
private getRuntime;
|
|
19
|
+
}
|
|
20
|
+
export declare function getProviderAuthService(): ProviderAuthService;
|
|
21
|
+
export declare function resolveProviderApiKey(providerId: string, credentialOptions?: CredentialResolverOptions): Promise<string | null>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_paths, resolveModelsJsonPath } from "../config/paths.js";
|
|
3
|
+
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
4
|
+
import { XopcModelCredentialStore, init_model_credential_store } from "../auth/model-credential-store.js";
|
|
5
|
+
import { init_register_runtime_providers, registerRuntimeProviders } from "./register-runtime-providers.js";
|
|
6
|
+
import { InMemoryModelsStore } from "@earendil-works/pi-ai";
|
|
7
|
+
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
//#region src/providers/provider-auth-service.ts
|
|
9
|
+
async function createAuthRuntime(credentials) {
|
|
10
|
+
const runtime = await ModelRuntime.create({
|
|
11
|
+
credentials,
|
|
12
|
+
modelsPath: resolveModelsJsonPath(),
|
|
13
|
+
modelsStore: new InMemoryModelsStore()
|
|
14
|
+
});
|
|
15
|
+
registerRuntimeProviders(runtime);
|
|
16
|
+
return runtime;
|
|
17
|
+
}
|
|
18
|
+
function getProviderAuthService() {
|
|
19
|
+
defaultProviderAuthService ??= new ProviderAuthService();
|
|
20
|
+
return defaultProviderAuthService;
|
|
21
|
+
}
|
|
22
|
+
async function resolveProviderApiKey(providerId, credentialOptions) {
|
|
23
|
+
if (!credentialOptions) return await getProviderAuthService().resolveApiKey(providerId);
|
|
24
|
+
const resolver = new CredentialResolver(credentialOptions);
|
|
25
|
+
return await new ProviderAuthService({
|
|
26
|
+
credentials: new XopcModelCredentialStore(resolver),
|
|
27
|
+
resolver
|
|
28
|
+
}).resolveApiKey(providerId);
|
|
29
|
+
}
|
|
30
|
+
var ProviderAuthService, defaultProviderAuthService;
|
|
31
|
+
var init_provider_auth_service = __esmMin((() => {
|
|
32
|
+
init_credentials();
|
|
33
|
+
init_model_credential_store();
|
|
34
|
+
init_paths();
|
|
35
|
+
init_register_runtime_providers();
|
|
36
|
+
ProviderAuthService = class {
|
|
37
|
+
credentials;
|
|
38
|
+
resolver;
|
|
39
|
+
runtimeFactory;
|
|
40
|
+
runtime;
|
|
41
|
+
constructor(options = {}) {
|
|
42
|
+
const defaultResolver = new CredentialResolver();
|
|
43
|
+
this.resolver = options.resolver ?? defaultResolver;
|
|
44
|
+
this.credentials = options.credentials ?? new XopcModelCredentialStore(defaultResolver);
|
|
45
|
+
this.runtimeFactory = options.runtimeFactory ?? createAuthRuntime;
|
|
46
|
+
}
|
|
47
|
+
async resolveApiKey(providerId, signal) {
|
|
48
|
+
if ((await this.credentials.read(providerId, { signal }))?.type === "oauth") {
|
|
49
|
+
const runtime = await this.getRuntime();
|
|
50
|
+
const provider = runtime.getProvider(providerId);
|
|
51
|
+
if (provider?.auth.oauth && !provider.auth.apiKey) return (await runtime.getAuth(providerId, { signal }))?.auth.apiKey ?? null;
|
|
52
|
+
}
|
|
53
|
+
return await this.resolver.resolveApiKey(providerId);
|
|
54
|
+
}
|
|
55
|
+
getRuntime() {
|
|
56
|
+
this.runtime ??= this.runtimeFactory(this.credentials).catch((error) => {
|
|
57
|
+
this.runtime = void 0;
|
|
58
|
+
throw error;
|
|
59
|
+
});
|
|
60
|
+
return this.runtime;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}));
|
|
64
|
+
//#endregion
|
|
65
|
+
init_provider_auth_service();
|
|
66
|
+
export { ProviderAuthService, getProviderAuthService, init_provider_auth_service, resolveProviderApiKey };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModelRuntime } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { type ModelCatalogSnapshot } from './model-catalog-store.js';
|
|
3
|
+
type RuntimeProviderRegistrar = Pick<ModelRuntime, 'registerProvider'>;
|
|
4
|
+
/** Register dynamically discovered model providers, including their OAuth contract. */
|
|
5
|
+
export declare function registerRuntimeProviders(modelRuntime: RuntimeProviderRegistrar, catalog?: ModelCatalogSnapshot): void;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
3
|
+
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
4
|
+
import { XOPC_CLOUD_PROVIDER_ID, init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
5
|
+
//#region src/providers/register-runtime-providers.ts
|
|
6
|
+
function registerRuntimeProvider(modelRuntime, source) {
|
|
7
|
+
const oauthDefinition = getOAuthProviderDefinition(source.providerId);
|
|
8
|
+
const oauth = oauthDefinition?.oauthOnly ? {
|
|
9
|
+
name: oauthDefinition.displayName,
|
|
10
|
+
login: oauthDefinition.provider.login.bind(oauthDefinition.provider),
|
|
11
|
+
refreshToken: oauthDefinition.provider.refreshToken.bind(oauthDefinition.provider),
|
|
12
|
+
getApiKey: oauthDefinition.provider.getApiKey.bind(oauthDefinition.provider)
|
|
13
|
+
} : void 0;
|
|
14
|
+
modelRuntime.registerProvider(source.providerId, {
|
|
15
|
+
name: oauthDefinition?.displayName ?? source.providerId,
|
|
16
|
+
baseUrl: source.baseUrl,
|
|
17
|
+
api: source.api,
|
|
18
|
+
oauth,
|
|
19
|
+
models: source.models.filter((model) => model.availability === "available").map((model) => ({
|
|
20
|
+
id: model.id,
|
|
21
|
+
name: model.name,
|
|
22
|
+
reasoning: false,
|
|
23
|
+
input: ["text"],
|
|
24
|
+
cost: {
|
|
25
|
+
input: 0,
|
|
26
|
+
output: 0,
|
|
27
|
+
cacheRead: 0,
|
|
28
|
+
cacheWrite: 0
|
|
29
|
+
},
|
|
30
|
+
contextWindow: 128e3,
|
|
31
|
+
maxTokens: model.maxOutputTokens ?? 16384
|
|
32
|
+
}))
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Register dynamically discovered model providers, including their OAuth contract. */
|
|
36
|
+
function registerRuntimeProviders(modelRuntime, catalog = getModelCatalogStore().load()) {
|
|
37
|
+
for (const source of Object.values(catalog.sources)) registerRuntimeProvider(modelRuntime, source);
|
|
38
|
+
if (!catalog.sources["xopc-cloud"]) registerRuntimeProvider(modelRuntime, {
|
|
39
|
+
providerId: XOPC_CLOUD_PROVIDER_ID,
|
|
40
|
+
baseUrl: resolveXopcModelRouterUrl(),
|
|
41
|
+
api: "openai-completions",
|
|
42
|
+
etag: null,
|
|
43
|
+
recommendedModel: null,
|
|
44
|
+
lastSuccessAt: 0,
|
|
45
|
+
models: []
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var init_register_runtime_providers = __esmMin((() => {
|
|
49
|
+
init_registry();
|
|
50
|
+
init_model_catalog_store();
|
|
51
|
+
init_xopc_cloud_config();
|
|
52
|
+
}));
|
|
53
|
+
//#endregion
|
|
54
|
+
init_register_runtime_providers();
|
|
55
|
+
export { init_register_runtime_providers, registerRuntimeProviders };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ProviderAuthService } from './provider-auth-service.js';
|
|
3
3
|
declare const accountSummarySchema: z.ZodObject<{
|
|
4
4
|
balance: z.ZodObject<{
|
|
5
5
|
credits: z.ZodNumber;
|
|
@@ -33,7 +33,7 @@ export declare class XopcCloudAccountService {
|
|
|
33
33
|
constructor(options?: {
|
|
34
34
|
fetchImpl?: typeof fetch;
|
|
35
35
|
routerUrl?: string;
|
|
36
|
-
credentials?: Pick<
|
|
36
|
+
credentials?: Pick<ProviderAuthService, 'resolveApiKey'>;
|
|
37
37
|
});
|
|
38
38
|
getSummary(days?: 1 | 7 | 30): Promise<XopcCloudAccountSummary | null>;
|
|
39
39
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
2
|
+
import { getProviderAuthService, init_provider_auth_service } from "./provider-auth-service.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
//#region src/providers/xopc-cloud-account-service.ts
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
init_provider_auth_service();
|
|
6
|
+
init_xopc_cloud_config();
|
|
6
7
|
const accountSummarySchema = z.object({
|
|
7
8
|
balance: z.object({
|
|
8
9
|
credits: z.number().int().nonnegative(),
|
|
@@ -41,8 +42,8 @@ var XopcCloudAccountService = class {
|
|
|
41
42
|
credentials;
|
|
42
43
|
constructor(options = {}) {
|
|
43
44
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
44
|
-
this.routerUrl = (options.routerUrl
|
|
45
|
-
this.credentials = options.credentials ??
|
|
45
|
+
this.routerUrl = resolveXopcModelRouterUrl(options.routerUrl);
|
|
46
|
+
this.credentials = options.credentials ?? getProviderAuthService();
|
|
46
47
|
}
|
|
47
48
|
async getSummary(days = 7) {
|
|
48
49
|
const accessToken = await this.credentials.resolveApiKey("xopc-cloud");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region src/providers/xopc-cloud-config.ts
|
|
3
|
+
function resolveXopcModelRouterUrl(override) {
|
|
4
|
+
return (override ?? process.env.XOPC_MODEL_ROUTER_URL ?? "https://router.xopc.ai/v1").replace(/\/+$/, "");
|
|
5
|
+
}
|
|
6
|
+
var XOPC_CLOUD_PROVIDER_ID, DEFAULT_XOPC_MODEL_ROUTER_URL;
|
|
7
|
+
var init_xopc_cloud_config = __esmMin((() => {
|
|
8
|
+
XOPC_CLOUD_PROVIDER_ID = "xopc-cloud";
|
|
9
|
+
DEFAULT_XOPC_MODEL_ROUTER_URL = "https://router.xopc.ai/v1";
|
|
10
|
+
}));
|
|
11
|
+
//#endregion
|
|
12
|
+
init_xopc_cloud_config();
|
|
13
|
+
export { DEFAULT_XOPC_MODEL_ROUTER_URL, XOPC_CLOUD_PROVIDER_ID, init_xopc_cloud_config, resolveXopcModelRouterUrl };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type CredentialResolver } from '../auth/credentials.js';
|
|
2
1
|
import { type ModelCatalogStore } from './model-catalog-store.js';
|
|
2
|
+
import { type ProviderAuthService } from './provider-auth-service.js';
|
|
3
3
|
export type XopcCloudModelRefreshResult = {
|
|
4
4
|
status: 'skipped';
|
|
5
5
|
reason: 'not_configured';
|
|
@@ -22,7 +22,7 @@ export declare class XopcCloudModelSource {
|
|
|
22
22
|
constructor(options?: {
|
|
23
23
|
fetchImpl?: typeof fetch;
|
|
24
24
|
routerUrl?: string;
|
|
25
|
-
credentials?: Pick<
|
|
25
|
+
credentials?: Pick<ProviderAuthService, 'resolveApiKey'>;
|
|
26
26
|
catalogStore?: ModelCatalogStore;
|
|
27
27
|
refreshModels?: () => void;
|
|
28
28
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
2
2
|
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
3
|
-
import {
|
|
3
|
+
import { init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
4
|
+
import { getProviderAuthService, init_provider_auth_service } from "./provider-auth-service.js";
|
|
4
5
|
//#region src/providers/xopc-cloud-model-source.ts
|
|
5
|
-
init_credentials();
|
|
6
6
|
init_model_catalog_store();
|
|
7
7
|
init_model_registry();
|
|
8
|
-
|
|
8
|
+
init_provider_auth_service();
|
|
9
|
+
init_xopc_cloud_config();
|
|
9
10
|
var XopcCloudModelError = class extends Error {
|
|
10
11
|
constructor(message, status, code) {
|
|
11
12
|
super(message);
|
|
@@ -22,8 +23,8 @@ var XopcCloudModelSource = class {
|
|
|
22
23
|
refreshModels;
|
|
23
24
|
constructor(options = {}) {
|
|
24
25
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
25
|
-
this.routerUrl = (options.routerUrl
|
|
26
|
-
this.credentials = options.credentials ??
|
|
26
|
+
this.routerUrl = resolveXopcModelRouterUrl(options.routerUrl);
|
|
27
|
+
this.credentials = options.credentials ?? getProviderAuthService();
|
|
27
28
|
this.catalogStore = options.catalogStore ?? getModelCatalogStore();
|
|
28
29
|
this.refreshModels = options.refreshModels ?? (() => getModelRegistry().refresh());
|
|
29
30
|
}
|
|
@@ -3,7 +3,7 @@ export { onSessionTranscriptUpdate, emitSessionTranscriptUpdate, type SessionTra
|
|
|
3
3
|
export { SessionStore } from './store.js';
|
|
4
4
|
export type { SessionStoreOptions } from './store.js';
|
|
5
5
|
export { SessionConfigStore, resolveThinkingLevel, resolveReasoningLevel, resolveVerboseLevel } from './config-store.js';
|
|
6
|
-
export { resolveEffectiveThinkingLevel, resolveEffectiveReasoningLevel } from './thinking-resolve.js';
|
|
6
|
+
export { DEFAULT_ACTIVITY_DETAIL_LEVEL, resolveConfiguredActivityDetailDefault, resolveEffectiveThinkingLevel, resolveEffectiveReasoningLevel, } from './thinking-resolve.js';
|
|
7
7
|
export type { SessionAgentConfig } from './config-types.js';
|
|
8
8
|
export { normalizeWorkingDirectoryInput, effectiveWorkspacePathForSession, projectWorkspacePath, } from './session-workspace.js';
|
|
9
9
|
export { SessionStatus, type SessionMetadata, type SessionDetail, type SessionListQuery, type PaginatedResult, type SessionStats, type ExportFormat, type SessionExport, type SessionTranscriptSummary, type CompactionBoundarySummary, } from './types.js';
|
|
@@ -8,7 +8,7 @@ import { SessionStore } from "./store.js";
|
|
|
8
8
|
import { applySessionPatchToMetadata } from "./patch-metadata.js";
|
|
9
9
|
import { SessionIndex } from "./manager.js";
|
|
10
10
|
import { SessionConfigStore, resolveReasoningLevel, resolveThinkingLevel, resolveVerboseLevel } from "./config-store.js";
|
|
11
|
-
import { resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel } from "./thinking-resolve.js";
|
|
11
|
+
import { DEFAULT_ACTIVITY_DETAIL_LEVEL, resolveConfiguredActivityDetailDefault, resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel } from "./thinking-resolve.js";
|
|
12
12
|
import { shouldSkipWebchatInboundByAbortCutoff } from "./abort-cutoff.js";
|
|
13
13
|
import { DEFAULT_IDLE_MINUTES, DEFAULT_RESET_AT_HOUR, DEFAULT_RESET_MODE, evaluateSessionFreshness, resolveDailyResetAtMs, resolveSessionResetPolicy } from "./reset-policy.js";
|
|
14
14
|
import { resolveChannelResetConfig, resolveSessionResetType } from "./reset-type.js";
|
|
@@ -17,4 +17,4 @@ import { resolveSession, resolveSessionKeyForRequest } from "./resolve-session.j
|
|
|
17
17
|
import { DEFAULT_RESET_TRIGGERS, RESET_OVERLAP_COMMANDS, bareResetAckMessage, matchResetTriggers, resolveResetTriggers, shouldSkipResetOverlapCommand, stripLeadingEnvelopeTimestamp } from "./reset-triggers.js";
|
|
18
18
|
import { initSessionTurn } from "./init-session-turn.js";
|
|
19
19
|
import { CURRENT_SESSION_TRANSCRIPT_VERSION, XOPC_SESSION_TRANSCRIPT_TYPE } from "./transcript-format.js";
|
|
20
|
-
export { CURRENT_SESSION_TRANSCRIPT_VERSION, DEFAULT_IDLE_MINUTES, DEFAULT_RESET_AT_HOUR, DEFAULT_RESET_MODE, DEFAULT_RESET_TRIGGERS, RESET_OVERLAP_COMMANDS, SessionConfigStore, SessionIndex, SessionStatus, SessionStore, XOPC_SESSION_TRANSCRIPT_TYPE, applySessionPatchToMetadata, bareResetAckMessage, buildSessionContextForLlm, effectiveWorkspacePathForSession, emitSessionTranscriptUpdate, evaluateSessionFreshness, fallbackTitleFromMessages, flattenMessageContent, generateSessionTitleFromMessages, getSessionTitleSource, initSessionTurn, isTranscriptContextEntry, isWebchatSessionKey, matchResetTriggers, maybeRefineSessionTitleWithLlm, maybeSetProvisionalSessionTitle, mergeLlmMessagesPreservingContextRows, messagesToClientHistory, normalizeWorkingDirectoryInput, onSessionTranscriptUpdate, projectWorkspacePath, provisionalTitleFromUserText, resolveChannelResetConfig, resolveDailyResetAtMs, resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel, resolveReasoningLevel, resolveResetTriggers, resolveSession, resolveSessionKeyForRequest, resolveSessionLifecycleTimestamps, resolveSessionResetPolicy, resolveSessionResetType, resolveThinkingLevel, resolveVerboseLevel, sanitizeGeneratedSessionTitle, sanitizeSessionTitle, shouldAutoTitleSessionKey, shouldRefineSessionTitleWithLlm, shouldSkipResetOverlapCommand, shouldSkipWebchatInboundByAbortCutoff, stripLeadingEnvelopeTimestamp, transcriptRowsFromJsonArray };
|
|
20
|
+
export { CURRENT_SESSION_TRANSCRIPT_VERSION, DEFAULT_ACTIVITY_DETAIL_LEVEL, DEFAULT_IDLE_MINUTES, DEFAULT_RESET_AT_HOUR, DEFAULT_RESET_MODE, DEFAULT_RESET_TRIGGERS, RESET_OVERLAP_COMMANDS, SessionConfigStore, SessionIndex, SessionStatus, SessionStore, XOPC_SESSION_TRANSCRIPT_TYPE, applySessionPatchToMetadata, bareResetAckMessage, buildSessionContextForLlm, effectiveWorkspacePathForSession, emitSessionTranscriptUpdate, evaluateSessionFreshness, fallbackTitleFromMessages, flattenMessageContent, generateSessionTitleFromMessages, getSessionTitleSource, initSessionTurn, isTranscriptContextEntry, isWebchatSessionKey, matchResetTriggers, maybeRefineSessionTitleWithLlm, maybeSetProvisionalSessionTitle, mergeLlmMessagesPreservingContextRows, messagesToClientHistory, normalizeWorkingDirectoryInput, onSessionTranscriptUpdate, projectWorkspacePath, provisionalTitleFromUserText, resolveChannelResetConfig, resolveConfiguredActivityDetailDefault, resolveDailyResetAtMs, resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel, resolveReasoningLevel, resolveResetTriggers, resolveSession, resolveSessionKeyForRequest, resolveSessionLifecycleTimestamps, resolveSessionResetPolicy, resolveSessionResetType, resolveThinkingLevel, resolveVerboseLevel, sanitizeGeneratedSessionTitle, sanitizeSessionTitle, shouldAutoTitleSessionKey, shouldRefineSessionTitleWithLlm, shouldSkipResetOverlapCommand, shouldSkipWebchatInboundByAbortCutoff, stripLeadingEnvelopeTimestamp, transcriptRowsFromJsonArray };
|
|
@@ -8,6 +8,14 @@ import { type ThinkLevel, type ReasoningLevel } from '../agent/transcript/thinki
|
|
|
8
8
|
* @param requestOverride - Raw value from HTTP/API (e.g. Web pill); wins over persisted session when valid.
|
|
9
9
|
*/
|
|
10
10
|
export declare function resolveEffectiveThinkingLevel(sessionConfigStore: SessionConfigStore, sessionKey: string, requestOverride?: string | null, agentDefault?: ThinkLevel): Promise<ThinkingLevel>;
|
|
11
|
+
export declare const DEFAULT_ACTIVITY_DETAIL_LEVEL: ReasoningLevel;
|
|
12
|
+
export declare function resolveConfiguredActivityDetailDefault(config?: {
|
|
13
|
+
gateway?: {
|
|
14
|
+
webchat?: {
|
|
15
|
+
activityDetailDefault?: ReasoningLevel;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}): ReasoningLevel;
|
|
11
19
|
/**
|
|
12
20
|
* Session override > runtime default.
|
|
13
21
|
*/
|
|
@@ -12,13 +12,16 @@ async function resolveEffectiveThinkingLevel(sessionConfigStore, sessionKey, req
|
|
|
12
12
|
if (fromSession !== void 0) return fromSession;
|
|
13
13
|
return agentDefault ?? FALLBACK;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const DEFAULT_ACTIVITY_DETAIL_LEVEL = "on";
|
|
16
|
+
function resolveConfiguredActivityDetailDefault(config) {
|
|
17
|
+
return config?.gateway?.webchat?.activityDetailDefault ?? "on";
|
|
18
|
+
}
|
|
16
19
|
/**
|
|
17
20
|
* Session override > runtime default.
|
|
18
21
|
*/
|
|
19
22
|
async function resolveEffectiveReasoningLevel(sessionConfigStore, sessionKey, agentDefault) {
|
|
20
|
-
const def = agentDefault ??
|
|
23
|
+
const def = agentDefault ?? "on";
|
|
21
24
|
return await resolveReasoningLevel(sessionConfigStore, sessionKey, def) ?? def;
|
|
22
25
|
}
|
|
23
26
|
//#endregion
|
|
24
|
-
export { resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel };
|
|
27
|
+
export { DEFAULT_ACTIVITY_DETAIL_LEVEL, resolveConfiguredActivityDetailDefault, resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
DROP TABLE IF EXISTS focus_insights;
|
|
2
|
+
DROP TABLE IF EXISTS focus_activities;
|
|
3
|
+
DROP TABLE IF EXISTS focus_monitors;
|
|
4
|
+
DROP TABLE IF EXISTS focus_projects;
|
|
5
|
+
DROP TABLE IF EXISTS focuses;
|
|
6
|
+
DROP TABLE IF EXISTS focus_candidate_projects;
|
|
7
|
+
DROP TABLE IF EXISTS focus_candidates;
|
|
8
|
+
|
|
9
|
+
CREATE TABLE proactive_events (
|
|
10
|
+
event_id TEXT PRIMARY KEY,
|
|
11
|
+
type TEXT NOT NULL,
|
|
12
|
+
schema_version INTEGER NOT NULL CHECK (schema_version > 0),
|
|
13
|
+
source_kind TEXT NOT NULL,
|
|
14
|
+
source_id TEXT NOT NULL,
|
|
15
|
+
device_id TEXT,
|
|
16
|
+
subject_kind TEXT NOT NULL,
|
|
17
|
+
subject_id TEXT NOT NULL,
|
|
18
|
+
actor_kind TEXT NOT NULL CHECK (actor_kind IN ('user', 'agent', 'system', 'integration')),
|
|
19
|
+
actor_id TEXT,
|
|
20
|
+
workspace_id TEXT NOT NULL,
|
|
21
|
+
project_id TEXT,
|
|
22
|
+
agent_id TEXT,
|
|
23
|
+
occurred_at TEXT NOT NULL,
|
|
24
|
+
observed_at TEXT NOT NULL,
|
|
25
|
+
correlation_id TEXT NOT NULL,
|
|
26
|
+
causation_id TEXT,
|
|
27
|
+
dedupe_key TEXT NOT NULL UNIQUE,
|
|
28
|
+
sensitivity TEXT NOT NULL CHECK (sensitivity IN ('public', 'personal', 'confidential', 'restricted')),
|
|
29
|
+
payload_json TEXT NOT NULL,
|
|
30
|
+
routed_at TEXT
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
CREATE TABLE proactive_signal_batches (
|
|
34
|
+
batch_id TEXT PRIMARY KEY,
|
|
35
|
+
scenario_key TEXT NOT NULL,
|
|
36
|
+
scenario_version INTEGER NOT NULL CHECK (scenario_version > 0),
|
|
37
|
+
aggregation_key TEXT NOT NULL,
|
|
38
|
+
window_started_at TEXT NOT NULL,
|
|
39
|
+
window_ends_at TEXT NOT NULL,
|
|
40
|
+
ready_at TEXT NOT NULL,
|
|
41
|
+
status TEXT NOT NULL CHECK (status IN (
|
|
42
|
+
'collecting', 'ready', 'processing', 'processed', 'ignored',
|
|
43
|
+
'failed_retryable', 'failed_permanent', 'expired'
|
|
44
|
+
)),
|
|
45
|
+
event_count INTEGER NOT NULL DEFAULT 0 CHECK (event_count >= 0),
|
|
46
|
+
created_at TEXT NOT NULL,
|
|
47
|
+
updated_at TEXT NOT NULL
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
CREATE TABLE proactive_batch_events (
|
|
51
|
+
batch_id TEXT NOT NULL,
|
|
52
|
+
event_id TEXT NOT NULL,
|
|
53
|
+
added_at TEXT NOT NULL,
|
|
54
|
+
PRIMARY KEY (batch_id, event_id),
|
|
55
|
+
FOREIGN KEY (batch_id) REFERENCES proactive_signal_batches(batch_id) ON DELETE CASCADE,
|
|
56
|
+
FOREIGN KEY (event_id) REFERENCES proactive_events(event_id) ON DELETE CASCADE
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
CREATE INDEX idx_proactive_events_type_observed
|
|
60
|
+
ON proactive_events(type, observed_at DESC);
|
|
61
|
+
CREATE INDEX idx_proactive_events_subject
|
|
62
|
+
ON proactive_events(subject_kind, subject_id, occurred_at DESC);
|
|
63
|
+
CREATE INDEX idx_proactive_events_project
|
|
64
|
+
ON proactive_events(project_id, occurred_at DESC) WHERE project_id IS NOT NULL;
|
|
65
|
+
CREATE INDEX idx_proactive_events_correlation
|
|
66
|
+
ON proactive_events(correlation_id);
|
|
67
|
+
CREATE INDEX idx_proactive_batches_ready
|
|
68
|
+
ON proactive_signal_batches(status, ready_at);
|
|
69
|
+
CREATE UNIQUE INDEX idx_proactive_collecting_batch
|
|
70
|
+
ON proactive_signal_batches(scenario_key, aggregation_key)
|
|
71
|
+
WHERE status = 'collecting';
|