@xopcai/xopc 0.0.161 → 0.0.163
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/README.md +4 -2
- package/README.zh-CN.md +4 -2
- 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-o7GRljfD.js → activity-store-Xj95LzTv.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9R3szLMc.js → agent-avatar-dicebear-C-QeUFwU.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DVKlWKJE.js +2 -0
- package/dist/gateway/static/root/assets/{api-jSTqFMq9.js → api-BTLmAm1_.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D81cyE76.js → app-management-settings-panel-zc6Gf-S5.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Ct6bZQCV.js → appearance-settings-0fMLnOWn.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BZXEJDIV.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-DOiR_E21.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CP_Gaxt3.js → attachment-load-BxmYl1D1.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BGKM_NDZ.js → automation-suggestion-card-BhZOirad.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-B8CnkoXv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-IPr2EVnS.js → binary-plugins-DTTKsvgk.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B6aHEGA6.js → block-editor-C7se7iqg.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-BCPWKI9V.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-kxmStCcv.js +1 -0
- package/dist/gateway/static/root/assets/browser-workflows-page-CwYf9OM_.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C7lr_mX2.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CCX9-LjU.js → capability-presets-api-BZKh2cWX.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Ble9kHRu.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-MmLMLDWf.js → channel-recipient-api-r7tdbnJE.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-CtQQQHrv.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-_VirfMKW.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BbjzIs87.js → connector-logo-BpnQYAxA.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BXWJSJeY.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CYH5ZSXy.js → desktop-pet-B86W4a5c.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DQLqGLc0.js → desktop-pet-settings-uv8Grtgk.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ClsiXhmz.js → directory-picker-path-field-C4TTvf7p.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CjMPPdzg.js → dreaming-settings-CzJAUPvM.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-57eizjhB.js → extension-debug-page-Ci2mOYUt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CsbSb3u1.js → extension-page-DeXdmhXQ.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C93vaOsU.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DIPJuzBZ.js → gateway-config-api-C31Hlblp.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CDLqAQY7.js → gateway-settings-D3zS6RZh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DrfSJtvT.js → gateway-startup-retry-CSRvCqxh.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-CWp2b7__.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-Dtm29FxD.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-lGC10UkU.js → goals-config-api-D4wYNRrf.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-jMzBJs6e.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-BWq0pdrA.js → goals-settings-Bx2jVvhQ.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D4o8BJVv.js → heartbeat-settings-BEIF1eXy.js} +1 -1
- package/dist/gateway/static/root/assets/index-BXtJvaQl.css +1 -0
- package/dist/gateway/static/root/assets/index-HZdBKfk_.js +199 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6T2QYehS.js → keyboard-shortcuts-settings-DOEDpvTM.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CseW9jD3.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DCjg2K9f.js → local-apps-page-B0OpGpxv.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dar-xqQr.js → locale-store-Ys6RP7Be.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DVqPbth5.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-rt1XO43g.js → markdown-split-CEZwysCH.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bwo8CJuh.js → media-plugins-CpGKE7B0.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BzI9Wx30.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-Dp-pkX7d.js → notes-page-CdiuDZ5a.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-mrc3xtpn.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-CzZ4iKOb.js → page-tabs-BkH5AVV2.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-3E_Qa-58.js → preview-open-alternatives-CQai8f9D.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B2T48Sbt.js → product-open-page-B2kSdB2b.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CfhPJLkH.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BfMoKjdm.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CrDtcsZ9.js +1 -0
- package/dist/gateway/static/root/assets/save-bar-controls-NGYnO7n7.js +1 -0
- package/dist/gateway/static/root/assets/schedule-field-nLOphnv3.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-DC-iU5IG.js → schema-form-D0e90ndE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-D3DbF3dV.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BZp0O2dH.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CNqF6IwY.js → settings-form-section-X2Sl-EAk.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkvwitK_.js → settings-loading-skeleton-DOnUabm7.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-C4UUNi1n.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DWvNgISx.js → settings-page-layout-C1yYqbT6.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-84iao4DZ.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DGpSPW-n.js → share-preview-page-Cfy_pH7V.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DtcwQvRG.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-L7j5Gc8Z.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-1Ps8PjsP.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-8TxxSbUw.js → system-settings-panel-Da81RJ6G.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B5FzMWOx.js → theme-store-DflSp9o4.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-BIkOW-2L.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-DEGtSA5h.js → typed-models-lib--HptwFcD.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BDU6FneG.js → use-channel-catalog-CMHY4ZfW.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BYAAs2iW.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-nvIZerol.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-J35JkJ7_.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-C4wYDYqV.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DMvitV6c.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cwi8Pz7n.js → workflow-run-setup-panel-D96MHABy.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-JMN0nMbM.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +9 -5
- package/dist/src/agent/embedded/run-for-session.js +38 -31
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +12 -4
- package/dist/src/agent/failover-error.d.ts +1 -1
- package/dist/src/agent/image/generation/openai-compatible-image-provider.d.ts +2 -6
- package/dist/src/agent/image/generation/openai-compatible-image-provider.js +1 -3
- package/dist/src/agent/image/generation/provider-registry.d.ts +5 -46
- package/dist/src/agent/image/generation/provider-registry.js +24 -73
- package/dist/{extensions/dashscope/src/image-generation-provider.d.ts → src/agent/image/generation/providers/dashscope.d.ts} +3 -6
- package/dist/{extensions/dashscope/src/image-generation-provider.js → src/agent/image/generation/providers/dashscope.js} +36 -59
- package/dist/{extensions/fal/src/image-generation-provider.d.ts → src/agent/image/generation/providers/fal.d.ts} +1 -1
- package/dist/{extensions/fal/src/image-generation-provider.js → src/agent/image/generation/providers/fal.js} +19 -29
- package/dist/{extensions/google/src/image-generation-provider.d.ts → src/agent/image/generation/providers/google.d.ts} +2 -2
- package/dist/{extensions/google/src/image-generation-provider.js → src/agent/image/generation/providers/google.js} +23 -30
- package/dist/{extensions/minimax/src/image-generation-provider.d.ts → src/agent/image/generation/providers/minimax.d.ts} +2 -5
- package/dist/{extensions/minimax/src/image-generation-provider.js → src/agent/image/generation/providers/minimax.js} +35 -51
- package/dist/{extensions/openai/src/image-generation-provider.d.ts → src/agent/image/generation/providers/openai.d.ts} +2 -2
- package/dist/{extensions/openai/src/image-generation-provider.js → src/agent/image/generation/providers/openai.js} +13 -38
- package/dist/src/agent/image/generation/runtime-types.d.ts +1 -0
- package/dist/src/agent/image/generation/runtime.d.ts +1 -3
- package/dist/src/agent/image/generation/runtime.js +6 -6
- package/dist/src/agent/image/generation/types.d.ts +23 -3
- package/dist/src/agent/image/index.d.ts +1 -1
- package/dist/src/agent/image/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +2 -0
- package/dist/src/agent/media-generation/runtime-shared.js +1 -0
- package/dist/src/agent/outcomes/task-evaluation.d.ts +20 -0
- package/dist/src/agent/outcomes/task-evaluation.js +48 -0
- package/dist/src/agent/outcomes/task-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/task-verifier.js +71 -0
- package/dist/src/agent/prompt/memory/index.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +32 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +1 -7
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +2 -73
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -13
- package/dist/src/agent/tools/browser/tool/schemas.js +1 -9
- package/dist/src/agent/tools/browser-recipe-tool.d.ts +12 -0
- package/dist/src/agent/tools/browser-recipe-tool.js +113 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +6 -1
- package/dist/src/agent/tools/image-generate-tool.d.ts +2 -0
- package/dist/src/agent/tools/image-generate-tool.js +14 -7
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/auth/sync-provider-auth.d.ts +3 -0
- package/dist/src/auth/sync-provider-auth.js +12 -1
- package/dist/src/automations/domain/types.d.ts +13 -0
- package/dist/src/automations/domain/validation.d.ts +44 -24
- package/dist/src/automations/domain/validation.js +27 -18
- package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -1
- package/dist/src/automations/draft/automation-draft-validator.js +1 -0
- package/dist/src/automations/service/action-executor.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +22 -0
- package/dist/src/browser/index.d.ts +0 -1
- package/dist/src/browser/index.js +1 -2
- package/dist/src/browser/pipeline/runner.d.ts +9 -2
- package/dist/src/browser/pipeline/runner.js +151 -105
- package/dist/src/browser/pipeline/schema.d.ts +21 -15
- package/dist/src/browser/pipeline/schema.js +93 -99
- package/dist/src/browser/recipes/index.d.ts +3 -0
- package/dist/src/browser/recipes/index.js +3 -0
- package/dist/src/browser/recipes/repository.d.ts +13 -0
- package/dist/src/browser/recipes/repository.js +81 -0
- package/dist/src/browser/recipes/runtime-service.d.ts +6 -0
- package/dist/src/browser/recipes/runtime-service.js +30 -0
- package/dist/src/browser/recipes/service.d.ts +36 -0
- package/dist/src/browser/recipes/service.js +186 -0
- package/dist/src/browser/recipes/types.d.ts +36 -0
- package/dist/src/cli/commands/browser-cli-helpers.js +6 -12
- package/dist/src/cli/commands/browser.js +4 -3
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/models.js +2 -5
- package/dist/src/cli/commands/onboard/model.js +3 -2
- package/dist/src/cli/commands/setup-shared/types.d.ts +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/models-json.d.ts +6 -0
- package/dist/src/config/models-json.js +2 -6
- package/dist/src/config/schema.d.ts +29 -18
- package/dist/src/config/schema.js +44 -33
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +12 -6
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/lib/safe-providers-config.d.ts +0 -3
- package/dist/src/gateway/hono/lib/safe-providers-config.js +1 -3
- package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
- package/dist/src/gateway/hono/routes/browser-workflows.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-workflows.js +78 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -11
- package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
- package/dist/src/gateway/hono/routes/home.js +1 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/interaction-state.d.ts +3 -0
- package/dist/src/gateway/hono/routes/interaction-state.js +45 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +17 -2
- package/dist/src/gateway/hono/routes/memory.js +33 -4
- package/dist/src/gateway/hono/routes/models.js +151 -129
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/task-outcomes.js +109 -0
- package/dist/src/gateway/hono/routes/you.d.ts +10 -2
- package/dist/src/gateway/hono/routes/you.js +184 -28
- package/dist/src/gateway/image-generation-setup.d.ts +40 -0
- package/dist/src/gateway/image-generation-setup.js +130 -0
- package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
- package/dist/src/gateway/rate-limit/buckets.js +12 -0
- package/dist/src/gateway/service/run-gateway-agent.js +84 -0
- package/dist/src/gateway/service.d.ts +6 -0
- package/dist/src/gateway/service.js +24 -0
- package/dist/src/media-shared/http/private-network.d.ts +1 -1
- package/dist/src/media-shared/http/private-network.js +1 -1
- package/dist/src/proactive/insight-repository.d.ts +2 -0
- package/dist/src/proactive/insight-repository.js +5 -2
- package/dist/src/proactive/run-processor.js +22 -1
- package/dist/src/proactive/types.d.ts +2 -0
- package/dist/src/proactive/value-score.d.ts +13 -0
- package/dist/src/proactive/value-score.js +30 -0
- package/dist/src/providers/auth-runtime/resolve-api-key.d.ts +2 -4
- package/dist/src/providers/auth-runtime/resolve-api-key.js +2 -4
- package/dist/src/providers/auth-runtime/resolve-auth.d.ts +3 -4
- package/dist/src/providers/auth-runtime/resolve-auth.js +18 -18
- package/dist/src/providers/domestic-presets.d.ts +22 -0
- package/dist/src/providers/domestic-presets.js +25 -0
- package/dist/src/providers/model-catalog-store.d.ts +71 -0
- package/dist/src/providers/model-catalog-store.js +102 -0
- package/dist/src/providers/model-catalog-sync-service.d.ts +41 -0
- package/dist/src/providers/model-catalog-sync-service.js +142 -0
- package/dist/src/providers/model-reference-auditor.d.ts +14 -0
- package/dist/src/providers/model-reference-auditor.js +71 -0
- package/dist/src/providers/model-registry.d.ts +4 -1
- package/dist/src/providers/model-registry.js +35 -2
- package/dist/src/providers/presentation.js +2 -0
- package/dist/src/providers/xopc-cloud-connection.d.ts +51 -0
- package/dist/src/providers/xopc-cloud-connection.js +196 -0
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/session-title.d.ts +2 -0
- package/dist/src/session/session-title.js +24 -3
- package/dist/src/share/share-types.js +5 -5
- package/dist/src/share/site-share-types.d.ts +1 -1
- package/dist/src/share/site-share-types.js +5 -5
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/interaction-state-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/interaction-state-repository.js +60 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +45 -0
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +24 -0
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +14 -0
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +6 -0
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +11 -0
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +3 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/relationship-settings-repository.js +64 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +46 -0
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +90 -0
- package/dist/src/storage/sqlite/task-outcome-repository.js +138 -0
- package/dist/src/user-context/interaction-state.d.ts +13 -0
- package/dist/src/user-context/interaction-state.js +69 -0
- package/dist/src/user-context/memory-use-audit.d.ts +10 -0
- package/dist/src/user-context/memory-use-audit.js +25 -0
- package/dist/src/user-context/personal-playbook.d.ts +11 -0
- package/dist/src/user-context/personal-playbook.js +41 -0
- package/dist/src/user-context/projection.d.ts +4 -0
- package/dist/src/user-context/projection.js +5 -1
- package/dist/src/user-context/relationship-continuity.d.ts +14 -0
- package/dist/src/user-context/relationship-continuity.js +51 -0
- package/package.json +5 -7
- package/dist/extensions/dashscope/src/index.d.ts +0 -4
- package/dist/extensions/dashscope/src/index.js +0 -2
- package/dist/extensions/dashscope/xopc.extension.json +0 -15
- package/dist/extensions/fal/src/index.d.ts +0 -4
- package/dist/extensions/fal/src/index.js +0 -2
- package/dist/extensions/fal/xopc.extension.json +0 -14
- package/dist/extensions/google/src/index.d.ts +0 -4
- package/dist/extensions/google/src/index.js +0 -2
- package/dist/extensions/google/xopc.extension.json +0 -14
- package/dist/extensions/minimax/src/index.d.ts +0 -4
- package/dist/extensions/minimax/src/index.js +0 -2
- package/dist/extensions/minimax/xopc.extension.json +0 -15
- package/dist/extensions/openai/src/index.d.ts +0 -4
- package/dist/extensions/openai/src/index.js +0 -2
- package/dist/extensions/openai/xopc.extension.json +0 -14
- package/dist/gateway/static/root/assets/action-boundary-settings-panel-BIVBUiNT.js +0 -1
- package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dva9SiPK.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-DKA9-lyP.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +0 -2
- package/dist/gateway/static/root/assets/index-CkUHH170.css +0 -1
- package/dist/gateway/static/root/assets/index-vq_cJZJC.js +0 -199
- package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CyYCBqym.js +0 -7
- package/dist/gateway/static/root/assets/messages-CxySDn9d.js +0 -5
- package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +0 -1
- package/dist/gateway/static/root/assets/save-bar-controls-CkeKasGm.js +0 -1
- package/dist/gateway/static/root/assets/schedule-field-TkqUL3wm.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +0 -1
- package/dist/gateway/static/root/assets/settings-collapsible-section-Dpqth3oA.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-qPG7I2zd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +0 -11
- package/dist/src/agent/image/generation/bundled-registry.d.ts +0 -18
- package/dist/src/agent/image/generation/bundled-registry.js +0 -35
- package/dist/src/agent/image/generation/bundled.d.ts +0 -10
- package/dist/src/agent/image/generation/bundled.js +0 -15
- package/dist/src/agent/image/generation/image-provider-ui.d.ts +0 -20
- package/dist/src/browser/pipeline/source.d.ts +0 -9
- package/dist/src/browser/pipeline/source.js +0 -77
- package/dist/src/gateway/image-capabilities.d.ts +0 -28
- package/dist/src/gateway/image-capabilities.js +0 -78
- package/dist/src/generated/bundled-image-generation-providers.d.ts +0 -14
- package/dist/src/generated/bundled-image-generation-providers.js +0 -17
- /package/dist/src/{agent/image/generation/image-provider-ui.js → browser/recipes/types.js} +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { inboundCorrelationMetadataFromAsyncLogContext, updateAsyncLogContext } from "../../utils/logger/context.js";
|
|
2
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
|
+
import { updateInteractionStateFromMessage } from "../../storage/sqlite/interaction-state-repository.js";
|
|
5
|
+
import { completeTaskOutcome, startTaskOutcome, updateTaskOutcome } from "../../storage/sqlite/task-outcome-repository.js";
|
|
6
|
+
import "../../storage/sqlite/index.js";
|
|
7
|
+
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
8
|
+
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
4
9
|
import { formatAgentRunErrorForClient } from "../../agent/client-error-format.js";
|
|
5
10
|
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
6
11
|
import { shouldSkipWebchatInboundByAbortCutoff } from "../../session/abort-cutoff.js";
|
|
@@ -11,6 +16,7 @@ import { coalesceThinkingDeltas } from "../chat-stream/thinking-delta-coalescer.
|
|
|
11
16
|
import crypto from "crypto";
|
|
12
17
|
//#region src/gateway/service/run-gateway-agent.ts
|
|
13
18
|
init_logger();
|
|
19
|
+
init_session_key();
|
|
14
20
|
const log = createLogger("Gateway:Service");
|
|
15
21
|
/**
|
|
16
22
|
* @param runOptions.signal — When set (e.g. client disconnect), aborts in-flight generation and persists partial output.
|
|
@@ -24,6 +30,11 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
24
30
|
const runId = crypto.randomUUID();
|
|
25
31
|
const { agentService, bus, runRelay, runAbortControllers, activeWebchatRunBySession, sessionIndex: sessionIndexFromDeps, emit } = deps;
|
|
26
32
|
const sessionIndex = sessionIndexFromDeps;
|
|
33
|
+
let taskOutcomeStarted = false;
|
|
34
|
+
let taskOutcomeStatus = "failed";
|
|
35
|
+
let taskOutcomeSummary = "Agent run ended unexpectedly";
|
|
36
|
+
let taskContract;
|
|
37
|
+
const taskEvidence = [];
|
|
27
38
|
let webchatSessionKey;
|
|
28
39
|
let webchatSessionId;
|
|
29
40
|
let webchatStaleSkip = false;
|
|
@@ -40,15 +51,65 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
40
51
|
runAbortControllers.set(runId, new AbortController());
|
|
41
52
|
}
|
|
42
53
|
const streamSessionKey = webchatSessionKey ?? chatId;
|
|
54
|
+
if (webchatSessionKey) {
|
|
55
|
+
const parsedSession = parseSessionKey(webchatSessionKey);
|
|
56
|
+
if (!parsedSession) throw new Error("Resolved webchat session key is invalid");
|
|
57
|
+
updateInteractionStateFromMessage({
|
|
58
|
+
sessionKey: webchatSessionKey,
|
|
59
|
+
message
|
|
60
|
+
});
|
|
61
|
+
recordExplicitRelationshipFollowUp({
|
|
62
|
+
sessionKey: webchatSessionKey,
|
|
63
|
+
sourceAgentId: parsedSession.agentId,
|
|
64
|
+
message
|
|
65
|
+
});
|
|
66
|
+
startTaskOutcome({
|
|
67
|
+
runId,
|
|
68
|
+
sessionKey: webchatSessionKey,
|
|
69
|
+
channel,
|
|
70
|
+
objective: message.trim()
|
|
71
|
+
});
|
|
72
|
+
taskOutcomeStarted = true;
|
|
73
|
+
}
|
|
43
74
|
const mapper = new ChatStreamMapper({
|
|
44
75
|
runId,
|
|
45
76
|
sessionKey: streamSessionKey,
|
|
46
77
|
channel
|
|
47
78
|
});
|
|
48
79
|
let registeredActiveWebchatRun = false;
|
|
80
|
+
const addTaskEvidence = (evidence) => {
|
|
81
|
+
if (taskEvidence.some((item) => item.kind === evidence.kind && item.title === evidence.title)) return;
|
|
82
|
+
taskEvidence.push(evidence);
|
|
83
|
+
};
|
|
84
|
+
const captureTaskEvent = (event) => {
|
|
85
|
+
if (event.type === "turn_plan") {
|
|
86
|
+
taskContract = {
|
|
87
|
+
objective: message.trim(),
|
|
88
|
+
deliverables: [],
|
|
89
|
+
acceptanceCriteria: event.payload.plan.map((item) => item.step),
|
|
90
|
+
constraints: [],
|
|
91
|
+
approvalRequired: []
|
|
92
|
+
};
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (event.type === "patch_applied") {
|
|
96
|
+
addTaskEvidence({
|
|
97
|
+
kind: "state",
|
|
98
|
+
title: "Changes applied",
|
|
99
|
+
summary: `${event.payload.added} additions and ${event.payload.removed} removals`
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (event.type === "command_completed" && event.payload.exitCode === 0 && /(^|\s)(test|vitest|jest|pytest|lint|typecheck|build)(\s|$|:)/i.test(event.payload.command)) addTaskEvidence({
|
|
104
|
+
kind: "test",
|
|
105
|
+
title: event.payload.command.slice(0, 120),
|
|
106
|
+
summary: event.payload.durationMs === void 0 ? "Command completed successfully" : `Command completed successfully in ${event.payload.durationMs} ms`
|
|
107
|
+
});
|
|
108
|
+
};
|
|
49
109
|
const publishStreamEvent = (event) => channel === "webchat" ? runRelay.publish(runId, event) ?? event : event;
|
|
50
110
|
const emitAndYield = function* (events) {
|
|
51
111
|
for (const event of events) {
|
|
112
|
+
if (taskOutcomeStarted) captureTaskEvent(event);
|
|
52
113
|
const relayedEvent = publishStreamEvent(event);
|
|
53
114
|
if (channel === "webchat") emit("agent.stream", {
|
|
54
115
|
sessionKey: streamSessionKey,
|
|
@@ -61,6 +122,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
61
122
|
try {
|
|
62
123
|
if (channel === "webchat" && webchatSessionKey) {
|
|
63
124
|
if (webchatStaleSkip) {
|
|
125
|
+
taskOutcomeStatus = "cancelled";
|
|
126
|
+
taskOutcomeSummary = "Stale inbound message skipped";
|
|
64
127
|
yield* emitAndYield(mapper.end("cancelled", "Stale inbound after abort (clientCreatedAtMs before cutoff)"));
|
|
65
128
|
runRelay.complete(runId);
|
|
66
129
|
runAbortControllers.delete(runId);
|
|
@@ -97,6 +160,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
97
160
|
for await (const event of coalesceThinkingDeltas(mappedEvents)) yield* emitAndYield([event]);
|
|
98
161
|
const endStatus = mergedSignal.aborted ? "cancelled" : "success";
|
|
99
162
|
const endSummary = mergedSignal.aborted ? "Interrupted" : "Message processed successfully";
|
|
163
|
+
taskOutcomeStatus = mergedSignal.aborted ? "cancelled" : "succeeded";
|
|
164
|
+
taskOutcomeSummary = endSummary;
|
|
100
165
|
yield* emitAndYield(mapper.end(endStatus, endSummary));
|
|
101
166
|
runRelay.complete(runId);
|
|
102
167
|
try {
|
|
@@ -121,6 +186,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
121
186
|
channel: "webchat"
|
|
122
187
|
}, `Agent processing failed: ${em}`);
|
|
123
188
|
streamError = em;
|
|
189
|
+
taskOutcomeStatus = "failed";
|
|
190
|
+
taskOutcomeSummary = em;
|
|
124
191
|
const errorContent = formatAgentRunErrorForClient(streamError);
|
|
125
192
|
yield* emitAndYield(mapper.error(errorContent));
|
|
126
193
|
yield* emitAndYield(mapper.end("error", streamError));
|
|
@@ -198,12 +265,16 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
198
265
|
payload: { messageId }
|
|
199
266
|
}]);
|
|
200
267
|
yield* emitAndYield(mapper.end("success", "Message processed"));
|
|
268
|
+
taskOutcomeStatus = "succeeded";
|
|
269
|
+
taskOutcomeSummary = "Message processed";
|
|
201
270
|
return {
|
|
202
271
|
status: "ok",
|
|
203
272
|
summary: "Message processed"
|
|
204
273
|
};
|
|
205
274
|
} catch (error) {
|
|
206
275
|
const em = error instanceof Error ? error.message : String(error);
|
|
276
|
+
taskOutcomeStatus = "failed";
|
|
277
|
+
taskOutcomeSummary = em;
|
|
207
278
|
log.error({
|
|
208
279
|
err: error,
|
|
209
280
|
errorMessage: em,
|
|
@@ -213,6 +284,19 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
213
284
|
chatId
|
|
214
285
|
}, `Agent run failed: ${em}`);
|
|
215
286
|
throw error;
|
|
287
|
+
} finally {
|
|
288
|
+
if (taskOutcomeStarted) {
|
|
289
|
+
updateTaskOutcome({
|
|
290
|
+
runId,
|
|
291
|
+
...taskContract ? { contract: taskContract } : {},
|
|
292
|
+
evidence: taskEvidence
|
|
293
|
+
});
|
|
294
|
+
completeTaskOutcome({
|
|
295
|
+
runId,
|
|
296
|
+
status: taskOutcomeStatus,
|
|
297
|
+
summary: taskOutcomeSummary
|
|
298
|
+
});
|
|
299
|
+
}
|
|
216
300
|
}
|
|
217
301
|
}
|
|
218
302
|
//#endregion
|
|
@@ -7,10 +7,12 @@ import { ExtensionLoader } from '../extensions/index.js';
|
|
|
7
7
|
import { SessionIndex } from '../session/index.js';
|
|
8
8
|
import type { Config } from '../config/schema.js';
|
|
9
9
|
import { type ResolvedGatewayAuth } from './auth.js';
|
|
10
|
+
import { ModelCatalogSyncService } from '../providers/model-catalog-sync-service.js';
|
|
10
11
|
import { AgentRunRelay } from './agent-run-relay.js';
|
|
11
12
|
import { type EnqueueGoalRunOptions } from '../goals/index.js';
|
|
12
13
|
import { ProjectService } from '../projects/index.js';
|
|
13
14
|
import { LocalAppService } from '../local-apps/index.js';
|
|
15
|
+
import { type BrowserRecipeService } from '../browser/recipes/index.js';
|
|
14
16
|
import { GatewaySessionsApi } from './service/sessions-api.js';
|
|
15
17
|
import { GatewayMarketplaceService } from './service/marketplace-service.js';
|
|
16
18
|
import { GatewayAgentRunner } from './service/agent-runner.js';
|
|
@@ -26,6 +28,7 @@ export declare class GatewayService {
|
|
|
26
28
|
private _agentService;
|
|
27
29
|
private channelManager;
|
|
28
30
|
private automationService;
|
|
31
|
+
private browserRecipeService;
|
|
29
32
|
private notesService;
|
|
30
33
|
private extensionLoader;
|
|
31
34
|
private extensionMetadataSnapshot;
|
|
@@ -39,9 +42,12 @@ export declare class GatewayService {
|
|
|
39
42
|
private startTime;
|
|
40
43
|
private workspacePath;
|
|
41
44
|
private readonly configCoordinator;
|
|
45
|
+
private readonly modelCatalogSync;
|
|
42
46
|
private auth;
|
|
43
47
|
private readonly sse;
|
|
44
48
|
getConfig(): Config;
|
|
49
|
+
getModelCatalogSync(): ModelCatalogSyncService;
|
|
50
|
+
get browserRecipes(): BrowserRecipeService;
|
|
45
51
|
private stopGatewayUpdateCheck;
|
|
46
52
|
/** When set (e.g. by `GatewayServer`), `triggerGatewayProcessRestart` can stop HTTP then exit. */
|
|
47
53
|
private gatewayShutdownForRestart;
|
|
@@ -74,10 +74,13 @@ import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
|
|
|
74
74
|
import "./rate-limit/index.js";
|
|
75
75
|
import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
76
76
|
import { auditGatewayConfig } from "./security/audit.js";
|
|
77
|
+
import { ModelCatalogSyncService } from "../providers/model-catalog-sync-service.js";
|
|
77
78
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
78
79
|
import { MobileNotificationService } from "../mobile/notification-service.js";
|
|
79
80
|
import { LocalAppService } from "../local-apps/service.js";
|
|
80
81
|
import "../local-apps/index.js";
|
|
82
|
+
import { createRuntimeBrowserRecipeService } from "../browser/recipes/runtime-service.js";
|
|
83
|
+
import "../browser/recipes/index.js";
|
|
81
84
|
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
82
85
|
import { resolveChannelConnectDeferSet } from "./resolve-channel-connect-defer.js";
|
|
83
86
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
@@ -108,6 +111,7 @@ var GatewayService = class {
|
|
|
108
111
|
_agentService = null;
|
|
109
112
|
channelManager;
|
|
110
113
|
automationService;
|
|
114
|
+
browserRecipeService = null;
|
|
111
115
|
notesService;
|
|
112
116
|
extensionLoader = null;
|
|
113
117
|
extensionMetadataSnapshot = null;
|
|
@@ -121,11 +125,25 @@ var GatewayService = class {
|
|
|
121
125
|
startTime = Date.now();
|
|
122
126
|
workspacePath;
|
|
123
127
|
configCoordinator;
|
|
128
|
+
modelCatalogSync = new ModelCatalogSyncService({
|
|
129
|
+
onUpdated: (modelCount) => this.emit("model-catalog.updated", { modelCount }),
|
|
130
|
+
getConfig: () => this.config
|
|
131
|
+
});
|
|
124
132
|
auth;
|
|
125
133
|
sse = new GatewaySseHub();
|
|
126
134
|
getConfig() {
|
|
127
135
|
return this.config;
|
|
128
136
|
}
|
|
137
|
+
getModelCatalogSync() {
|
|
138
|
+
return this.modelCatalogSync;
|
|
139
|
+
}
|
|
140
|
+
get browserRecipes() {
|
|
141
|
+
if (!this.browserRecipeService) this.browserRecipeService = createRuntimeBrowserRecipeService({
|
|
142
|
+
getConfig: () => this.config,
|
|
143
|
+
emit: (type, payload) => this.emit(type, payload)
|
|
144
|
+
});
|
|
145
|
+
return this.browserRecipeService;
|
|
146
|
+
}
|
|
129
147
|
stopGatewayUpdateCheck = null;
|
|
130
148
|
/** When set (e.g. by `GatewayServer`), `triggerGatewayProcessRestart` can stop HTTP then exit. */
|
|
131
149
|
gatewayShutdownForRestart = null;
|
|
@@ -322,6 +340,7 @@ var GatewayService = class {
|
|
|
322
340
|
},
|
|
323
341
|
extensionRegistry: this.extensionLoader?.getRegistry(),
|
|
324
342
|
getAutomationService: () => this.automationService,
|
|
343
|
+
getBrowserRecipeService: () => this.browserRecipes,
|
|
325
344
|
getNotesService: () => this.notesService,
|
|
326
345
|
getProjectService: () => this.projects,
|
|
327
346
|
getWorkItemService: () => new WorkItemService(),
|
|
@@ -361,6 +380,7 @@ var GatewayService = class {
|
|
|
361
380
|
getDefaultAgentId: () => getDefaultAgentId(this.config),
|
|
362
381
|
getProjectWorkspaceRoot: (projectId) => this.projects.get(projectId)?.workspaceRoot,
|
|
363
382
|
workflowRunService: this.createWorkflowRunService(),
|
|
383
|
+
browserRecipeService: this.browserRecipes,
|
|
364
384
|
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
365
385
|
});
|
|
366
386
|
this._agentService.persistentGoals.setWebchatContinuationScheduler((sessionKey, message) => {
|
|
@@ -570,6 +590,7 @@ var GatewayService = class {
|
|
|
570
590
|
phase: "sidecars.model_prewarm"
|
|
571
591
|
}, `Model registry prewarm failed: ${em}`);
|
|
572
592
|
}
|
|
593
|
+
this.modelCatalogSync.start();
|
|
573
594
|
if (!this.extensionLoader || areExtensionsGloballyDisabled(this.config)) return;
|
|
574
595
|
try {
|
|
575
596
|
if (trace) await trace.measure("extensions.deferred-load", () => this.loadDeferredExtensions());
|
|
@@ -671,6 +692,7 @@ var GatewayService = class {
|
|
|
671
692
|
agentService: this.agentService,
|
|
672
693
|
getDefaultAgentId: () => getDefaultAgentId(this.config),
|
|
673
694
|
workflowRunService: this.createWorkflowRunService(),
|
|
695
|
+
browserRecipeService: this.browserRecipes,
|
|
674
696
|
onRunCompleted: (run) => this.handleAutomationRunCompleted(run)
|
|
675
697
|
});
|
|
676
698
|
this.startAutomationProductEventBridge();
|
|
@@ -814,6 +836,7 @@ var GatewayService = class {
|
|
|
814
836
|
this.stopGatewayUpdateCheck();
|
|
815
837
|
this.stopGatewayUpdateCheck = null;
|
|
816
838
|
}
|
|
839
|
+
this.modelCatalogSync.stop();
|
|
817
840
|
await this.configCoordinator.stopHotReloader();
|
|
818
841
|
this.heartbeatService?.stop();
|
|
819
842
|
this.connectorSupervisor?.stop();
|
|
@@ -822,6 +845,7 @@ var GatewayService = class {
|
|
|
822
845
|
this.connectorMemorySyncCoordinator = null;
|
|
823
846
|
this.connectedKnowledgeCoordinator?.stop();
|
|
824
847
|
this.connectedKnowledgeCoordinator = null;
|
|
848
|
+
await this.browserRecipeService?.shutdown();
|
|
825
849
|
if (this.browserExtensionRelease) {
|
|
826
850
|
await this.browserExtensionRelease();
|
|
827
851
|
this.browserExtensionRelease = null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* SSRF / private-network protection for provider HTTP calls.
|
|
3
3
|
*
|
|
4
4
|
* Provider URLs are mostly user-controllable (cfg.providers.<id>.baseUrl,
|
|
5
|
-
*
|
|
5
|
+
* custom provider base URLs. Without a guard a malicious config could make xopc
|
|
6
6
|
* fetch internal services (169.254.x.x metadata, 127.0.0.1, RFC1918, …).
|
|
7
7
|
*
|
|
8
8
|
* Policy:
|
|
@@ -4,7 +4,7 @@ import { isIP } from "node:net";
|
|
|
4
4
|
* SSRF / private-network protection for provider HTTP calls.
|
|
5
5
|
*
|
|
6
6
|
* Provider URLs are mostly user-controllable (cfg.providers.<id>.baseUrl,
|
|
7
|
-
*
|
|
7
|
+
* custom provider base URLs. Without a guard a malicious config could make xopc
|
|
8
8
|
* fetch internal services (169.254.x.x metadata, 127.0.0.1, RFC1918, …).
|
|
9
9
|
*
|
|
10
10
|
* Policy:
|
|
@@ -13,6 +13,8 @@ export declare function createProactiveInsight(input: {
|
|
|
13
13
|
whyItMatters: string;
|
|
14
14
|
nextAction: string;
|
|
15
15
|
evidence: ProactiveEvidence[];
|
|
16
|
+
valueScore: number;
|
|
17
|
+
valueReasons: string[];
|
|
16
18
|
nowMs?: number;
|
|
17
19
|
}): ProactiveInsight | null;
|
|
18
20
|
export declare function setProactiveInsightStatus(id: string, status: ProactiveInsightStatus, nowMs?: number, expectedStatus?: ProactiveInsightStatus): ProactiveInsight | null;
|
|
@@ -14,6 +14,8 @@ function insightFromRow(row) {
|
|
|
14
14
|
nextAction: row.next_action,
|
|
15
15
|
evidence: JSON.parse(row.evidence_json),
|
|
16
16
|
status: row.status,
|
|
17
|
+
valueScore: row.value_score,
|
|
18
|
+
valueReasons: JSON.parse(row.value_reasons_json),
|
|
17
19
|
createdAt: row.created_at,
|
|
18
20
|
updatedAt: row.updated_at
|
|
19
21
|
};
|
|
@@ -58,8 +60,9 @@ function createProactiveInsight(input) {
|
|
|
58
60
|
runSqliteWriteTransaction((db) => {
|
|
59
61
|
created = db.prepare(`INSERT OR IGNORE INTO proactive_insights (
|
|
60
62
|
insight_id, watch_id, run_id, kind, title, summary, why_it_matters,
|
|
61
|
-
next_action, evidence_json, content_hash, status,
|
|
62
|
-
|
|
63
|
+
next_action, evidence_json, content_hash, status, value_score,
|
|
64
|
+
value_reasons_json, created_at, updated_at
|
|
65
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unread', ?, ?, ?, ?)`).run(id, input.watchId, input.runId, input.kind, input.title, input.summary, input.whyItMatters, input.nextAction, JSON.stringify(input.evidence), contentHash, input.valueScore, JSON.stringify(input.valueReasons), now, now).changes > 0;
|
|
63
66
|
});
|
|
64
67
|
return created ? listProactiveInsights({ limit: 100 }).find((item) => item.id === id) ?? null : null;
|
|
65
68
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getRelationshipSettings, isProactiveSupportAllowed } from "../storage/sqlite/relationship-settings-repository.js";
|
|
4
|
+
import "../storage/sqlite/index.js";
|
|
3
5
|
import { getFocusWatchByAutomationId, recordFocusWatchRun } from "./watch-repository.js";
|
|
4
|
-
import { createProactiveInsight } from "./insight-repository.js";
|
|
6
|
+
import { createProactiveInsight, listProactiveInsights } from "./insight-repository.js";
|
|
7
|
+
import { scoreProactiveValue } from "./value-score.js";
|
|
5
8
|
//#region src/proactive/run-processor.ts
|
|
6
9
|
init_logger();
|
|
7
10
|
const log = createLogger("ProactiveRunProcessor");
|
|
@@ -105,6 +108,22 @@ function processFocusAutomationRun(run) {
|
|
|
105
108
|
nowMs: run.endedAtMs
|
|
106
109
|
})) return { handled: true };
|
|
107
110
|
if (!result.meaningful) return { handled: true };
|
|
111
|
+
if (!isProactiveSupportAllowed(getRelationshipSettings(), {
|
|
112
|
+
now: new Date(run.endedAtMs),
|
|
113
|
+
topic: watch.kind
|
|
114
|
+
})) return { handled: true };
|
|
115
|
+
const history = listProactiveInsights({
|
|
116
|
+
status: ["approved", "dismissed"],
|
|
117
|
+
limit: 50
|
|
118
|
+
});
|
|
119
|
+
const value = scoreProactiveValue({
|
|
120
|
+
kind: watch.kind,
|
|
121
|
+
evidenceCount: result.evidence.length,
|
|
122
|
+
hasNextAction: Boolean(result.nextAction),
|
|
123
|
+
approvedCount: history.filter((item) => item.status === "approved").length,
|
|
124
|
+
dismissedCount: history.filter((item) => item.status === "dismissed").length
|
|
125
|
+
});
|
|
126
|
+
if (!value.shouldDeliver) return { handled: true };
|
|
108
127
|
const insight = createProactiveInsight({
|
|
109
128
|
watchId: watch.id,
|
|
110
129
|
runId: run.id,
|
|
@@ -114,6 +133,8 @@ function processFocusAutomationRun(run) {
|
|
|
114
133
|
whyItMatters: result.whyItMatters,
|
|
115
134
|
nextAction: result.nextAction,
|
|
116
135
|
evidence: result.evidence,
|
|
136
|
+
valueScore: value.score,
|
|
137
|
+
valueReasons: value.reasons,
|
|
117
138
|
nowMs: run.endedAtMs
|
|
118
139
|
});
|
|
119
140
|
return insight ? {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FocusWatchKind } from './types.js';
|
|
2
|
+
export interface ProactiveValueScore {
|
|
3
|
+
score: number;
|
|
4
|
+
reasons: string[];
|
|
5
|
+
shouldDeliver: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function scoreProactiveValue(input: {
|
|
8
|
+
kind: FocusWatchKind;
|
|
9
|
+
evidenceCount: number;
|
|
10
|
+
hasNextAction: boolean;
|
|
11
|
+
approvedCount: number;
|
|
12
|
+
dismissedCount: number;
|
|
13
|
+
}): ProactiveValueScore;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/proactive/value-score.ts
|
|
2
|
+
function scoreProactiveValue(input) {
|
|
3
|
+
const reasons = [];
|
|
4
|
+
let score = .15;
|
|
5
|
+
if (input.evidenceCount > 0) {
|
|
6
|
+
score += Math.min(.25, input.evidenceCount * .1);
|
|
7
|
+
reasons.push("evidence_backed");
|
|
8
|
+
}
|
|
9
|
+
if (input.hasNextAction) {
|
|
10
|
+
score += .25;
|
|
11
|
+
reasons.push("actionable");
|
|
12
|
+
}
|
|
13
|
+
const urgency = input.kind === "deadline" ? .25 : input.kind === "staleness" ? .2 : .15;
|
|
14
|
+
score += urgency;
|
|
15
|
+
reasons.push(input.kind === "deadline" ? "time_sensitive" : "focus_relevant");
|
|
16
|
+
const rated = input.approvedCount + input.dismissedCount;
|
|
17
|
+
if (rated > 0) {
|
|
18
|
+
const approvalRate = input.approvedCount / rated;
|
|
19
|
+
score += (approvalRate - .5) * .4;
|
|
20
|
+
reasons.push(approvalRate >= .5 ? "historically_useful" : "historically_dismissed");
|
|
21
|
+
}
|
|
22
|
+
score = Math.max(0, Math.min(1, score));
|
|
23
|
+
return {
|
|
24
|
+
score,
|
|
25
|
+
reasons,
|
|
26
|
+
shouldDeliver: score >= .65
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { scoreProactiveValue };
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Resolution order:
|
|
6
6
|
* 1. AuthProfileStore (per-agent / per-profile; noop in Step 1)
|
|
7
|
-
* 2.
|
|
8
|
-
* 3. PROVIDER_ENV_MAP[providerId] env vars (or `<PROVIDER>_API_KEY` fallback)
|
|
7
|
+
* 2. PROVIDER_ENV_MAP[providerId] env vars (or `<PROVIDER>_API_KEY` fallback)
|
|
9
8
|
*
|
|
10
9
|
* Distinct from `src/providers/index.ts#getApiKeySync` which is keyed to the
|
|
11
10
|
* LLM model registry. Capability providers care only about per-vendor API
|
|
@@ -21,7 +20,6 @@ import type { ResolveApiKeyOptions } from './types.js';
|
|
|
21
20
|
*
|
|
22
21
|
* Resolution order (matches spec §8.4):
|
|
23
22
|
* 1. AuthProfileStore (per-agent profile — may be OAuth)
|
|
24
|
-
* 2.
|
|
25
|
-
* 3. PROVIDER_ENV_MAP[providerId] env vars
|
|
23
|
+
* 2. PROVIDER_ENV_MAP[providerId] env vars
|
|
26
24
|
*/
|
|
27
25
|
export declare function resolveApiKeyForProvider(options: ResolveApiKeyOptions): string | undefined;
|
|
@@ -6,8 +6,7 @@ import { resolveAuthProfileForProvider } from "./resolve-auth.js";
|
|
|
6
6
|
*
|
|
7
7
|
* Resolution order:
|
|
8
8
|
* 1. AuthProfileStore (per-agent / per-profile; noop in Step 1)
|
|
9
|
-
* 2.
|
|
10
|
-
* 3. PROVIDER_ENV_MAP[providerId] env vars (or `<PROVIDER>_API_KEY` fallback)
|
|
9
|
+
* 2. PROVIDER_ENV_MAP[providerId] env vars (or `<PROVIDER>_API_KEY` fallback)
|
|
11
10
|
*
|
|
12
11
|
* Distinct from `src/providers/index.ts#getApiKeySync` which is keyed to the
|
|
13
12
|
* LLM model registry. Capability providers care only about per-vendor API
|
|
@@ -22,8 +21,7 @@ import { resolveAuthProfileForProvider } from "./resolve-auth.js";
|
|
|
22
21
|
*
|
|
23
22
|
* Resolution order (matches spec §8.4):
|
|
24
23
|
* 1. AuthProfileStore (per-agent profile — may be OAuth)
|
|
25
|
-
* 2.
|
|
26
|
-
* 3. PROVIDER_ENV_MAP[providerId] env vars
|
|
24
|
+
* 2. PROVIDER_ENV_MAP[providerId] env vars
|
|
27
25
|
*/
|
|
28
26
|
function resolveApiKeyForProvider(options) {
|
|
29
27
|
return resolveAuthProfileForProvider(options).apiKey;
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Resolution order matches `resolveApiKeyForProvider`:
|
|
8
8
|
* 1. AuthProfileStore (per-agent profile — may be OAuth)
|
|
9
|
-
* 2.
|
|
10
|
-
* 3. PROVIDER_ENV_MAP[providerId] env vars
|
|
9
|
+
* 2. Environment variables
|
|
11
10
|
*
|
|
12
11
|
* Returns:
|
|
13
12
|
* - `mode: 'oauth' | 'azure-key' | 'api-key'`
|
|
@@ -19,8 +18,8 @@ export interface ProviderAuthResolution {
|
|
|
19
18
|
apiKey?: string;
|
|
20
19
|
mode: ProviderAuthMode;
|
|
21
20
|
profileId?: string;
|
|
22
|
-
/** Source bucket
|
|
23
|
-
source: 'store' | '
|
|
21
|
+
/** Source bucket. */
|
|
22
|
+
source: 'store' | 'env' | 'none';
|
|
24
23
|
/** Vendor metadata copied from the matched profile (azure resource etc.). */
|
|
25
24
|
meta?: Record<string, unknown>;
|
|
26
25
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
1
2
|
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
2
3
|
import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
|
|
3
4
|
//#region src/providers/auth-runtime/resolve-auth.ts
|
|
4
5
|
init_env_keys();
|
|
6
|
+
init_sync_provider_auth();
|
|
5
7
|
function resolveAuthProfileForProvider(options) {
|
|
6
8
|
const { providerId } = options;
|
|
7
9
|
if (!providerId) return {
|
|
@@ -20,22 +22,28 @@ function resolveAuthProfileForProvider(options) {
|
|
|
20
22
|
meta: profile.meta
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
if (!options.store && !options.envReader) {
|
|
26
|
+
const storedKey = resolveProviderApiKeyForAgentSync(providerId, options.agentId, options.cfg);
|
|
27
|
+
if (storedKey) {
|
|
28
|
+
const azure = readCfgAzureMeta(options.cfg, providerId);
|
|
29
|
+
return {
|
|
30
|
+
apiKey: storedKey,
|
|
31
|
+
mode: azure ? "azure-key" : "api-key",
|
|
32
|
+
source: "store",
|
|
33
|
+
meta: azure
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const envKey = options.envReader ? readFromCustomEnv(options.envReader, providerId) : getApiKeyFromEnv(providerId);
|
|
38
|
+
if (envKey) {
|
|
25
39
|
const azure = readCfgAzureMeta(options.cfg, providerId);
|
|
26
40
|
return {
|
|
27
|
-
apiKey:
|
|
41
|
+
apiKey: envKey,
|
|
28
42
|
mode: azure ? "azure-key" : "api-key",
|
|
29
|
-
source: "
|
|
43
|
+
source: "env",
|
|
30
44
|
meta: azure
|
|
31
45
|
};
|
|
32
46
|
}
|
|
33
|
-
const envKey = options.envReader ? readFromCustomEnv(options.envReader, providerId) : getApiKeyFromEnv(providerId);
|
|
34
|
-
if (envKey) return {
|
|
35
|
-
apiKey: envKey,
|
|
36
|
-
mode: "api-key",
|
|
37
|
-
source: "env"
|
|
38
|
-
};
|
|
39
47
|
return {
|
|
40
48
|
apiKey: void 0,
|
|
41
49
|
mode: "api-key",
|
|
@@ -49,14 +57,6 @@ function pickProfile(store, providerId, profileName) {
|
|
|
49
57
|
return;
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
|
-
function readCfgApiKey(cfg, providerId) {
|
|
53
|
-
const providers = cfg?.providers;
|
|
54
|
-
if (!providers || typeof providers !== "object") return void 0;
|
|
55
|
-
const entry = providers[providerId];
|
|
56
|
-
if (!entry || typeof entry !== "object") return void 0;
|
|
57
|
-
const apiKey = entry.apiKey;
|
|
58
|
-
return typeof apiKey === "string" && apiKey.length > 0 ? apiKey : void 0;
|
|
59
|
-
}
|
|
60
60
|
function readCfgAzureMeta(cfg, providerId) {
|
|
61
61
|
const providers = cfg?.providers;
|
|
62
62
|
if (!providers || typeof providers !== "object") return void 0;
|
|
@@ -30,8 +30,30 @@ export interface DomesticProviderPreset {
|
|
|
30
30
|
models: DomesticProviderModelPreset[];
|
|
31
31
|
aliases: string[];
|
|
32
32
|
quirks?: string[];
|
|
33
|
+
onboardingIcon?: string;
|
|
34
|
+
requiresModelDiscovery?: boolean;
|
|
33
35
|
}
|
|
34
36
|
export declare const DOMESTIC_PROVIDER_PRESETS: readonly [{
|
|
37
|
+
readonly id: "xopc-cloud";
|
|
38
|
+
readonly displayName: "XOPC Model Service";
|
|
39
|
+
readonly description: "Official XOPC OpenAI-compatible model service. Available models are loaded from your account.";
|
|
40
|
+
readonly docsUrl: "https://console.xopc.ai/models";
|
|
41
|
+
readonly apiKeyUrl: "https://console.xopc.ai/models";
|
|
42
|
+
readonly envVars: ["XOPC_MODEL_API_KEY"];
|
|
43
|
+
readonly api: "openai-completions";
|
|
44
|
+
readonly baseUrlPresets: [{
|
|
45
|
+
readonly id: "official";
|
|
46
|
+
readonly label: "XOPC Official";
|
|
47
|
+
readonly baseUrl: "https://router.xopc.ai/v1";
|
|
48
|
+
}];
|
|
49
|
+
readonly defaultBaseUrlPreset: "official";
|
|
50
|
+
readonly defaultModel: "";
|
|
51
|
+
readonly models: [];
|
|
52
|
+
readonly aliases: ["xopc", "xopc cloud", "xopc models"];
|
|
53
|
+
readonly onboardingIcon: "☁️";
|
|
54
|
+
readonly requiresModelDiscovery: true;
|
|
55
|
+
readonly quirks: ["Connect through XOPC Console; credentials and available models are configured automatically."];
|
|
56
|
+
}, {
|
|
35
57
|
readonly id: "dashscope-cn";
|
|
36
58
|
readonly displayName: "Alibaba Bailian / DashScope China";
|
|
37
59
|
readonly description: "Alibaba Bailian Qwen models through the China DashScope OpenAI-compatible endpoint.";
|
|
@@ -87,6 +87,31 @@ const MINIMAX_MODELS = [
|
|
|
87
87
|
}
|
|
88
88
|
];
|
|
89
89
|
const DOMESTIC_PROVIDER_PRESETS = [
|
|
90
|
+
{
|
|
91
|
+
id: "xopc-cloud",
|
|
92
|
+
displayName: "XOPC Model Service",
|
|
93
|
+
description: "Official XOPC OpenAI-compatible model service. Available models are loaded from your account.",
|
|
94
|
+
docsUrl: "https://console.xopc.ai/models",
|
|
95
|
+
apiKeyUrl: "https://console.xopc.ai/models",
|
|
96
|
+
envVars: ["XOPC_MODEL_API_KEY"],
|
|
97
|
+
api: "openai-completions",
|
|
98
|
+
baseUrlPresets: [{
|
|
99
|
+
id: "official",
|
|
100
|
+
label: "XOPC Official",
|
|
101
|
+
baseUrl: "https://router.xopc.ai/v1"
|
|
102
|
+
}],
|
|
103
|
+
defaultBaseUrlPreset: "official",
|
|
104
|
+
defaultModel: "",
|
|
105
|
+
models: [],
|
|
106
|
+
aliases: [
|
|
107
|
+
"xopc",
|
|
108
|
+
"xopc cloud",
|
|
109
|
+
"xopc models"
|
|
110
|
+
],
|
|
111
|
+
onboardingIcon: "☁️",
|
|
112
|
+
requiresModelDiscovery: true,
|
|
113
|
+
quirks: ["Connect through XOPC Console; credentials and available models are configured automatically."]
|
|
114
|
+
},
|
|
90
115
|
{
|
|
91
116
|
id: "dashscope-cn",
|
|
92
117
|
displayName: "Alibaba Bailian / DashScope China",
|