@xopcai/xopc 0.0.362 → 0.0.364
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-_2aJ4ozN.js → activity-store-GvR2gZ0T.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CSIn4ghK.js → agent-avatar-dicebear-7Ct-ZlfL.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DBNFaHYa.js → agent-defaults-settings-panel-wYj-iyqv.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DJkGbMVg.js → agent-plugin-dialog-C9HYMhnJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-admin-api-Dl0V7UQq.js → agents-admin-api-BkXb7VEZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CuQayYYr.js → agents-hPkFQ81z.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CSczq9QV.js → app-management-settings-panel-CjfsIn9A.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-W0vc1J1Q.js → appearance-settings-qqHZ15GU.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-esnvb3hh.js → apps-page-Ba2VkQk6.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CBR91gHK.js → archive-plugin-CKe3qAaL.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B9RdzKUS.js → automations-page-Bt8Q58ut.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-U9TEZd_t.js → automations-workspace-Ch0ViAJW.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-C9KIjPph.js → binary-plugins-J51oS7-D.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C0bammwh.js → block-editor-ClRFbHP7.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D2E0co_S.js → browser-automation-inputs-5B3qAdmb.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-8kqdhAOz.js → browser-automations-page-BjMub7JM.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Dl4idi13.js → browser-settings-page-CYrPA-Fp.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Bfktn_7E.js → capabilities-BKu9BqPe.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BmMMlNmY.js → capabilities-CT_ZW9fT.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-3ImhKPBx.js → capabilities-page-dW6FXtOy.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-4VDEB_ob.js → capabilities-settings-panel-gZ8auLwa.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-D1gxCGi8.js → capability-header-actions-L1NvoOUG.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-Drbr2JR-.js → channels-Dx5T2G73.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CSkksCaa.js → chat-terminal-dock-DsCpKPBe.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-BIXpOJAk.js → computer-settings-page-6FWwxYLe.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CTnlVEE1.js → connector-service-page-mtH9mEBf.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BluT2l4d.js → connectors-page-DgDLaws0.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Bw-CydDe.js → date-picker-BDcwEaIx.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CgHzhtAc.js → dependency-picker-B_fPQBTM.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-YahEnyfd.js → desktop-pet-CJrO9Vd_.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-47Z4bqJr.js → desktop-pet-settings-DYAfri9w.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-C3aPEEaM.js → device-pairing-wizard-CqRys2R8.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DH_ok92y.js → directory-picker-path-field-D7_qSxNZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-t1TiLQrR.js → extension-debug-page-BGyJpRv4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BeV-7G1h.js → extension-page-D1zBmd8F.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-CFCxzqna.js → extension-provider-F9JzOWZ3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DCODJHOu.js → extension-settings-page-CTR8AjCG.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-CJzvASNV.js → fallback-models-Chhv4Nfv.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B3LfyXpc.js → gateway-config-swr-CoRoOG1l.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-CWxXXAe_.js → gateway-realtime-D0ygm6bc.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DBvCRclh.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-Q5NFzAJ_.js → gateway-settings-BVfz4Tla.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BzQP02wp.js → gateway-startup-retry-FDS6S6qa.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DndTkAw8.js → home-page-BF_9C9yW.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BO-Xs__S.js → image-generation-api-BPd76jW5.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Bb6Gm30L.js → imports-page-9EnECtcl.js} +1 -1
- package/dist/gateway/static/root/assets/{index-qOHWhsEK.js → index-BpXej9jJ.js} +7 -7
- package/dist/gateway/static/root/assets/index-CbJNcWAn.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D2u6sk5l.js → keyboard-shortcuts-settings-MC7mG2h2.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CHeMfXrB.js → local-app-workbench-page-CytNu0-_.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BanU1SLr.js → local-apps-page-c3HncHZ3.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-DLZQBcZY.js → local-session-drafts-gbemPamv.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BbwWB0ra.js → locale-store-DId6-v2R.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CQdHKCL0.js → logs-page-D4aXtitd.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-D0V5kCx0.js → management-settings-CRzWi_iJ.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DIBLXsPm.js → markdown-view-DQZ51j9e.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-XPzvDZPz.js → media-plugins-XLewwq2q.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-B4AhAW4B.js → messages-BHvpZNe9.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-cache-B9SKjidc.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-CodeKI_W.js → note-detail-panel-BgbByI-4.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-api-CLn4r03Z.js → notes-api-Byt65v3r.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-liRQoHbF.js → notes-page-R2BX5XCE.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-D9zkd42J.js → oauth-api-BYsCbyGZ.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-DO6DB9pi.js → page-context-capture-button-RBp1QK0F.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-DdfdwOv5.js → personal-page-F0jTBWva.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-C9a3sm6Z.js → product-open-page-BtDK68qb.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BVe5R-Nj.js → project-detail-page-DmQEm0yH.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-D_rCwi7w.js → projects-page-CrLQvkHX.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BFxQTbXQ.js → registry-api-7F2WNEZC.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-B3imt2du.js → remote-access-hub-C25_hQAd.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C9WC8hJM.js → runtime-tools-settings-panel-B0c120iI.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-DL95V1UP.js → scenes-page-DM64yMnx.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CDgGmgrq.js → schema-form-DQpQc9tH.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-tkAQXGBG.js → send-session-input-D1oc6BC6.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-9X7qep91.js → session-api-N3N37MrR.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-Dy22bbJT.js → session-manager-CMGUwtbN.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-CeeKIVsM.js → sessions-page-DvDO8LtA.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BNhgbmcX.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-xmUGYSOG.js → settings-page-GgBEp6O7.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CmjT9Q4P.js → setup-status-panel-10bMi6yL.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-DeOe9qfQ.js → share-link-dialog-TBBGJPfT.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Ck27gozJ.js → share-preview-page-DyRLPsPv.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-D-GuMkPu.js → shares-api-DU0fHP2G.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DpvM2OyO.js → shares-settings-DJ1ME-XM.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-BpD02td8.js → skill-api-1Puv6wOz.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CezAwYxM.js → skill-reload-api-ClyFqHk7.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BCgbVI-P.js → skills-page-D52pEr5x.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-UODcpzsP.js → system-settings-panel--yV67a8L.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BbqQnNes.js → task-detail-page-D-tcS2bS.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-6IK2Ik2J.js → theme-store-OhcbFEUR.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-DoBJ0TYY.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-Eey2aZIz.js → tunnel-api-COLdiP_E.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-BrWj5mk3.js → usage-page-CtM5IfrL.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-B-3BJbnn.js → use-autosave-veoM0dHn.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-ByAHuR8v.js → use-composer-attachments-DB0bBGzZ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-CXVwWJeP.js → use-file-preview-expanded-Bope6MW6.js} +2 -2
- package/dist/gateway/static/root/assets/{user-model-page-Cg-oM8nY.js → user-model-page-CSh61kZ5.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BtffIKZD.js → voice-api-key-field-CwD6a3KQ.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-BMm9dSKX.js → voice-config-api-Daexehmc.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-ByHhF_4r.js → work-discovery-overlay-C9u7tuEc.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DfNn5VTy.js → workflow-run-setup-panel-BMOBbf33.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-B67D-7Wt.js → workflows-page-BrD9vXqO.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-TAD7LYsc.js → workspace-api-Cs4sjV2A.js} +2 -2
- package/dist/gateway/static/root/index.html +28 -28
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +11 -7
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +28 -3
- package/dist/src/agent/embedded/run-turn.js +18 -3
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service.js +6 -4
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/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/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard/model.js +4 -4
- 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/reload.d.ts +1 -0
- package/dist/src/config/reload.js +4 -0
- package/dist/src/config/rules.js +5 -0
- package/dist/src/config/schema.d.ts +23 -0
- package/dist/src/config/schema.js +6 -3
- package/dist/src/extensions/activation-context.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/lockfile.js +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/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +3 -3
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/observability.d.ts +3 -0
- package/dist/src/gateway/hono/routes/observability.js +106 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +0 -25
- package/dist/src/gateway/service/config-coordinator.js +31 -0
- package/dist/src/gateway/service.js +18 -8
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/observability/config.d.ts +40 -0
- package/dist/src/observability/config.js +31 -0
- package/dist/src/observability/langfuse.d.ts +31 -0
- package/dist/src/observability/langfuse.js +180 -0
- package/dist/src/observability/runtime.d.ts +57 -0
- package/dist/src/observability/runtime.js +404 -0
- package/dist/src/observability/sanitize.d.ts +3 -0
- package/dist/src/observability/sanitize.js +74 -0
- package/dist/src/observability/store.d.ts +20 -0
- package/dist/src/observability/store.js +128 -0
- package/dist/src/observability/storeWorker.d.ts +2 -0
- package/dist/src/observability/storeWorker.js +155 -0
- package/dist/src/observability/types.d.ts +21 -0
- package/dist/src/observability/types.js +1 -0
- package/dist/src/personal-agent/communication.js +1 -1
- package/dist/src/personal-agent/reply-composer.d.ts +22 -0
- package/dist/src/personal-agent/reply-composer.js +276 -0
- package/dist/src/personal-agent/reply-style.d.ts +2 -0
- package/dist/src/personal-agent/reply-style.js +14 -0
- package/dist/src/personal-agent/request-delivery.d.ts +1 -1
- package/dist/src/personal-agent/request-delivery.js +18 -4
- package/dist/src/personal-agent/request-service.js +1 -1
- package/dist/src/personal-agent/service.js +10 -2
- package/dist/src/platform/index.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-call.js +19 -5
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/provider-disconnect-core.js +1 -1
- package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
- package/dist/src/storage/sqlite/ai-usage-repository.d.ts +6 -0
- package/dist/src/storage/sqlite/ai-usage-repository.js +4 -2
- package/dist/src/storage/sqlite/migrations/233_observability_usage_links.sql +3 -0
- package/dist/src/storage/sqlite/migrations/234_task_result_reply.sql +14 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/task-result-delivery-service.js +20 -4
- package/dist/src/tui/backends/embedded-backend.js +3 -3
- 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/recorder.d.ts +4 -2
- package/dist/src/usage/recorder.js +54 -26
- package/dist/src/usage/types.d.ts +3 -0
- package/dist/src/utils/logger/context.d.ts +1 -1
- package/dist/src/utils/logger/context.js +4 -1
- package/dist/src/utils/logger/types.d.ts +3 -0
- package/dist/src/voice/realtime/agentBroker.js +11 -2
- package/dist/src/voice/realtime/agentEngine.js +18 -10
- package/dist/src/voice/realtime/omniEngine.js +11 -2
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/playback-echo.d.ts +7 -0
- package/dist/src/voice/realtime/playback-echo.js +23 -1
- package/package.json +7 -4
- package/dist/gateway/static/root/assets/gateway-realtime-store-DS4WzQyF.js +0 -1
- package/dist/gateway/static/root/assets/index-Byk2QKIS.css +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-DN5MnhL8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DuvJrDU2.js +0 -1
|
@@ -4,13 +4,14 @@ import { init_config_repository, setSessionConfig } from "../storage/sqlite/conf
|
|
|
4
4
|
import { ResponsePreferencesSchema } from "../agent-config/schema.js";
|
|
5
5
|
import { init_agent_config } from "../agent-config/index.js";
|
|
6
6
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
7
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
7
8
|
import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
|
|
8
9
|
import { getAvailableModels, init_providers } from "../providers/index.js";
|
|
9
10
|
import { DEFAULT_PERSONAL_PREFERENCES, getPersonalAgent, personalAgentId } from "./repository.js";
|
|
10
11
|
import { getModelThinking } from "../providers/model-thinking.js";
|
|
11
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
12
12
|
import { PERSONAL_COMMUNICATION_RULES, PERSONAL_RELIABILITY_RULES } from "./communication.js";
|
|
13
13
|
import { PERSONAL_MAIN_TOOL_IDS } from "./policy.js";
|
|
14
|
+
import { PERSONAL_REPLY_EXAMPLES, PERSONAL_REPLY_STYLE_RULES } from "./reply-style.js";
|
|
14
15
|
import { completePersonalOnboarding } from "./onboarding.js";
|
|
15
16
|
import { z } from "zod";
|
|
16
17
|
//#region src/personal-agent/service.ts
|
|
@@ -67,6 +68,8 @@ function personalInstructions(preferences) {
|
|
|
67
68
|
RESULT_DELIVERY_RULE,
|
|
68
69
|
...PERSONAL_COMMUNICATION_RULES,
|
|
69
70
|
...PERSONAL_RELIABILITY_RULES,
|
|
71
|
+
...PERSONAL_REPLY_STYLE_RULES,
|
|
72
|
+
PERSONAL_REPLY_EXAMPLES,
|
|
70
73
|
"When creating a Task, provide a short title that names the work, a one-sentence objective, and a Markdown description with all detailed instructions. Keep the title free of checklists and long background. Preserve user requirements in the description.",
|
|
71
74
|
"Adapt to the user’s current words first, then their saved preferences. If the user explicitly changes how they want you to respond in future, save it with personal_preference. Do not infer a lasting emotional trait from one conversation or claim human feelings or experiences.",
|
|
72
75
|
"Give the accurate answer or next step in the order this user prefers. Acknowledge feelings only when relevant, without guessing how the user feels. Avoid formulaic reassurance, praise, pet names, emojis, or jokes unless the user welcomes them and the moment fits. Be accurate about task state, evidence, and uncertainty."
|
|
@@ -117,7 +120,12 @@ async function refreshPersonalDelegationGuidance(service, ownerId) {
|
|
|
117
120
|
if (!nextInstructions.includes(LOCAL_READ_RULE)) nextInstructions += `\n${LOCAL_READ_RULE}`;
|
|
118
121
|
if (!nextInstructions.includes(RESULT_DELIVERY_RULE)) nextInstructions += `\n${RESULT_DELIVERY_RULE}`;
|
|
119
122
|
if (!nextInstructions.includes(CONNECTED_APP_RULE)) nextInstructions += `\n${CONNECTED_APP_RULE}`;
|
|
120
|
-
for (const rule of [
|
|
123
|
+
for (const rule of [
|
|
124
|
+
...PERSONAL_COMMUNICATION_RULES,
|
|
125
|
+
...PERSONAL_RELIABILITY_RULES,
|
|
126
|
+
...PERSONAL_REPLY_STYLE_RULES,
|
|
127
|
+
PERSONAL_REPLY_EXAMPLES
|
|
128
|
+
]) if (!nextInstructions.includes(rule)) nextInstructions += `\n${rule}`;
|
|
121
129
|
const toolAllowlist = agent.toolAllowlist?.includes("personal_task") ? [...new Set([...agent.toolAllowlist, ...PERSONAL_MAIN_TOOL_IDS])] : agent.toolAllowlist;
|
|
122
130
|
if (nextInstructions === instructions && JSON.stringify(toolAllowlist) === JSON.stringify(agent.toolAllowlist)) return;
|
|
123
131
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AgentManifestSchema, PlatformCapabilitySchema, PlatformConfigSchema, PlatformDiscoverySchema, PlatformEventSchema, init_contracts } from "./contracts.js";
|
|
2
1
|
import { init_resolution, resolveConnectedPlatformDiscovery, resolveConnectedPlatformEndpoint, setActivePlatformDiscovery } from "./resolution.js";
|
|
2
|
+
import { AgentManifestSchema, PlatformCapabilitySchema, PlatformConfigSchema, PlatformDiscoverySchema, PlatformEventSchema, init_contracts } from "./contracts.js";
|
|
3
3
|
import { PLATFORM_RUNTIME_PROFILE, PLATFORM_RUNTIME_PROVIDER, PlatformRuntimeClient, RuntimeCommandSchema, discoverPlatform } from "./client.js";
|
|
4
4
|
import { processRuntimeCommand } from "./worker.js";
|
|
5
5
|
//#region src/platform/index.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
2
1
|
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
2
|
+
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
3
3
|
import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
|
|
4
4
|
//#region src/providers/auth-runtime/resolve-auth.ts
|
|
5
5
|
init_env_keys();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
3
3
|
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
4
|
+
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
5
|
+
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
4
6
|
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
5
|
-
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
6
7
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
7
8
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
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 { applyOfficialModelMetadataCorrections, getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
11
11
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
@@ -43,14 +43,21 @@ async function resolveModelCallOptions(model, options = {}, credentialOptions) {
|
|
|
43
43
|
*/
|
|
44
44
|
async function completeWithResolvedCredentials(model, context, options, credentialOptions, usageContext) {
|
|
45
45
|
const resolvedOptions = await resolveModelCallOptions(model, options, credentialOptions);
|
|
46
|
-
const usageCall = startAiUsageCall(model, usageContext
|
|
46
|
+
const usageCall = startAiUsageCall(model, usageContext, {
|
|
47
|
+
context,
|
|
48
|
+
options: {
|
|
49
|
+
reasoning: options.reasoning,
|
|
50
|
+
temperature: options.temperature,
|
|
51
|
+
maxTokens: options.maxTokens
|
|
52
|
+
}
|
|
53
|
+
});
|
|
47
54
|
try {
|
|
48
55
|
if (model.baseUrl === "extension://provider-plugin") {
|
|
49
|
-
const result = await (await createExtensionAwareStreamFn()(model, normalizeContext(context), resolvedOptions)).result();
|
|
56
|
+
const result = await (await usageCall.run(() => createExtensionAwareStreamFn()(model, normalizeContext(context), resolvedOptions))).result();
|
|
50
57
|
finishAiUsageFromMessage(usageCall, result);
|
|
51
58
|
return result;
|
|
52
59
|
}
|
|
53
|
-
const result = await completeSimple(model, context, resolvedOptions);
|
|
60
|
+
const result = await usageCall.run(() => completeSimple(model, context, resolvedOptions));
|
|
54
61
|
finishAiUsageFromMessage(usageCall, result);
|
|
55
62
|
return result;
|
|
56
63
|
} catch (error) {
|
|
@@ -68,9 +75,16 @@ async function completeWithResolvedCredentials(model, context, options, credenti
|
|
|
68
75
|
*/
|
|
69
76
|
async function createResolvedModelStream(model, context, options, credentialOptions, usageContext) {
|
|
70
77
|
const resolvedOptions = await resolveModelCallOptions(model, options, credentialOptions);
|
|
71
|
-
const usageCall = startAiUsageCall(model, usageContext
|
|
78
|
+
const usageCall = startAiUsageCall(model, usageContext, {
|
|
79
|
+
context,
|
|
80
|
+
options: {
|
|
81
|
+
reasoning: options.reasoning,
|
|
82
|
+
temperature: options.temperature,
|
|
83
|
+
maxTokens: options.maxTokens
|
|
84
|
+
}
|
|
85
|
+
});
|
|
72
86
|
try {
|
|
73
|
-
return observeAiUsageStream(await createExtensionAwareStreamFn()(model, normalizeContext(context), resolvedOptions), usageCall);
|
|
87
|
+
return observeAiUsageStream(await usageCall.run(() => createExtensionAwareStreamFn()(model, normalizeContext(context), resolvedOptions)), usageCall);
|
|
74
88
|
} catch (error) {
|
|
75
89
|
usageCall?.finish({
|
|
76
90
|
status: "failed",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths_state, resolveXopcCloudCatalogCachePath } from "../config/paths-state.js";
|
|
3
|
-
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
4
3
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
|
+
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
5
5
|
import { voiceManifestSchema } from "../../packages/realtime-protocol/src/voice-catalog.js";
|
|
6
6
|
import { init_voice } from "../../packages/realtime-protocol/src/voice.js";
|
|
7
7
|
import { readFileSync, rmSync } from "node:fs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
+
import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
4
5
|
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
5
6
|
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
6
7
|
import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
|
|
7
|
-
import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
8
8
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
9
9
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
10
10
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
4
3
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "../auth/oauth-provider-lock.js";
|
|
5
4
|
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
5
|
+
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
6
6
|
import { getProviderAuthService, init_provider_auth_service } from "./provider-auth-service.js";
|
|
7
7
|
import { evictAllEmbeddedSessionRunners } from "../agent/embedded/session-runner.js";
|
|
8
8
|
//#region src/providers/provider-disconnect-core.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { init_oauth_provider_lock, withOAuthProviderLock } from "../auth/oauth-provider-lock.js";
|
|
3
4
|
import { ModelCatalogPersistence, init_model_catalog_persistence } from "./model-catalog-persistence.js";
|
|
4
5
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
5
6
|
import { getModelRegistry, init_model_registry } from "./model-registry.js";
|
|
6
|
-
import { init_oauth_provider_lock, withOAuthProviderLock } from "../auth/oauth-provider-lock.js";
|
|
7
7
|
import { reloadImageGenerationProviders } from "../agent/image/generation/provider-registry.js";
|
|
8
8
|
import { disconnectProviderCore } from "./provider-disconnect-core.js";
|
|
9
9
|
import { XopcCloudModelSource } from "./xopc-cloud-model-source.js";
|
|
@@ -55,6 +55,8 @@ export declare function listAiUsageEvents(query: AiUsageQuery & {
|
|
|
55
55
|
items: {
|
|
56
56
|
id: string;
|
|
57
57
|
traceId: string;
|
|
58
|
+
otelTraceId: string;
|
|
59
|
+
otelSpanId: string;
|
|
58
60
|
parentEventId: string;
|
|
59
61
|
conversationId: string;
|
|
60
62
|
runId: string;
|
|
@@ -85,6 +87,8 @@ export declare function listAiUsageEvents(query: AiUsageQuery & {
|
|
|
85
87
|
export declare function getAiUsageEventView(id: string): {
|
|
86
88
|
id: string;
|
|
87
89
|
traceId: string;
|
|
90
|
+
otelTraceId: string;
|
|
91
|
+
otelSpanId: string;
|
|
88
92
|
parentEventId: string;
|
|
89
93
|
conversationId: string;
|
|
90
94
|
runId: string;
|
|
@@ -113,6 +117,8 @@ export declare function getAiUsageEventView(id: string): {
|
|
|
113
117
|
export declare function listAiUsageTrace(traceId: string): {
|
|
114
118
|
id: string;
|
|
115
119
|
traceId: string;
|
|
120
|
+
otelTraceId: string;
|
|
121
|
+
otelSpanId: string;
|
|
116
122
|
parentEventId: string;
|
|
117
123
|
conversationId: string;
|
|
118
124
|
runId: string;
|
|
@@ -15,8 +15,8 @@ function insertAiUsageEvent(event) {
|
|
|
15
15
|
started_at, finished_at, duration_ms, input_tokens, output_tokens,
|
|
16
16
|
cache_read_tokens, cache_write_tokens, reasoning_tokens, total_tokens,
|
|
17
17
|
estimated_cost_microusd, cost_source, pricing_snapshot_json, error_summary,
|
|
18
|
-
created_at, updated_at
|
|
19
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(event.id, event.traceId, event.parentEventId ?? null, event.conversationId ?? null, event.runId ?? null, event.agentId ?? null, event.category, event.operation, event.trigger, event.reasonKey, event.provider, event.model, event.status, event.startedAt, event.finishedAt ?? null, event.durationMs ?? null, event.inputTokens ?? null, event.outputTokens ?? null, event.cacheReadTokens ?? null, event.cacheWriteTokens ?? null, event.reasoningTokens ?? null, event.totalTokens ?? null, event.estimatedCostMicrousd ?? null, event.costSource, event.pricingSnapshot ? JSON.stringify(event.pricingSnapshot) : null, boundedError(event.errorSummary) ?? null, event.startedAt, event.startedAt);
|
|
18
|
+
created_at, updated_at, otel_trace_id, otel_span_id
|
|
19
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(event.id, event.traceId, event.parentEventId ?? null, event.conversationId ?? null, event.runId ?? null, event.agentId ?? null, event.category, event.operation, event.trigger, event.reasonKey, event.provider, event.model, event.status, event.startedAt, event.finishedAt ?? null, event.durationMs ?? null, event.inputTokens ?? null, event.outputTokens ?? null, event.cacheReadTokens ?? null, event.cacheWriteTokens ?? null, event.reasoningTokens ?? null, event.totalTokens ?? null, event.estimatedCostMicrousd ?? null, event.costSource, event.pricingSnapshot ? JSON.stringify(event.pricingSnapshot) : null, boundedError(event.errorSummary) ?? null, event.startedAt, event.startedAt, event.otelTraceId ?? null, event.otelSpanId ?? null);
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
function finishAiUsageEvent(id, finish) {
|
|
@@ -143,6 +143,8 @@ function eventFromRow(row) {
|
|
|
143
143
|
return {
|
|
144
144
|
id: String(row.id),
|
|
145
145
|
traceId: String(row.trace_id),
|
|
146
|
+
otelTraceId: row.otel_trace_id ? String(row.otel_trace_id) : void 0,
|
|
147
|
+
otelSpanId: row.otel_span_id ? String(row.otel_span_id) : void 0,
|
|
146
148
|
parentEventId: row.parent_event_id ? String(row.parent_event_id) : void 0,
|
|
147
149
|
conversationId: row.conversation_id ? String(row.conversation_id) : void 0,
|
|
148
150
|
runId: row.run_id ? String(row.run_id) : void 0,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- Keep artifact delivery and final prose in one durable outbox with independent progress.
|
|
2
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_payload_json TEXT;
|
|
3
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_status TEXT CHECK(reply_status IN ('pending','generating','ready','delivered','stale'));
|
|
4
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_lease_token TEXT;
|
|
5
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_lease_until INTEGER NOT NULL DEFAULT 0;
|
|
6
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_text TEXT;
|
|
7
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_draft_transcript_id TEXT;
|
|
8
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_message_entry_id TEXT;
|
|
9
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_notified_at INTEGER;
|
|
10
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_attempts INTEGER NOT NULL DEFAULT 0;
|
|
11
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_next_attempt_at INTEGER NOT NULL DEFAULT 0;
|
|
12
|
+
ALTER TABLE task_result_deliveries ADD COLUMN reply_last_error TEXT;
|
|
13
|
+
|
|
14
|
+
CREATE INDEX idx_task_result_reply_pending ON task_result_deliveries(reply_status, reply_next_attempt_at, reply_lease_until);
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 234;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -57,7 +57,7 @@ function applySingleMigration(db, migration, discardOldScenes = false) {
|
|
|
57
57
|
*/
|
|
58
58
|
function applyPendingMigrations(db, options = {}) {
|
|
59
59
|
db.function("xopc_operation_id", () => currentOperationId() ?? null);
|
|
60
|
-
const targetVersion = options.targetVersion ??
|
|
60
|
+
const targetVersion = options.targetVersion ?? 234;
|
|
61
61
|
let currentVersion = readSchemaVersion(db);
|
|
62
62
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
63
63
|
if (!options.migrationsDir && currentVersion < 165) throw new DatabaseSchemaTooOldError(currentVersion, 165);
|
|
@@ -95,7 +95,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
95
95
|
}
|
|
96
96
|
/** Inspect schema version without mutating the database. */
|
|
97
97
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
98
|
-
const appVersion = options.targetVersion ??
|
|
98
|
+
const appVersion = options.targetVersion ?? 234;
|
|
99
99
|
const dbVersion = readSchemaVersion(db);
|
|
100
100
|
if (dbVersion > appVersion) return {
|
|
101
101
|
dbVersion,
|
|
@@ -137,7 +137,7 @@ var init_runner = __esmMin((() => {
|
|
|
137
137
|
init_errors();
|
|
138
138
|
log = createLogger("Sqlite:Migrations");
|
|
139
139
|
XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
140
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
140
|
+
XOPC_DB_SCHEMA_VERSION = 234;
|
|
141
141
|
}));
|
|
142
142
|
//#endregion
|
|
143
143
|
init_runner();
|
|
@@ -2,10 +2,10 @@ import { ProductReadContracts } from "../../../packages/gateway-contract/src/cap
|
|
|
2
2
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { TaskRepository, init_task_repository } from "../task-repository.js";
|
|
4
4
|
import { TaskRunRepository, init_task_run_repository } from "../task-run-repository.js";
|
|
5
|
-
import { TaskConversationRepository } from "../task-conversation-repository.js";
|
|
6
|
-
import { TaskReadModelProjector } from "../task-read-model-projector.js";
|
|
7
5
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
8
6
|
import { defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
7
|
+
import { TaskConversationRepository } from "../task-conversation-repository.js";
|
|
8
|
+
import { TaskReadModelProjector } from "../task-read-model-projector.js";
|
|
9
9
|
import { TaskContextRepository } from "../task-context-repository.js";
|
|
10
10
|
import { TaskDependencyService } from "../task-dependency-service.js";
|
|
11
11
|
import { TaskCriterionReviewRepository } from "../task-criterion-review-repository.js";
|
|
@@ -3,19 +3,25 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
4
4
|
import { TaskResultDeliverySchema } from "../../packages/gateway-contract/src/task-result-delivery.js";
|
|
5
5
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
6
|
+
import { TaskRepository, init_task_repository } from "./task-repository.js";
|
|
6
7
|
import { TaskRunRepository, init_task_run_repository } from "./task-run-repository.js";
|
|
8
|
+
import { init_request_repository, personalRequestForTask } from "../personal-agent/request-repository.js";
|
|
7
9
|
import { appendTranscriptEntry, init_transcript_repository } from "../storage/sqlite/transcript-repository.js";
|
|
8
10
|
import { TaskConversationRepository } from "./task-conversation-repository.js";
|
|
9
11
|
import { tryParseMediaUri } from "../media/uri.js";
|
|
10
12
|
import { resolveMediaBufferPath } from "../media/store.js";
|
|
11
13
|
import { emitSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
14
|
+
import { getPersonalAgentByConversation } from "../personal-agent/repository.js";
|
|
12
15
|
import { TaskResultDeliveryRepository } from "./task-result-delivery-repository.js";
|
|
16
|
+
import { enqueuePersonalReply } from "../personal-agent/reply-composer.js";
|
|
13
17
|
import { lstat } from "node:fs/promises";
|
|
14
18
|
//#region src/tasks/task-result-delivery-service.ts
|
|
15
19
|
init_src();
|
|
16
20
|
init_transcript_repository();
|
|
17
21
|
init_transaction();
|
|
18
22
|
init_logger();
|
|
23
|
+
init_request_repository();
|
|
24
|
+
init_task_repository();
|
|
19
25
|
init_task_run_repository();
|
|
20
26
|
const log = createLogger("TaskResultDelivery");
|
|
21
27
|
async function materializedArtifact(item) {
|
|
@@ -86,21 +92,31 @@ var TaskResultDeliveryService = class {
|
|
|
86
92
|
status: deliverables.length > 0 && available === 0 ? "failed" : available < deliverables.length ? "partial" : delivery.outcome.status
|
|
87
93
|
};
|
|
88
94
|
const statusText = db.prepare("SELECT locale FROM tasks WHERE task_id = ?").get(delivery.taskId).locale?.startsWith("zh") === true ? `${delivery.taskTitle}:${available === deliverables.length ? "成果已生成" : available > 0 ? "部分成果已生成" : "成果暂不可用"}。` : `${delivery.taskTitle}: ${available === deliverables.length ? "Results ready" : available > 0 ? "Partial results ready" : "Results unavailable"}.`;
|
|
89
|
-
const
|
|
95
|
+
const personal = getPersonalAgentByConversation(delivery.conversationId);
|
|
96
|
+
if (personal && !personalRequestForTask(delivery.taskId)) enqueuePersonalReply({
|
|
97
|
+
delivery: {
|
|
98
|
+
...delivery,
|
|
99
|
+
outcome
|
|
100
|
+
},
|
|
101
|
+
report: delivery.text?.trim() || delivery.outcome.summary?.trim() || statusText,
|
|
102
|
+
objective: new TaskRepository().get(delivery.taskId)?.contract?.objective ?? delivery.taskTitle
|
|
103
|
+
});
|
|
104
|
+
const content = personal ? statusText : delivery.text ? `${statusText}\n\n${delivery.text}` : statusText;
|
|
90
105
|
const details = {
|
|
91
106
|
...delivery,
|
|
92
107
|
outcome
|
|
93
108
|
};
|
|
94
|
-
|
|
109
|
+
if (personal) delete details.text;
|
|
110
|
+
const entry = !personal || deliverables.length ? appendTranscriptEntry(delivery.conversationId, {
|
|
95
111
|
role: "custom",
|
|
96
112
|
customType: "task_result_delivery",
|
|
97
113
|
content,
|
|
98
114
|
display: true,
|
|
99
115
|
details,
|
|
100
116
|
timestamp: Date.now()
|
|
101
|
-
});
|
|
117
|
+
}) : void 0;
|
|
102
118
|
db.prepare(`UPDATE task_result_deliveries SET status = 'delivered', payload_json = ?,
|
|
103
|
-
message_entry_id = ?, delivered_at = ? WHERE delivery_id = ?`).run(JSON.stringify(details), entry
|
|
119
|
+
message_entry_id = ?, delivered_at = ? WHERE delivery_id = ?`).run(JSON.stringify(details), entry?.entry_id ?? null, Date.now(), row.delivery_id);
|
|
104
120
|
return true;
|
|
105
121
|
})) continue;
|
|
106
122
|
}
|
|
@@ -9,11 +9,12 @@ import { appendComposerInputHistory, listComposerInputHistory } from "../../stor
|
|
|
9
9
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
10
10
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
11
11
|
import { normalizeAgentId } from "../../agent-catalog/id.js";
|
|
12
|
-
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
13
12
|
import { init_agent_scope, listAgentEntries } from "../../agent/agent-scope.js";
|
|
13
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
14
|
+
import { init_paths } from "../../config/paths.js";
|
|
15
|
+
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
14
16
|
import { init_agent_session_key, resolveAgentIdFromConversationId } from "../../routing/agent-session-key.js";
|
|
15
17
|
import { resolveEffectiveAgentProfile } from "../../config/agent-profile.js";
|
|
16
|
-
import { init_paths } from "../../config/paths.js";
|
|
17
18
|
import { effectiveWorkspacePathForSession } from "../../session/session-workspace.js";
|
|
18
19
|
import { ProjectService } from "../../projects/project-service.js";
|
|
19
20
|
import { inferSuggestedProjectDefaultAgentId } from "../../projects/project-agent-suggestion.js";
|
|
@@ -22,7 +23,6 @@ import { buildSessionTimeline } from "../../session/transcript-outline.js";
|
|
|
22
23
|
import { transcriptRowsToClientHistory } from "../../session/client-history.js";
|
|
23
24
|
import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
|
|
24
25
|
import { evictEmbeddedSessionRunner } from "../../agent/embedded/session-runner.js";
|
|
25
|
-
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
26
26
|
import { SessionIndex } from "../../session/manager.js";
|
|
27
27
|
import "../../session/index.js";
|
|
28
28
|
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 { init_agent_session_key, isValidAgentId, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
6
5
|
import { resolveConfigPath } from "../config/paths.js";
|
|
6
|
+
import { init_agent_session_key, isValidAgentId, normalizeAgentId } from "../routing/agent-session-key.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 { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
3
2
|
import { init_paths, resolveAgentProfileDir, resolveBundledSkillsDir } from "../config/paths.js";
|
|
3
|
+
import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.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";
|
|
3
4
|
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
4
5
|
import { resolveEffectiveAgentProfile } 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";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { AssistantMessage, AssistantMessageEventStream } from '@earendil-works/pi-ai/compat';
|
|
2
|
+
import { type Observation } from '../observability/runtime.js';
|
|
2
3
|
import type { AiUsageContext, AiUsageFinish, AiUsageModel } from './types.js';
|
|
3
4
|
export type AiUsageCall = {
|
|
4
5
|
id: string;
|
|
5
6
|
finish: (result: AiUsageFinish) => void;
|
|
7
|
+
run: Observation['run'];
|
|
6
8
|
};
|
|
7
9
|
export declare function continuesAfterTool(messages: readonly {
|
|
8
10
|
role?: string;
|
|
9
11
|
}[]): boolean;
|
|
10
|
-
export declare function startAiUsageCall(model: AiUsageModel, context: AiUsageContext): AiUsageCall
|
|
12
|
+
export declare function startAiUsageCall(model: AiUsageModel, context: AiUsageContext, input?: unknown): AiUsageCall;
|
|
11
13
|
export declare function observeAiUsageStream(stream: AssistantMessageEventStream, call: AiUsageCall | undefined): AssistantMessageEventStream;
|
|
12
|
-
export declare function trackAiUsageStream(model: AiUsageModel, context: AiUsageContext, create: () => AssistantMessageEventStream | Promise<AssistantMessageEventStream
|
|
14
|
+
export declare function trackAiUsageStream(model: AiUsageModel, context: AiUsageContext, create: () => AssistantMessageEventStream | Promise<AssistantMessageEventStream>, input?: unknown): AssistantMessageEventStream | Promise<AssistantMessageEventStream>;
|
|
13
15
|
export declare function finishAiUsageFromMessage(call: AiUsageCall | undefined, message: AssistantMessage): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_connection, isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
4
|
+
import { startObservation } from "../observability/runtime.js";
|
|
4
5
|
import { finishAiUsageEvent, insertAiUsageEvent } from "../storage/sqlite/ai-usage-repository.js";
|
|
5
6
|
import { classifyCostSource, dollarsToMicrousd, pricingSnapshot } from "./cost.js";
|
|
6
7
|
import { resolveAiUsageScenario } from "./scenario-registry.js";
|
|
@@ -17,32 +18,43 @@ function continuesAfterTool(messages) {
|
|
|
17
18
|
}
|
|
18
19
|
return false;
|
|
19
20
|
}
|
|
20
|
-
function startAiUsageCall(model, context) {
|
|
21
|
-
|
|
21
|
+
function startAiUsageCall(model, context, input) {
|
|
22
|
+
const observation = startObservation(context.operation, "generation", context);
|
|
23
|
+
observation.update({
|
|
24
|
+
"gen_ai.request.model": model.id,
|
|
25
|
+
"gen_ai.system": model.provider
|
|
26
|
+
});
|
|
27
|
+
observation.input(input);
|
|
22
28
|
const operation = context.operation;
|
|
23
29
|
const scenario = resolveAiUsageScenario(operation);
|
|
24
30
|
const id = randomUUID();
|
|
25
31
|
const startedAt = Date.now();
|
|
26
32
|
const costSource = classifyCostSource(model);
|
|
33
|
+
let persisted = false;
|
|
27
34
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
if (isXopcDatabaseOpen()) {
|
|
36
|
+
insertAiUsageEvent({
|
|
37
|
+
otelTraceId: observation.span?.spanContext().traceId,
|
|
38
|
+
otelSpanId: observation.span?.spanContext().spanId,
|
|
39
|
+
id,
|
|
40
|
+
traceId: context.traceId ?? context.runId ?? id,
|
|
41
|
+
parentEventId: context.parentEventId,
|
|
42
|
+
conversationId: context.conversationId,
|
|
43
|
+
runId: context.runId,
|
|
44
|
+
agentId: context.agentId,
|
|
45
|
+
category: scenario.category,
|
|
46
|
+
operation,
|
|
47
|
+
trigger: context.trigger ?? scenario.trigger,
|
|
48
|
+
reasonKey: scenario.reasonKey,
|
|
49
|
+
provider: model.provider,
|
|
50
|
+
model: model.id,
|
|
51
|
+
status: "running",
|
|
52
|
+
startedAt,
|
|
53
|
+
costSource,
|
|
54
|
+
pricingSnapshot: costSource === "unknown" ? void 0 : pricingSnapshot(model)
|
|
55
|
+
});
|
|
56
|
+
persisted = true;
|
|
57
|
+
}
|
|
46
58
|
} catch (err) {
|
|
47
59
|
log.error({
|
|
48
60
|
err,
|
|
@@ -50,18 +62,33 @@ function startAiUsageCall(model, context) {
|
|
|
50
62
|
provider: model.provider,
|
|
51
63
|
modelId: model.id
|
|
52
64
|
}, "Failed to start AI usage record");
|
|
53
|
-
return;
|
|
54
65
|
}
|
|
66
|
+
observation.update({ "xopc.usageEventId": id });
|
|
55
67
|
let completed = false;
|
|
56
68
|
return {
|
|
57
69
|
id,
|
|
70
|
+
run: observation.run,
|
|
58
71
|
finish(result) {
|
|
59
72
|
if (completed) return;
|
|
60
73
|
completed = true;
|
|
74
|
+
observation.update({
|
|
75
|
+
"gen_ai.usage.input_tokens": result.usage?.input,
|
|
76
|
+
"gen_ai.usage.output_tokens": result.usage?.output,
|
|
77
|
+
"langfuse.observation.usage_details": JSON.stringify({
|
|
78
|
+
input: result.usage?.input,
|
|
79
|
+
output: result.usage?.output,
|
|
80
|
+
cache_read: result.usage?.cacheRead,
|
|
81
|
+
cache_write: result.usage?.cacheWrite
|
|
82
|
+
}),
|
|
83
|
+
"langfuse.observation.cost_details": costSource === "unknown" ? void 0 : JSON.stringify({ total: result.usage?.cost?.total }),
|
|
84
|
+
"xopc.costSource": costSource
|
|
85
|
+
});
|
|
86
|
+
observation.finish(result.status === "failed" ? "error" : result.status === "aborted" ? "cancelled" : "success", result.output ?? result.errorSummary);
|
|
87
|
+
if (!persisted) return;
|
|
61
88
|
try {
|
|
62
89
|
finishAiUsageEvent(id, {
|
|
63
90
|
...result,
|
|
64
|
-
estimatedCostMicrousd: costSource === "local" ? 0 : costSource === "unknown" ? void 0 : dollarsToMicrousd(result.usage?.cost
|
|
91
|
+
estimatedCostMicrousd: costSource === "local" ? 0 : costSource === "unknown" ? void 0 : dollarsToMicrousd(result.usage?.cost?.total)
|
|
65
92
|
});
|
|
66
93
|
} catch (err) {
|
|
67
94
|
log.error({
|
|
@@ -79,7 +106,8 @@ function finishFromMessage(call, message) {
|
|
|
79
106
|
call.finish({
|
|
80
107
|
status,
|
|
81
108
|
usage: message.usage,
|
|
82
|
-
errorSummary: message.errorMessage
|
|
109
|
+
errorSummary: message.errorMessage,
|
|
110
|
+
output: message.content
|
|
83
111
|
});
|
|
84
112
|
}
|
|
85
113
|
function observeAiUsageStream(stream, call) {
|
|
@@ -90,10 +118,10 @@ function observeAiUsageStream(stream, call) {
|
|
|
90
118
|
}));
|
|
91
119
|
return stream;
|
|
92
120
|
}
|
|
93
|
-
function trackAiUsageStream(model, context, create) {
|
|
94
|
-
const call = startAiUsageCall(model, context);
|
|
121
|
+
function trackAiUsageStream(model, context, create, input) {
|
|
122
|
+
const call = startAiUsageCall(model, context, input);
|
|
95
123
|
try {
|
|
96
|
-
const created = create
|
|
124
|
+
const created = call.run(create);
|
|
97
125
|
if (created instanceof Promise) return created.then((stream) => observeAiUsageStream(stream, call), (error) => {
|
|
98
126
|
call?.finish({
|
|
99
127
|
status: "failed",
|
|
@@ -19,6 +19,8 @@ export type AiPricingSnapshot = {
|
|
|
19
19
|
cacheWrite: number;
|
|
20
20
|
};
|
|
21
21
|
export type AiUsageEvent = {
|
|
22
|
+
otelTraceId?: string;
|
|
23
|
+
otelSpanId?: string;
|
|
22
24
|
id: string;
|
|
23
25
|
traceId: string;
|
|
24
26
|
parentEventId?: string;
|
|
@@ -50,6 +52,7 @@ export type AiUsageFinish = {
|
|
|
50
52
|
status: Exclude<AiUsageStatus, 'running'>;
|
|
51
53
|
usage?: Usage;
|
|
52
54
|
errorSummary?: string;
|
|
55
|
+
output?: unknown;
|
|
53
56
|
finishedAt?: number;
|
|
54
57
|
};
|
|
55
58
|
export type AiUsageModel = Pick<Model<Api>, 'provider' | 'id' | 'baseUrl' | 'cost'>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { LogContext } from './types.js';
|
|
6
6
|
/** Correlation fields merged into every log line while the store is active (via pino mixin). */
|
|
7
|
-
declare const ASYNC_LOG_CORRELATION_KEYS: readonly ["requestId", "conversationId", "transcriptId", "userId", "correlationId"];
|
|
7
|
+
declare const ASYNC_LOG_CORRELATION_KEYS: readonly ["requestId", "conversationId", "transcriptId", "userId", "correlationId", "traceId", "spanId", "runId"];
|
|
8
8
|
type AsyncLogCorrelationKey = (typeof ASYNC_LOG_CORRELATION_KEYS)[number];
|
|
9
9
|
/**
|
|
10
10
|
* Run *fn* with merged async log context. Propagates through async/await (Node AsyncLocalStorage).
|
|
@@ -54,7 +54,10 @@ var init_context = __esmMin((() => {
|
|
|
54
54
|
"conversationId",
|
|
55
55
|
"transcriptId",
|
|
56
56
|
"userId",
|
|
57
|
-
"correlationId"
|
|
57
|
+
"correlationId",
|
|
58
|
+
"traceId",
|
|
59
|
+
"spanId",
|
|
60
|
+
"runId"
|
|
58
61
|
];
|
|
59
62
|
logContextStorage = new AsyncLocalStorage();
|
|
60
63
|
INBOUND_METADATA_FROM_ASYNC = [
|
|
@@ -41,6 +41,9 @@ export declare const LogLevelValue: Record<LogLevel, number>;
|
|
|
41
41
|
* Common log context fields
|
|
42
42
|
*/
|
|
43
43
|
export interface LogContext {
|
|
44
|
+
traceId?: string;
|
|
45
|
+
spanId?: string;
|
|
46
|
+
runId?: string;
|
|
44
47
|
/** Request/operation ID for tracing */
|
|
45
48
|
requestId?: string;
|
|
46
49
|
/** Session ID for user tracking */
|