@xopcai/xopc 0.0.331 → 0.0.333
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/{agent-avatar-dicebear-B0BtF24E.js → agent-avatar-dicebear-DiI2O7lC.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CVp3J969.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DbvLXQO2.js → agent-plugin-dialog-CacyndrS.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DXYZSuUV.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fwzTRJfP.js → app-management-settings-panel-BcszTlqr.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-v_GGe8UZ.js → appearance-settings-B1XPe8qz.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C9ZMEuuA.js → apps-page-ZqANbUZv.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-B6EgADeH.js → archive-plugin-MjUsJcNb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B4H_IFeX.js → attachment-load-DHa-BI9a.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-UlVCvg4r.js → automations-page-Dsjivdxs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B37vs5tk.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BxTSx30f.js → binary-plugins-DQYcuBHP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CVzdrpjl.js → block-editor-Bx0uXbJP.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C5s1yHOu.js → browser-automation-inputs-1ZIPGDeq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CBVD8k6O.js → browser-automations-page-CCjYipHc.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CSv4rvmx.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-BnO9LV7U.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-page-BAT7Vvb8.js → capabilities-page-BfvDvIY1.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CoW7-ESq.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-EETjXmkG.js → capability-header-actions-D_hbWRRF.js} +1 -1
- package/dist/gateway/static/root/assets/channels-BhMaRh1x.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DCqm9j9W.js → chat-terminal-dock-Fnum_IEm.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-CxFWdovV.js → computer-settings-page-DI1zfCTA.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-wxsEhmlU.js → connector-service-page-CiGDAubm.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Ono0Pha1.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-h_OS6uBR.js → date-picker-D-JhzZyW.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DNgSSH3z.js → dependency-picker-DpD3xaEB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CflvPnB-.js → desktop-pet-CCoDxKqh.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CXy0X5Js.js → desktop-pet-settings-GxndKfCx.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-BDMiJcsK.js → device-pairing-wizard-B71w3ptm.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BqkOh13m.js → directory-picker-path-field-CUzjJvjs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-VT4s-9pK.js → extension-debug-page-BtDY8ntX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CBSeGhGA.js → extension-page-D9_XF-XC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DRB6uOo8.js → extension-settings-page-CjhUFAaC.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-cR-tz7-Q.js → gateway-config-swr-CgIjCxM8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-lF-FpnZy.js → gateway-settings-BWaCnwT1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-6jLRcQsu.js → gateway-startup-retry-i-1lTrwY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BTjGLngn.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CSSkwsyC.js → image-generation-api-gilc-u7M.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DGkOijwE.js → imports-page-BEtq5BRU.js} +1 -1
- package/dist/gateway/static/root/assets/index-DHL16aYZ.js +121 -0
- package/dist/gateway/static/root/assets/index-N1e6PDwx.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-iU6c2zg1.js → keyboard-shortcuts-settings-JUYY_18v.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-uI7mtoVz.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-C0BWC8D2.js → local-apps-page-BlYESNqz.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-wNXWkWu5.js → locale-store-BY30D6tg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Dpoi-r-_.js → logs-page-BbLQreeN.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-c4krhYU7.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DlT9KqwF.js → markdown-view-BEeXMfDw.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C8E_F2F_.js → media-plugins-DEFN1I73.js} +1 -1
- package/dist/gateway/static/root/assets/messages-_6IXbP2u.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel--09xGxyE.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-DsxcVBXF.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-qqWG_gs_.js → page-context-capture-button-D43aVpCj.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-b3lheKy4.js → page-tabs-BhYBCqls.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-0Q4rTfGX.js → preview-open-alternatives-CP8agNlc.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-jnJZCrKQ.js → product-open-page-CU7fRhfT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-U-EdDfAW.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-r96k_2wB.js → projects-page-DUOKZLt7.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BIpltJ47.js → registry-api-BvVx0G1o.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-B1d8pB_y.js → remote-access-hub-fVPQe5YS.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Do_iF13W.js → runtime-tools-settings-panel-Czvzsuj_.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-C0-WHOY3.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-Cfft26Je.js → schema-form-B9Ni5O93.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DdXvW09N.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BtF83fBY.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-iI0MTyuU.js → settings-form-section-jquf1P7n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C2Ka9oJm.js → settings-page-DPomsvba.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-nnmS_p5h.js → setup-status-panel-BvVlqpHf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-D0Knvtlp.js → share-preview-page-b9DI0N1J.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-R_qwc4DN.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BuZKcy9b.js → skill-api-Bu7-3w-L.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNJAQ_e-.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DcxWxIrR.js → skills-page-D7XPEQu_.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CMG0ZAsd.js → system-settings-panel-BwFR0Uci.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-PFjGW2g1.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DGYA6GyO.js → tunnel-api-PfucxMP3.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-t_zdQHcy.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CDemMoSX.js → use-autosave-DLyy2wHz.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-OyfPVfB9.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CXArY4t5.js → voice-api-key-field-CQDY5EBK.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-ujEySjyc.js → voice-config-api-Bwy3Al3J.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Dk5KsKOm.js → work-discovery-overlay-CJzqJ47I.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DNpdaI-2.js → workflow-run-setup-panel-sCOk-esV.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DYBGjN7C.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +59 -14
- package/dist/packages/gateway-contract/src/capabilities.js +106 -8
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/scenes.js +7 -6
- package/dist/packages/gateway-contract/src/sessions.js +2 -1
- package/dist/packages/gateway-contract/src/usage.js +6 -0
- package/dist/src/agent/agent-manager.js +13 -7
- package/dist/src/agent/background-review/run-background-review.js +7 -2
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +7 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.d.ts +2 -1
- package/dist/src/agent/external-tools/gateway-tools.js +44 -11
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
- package/dist/src/agent/memory/compaction.js +4 -0
- package/dist/src/agent/orchestration/agent-orchestrator.js +0 -21
- package/dist/src/agent/service/btw-query.js +8 -2
- package/dist/src/agent/service.js +3 -3
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +4 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +5 -4
- package/dist/src/agent/tools/automation-tool.d.ts +4 -1
- package/dist/src/agent/tools/automation-tool.js +42 -4
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +50 -9
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/ai-assist/text-assist.js +5 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/api/routes.js +65 -0
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/read.js +24 -0
- package/dist/src/automations/capabilities/write.d.ts +69 -14
- package/dist/src/automations/capabilities/write.js +78 -5
- package/dist/src/automations/delivery/delivery-router.d.ts +50 -0
- package/dist/src/automations/delivery/delivery-router.js +318 -0
- package/dist/src/automations/delivery/index.d.ts +1 -0
- package/dist/src/automations/delivery/index.js +2 -0
- package/dist/src/automations/domain/defaults.d.ts +0 -1
- package/dist/src/automations/domain/defaults.js +2 -2
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +180 -7
- package/dist/src/automations/domain/validation.d.ts +172 -22
- package/dist/src/automations/domain/validation.js +82 -13
- package/dist/src/automations/draft/automation-draft-prompt.js +3 -4
- package/dist/src/automations/draft/automation-draft-service.js +6 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +31 -3
- package/dist/src/automations/draft/automation-draft-validator.js +5 -4
- package/dist/src/automations/events/event-catalog.d.ts +14 -0
- package/dist/src/automations/events/event-catalog.js +117 -0
- package/dist/src/automations/events/event-dispatcher.d.ts +27 -0
- package/dist/src/automations/events/event-dispatcher.js +140 -0
- package/dist/src/automations/events/event-repository.d.ts +59 -0
- package/dist/src/automations/events/event-repository.js +361 -0
- package/dist/src/automations/events/index.d.ts +3 -0
- package/dist/src/automations/events/index.js +4 -0
- package/dist/src/automations/index.d.ts +3 -1
- package/dist/src/automations/index.js +9 -3
- package/dist/src/automations/service/action-executor.d.ts +20 -1
- package/dist/src/automations/service/action-executor.js +80 -24
- package/dist/src/automations/service/automation-service.d.ts +21 -4
- package/dist/src/automations/service/automation-service.js +150 -100
- package/dist/src/automations/storage/automation-repository.js +7 -7
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +26 -1
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/automations/webhook-secrets.d.ts +1 -0
- package/dist/src/automations/webhook-secrets.js +16 -0
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.d.ts +17 -1
- package/dist/src/capabilities/store-connector.js +69 -3
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/connectors.js +4 -3
- package/dist/src/cli/commands/doctor/checks/automation-integrity.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/automation-integrity.js +55 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.js +81 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/flow.js +5 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +5 -1
- package/dist/src/connectors/approval-resume.js +1 -1
- package/dist/src/connectors/cli/store.js +1 -1
- package/dist/src/connectors/composio-backends.js +14 -4
- package/dist/src/connectors/composio-managed-events.d.ts +5 -2
- package/dist/src/connectors/composio-managed-events.js +4 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +2 -1
- package/dist/src/connectors/connection-recovery-service.js +89 -4
- package/dist/src/discussions/analyzer.js +4 -4
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/home-intelligence-automation-reconciler.d.ts +3 -0
- package/dist/src/gateway/home-intelligence-automation-reconciler.js +52 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -4
- package/dist/src/gateway/hono/routes/connection-waits.js +3 -2
- package/dist/src/gateway/hono/routes/home.js +0 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/public-gateway.js +93 -3
- package/dist/src/gateway/hono/routes/scenes.js +57 -41
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +15 -0
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/update.js +6 -1
- package/dist/src/gateway/hono/routes/usage.d.ts +3 -0
- package/dist/src/gateway/hono/routes/usage.js +61 -0
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +21 -15
- package/dist/src/gateway/scenes/host.js +27 -14
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/active-execution.d.ts +19 -0
- package/dist/src/gateway/service/active-execution.js +16 -0
- package/dist/src/gateway/service/agent-runner.d.ts +4 -0
- package/dist/src/gateway/service/agent-runner.js +19 -1
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +9 -1
- package/dist/src/gateway/service/sessions-api.d.ts +13 -0
- package/dist/src/gateway/service/sessions-api.js +23 -0
- package/dist/src/gateway/service.d.ts +7 -3
- package/dist/src/gateway/service.js +108 -89
- package/dist/src/gateway/side-chat/run-service.js +10 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +4 -1
- package/dist/src/home-intelligence/host.d.ts +1 -1
- package/dist/src/home-intelligence/host.js +2 -10
- package/dist/src/home-intelligence/notification.js +1 -1
- package/dist/src/home-intelligence/repository.d.ts +1 -1
- package/dist/src/infra/domain-outbox-dispatcher.d.ts +0 -3
- package/dist/src/infra/domain-outbox-dispatcher.js +15 -7
- package/dist/src/infra/update-check.d.ts +8 -4
- package/dist/src/infra/update-check.js +43 -41
- package/dist/src/infra/update-startup.d.ts +7 -1
- package/dist/src/infra/update-startup.js +15 -6
- package/dist/src/local-apps/service.js +2 -2
- package/dist/src/memory-maintenance/index.js +2 -2
- package/dist/src/memory-maintenance/schedule.d.ts +0 -3
- package/dist/src/memory-maintenance/schedule.js +1 -8
- package/dist/src/notes/service.js +2 -3
- package/dist/src/projects/project-service.js +1 -2
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/providers/model-call.d.ts +3 -2
- package/dist/src/providers/model-call.js +30 -5
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/scenes/activationAdapter.d.ts +19 -0
- package/dist/src/scenes/activationAdapter.js +1 -0
- package/dist/src/scenes/agentExecutor.js +3 -10
- package/dist/src/scenes/contracts.d.ts +3 -9
- package/dist/src/scenes/contracts.js +1 -0
- package/dist/src/scenes/execution.d.ts +9 -3
- package/dist/src/scenes/execution.js +12 -11
- package/dist/src/scenes/httpServices.d.ts +5 -2
- package/dist/src/scenes/mailContext.d.ts +4 -0
- package/dist/src/scenes/mailContext.js +9 -0
- package/dist/src/scenes/maintenance.js +1 -5
- package/dist/src/scenes/metrics.d.ts +0 -6
- package/dist/src/scenes/metrics.js +0 -11
- package/dist/src/scenes/registry.d.ts +11 -0
- package/dist/src/scenes/registry.js +28 -0
- package/dist/src/scenes/repository.d.ts +6 -3
- package/dist/src/scenes/repository.js +43 -5
- package/dist/src/scenes/service.d.ts +2 -1
- package/dist/src/scenes/service.js +9 -7
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +37 -7
- package/dist/src/scenes/taskFollowUp/contracts.js +36 -17
- package/dist/src/scenes/taskFollowUp/service.d.ts +35 -7
- package/dist/src/scenes/taskFollowUp/service.js +86 -28
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/scenes/userNotes.d.ts +3 -0
- package/dist/src/scenes/userNotes.js +6 -0
- package/dist/src/session/client-history.d.ts +3 -0
- package/dist/src/session/client-history.js +10 -5
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/resolve-session.js +4 -3
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +3 -2
- package/dist/src/storage/sqlite/ai-usage-repository.d.ts +137 -0
- package/dist/src/storage/sqlite/ai-usage-repository.js +175 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +7 -5
- package/dist/src/storage/sqlite/connector-repository.js +36 -34
- package/dist/src/storage/sqlite/index.d.ts +2 -2
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/migrations/208_automation_management.sql +2 -0
- package/dist/src/storage/sqlite/migrations/209_automation_event_hub.sql +48 -0
- package/dist/src/storage/sqlite/migrations/210_remove_legacy_automation_timeout.sql +14 -0
- package/dist/src/storage/sqlite/migrations/211_automation_result_deliveries.sql +16 -0
- package/dist/src/storage/sqlite/migrations/212_automation_delivery_policy.sql +30 -0
- package/dist/src/storage/sqlite/migrations/213_automation_reliability_contract.sql +188 -0
- package/dist/src/storage/sqlite/migrations/214_ai_usage_ledger.sql +41 -0
- package/dist/src/storage/sqlite/migrations/215_scene_execution_adapters.sql +6 -0
- package/dist/src/storage/sqlite/migrations/216_remove_scene_model_usage.sql +1 -0
- package/dist/src/storage/sqlite/migrations/217_remove_legacy_memory_tables.sql +4 -0
- package/dist/src/storage/sqlite/migrations/218_core_relation_indexes.sql +26 -0
- package/dist/src/storage/sqlite/migrations/219_json_contracts.sql +123 -0
- package/dist/src/storage/sqlite/migrations/220_normalize_timestamps.sql +339 -0
- package/dist/src/storage/sqlite/migrations/221_ai_usage_retention_index.sql +2 -0
- package/dist/src/storage/sqlite/migrations/222_session_config_authority.sql +13 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +4 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +3 -7
- package/dist/src/storage/sqlite/row-mappers.js +6 -6
- package/dist/src/storage/sqlite/scenes-schema.d.ts +1 -1
- package/dist/src/storage/sqlite/scenes-schema.js +0 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -52
- package/dist/src/storage/sqlite/schemas/scenes.sql +0 -7
- package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +18 -1
- package/dist/src/storage/sqlite/session-read-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-read-repository.js +0 -1
- package/dist/src/storage/sqlite/session-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/session-repository.js +8 -18
- package/dist/src/storage/sqlite/timestamps.d.ts +4 -0
- package/dist/src/storage/sqlite/timestamps.js +20 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/transcript-repository.js +23 -15
- package/dist/src/storage/sqlite/user-trust-repository.js +4 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/home-query-service.js +4 -3
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/usage/cost.d.ts +4 -0
- package/dist/src/usage/cost.js +28 -0
- package/dist/src/usage/recorder.d.ts +13 -0
- package/dist/src/usage/recorder.js +117 -0
- package/dist/src/usage/scenario-registry.d.ts +8 -0
- package/dist/src/usage/scenario-registry.js +117 -0
- package/dist/src/usage/types.d.ts +55 -0
- package/dist/src/usage/types.js +1 -0
- package/dist/src/user-context/config.d.ts +9 -0
- package/dist/src/user-context/config.js +13 -4
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/work-discovery/analyzer.js +2 -2
- package/dist/src/work-discovery/investigator.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +15 -2
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DgP5DEJF.js +0 -1
- package/dist/gateway/static/root/assets/agents-Bh4XNLyk.js +0 -70
- package/dist/gateway/static/root/assets/automations-workspace-C7VS-yb7.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-CC43CC43.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DPETQOfF.js +0 -8
- package/dist/gateway/static/root/assets/channels-CwA619os.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-l7goF6QS.js +0 -2
- package/dist/gateway/static/root/assets/home-page-DSaXXoLm.js +0 -1
- package/dist/gateway/static/root/assets/index-BEw0xrde.css +0 -1
- package/dist/gateway/static/root/assets/index-D99vN3es.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-rH33N8I9.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-RFDLaquR.js +0 -1
- package/dist/gateway/static/root/assets/messages-fmf0dnr4.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DI7CIjmM.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BkqnU-Jh.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BvvcTH2F.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DK316w9a.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-EIk8iJTK.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DcOsdz78.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BcaxGQLC.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cb_CUL-U.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Cvr1qUTW.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-VXfz3rE7.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DDNDLdId.js +0 -6
- package/dist/src/automations/product-events.d.ts +0 -5
- package/dist/src/automations/product-events.js +0 -19
|
@@ -22,7 +22,6 @@ var init_session_read_repository = __esmMin((() => {
|
|
|
22
22
|
s.project_id, s.routing_json, s.custom_data_json,
|
|
23
23
|
s.message_count, s.estimated_tokens, s.compacted_count,
|
|
24
24
|
s.last_flushed_at, s.flush_count,
|
|
25
|
-
s.thinking_level, s.verbose_level,
|
|
26
25
|
t.cwd AS cwd
|
|
27
26
|
`;
|
|
28
27
|
SESSION_FROM_JOIN = `
|
|
@@ -21,10 +21,6 @@ export declare function resetSessionRecord(conversationId: string, cwd: string):
|
|
|
21
21
|
} | null;
|
|
22
22
|
export declare function deleteSessionRecord(conversationId: string): boolean;
|
|
23
23
|
export declare function listSessionsByAgent(agentId: string): SessionMetadata[];
|
|
24
|
-
export declare function getSessionPersistedLevels(conversationId: string): {
|
|
25
|
-
thinkingLevel: string | null;
|
|
26
|
-
verboseLevel: string | null;
|
|
27
|
-
} | null;
|
|
28
24
|
export declare function findConversationIdByTranscriptId(transcriptId: string): string | null;
|
|
29
25
|
export declare function getGlobalSessionStats(): ReturnType<typeof buildGlobalSessionStats>;
|
|
30
26
|
export declare function resolveSessionAgentId(conversationId: string): string;
|
|
@@ -4,6 +4,7 @@ import { validateConversationId, validateTranscriptId } from "../../../packages/
|
|
|
4
4
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
5
5
|
import { init_session_instance_repository, readCurrentTranscriptId } from "./session-instance-repository.js";
|
|
6
6
|
import { buildDefaultSessionMetadata, init_session_metadata } from "./session-metadata.js";
|
|
7
|
+
import { init_timestamps, optionalTimestampToMs } from "./timestamps.js";
|
|
7
8
|
import { buildGlobalSessionStats, init_row_mappers, metadataToSessionInsert, sessionRowToMetadata } from "./row-mappers.js";
|
|
8
9
|
import { cancelConnectionObjective, init_connection_wait_repository } from "./connection-wait-repository.js";
|
|
9
10
|
import { init_changes, notifyUserContextChange } from "../../user-context/changes.js";
|
|
@@ -21,17 +22,15 @@ function insertSessionAndTranscript(db, conversationId, transcriptId, cwd, metad
|
|
|
21
22
|
parent_conversation_id, workflow_run_id, workflow_definition_id, workflow_agent_id, workflow_agent_label,
|
|
22
23
|
project_id, routing_json, custom_data_json,
|
|
23
24
|
message_count, estimated_tokens, compacted_count,
|
|
24
|
-
last_flushed_at, flush_count
|
|
25
|
-
thinking_level, verbose_level
|
|
25
|
+
last_flushed_at, flush_count
|
|
26
26
|
) VALUES (
|
|
27
27
|
?, ?, ?, ?, ?,
|
|
28
28
|
?, ?, ?, ?, ?,
|
|
29
29
|
?, ?, ?, ?,
|
|
30
30
|
?, ?, ?, ?, ?,
|
|
31
31
|
?, ?, ?,
|
|
32
|
-
?, ?, ?, ?, ?,
|
|
33
|
-
|
|
34
|
-
)`).run(row.conversationId, row.agentId, row.transcriptId, row.status, row.name, row.tagsJson, row.createdAt, row.updatedAt, row.lastAccessedAt, row.sessionStartedAt, row.lastInteractionAt, row.sourceChannel, row.sourceChatId, row.sessionType, row.hiddenFromSessionList, row.parentConversationId, row.workflowRunId, row.workflowDefinitionId, row.workflowAgentId, row.workflowAgentLabel, row.projectId, row.routingJson, row.customDataJson, row.messageCount, row.estimatedTokens, row.compactedCount, row.lastFlushedAt, row.flushCount, row.thinkingLevel, row.verboseLevel);
|
|
32
|
+
?, ?, ?, ?, ?, ?
|
|
33
|
+
)`).run(row.conversationId, row.agentId, row.transcriptId, row.status, row.name, row.tagsJson, row.createdAt, row.updatedAt, row.lastAccessedAt, row.sessionStartedAt, row.lastInteractionAt, row.sourceChannel, row.sourceChatId, row.sessionType, row.hiddenFromSessionList, row.parentConversationId, row.workflowRunId, row.workflowDefinitionId, row.workflowAgentId, row.workflowAgentLabel, row.projectId, row.routingJson, row.customDataJson, row.messageCount, row.estimatedTokens, row.compactedCount, row.lastFlushedAt, row.flushCount);
|
|
35
34
|
const now = Date.now();
|
|
36
35
|
db.prepare(`INSERT INTO transcripts (transcript_id, conversation_id, status, created_at, cwd)
|
|
37
36
|
VALUES (?, ?, 'active', ?, ?)`).run(transcriptId, conversationId, now, cwd);
|
|
@@ -224,10 +223,8 @@ function patchSessionMetadata(conversationId, updates) {
|
|
|
224
223
|
estimated_tokens = ?,
|
|
225
224
|
compacted_count = ?,
|
|
226
225
|
last_flushed_at = ?,
|
|
227
|
-
flush_count =
|
|
228
|
-
|
|
229
|
-
verbose_level = ?
|
|
230
|
-
WHERE conversation_id = ?`).run(merged.status, merged.name ?? null, JSON.stringify(merged.tags ?? []), Date.parse(merged.updatedAt) || now, Date.parse(merged.lastAccessedAt) || now, merged.sessionStartedAt ? Date.parse(merged.sessionStartedAt) : existing.session_started_at, merged.lastInteractionAt ? Date.parse(merged.lastInteractionAt) : existing.last_interaction_at, merged.sourceChannel, merged.sourceChatId, merged.sessionType, merged.hiddenFromSessionList ? 1 : 0, merged.parentConversationId ?? null, merged.workflowRunId ?? null, merged.workflowDefinitionId ?? null, merged.workflowAgentId ?? null, merged.workflowAgentLabel ?? null, merged.projectId ?? null, merged.routing ? JSON.stringify(merged.routing) : null, merged.customData ? JSON.stringify(merged.customData) : null, merged.messageCount, merged.estimatedTokens, merged.compactedCount, merged.lastFlushedAt ?? null, merged.flushCount ?? 0, existing.thinking_level, existing.verbose_level, conversationId);
|
|
226
|
+
flush_count = ?
|
|
227
|
+
WHERE conversation_id = ?`).run(merged.status, merged.name ?? null, JSON.stringify(merged.tags ?? []), Date.parse(merged.updatedAt) || now, Date.parse(merged.lastAccessedAt) || now, merged.sessionStartedAt ? Date.parse(merged.sessionStartedAt) : existing.session_started_at, merged.lastInteractionAt ? Date.parse(merged.lastInteractionAt) : existing.last_interaction_at, merged.sourceChannel, merged.sourceChatId, merged.sessionType, merged.hiddenFromSessionList ? 1 : 0, merged.parentConversationId ?? null, merged.workflowRunId ?? null, merged.workflowDefinitionId ?? null, merged.workflowAgentId ?? null, merged.workflowAgentLabel ?? null, merged.projectId ?? null, merged.routing ? JSON.stringify(merged.routing) : null, merged.customData ? JSON.stringify(merged.customData) : null, merged.messageCount, merged.estimatedTokens, merged.compactedCount, optionalTimestampToMs(merged.lastFlushedAt), merged.flushCount ?? 0, conversationId);
|
|
231
228
|
const row = readSessionRow(db, conversationId);
|
|
232
229
|
if (!row) throw new Error(`Session not found after patch: ${conversationId}`);
|
|
233
230
|
return sessionRowToMetadata(conversationId, row);
|
|
@@ -308,14 +305,6 @@ function listSessionsByAgent(agentId) {
|
|
|
308
305
|
WHERE s.agent_id = ?
|
|
309
306
|
ORDER BY s.updated_at DESC`).all(agentId.toLowerCase()).map((row) => sessionRowToMetadata(row.conversation_id, row));
|
|
310
307
|
}
|
|
311
|
-
function getSessionPersistedLevels(conversationId) {
|
|
312
|
-
const row = getSqliteDatabase().prepare(`SELECT thinking_level, verbose_level FROM sessions WHERE conversation_id = ?`).get(conversationId);
|
|
313
|
-
if (!row) return null;
|
|
314
|
-
return {
|
|
315
|
-
thinkingLevel: row.thinking_level,
|
|
316
|
-
verboseLevel: row.verbose_level
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
308
|
function findConversationIdByTranscriptId(transcriptId) {
|
|
320
309
|
return getSqliteDatabase().prepare(`SELECT conversation_id FROM sessions WHERE active_transcript_id = ?`).get(transcriptId)?.conversation_id ?? null;
|
|
321
310
|
}
|
|
@@ -335,6 +324,7 @@ var init_session_repository = __esmMin((() => {
|
|
|
335
324
|
init_session_metadata();
|
|
336
325
|
init_session_instance_repository();
|
|
337
326
|
init_row_mappers();
|
|
327
|
+
init_timestamps();
|
|
338
328
|
init_transaction();
|
|
339
329
|
init_session_identity_sql();
|
|
340
330
|
init_fts();
|
|
@@ -342,4 +332,4 @@ var init_session_repository = __esmMin((() => {
|
|
|
342
332
|
}));
|
|
343
333
|
//#endregion
|
|
344
334
|
init_session_repository();
|
|
345
|
-
export { deleteSessionRecord, ensureSessionInTransaction, ensureSessionRecord, findConversationIdByTranscriptId, getCurrentTranscriptId, getGlobalSessionStats, getSessionMetadata,
|
|
335
|
+
export { deleteSessionRecord, ensureSessionInTransaction, ensureSessionRecord, findConversationIdByTranscriptId, getCurrentTranscriptId, getGlobalSessionStats, getSessionMetadata, incrementSessionStatsOnAppend, init_session_repository, listSessionMetadata, listSessionsByAgent, patchSessionMetadata, readCurrentTranscriptId, resetSessionRecord, resolveSessionAgentId, updateSessionStats };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function timestampToMs(value: string): number;
|
|
2
|
+
export declare function optionalTimestampToMs(value: string | undefined): number | null;
|
|
3
|
+
export declare function timestampToIso(value: number): string;
|
|
4
|
+
export declare function optionalTimestampToIso(value: number | null): string | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region src/storage/sqlite/timestamps.ts
|
|
3
|
+
function timestampToMs(value) {
|
|
4
|
+
const timestamp = Date.parse(value);
|
|
5
|
+
if (!Number.isFinite(timestamp)) throw new Error(`Invalid ISO timestamp: ${value}`);
|
|
6
|
+
return timestamp;
|
|
7
|
+
}
|
|
8
|
+
function optionalTimestampToMs(value) {
|
|
9
|
+
return value === void 0 ? null : timestampToMs(value);
|
|
10
|
+
}
|
|
11
|
+
function timestampToIso(value) {
|
|
12
|
+
return new Date(value).toISOString();
|
|
13
|
+
}
|
|
14
|
+
function optionalTimestampToIso(value) {
|
|
15
|
+
return value === null ? void 0 : timestampToIso(value);
|
|
16
|
+
}
|
|
17
|
+
var init_timestamps = __esmMin((() => {}));
|
|
18
|
+
//#endregion
|
|
19
|
+
init_timestamps();
|
|
20
|
+
export { init_timestamps, optionalTimestampToIso, optionalTimestampToMs, timestampToIso, timestampToMs };
|
|
@@ -52,6 +52,7 @@ export declare function paginateTranscriptMessages(conversationId: string, optio
|
|
|
52
52
|
total: number;
|
|
53
53
|
startSeq: number;
|
|
54
54
|
endSeq: number;
|
|
55
|
+
revision: number;
|
|
55
56
|
};
|
|
56
57
|
export declare function listCompactionBoundaries(conversationId: string): CompactionBoundarySummary[];
|
|
57
58
|
export declare function restoreBeforeCompactionBoundary(conversationId: string, compactionId: string): void;
|
|
@@ -50,24 +50,27 @@ function withSessionInputContextMetadata(db, conversationId, row) {
|
|
|
50
50
|
const turnId = typeof message.turnId === "string" ? message.turnId.trim() : "";
|
|
51
51
|
if (!turnId) return row;
|
|
52
52
|
const metadata = message.metadata && typeof message.metadata === "object" && !Array.isArray(message.metadata) ? message.metadata : {};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
WHERE conversation_id = ? AND run_id = ? AND context_refs_json IS NOT NULL
|
|
53
|
+
const input = db.prepare(`SELECT client_message_id, context_refs_json FROM session_inputs
|
|
54
|
+
WHERE conversation_id = ? AND run_id = ?
|
|
56
55
|
LIMIT 1`).get(conversationId, turnId);
|
|
57
56
|
if (!input) return row;
|
|
57
|
+
let sourceContexts = metadata.sourceContexts;
|
|
58
58
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
metadata: {
|
|
64
|
-
...metadata,
|
|
65
|
-
sourceContexts
|
|
66
|
-
}
|
|
67
|
-
};
|
|
59
|
+
if ((!Array.isArray(sourceContexts) || sourceContexts.length === 0) && input.context_refs_json) {
|
|
60
|
+
const parsed = JSON.parse(input.context_refs_json);
|
|
61
|
+
if (Array.isArray(parsed) && parsed.length > 0) sourceContexts = parsed;
|
|
62
|
+
}
|
|
68
63
|
} catch {
|
|
69
|
-
|
|
64
|
+
sourceContexts = metadata.sourceContexts;
|
|
70
65
|
}
|
|
66
|
+
return {
|
|
67
|
+
...message,
|
|
68
|
+
metadata: {
|
|
69
|
+
...metadata,
|
|
70
|
+
clientMessageId: input.client_message_id,
|
|
71
|
+
...Array.isArray(sourceContexts) && sourceContexts.length > 0 ? { sourceContexts } : {}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
71
74
|
}
|
|
72
75
|
function appendTranscriptEntry(conversationId, row, opts) {
|
|
73
76
|
if (isRuntimeOnlyTranscriptMessage(row)) throw new Error("Runtime-only messages cannot be persisted in a session transcript");
|
|
@@ -281,7 +284,8 @@ function paginateTranscriptMessages(conversationId, options = {}) {
|
|
|
281
284
|
messages: [],
|
|
282
285
|
total: 0,
|
|
283
286
|
startSeq: 0,
|
|
284
|
-
endSeq: 0
|
|
287
|
+
endSeq: 0,
|
|
288
|
+
revision: 0
|
|
285
289
|
};
|
|
286
290
|
const db = getSqliteDatabase();
|
|
287
291
|
const kinds = options.includeContext ? ["message", "context"] : ["message"];
|
|
@@ -293,6 +297,9 @@ function paginateTranscriptMessages(conversationId, options = {}) {
|
|
|
293
297
|
FROM transcript_entries e
|
|
294
298
|
JOIN transcripts t ON t.transcript_id = e.transcript_id
|
|
295
299
|
WHERE ${transcriptWhere} AND e.entry_kind IN (${kindPlaceholders})`).get(transcriptArg, ...kinds).total;
|
|
300
|
+
const revisionRow = db.prepare(`SELECT COALESCE(MAX(seq), 0) AS revision
|
|
301
|
+
FROM transcript_entries
|
|
302
|
+
WHERE transcript_id = ? AND entry_kind IN (${kindPlaceholders})`).get(transcriptId, ...kinds);
|
|
296
303
|
const limit = Math.min(200, Math.max(1, Math.trunc(options.limit ?? 50)));
|
|
297
304
|
const offset = Math.max(0, Math.trunc(options.offset ?? 0));
|
|
298
305
|
let rows;
|
|
@@ -324,7 +331,8 @@ function paginateTranscriptMessages(conversationId, options = {}) {
|
|
|
324
331
|
messages: buildSessionContextForLlm(storedRows),
|
|
325
332
|
total,
|
|
326
333
|
startSeq: rows[0]?.seq ?? 0,
|
|
327
|
-
endSeq: rows[rows.length - 1]?.seq ?? 0
|
|
334
|
+
endSeq: rows[rows.length - 1]?.seq ?? 0,
|
|
335
|
+
revision: revisionRow.revision
|
|
328
336
|
};
|
|
329
337
|
}
|
|
330
338
|
function listCompactionBoundaries(conversationId) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "./transaction.js";
|
|
3
|
+
import { init_timestamps, timestampToIso } from "./timestamps.js";
|
|
3
4
|
import { DEFAULT_USER_TRUST_LEVEL, init_trust_policy, isUserTrustLevel } from "../../user-context/trust-policy.js";
|
|
4
5
|
//#region src/storage/sqlite/user-trust-repository.ts
|
|
5
6
|
function fromRow(row) {
|
|
6
7
|
return {
|
|
7
8
|
principalId: row.principal_id,
|
|
8
9
|
defaultActionLevel: isUserTrustLevel(row.default_action_level) ? row.default_action_level : DEFAULT_USER_TRUST_LEVEL,
|
|
9
|
-
updatedAt: row.updated_at
|
|
10
|
+
updatedAt: timestampToIso(row.updated_at)
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
function getUserTrustPolicy(principalId = "local-owner") {
|
|
@@ -17,7 +18,7 @@ function getUserTrustPolicy(principalId = "local-owner") {
|
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
function setUserTrustPolicy(defaultActionLevel, principalId = "local-owner") {
|
|
20
|
-
const updatedAt =
|
|
21
|
+
const updatedAt = Date.now();
|
|
21
22
|
return runSqliteWriteTransaction((db) => {
|
|
22
23
|
db.prepare(`
|
|
23
24
|
INSERT INTO user_trust_policies (principal_id, default_action_level, updated_at)
|
|
@@ -31,6 +32,7 @@ function setUserTrustPolicy(defaultActionLevel, principalId = "local-owner") {
|
|
|
31
32
|
}
|
|
32
33
|
var init_user_trust_repository = __esmMin((() => {
|
|
33
34
|
init_trust_policy();
|
|
35
|
+
init_timestamps();
|
|
34
36
|
init_transaction();
|
|
35
37
|
}));
|
|
36
38
|
//#endregion
|
|
@@ -2,10 +2,10 @@ import { ProductReadContracts } from "../../../packages/gateway-contract/src/cap
|
|
|
2
2
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { TaskRepository, init_task_repository } from "../task-repository.js";
|
|
4
4
|
import { TaskRunRepository, init_task_run_repository } from "../task-run-repository.js";
|
|
5
|
-
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
6
|
-
import { defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
7
5
|
import { TaskConversationRepository } from "../task-conversation-repository.js";
|
|
8
6
|
import { TaskReadModelProjector } from "../task-read-model-projector.js";
|
|
7
|
+
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
8
|
+
import { defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
9
9
|
import { TaskContextRepository } from "../task-context-repository.js";
|
|
10
10
|
import { TaskDependencyService } from "../task-dependency-service.js";
|
|
11
11
|
import { TaskValueMetricsService } from "../task-value-metrics-service.js";
|
|
@@ -101,8 +101,8 @@ export declare const TaskMutationOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
101
101
|
ok: z.ZodLiteral<false>;
|
|
102
102
|
reason: z.ZodEnum<{
|
|
103
103
|
blocked: "blocked";
|
|
104
|
-
not_found: "not_found";
|
|
105
104
|
conflict: "conflict";
|
|
105
|
+
not_found: "not_found";
|
|
106
106
|
invalid_transition: "invalid_transition";
|
|
107
107
|
}>;
|
|
108
108
|
model: z.ZodOptional<z.ZodObject<{
|
|
@@ -37,6 +37,7 @@ function actionLabel(automation) {
|
|
|
37
37
|
if (automation.action.kind === "workflow") return `workflow:${automation.action.workflowId}`;
|
|
38
38
|
if (automation.action.kind === "browser_automation") return `browser-automation:${automation.action.automationId}`;
|
|
39
39
|
if (automation.action.kind === "task_command") return `task:${automation.action.command.type}`;
|
|
40
|
+
if (automation.action.kind === "system") return `system:${automation.action.capability}`;
|
|
40
41
|
return automation.action.agentId ? `agent:${automation.action.agentId}` : "agent";
|
|
41
42
|
}
|
|
42
43
|
function toHomeAutomation(automation) {
|
|
@@ -50,7 +51,7 @@ function toHomeAutomation(automation) {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
function effectiveAutomationTimeoutSeconds(run, automation) {
|
|
53
|
-
return ("timeoutSeconds" in run.actionSnapshot ? run.actionSnapshot.timeoutSeconds : void 0) ?? automation?.reliability?.
|
|
54
|
+
return ("timeoutSeconds" in run.actionSnapshot ? run.actionSnapshot.timeoutSeconds : void 0) ?? automation?.reliability?.executionTimeoutSeconds ?? 1800;
|
|
54
55
|
}
|
|
55
56
|
function attentionDetail(kind, status, locale, timeoutSeconds) {
|
|
56
57
|
const isChinese = locale?.toLowerCase().startsWith("zh") ?? false;
|
|
@@ -326,7 +327,7 @@ var HomeQueryService = class {
|
|
|
326
327
|
const projectsById = new Map(projects.items.map((project) => [project.id, project]));
|
|
327
328
|
const activeWorkflowRuns = workflowRuns.filter((run) => run.status === "queued" || run.status === "running").map(toHomeWorkflowRun);
|
|
328
329
|
const failedWorkflowRuns = workflowRuns.filter((run) => run.status === "failed" || run.status === "timeout").slice(0, 5).map(toHomeWorkflowRun);
|
|
329
|
-
const upcomingAutomations = automations.filter((automation) => automation.notificationPolicy !== "none").map(toHomeAutomation).filter((automation) => Boolean(automation)).sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt));
|
|
330
|
+
const upcomingAutomations = automations.filter((automation) => automation.delivery.notificationPolicy !== "none").map(toHomeAutomation).filter((automation) => Boolean(automation)).sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt));
|
|
330
331
|
const latestAutomationRuns = [...automationRuns].sort((left, right) => right.createdAtMs - left.createdAtMs).filter((run, index, all) => all.findIndex((candidate) => candidate.automationId === run.automationId) === index);
|
|
331
332
|
const automationsById = new Map(automations.map((automation) => [automation.id, automation]));
|
|
332
333
|
const decisionCandidates = [...activeTasks.map((task) => decisionFromTask(this.#projector.project(task), task.projectId ? projectsById.get(task.projectId)?.name : void 0, locale)).filter((item) => Boolean(item)), ...connectorApprovals.filter((approval) => Date.parse(approval.expiresAt) > nowMs).map((approval) => ({
|
|
@@ -353,7 +354,7 @@ var HomeQueryService = class {
|
|
|
353
354
|
href: `/workflows?runId=${encodeURIComponent(run.id)}`,
|
|
354
355
|
updatedAt: run.completedAtMs ?? run.startedAtMs ?? run.createdAtMs,
|
|
355
356
|
conversationId: run.conversationId
|
|
356
|
-
})), ...latestAutomationRuns.filter((run) => run.status === "failed" || run.status === "timeout").filter((run) => automationsById.get(run.automationId)?.notificationPolicy !== "none").filter((run) => !isHomeAttentionAcknowledged("automation_run", run.id)).map((run) => ({
|
|
357
|
+
})), ...latestAutomationRuns.filter((run) => run.status === "failed" || run.status === "timeout").filter((run) => automationsById.get(run.automationId)?.delivery.notificationPolicy !== "none").filter((run) => !isHomeAttentionAcknowledged("automation_run", run.id)).map((run) => ({
|
|
357
358
|
id: `automation_run:${run.id}`,
|
|
358
359
|
kind: "automation_run",
|
|
359
360
|
runId: run.id,
|
|
@@ -69,7 +69,7 @@ var ModelTaskContractPlanner = class {
|
|
|
69
69
|
apiKey: await resolveModelCallApiKey(model),
|
|
70
70
|
maxTokens: 2e3,
|
|
71
71
|
temperature: 0
|
|
72
|
-
})).content));
|
|
72
|
+
}, void 0, { operation: "task.plan_contract" })).content));
|
|
73
73
|
return planned ? {
|
|
74
74
|
...planned,
|
|
75
75
|
objective: fallback.objective
|
|
@@ -5,9 +5,8 @@ import { appendComposerInputHistory, listComposerInputHistory } from "../../stor
|
|
|
5
5
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
6
6
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
7
7
|
import { normalizeAgentId } from "../../agent-catalog/id.js";
|
|
8
|
-
import { init_agent_scope, listAgentEntries } from "../../agent/agent-scope.js";
|
|
9
|
-
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
10
8
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
9
|
+
import { init_agent_scope, listAgentEntries } from "../../agent/agent-scope.js";
|
|
11
10
|
import { createConversation, init_conversation_repository } from "../../storage/sqlite/conversation-repository.js";
|
|
12
11
|
import { init_agent_session_key, resolveAgentIdFromConversationId } from "../../routing/agent-session-key.js";
|
|
13
12
|
import { effectiveWorkspacePathForSession } from "../../session/session-workspace.js";
|
|
@@ -18,6 +17,7 @@ import { buildSessionTimeline } from "../../session/transcript-outline.js";
|
|
|
18
17
|
import { transcriptRowsToClientHistory } from "../../session/client-history.js";
|
|
19
18
|
import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
|
|
20
19
|
import { evictEmbeddedSessionRunner } from "../../agent/embedded/session-runner.js";
|
|
20
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
21
21
|
import { SessionIndex } from "../../session/manager.js";
|
|
22
22
|
import "../../session/index.js";
|
|
23
23
|
import { parseModelRef } from "../../agent/models/selection.js";
|
|
@@ -2,8 +2,8 @@ import { closeXopcDatabase, isXopcDatabaseOpen, openXopcDatabase } from "../stor
|
|
|
2
2
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
3
3
|
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
4
4
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
5
|
-
import { resolveConfigPath } from "../config/paths.js";
|
|
6
5
|
import { init_agent_session_key, isValidAgentId, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
6
|
+
import { resolveConfigPath } from "../config/paths.js";
|
|
7
7
|
import { init_providers, providerSupportsOAuth } from "../providers/index.js";
|
|
8
8
|
import { ProjectService } from "../projects/project-service.js";
|
|
9
9
|
import { isValidProjectAgentId, normalizeProjectAgentId } from "../projects/project-agent.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveStateDir } from "../config/paths-state.js";
|
|
2
|
-
import { init_paths, resolveAgentProfileDir, resolveBundledSkillsDir } from "../config/paths.js";
|
|
3
2
|
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
3
|
+
import { init_paths, resolveAgentProfileDir, resolveBundledSkillsDir } from "../config/paths.js";
|
|
4
4
|
import { resolveBootstrapFilesSync } from "../agent/bootstrap/bootstrap-files.js";
|
|
5
5
|
import { listConnectorInstances } from "../connectors/instances.js";
|
|
6
6
|
import { createSkillConfigManager, isSkillEnabled } from "../agent/skills/config.js";
|
package/dist/src/tui/tui.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { version } from "../../package.js";
|
|
2
2
|
import { resolveStateDir, resolveXopcDatabasePath } from "../config/paths-state.js";
|
|
3
|
-
import { init_paths } from "../config/paths.js";
|
|
4
3
|
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
5
4
|
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
5
|
+
import { init_paths } from "../config/paths.js";
|
|
6
6
|
import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
7
7
|
import { isTerminalWorkflowRunStatus } from "../workflows/domain/run.js";
|
|
8
8
|
import "../workflows/domain/index.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AiPricingSnapshot, AiUsageCostSource, AiUsageModel } from './types.js';
|
|
2
|
+
export declare function pricingSnapshot(model: AiUsageModel): AiPricingSnapshot;
|
|
3
|
+
export declare function classifyCostSource(model: AiUsageModel): AiUsageCostSource;
|
|
4
|
+
export declare function dollarsToMicrousd(value: number | undefined): number | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/usage/cost.ts
|
|
2
|
+
function isLocalBaseUrl(baseUrl) {
|
|
3
|
+
if (!baseUrl) return false;
|
|
4
|
+
try {
|
|
5
|
+
const host = new URL(baseUrl).hostname.toLowerCase();
|
|
6
|
+
return host === "localhost" || host === "::1" || host === "[::1]" || host.startsWith("127.") || host.startsWith("10.") || host.startsWith("192.168.") || /^172\.(1[6-9]|2\d|3[0-1])\./.test(host);
|
|
7
|
+
} catch {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function pricingSnapshot(model) {
|
|
12
|
+
return {
|
|
13
|
+
input: model.cost?.input ?? 0,
|
|
14
|
+
output: model.cost?.output ?? 0,
|
|
15
|
+
cacheRead: model.cost?.cacheRead ?? 0,
|
|
16
|
+
cacheWrite: model.cost?.cacheWrite ?? 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function classifyCostSource(model) {
|
|
20
|
+
if (isLocalBaseUrl(model.baseUrl)) return "local";
|
|
21
|
+
return Object.values(pricingSnapshot(model)).some((price) => price > 0) ? "model_catalog" : "unknown";
|
|
22
|
+
}
|
|
23
|
+
function dollarsToMicrousd(value) {
|
|
24
|
+
if (value === void 0 || !Number.isFinite(value) || value < 0) return void 0;
|
|
25
|
+
return Math.round(value * 1e6);
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { classifyCostSource, dollarsToMicrousd, pricingSnapshot };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AssistantMessage, AssistantMessageEventStream } from '@earendil-works/pi-ai/compat';
|
|
2
|
+
import type { AiUsageContext, AiUsageFinish, AiUsageModel } from './types.js';
|
|
3
|
+
export type AiUsageCall = {
|
|
4
|
+
id: string;
|
|
5
|
+
finish: (result: AiUsageFinish) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function continuesAfterTool(messages: readonly {
|
|
8
|
+
role?: string;
|
|
9
|
+
}[]): boolean;
|
|
10
|
+
export declare function startAiUsageCall(model: AiUsageModel, context: AiUsageContext): AiUsageCall | undefined;
|
|
11
|
+
export declare function observeAiUsageStream(stream: AssistantMessageEventStream, call: AiUsageCall | undefined): AssistantMessageEventStream;
|
|
12
|
+
export declare function trackAiUsageStream(model: AiUsageModel, context: AiUsageContext, create: () => AssistantMessageEventStream | Promise<AssistantMessageEventStream>): AssistantMessageEventStream | Promise<AssistantMessageEventStream>;
|
|
13
|
+
export declare function finishAiUsageFromMessage(call: AiUsageCall | undefined, message: AssistantMessage): void;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { init_connection, isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
4
|
+
import { finishAiUsageEvent, insertAiUsageEvent } from "../storage/sqlite/ai-usage-repository.js";
|
|
5
|
+
import { classifyCostSource, dollarsToMicrousd, pricingSnapshot } from "./cost.js";
|
|
6
|
+
import { resolveAiUsageScenario } from "./scenario-registry.js";
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
//#region src/usage/recorder.ts
|
|
9
|
+
init_connection();
|
|
10
|
+
init_logger();
|
|
11
|
+
const log = createLogger("AiUsage");
|
|
12
|
+
function continuesAfterTool(messages) {
|
|
13
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
14
|
+
const role = messages[index]?.role;
|
|
15
|
+
if (role === "system") continue;
|
|
16
|
+
return role === "toolResult";
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function startAiUsageCall(model, context) {
|
|
21
|
+
if (!isXopcDatabaseOpen()) return void 0;
|
|
22
|
+
const operation = context.operation;
|
|
23
|
+
const scenario = resolveAiUsageScenario(operation);
|
|
24
|
+
const id = randomUUID();
|
|
25
|
+
const startedAt = Date.now();
|
|
26
|
+
const costSource = classifyCostSource(model);
|
|
27
|
+
try {
|
|
28
|
+
insertAiUsageEvent({
|
|
29
|
+
id,
|
|
30
|
+
traceId: context.traceId ?? context.runId ?? id,
|
|
31
|
+
parentEventId: context.parentEventId,
|
|
32
|
+
conversationId: context.conversationId,
|
|
33
|
+
runId: context.runId,
|
|
34
|
+
agentId: context.agentId,
|
|
35
|
+
category: scenario.category,
|
|
36
|
+
operation,
|
|
37
|
+
trigger: context.trigger ?? scenario.trigger,
|
|
38
|
+
reasonKey: scenario.reasonKey,
|
|
39
|
+
provider: model.provider,
|
|
40
|
+
model: model.id,
|
|
41
|
+
status: "running",
|
|
42
|
+
startedAt,
|
|
43
|
+
costSource,
|
|
44
|
+
pricingSnapshot: costSource === "unknown" ? void 0 : pricingSnapshot(model)
|
|
45
|
+
});
|
|
46
|
+
} catch (err) {
|
|
47
|
+
log.error({
|
|
48
|
+
err,
|
|
49
|
+
operation,
|
|
50
|
+
provider: model.provider,
|
|
51
|
+
modelId: model.id
|
|
52
|
+
}, "Failed to start AI usage record");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
let completed = false;
|
|
56
|
+
return {
|
|
57
|
+
id,
|
|
58
|
+
finish(result) {
|
|
59
|
+
if (completed) return;
|
|
60
|
+
completed = true;
|
|
61
|
+
try {
|
|
62
|
+
finishAiUsageEvent(id, {
|
|
63
|
+
...result,
|
|
64
|
+
estimatedCostMicrousd: costSource === "local" ? 0 : costSource === "unknown" ? void 0 : dollarsToMicrousd(result.usage?.cost.total)
|
|
65
|
+
});
|
|
66
|
+
} catch (err) {
|
|
67
|
+
log.error({
|
|
68
|
+
err,
|
|
69
|
+
usageEventId: id,
|
|
70
|
+
operation
|
|
71
|
+
}, "Failed to finish AI usage record");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function finishFromMessage(call, message) {
|
|
77
|
+
if (!call) return;
|
|
78
|
+
const status = message.stopReason === "aborted" ? "aborted" : message.stopReason === "error" ? "failed" : "succeeded";
|
|
79
|
+
call.finish({
|
|
80
|
+
status,
|
|
81
|
+
usage: message.usage,
|
|
82
|
+
errorSummary: message.errorMessage
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function observeAiUsageStream(stream, call) {
|
|
86
|
+
if (!call) return stream;
|
|
87
|
+
stream.result().then((message) => finishFromMessage(call, message), (error) => call.finish({
|
|
88
|
+
status: "failed",
|
|
89
|
+
errorSummary: error instanceof Error ? error.message : String(error)
|
|
90
|
+
}));
|
|
91
|
+
return stream;
|
|
92
|
+
}
|
|
93
|
+
function trackAiUsageStream(model, context, create) {
|
|
94
|
+
const call = startAiUsageCall(model, context);
|
|
95
|
+
try {
|
|
96
|
+
const created = create();
|
|
97
|
+
if (created instanceof Promise) return created.then((stream) => observeAiUsageStream(stream, call), (error) => {
|
|
98
|
+
call?.finish({
|
|
99
|
+
status: "failed",
|
|
100
|
+
errorSummary: error instanceof Error ? error.message : String(error)
|
|
101
|
+
});
|
|
102
|
+
throw error;
|
|
103
|
+
});
|
|
104
|
+
return observeAiUsageStream(created, call);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
call?.finish({
|
|
107
|
+
status: "failed",
|
|
108
|
+
errorSummary: error instanceof Error ? error.message : String(error)
|
|
109
|
+
});
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function finishAiUsageFromMessage(call, message) {
|
|
114
|
+
finishFromMessage(call, message);
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { continuesAfterTool, finishAiUsageFromMessage, observeAiUsageStream, startAiUsageCall, trackAiUsageStream };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
//#region src/usage/scenario-registry.ts
|
|
2
|
+
const SCENARIOS = {
|
|
3
|
+
"agent.answer": {
|
|
4
|
+
category: "chat",
|
|
5
|
+
reasonKey: "usage.reason.agentAnswer",
|
|
6
|
+
trigger: "user"
|
|
7
|
+
},
|
|
8
|
+
"agent.continue_after_tool": {
|
|
9
|
+
category: "tool_loop",
|
|
10
|
+
reasonKey: "usage.reason.continueAfterTool",
|
|
11
|
+
trigger: "agent"
|
|
12
|
+
},
|
|
13
|
+
"agent.background_review": {
|
|
14
|
+
category: "delegation",
|
|
15
|
+
reasonKey: "usage.reason.backgroundReview",
|
|
16
|
+
trigger: "agent"
|
|
17
|
+
},
|
|
18
|
+
"session.compact": {
|
|
19
|
+
category: "compaction",
|
|
20
|
+
reasonKey: "usage.reason.sessionCompaction",
|
|
21
|
+
trigger: "system"
|
|
22
|
+
},
|
|
23
|
+
"session.generate_title": {
|
|
24
|
+
category: "session_title",
|
|
25
|
+
reasonKey: "usage.reason.sessionTitle",
|
|
26
|
+
trigger: "system"
|
|
27
|
+
},
|
|
28
|
+
"media.understand_image": {
|
|
29
|
+
category: "image_understanding",
|
|
30
|
+
reasonKey: "usage.reason.imageUnderstanding",
|
|
31
|
+
trigger: "user"
|
|
32
|
+
},
|
|
33
|
+
"tool.web_extract": {
|
|
34
|
+
category: "web_extract",
|
|
35
|
+
reasonKey: "usage.reason.webExtract",
|
|
36
|
+
trigger: "agent"
|
|
37
|
+
},
|
|
38
|
+
"tool.session_search_summarize": {
|
|
39
|
+
category: "session_search",
|
|
40
|
+
reasonKey: "usage.reason.sessionSearch",
|
|
41
|
+
trigger: "agent"
|
|
42
|
+
},
|
|
43
|
+
"note.generate": {
|
|
44
|
+
category: "note_generation",
|
|
45
|
+
reasonKey: "usage.reason.noteGeneration",
|
|
46
|
+
trigger: "user"
|
|
47
|
+
},
|
|
48
|
+
"automation.generate_draft": {
|
|
49
|
+
category: "automation",
|
|
50
|
+
reasonKey: "usage.reason.automationDraft",
|
|
51
|
+
trigger: "user"
|
|
52
|
+
},
|
|
53
|
+
"scene.execute": {
|
|
54
|
+
category: "scene",
|
|
55
|
+
reasonKey: "usage.reason.sceneExecution",
|
|
56
|
+
trigger: "scheduled"
|
|
57
|
+
},
|
|
58
|
+
"task.plan_contract": {
|
|
59
|
+
category: "task_planning",
|
|
60
|
+
reasonKey: "usage.reason.taskPlanning",
|
|
61
|
+
trigger: "agent"
|
|
62
|
+
},
|
|
63
|
+
"task.judge_result": {
|
|
64
|
+
category: "task_judging",
|
|
65
|
+
reasonKey: "usage.reason.taskJudging",
|
|
66
|
+
trigger: "agent"
|
|
67
|
+
},
|
|
68
|
+
"voice.summarize_for_tts": {
|
|
69
|
+
category: "voice_summary",
|
|
70
|
+
reasonKey: "usage.reason.voiceSummary",
|
|
71
|
+
trigger: "user"
|
|
72
|
+
},
|
|
73
|
+
"voice.select": {
|
|
74
|
+
category: "voice_summary",
|
|
75
|
+
reasonKey: "usage.reason.voiceSelection",
|
|
76
|
+
trigger: "user"
|
|
77
|
+
},
|
|
78
|
+
"home.generate_advice": {
|
|
79
|
+
category: "home_intelligence",
|
|
80
|
+
reasonKey: "usage.reason.homeAdvice",
|
|
81
|
+
trigger: "system"
|
|
82
|
+
},
|
|
83
|
+
"work_discovery.analyze": {
|
|
84
|
+
category: "work_discovery",
|
|
85
|
+
reasonKey: "usage.reason.workDiscovery",
|
|
86
|
+
trigger: "user"
|
|
87
|
+
},
|
|
88
|
+
"work_discovery.investigate": {
|
|
89
|
+
category: "work_discovery",
|
|
90
|
+
reasonKey: "usage.reason.workInvestigation",
|
|
91
|
+
trigger: "user"
|
|
92
|
+
},
|
|
93
|
+
"discussion.analyze": {
|
|
94
|
+
category: "discussion_analysis",
|
|
95
|
+
reasonKey: "usage.reason.discussionAnalysis",
|
|
96
|
+
trigger: "user"
|
|
97
|
+
},
|
|
98
|
+
"text_assist.generate": {
|
|
99
|
+
category: "other",
|
|
100
|
+
reasonKey: "usage.reason.textAssist",
|
|
101
|
+
trigger: "user"
|
|
102
|
+
},
|
|
103
|
+
"user_model.interpret": {
|
|
104
|
+
category: "other",
|
|
105
|
+
reasonKey: "usage.reason.userModelInterpretation",
|
|
106
|
+
trigger: "system"
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function resolveAiUsageScenario(operation) {
|
|
110
|
+
return SCENARIOS[operation] ?? {
|
|
111
|
+
category: "other",
|
|
112
|
+
reasonKey: "usage.reason.other",
|
|
113
|
+
trigger: "system"
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { resolveAiUsageScenario };
|