@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
|
@@ -43,6 +43,14 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
43
43
|
return { register: registerBrowserInstallRoutes };
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
id: "browser-workflows",
|
|
48
|
+
match: (path) => startsWithAny(path, ["/api/browser/workflows", "/api/browser/workflow-runs"]),
|
|
49
|
+
load: async () => {
|
|
50
|
+
const { registerBrowserWorkflowRoutes } = await import("./browser-workflows.js");
|
|
51
|
+
return { register: registerBrowserWorkflowRoutes };
|
|
52
|
+
}
|
|
53
|
+
},
|
|
46
54
|
{
|
|
47
55
|
id: "browser",
|
|
48
56
|
match: (path) => startsWithAny(path, ["/api/browser"]),
|
|
@@ -84,6 +92,14 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
84
92
|
return { register: registerDreamingRoutes };
|
|
85
93
|
}
|
|
86
94
|
},
|
|
95
|
+
{
|
|
96
|
+
id: "image-generation",
|
|
97
|
+
match: (path) => startsWithAny(path, ["/api/image-generation"]) || /^\/api\/agents\/[^/]+\/image-generation(?:\/setup)?$/.test(path),
|
|
98
|
+
load: async () => {
|
|
99
|
+
const { registerModelsRoutes } = await import("./models.js");
|
|
100
|
+
return { register: registerModelsRoutes };
|
|
101
|
+
}
|
|
102
|
+
},
|
|
87
103
|
{
|
|
88
104
|
id: "agents",
|
|
89
105
|
match: (path) => startsWithAny(path, [
|
|
@@ -127,8 +143,7 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
127
143
|
match: (path) => startsWithAny(path, [
|
|
128
144
|
"/api/models",
|
|
129
145
|
"/api/models-json",
|
|
130
|
-
"/api/providers"
|
|
131
|
-
"/api/image"
|
|
146
|
+
"/api/providers"
|
|
132
147
|
]),
|
|
133
148
|
load: async () => {
|
|
134
149
|
const { registerModelsRoutes } = await import("./models.js");
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { setInteractionState } from "../../../storage/sqlite/interaction-state-repository.js";
|
|
1
2
|
import { LOCAL_USER_ID } from "../../../user-context/owner.js";
|
|
3
|
+
import { findTaskOutcomeForAssistant, setTaskOutcomeFeedback } from "../../../storage/sqlite/task-outcome-repository.js";
|
|
2
4
|
import { appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryRecord, listMemoryRecords, listMemorySignals, listMemoryTraceEvents, searchMemoryRecords, setLatestMemoryInjectFeedback, setMemoryTraceFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
|
|
3
5
|
import { listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
|
|
4
6
|
import "../../../storage/sqlite/index.js";
|
|
@@ -10,6 +12,7 @@ import { discoverMemoryPlugins } from "../../../agent/memory/plugin-discovery.js
|
|
|
10
12
|
import { createMemoryManagerFromConfig } from "../../../agent/memory/create-memory-manager.js";
|
|
11
13
|
import { resolveAdaptiveUnderstandingCadence } from "../../../agent/memory/understanding/quality.js";
|
|
12
14
|
import { isUserContextRecord, projectUserContextRecord } from "../../../user-context/projection.js";
|
|
15
|
+
import { summarizeMemoryUseAudit } from "../../../user-context/memory-use-audit.js";
|
|
13
16
|
//#region src/gateway/hono/routes/memory.ts
|
|
14
17
|
init_agent_scope();
|
|
15
18
|
init_config();
|
|
@@ -310,6 +313,13 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
310
313
|
});
|
|
311
314
|
return c.json({ traces });
|
|
312
315
|
});
|
|
316
|
+
authenticated.get("/api/user-context/memory-use-audit", (c) => {
|
|
317
|
+
const traces = listMemoryTraceEvents({
|
|
318
|
+
sessionKey: c.req.query("sessionKey") || void 0,
|
|
319
|
+
limit: parseLimit(c.req.query("limit"))
|
|
320
|
+
});
|
|
321
|
+
return c.json({ audit: summarizeMemoryUseAudit(traces) });
|
|
322
|
+
});
|
|
313
323
|
authenticated.patch("/api/user-context/traces/:traceId/feedback", async (c) => {
|
|
314
324
|
const body = await c.req.json().catch(() => ({}));
|
|
315
325
|
const outcome = typeof body.outcome === "string" && MEMORY_TRACE_FEEDBACK_OUTCOMES.has(body.outcome) ? body.outcome : void 0;
|
|
@@ -353,6 +363,24 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
353
363
|
const outcome = body.outcome === "helpful" || body.outcome === "not_helpful" ? body.outcome : void 0;
|
|
354
364
|
const reason = typeof body.reason === "string" ? body.reason.trim().slice(0, 160) : "";
|
|
355
365
|
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0 || !outcome) return c.json({ error: "sessionKey, assistantTimestamp, and a valid outcome are required" }, 400);
|
|
366
|
+
const taskOutcome = setTaskOutcomeFeedback({
|
|
367
|
+
sessionKey,
|
|
368
|
+
assistantTimestamp,
|
|
369
|
+
outcome,
|
|
370
|
+
reason: reason || void 0,
|
|
371
|
+
needsCorrection: outcome === "not_helpful",
|
|
372
|
+
...outcome === "helpful" ? { supportFit: true } : reason.includes("tone_mismatch") ? { supportFit: false } : {}
|
|
373
|
+
});
|
|
374
|
+
if (outcome === "not_helpful" && reason.includes("tone_mismatch")) setInteractionState({
|
|
375
|
+
sessionKey,
|
|
376
|
+
signal: {
|
|
377
|
+
supportNeed: "unknown",
|
|
378
|
+
confidence: 1,
|
|
379
|
+
source: "explicit",
|
|
380
|
+
repairStatus: "needed",
|
|
381
|
+
repairReason: reason
|
|
382
|
+
}
|
|
383
|
+
});
|
|
356
384
|
const trace = setLatestMemoryInjectFeedback({
|
|
357
385
|
sessionKey,
|
|
358
386
|
beforeMs: assistantTimestamp,
|
|
@@ -363,10 +391,10 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
363
391
|
}
|
|
364
392
|
});
|
|
365
393
|
return c.json({
|
|
366
|
-
matched: Boolean(
|
|
394
|
+
matched: Boolean(taskOutcome),
|
|
367
395
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
368
396
|
personalContext: personalContextForTrace(trace),
|
|
369
|
-
feedback:
|
|
397
|
+
feedback: taskOutcome?.feedback ?? null,
|
|
370
398
|
remediation: trace?.remediation ?? null
|
|
371
399
|
});
|
|
372
400
|
});
|
|
@@ -374,15 +402,16 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
374
402
|
const sessionKey = c.req.query("sessionKey")?.trim() ?? "";
|
|
375
403
|
const assistantTimestamp = Number(c.req.query("assistantTimestamp"));
|
|
376
404
|
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0) return c.json({ error: "sessionKey and assistantTimestamp are required" }, 400);
|
|
405
|
+
const taskOutcome = findTaskOutcomeForAssistant(sessionKey, assistantTimestamp);
|
|
377
406
|
const trace = findLatestMemoryInjectTrace({
|
|
378
407
|
sessionKey,
|
|
379
408
|
beforeMs: assistantTimestamp
|
|
380
409
|
});
|
|
381
410
|
return c.json({
|
|
382
|
-
matched: Boolean(
|
|
411
|
+
matched: Boolean(taskOutcome),
|
|
383
412
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
384
413
|
personalContext: personalContextForTrace(trace),
|
|
385
|
-
feedback:
|
|
414
|
+
feedback: taskOutcome?.feedback ?? null
|
|
386
415
|
});
|
|
387
416
|
});
|
|
388
417
|
authenticated.post("/api/user-context/signals", async (c) => {
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { init_schema, parseModelRef } from "../../../config/schema.js";
|
|
2
1
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
3
2
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
4
3
|
import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
4
|
+
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
5
5
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
6
6
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
7
7
|
import "../../../providers/constants.js";
|
|
8
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
9
|
-
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured
|
|
10
|
-
import {
|
|
11
|
-
import { listImageGenerationProvidersSummary } from "../../../agent/image/generation/runtime.js";
|
|
9
|
+
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
10
|
+
import { SessionConfigStore } from "../../../session/config-store.js";
|
|
12
11
|
import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "../../../providers/domestic-presets.js";
|
|
13
12
|
import { getOnboardingFeaturedProviders, getProviderHint, getRecommendedModelsForProvider, isRecommendedModel, sortModelsForPicker, sortProvidersForPicker } from "../../../providers/presentation.js";
|
|
14
|
-
import {
|
|
15
|
-
import { respondStartupUnavailable } from "../lib/startup-unavailable.js";
|
|
13
|
+
import { getAgentImageGenerationConfig, getImageGenerationCatalog, prepareImageGenerationSetup, verifyImageGenerationCredential } from "../../image-generation-setup.js";
|
|
16
14
|
import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
|
|
15
|
+
import { XopcCloudHttpError } from "../../../providers/xopc-cloud-connection.js";
|
|
16
|
+
import { respondStartupUnavailable } from "../lib/startup-unavailable.js";
|
|
17
|
+
import { auditModelReferences } from "../../../providers/model-reference-auditor.js";
|
|
17
18
|
//#region src/gateway/hono/routes/models.ts
|
|
18
19
|
init_models_json();
|
|
19
|
-
init_schema();
|
|
20
20
|
init_resolve_config_value();
|
|
21
21
|
init_providers();
|
|
22
22
|
init_credentials();
|
|
23
|
+
init_model_catalog_store();
|
|
23
24
|
init_plugin_registry();
|
|
24
25
|
function readModelsJsonProviderApiKey(providerId) {
|
|
25
26
|
const { config } = loadModelsJson(resolveModelsJsonPath());
|
|
@@ -31,14 +32,6 @@ function readStringRecord(value) {
|
|
|
31
32
|
const entries = Object.entries(value).filter((entry) => typeof entry[1] === "string");
|
|
32
33
|
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
33
34
|
}
|
|
34
|
-
/** Plaintext key only when persisted under `cfg.providers.<id>.apiKey` (not env / credential store). */
|
|
35
|
-
function readProviderApiKeyFromConfigFileOnly(cfg, providerId) {
|
|
36
|
-
const id = providerId.trim().toLowerCase();
|
|
37
|
-
const bucket = cfg.providers?.[id];
|
|
38
|
-
if (!bucket || typeof bucket !== "object" || Array.isArray(bucket)) return void 0;
|
|
39
|
-
const k = bucket.apiKey;
|
|
40
|
-
return typeof k === "string" && k.trim() ? k.trim() : void 0;
|
|
41
|
-
}
|
|
42
35
|
/** Extension id from manifest `providers[]` (e.g. provider `demo` → extension `demo-provider`). */
|
|
43
36
|
function resolveExtensionIdForProvider(service, providerId) {
|
|
44
37
|
const loader = service.getExtensionLoader();
|
|
@@ -70,7 +63,85 @@ function mapPluginModel(providerId, model, available) {
|
|
|
70
63
|
};
|
|
71
64
|
}
|
|
72
65
|
function registerModelsRoutes(authenticated, deps) {
|
|
73
|
-
const { service, strictRateLimitMiddleware } = deps;
|
|
66
|
+
const { service, strictRateLimitMiddleware, xopcCloudPollRateLimitMiddleware } = deps;
|
|
67
|
+
const catalogSync = service.getModelCatalogSync();
|
|
68
|
+
const xopcCloud = catalogSync.getXopcCloudConnection();
|
|
69
|
+
authenticated.post("/api/models/xopc-cloud/connect", strictRateLimitMiddleware, async (c) => {
|
|
70
|
+
const body = await c.req.json().catch(() => ({}));
|
|
71
|
+
const clientType = body.clientType === "electron" || body.clientType === "cli" ? body.clientType : "web";
|
|
72
|
+
try {
|
|
73
|
+
return c.json({
|
|
74
|
+
ok: true,
|
|
75
|
+
payload: await xopcCloud.start(clientType)
|
|
76
|
+
}, 201);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return c.json({
|
|
79
|
+
ok: false,
|
|
80
|
+
error: { message: error instanceof Error ? error.message : "Connection failed" }
|
|
81
|
+
}, 502);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
authenticated.post("/api/models/xopc-cloud/connect/:requestId/poll", xopcCloudPollRateLimitMiddleware, async (c) => {
|
|
85
|
+
try {
|
|
86
|
+
const result = await xopcCloud.poll(c.req.param("requestId"));
|
|
87
|
+
if (result.status === "pending") return c.json({
|
|
88
|
+
ok: true,
|
|
89
|
+
payload: result
|
|
90
|
+
}, 202);
|
|
91
|
+
service.emit("model-catalog.updated", { modelCount: getModelRegistry().getAll().length });
|
|
92
|
+
return c.json({
|
|
93
|
+
ok: true,
|
|
94
|
+
payload: result
|
|
95
|
+
});
|
|
96
|
+
} catch (error) {
|
|
97
|
+
return c.json({
|
|
98
|
+
ok: false,
|
|
99
|
+
error: { message: error instanceof Error ? error.message : "Connection failed" }
|
|
100
|
+
}, 400);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
authenticated.post("/api/models/xopc-cloud/refresh", strictRateLimitMiddleware, async (c) => {
|
|
104
|
+
try {
|
|
105
|
+
const result = await catalogSync.refreshNow();
|
|
106
|
+
return c.json({
|
|
107
|
+
ok: true,
|
|
108
|
+
payload: result
|
|
109
|
+
});
|
|
110
|
+
} catch (error) {
|
|
111
|
+
const status = error instanceof XopcCloudHttpError && error.status === 401 ? 401 : error instanceof XopcCloudHttpError && error.status === 403 ? 403 : 502;
|
|
112
|
+
return c.json({
|
|
113
|
+
ok: false,
|
|
114
|
+
error: {
|
|
115
|
+
message: error instanceof Error ? error.message : "Refresh failed",
|
|
116
|
+
...error instanceof XopcCloudHttpError && error.code ? { code: error.code } : {}
|
|
117
|
+
}
|
|
118
|
+
}, status);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
authenticated.get("/api/models/catalog/status", (c) => c.json({
|
|
122
|
+
ok: true,
|
|
123
|
+
payload: catalogSync.getStatus()
|
|
124
|
+
}));
|
|
125
|
+
authenticated.get("/api/models/catalog", async (c) => {
|
|
126
|
+
const catalog = getModelCatalogStore().load();
|
|
127
|
+
const sessionConfigs = await new SessionConfigStore("").getAll();
|
|
128
|
+
const references = auditModelReferences(service.currentConfig, sessionConfigs, { catalog });
|
|
129
|
+
return c.json({
|
|
130
|
+
ok: true,
|
|
131
|
+
payload: {
|
|
132
|
+
sources: catalog.sources,
|
|
133
|
+
sync: catalogSync.getStatus(),
|
|
134
|
+
references
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
authenticated.post("/api/models/catalog/refresh", strictRateLimitMiddleware, async (c) => {
|
|
139
|
+
const result = await catalogSync.refreshAll();
|
|
140
|
+
return c.json({
|
|
141
|
+
ok: true,
|
|
142
|
+
payload: result
|
|
143
|
+
});
|
|
144
|
+
});
|
|
74
145
|
authenticated.get("/api/models-json", async (c) => {
|
|
75
146
|
const path = resolveModelsJsonPath();
|
|
76
147
|
const { config, error } = loadModelsJson(path);
|
|
@@ -216,142 +287,93 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
216
287
|
payload: { models }
|
|
217
288
|
});
|
|
218
289
|
});
|
|
219
|
-
authenticated.get("/api/image/
|
|
220
|
-
const config = service.currentConfig;
|
|
221
|
-
const agentId = c.req.query("agentId")?.trim() || void 0;
|
|
222
|
-
const imageGenerationProviders = await resolveImageGenerationCapabilities(config);
|
|
223
|
-
const imageUnderstandingProviders = await resolveImageUnderstandingCapabilities(config);
|
|
290
|
+
authenticated.get("/api/image-generation/catalog", (c) => {
|
|
224
291
|
return c.json({
|
|
225
292
|
ok: true,
|
|
226
|
-
payload: {
|
|
227
|
-
current: resolveCurrentImageModelCapabilities(config, agentId),
|
|
228
|
-
imageGeneration: { providers: imageGenerationProviders },
|
|
229
|
-
imageUnderstanding: { providers: imageUnderstandingProviders }
|
|
230
|
-
}
|
|
293
|
+
payload: { providers: getImageGenerationCatalog(service.currentConfig) }
|
|
231
294
|
});
|
|
232
295
|
});
|
|
233
|
-
authenticated.
|
|
234
|
-
let body;
|
|
296
|
+
authenticated.get("/api/agents/:agentId/image-generation", (c) => {
|
|
235
297
|
try {
|
|
236
|
-
|
|
237
|
-
|
|
298
|
+
return c.json({
|
|
299
|
+
ok: true,
|
|
300
|
+
payload: getAgentImageGenerationConfig(service.currentConfig, c.req.param("agentId"))
|
|
301
|
+
});
|
|
302
|
+
} catch (error) {
|
|
238
303
|
return c.json({
|
|
239
304
|
ok: false,
|
|
240
|
-
error:
|
|
241
|
-
},
|
|
305
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
306
|
+
}, 404);
|
|
242
307
|
}
|
|
243
|
-
|
|
244
|
-
|
|
308
|
+
});
|
|
309
|
+
authenticated.post("/api/agents/:agentId/image-generation/setup", strictRateLimitMiddleware, async (c) => {
|
|
310
|
+
const body = await c.req.json().catch(() => null);
|
|
311
|
+
if (!body || typeof body.providerId !== "string") return c.json({
|
|
245
312
|
ok: false,
|
|
246
|
-
error: "
|
|
313
|
+
error: { message: "providerId is required" }
|
|
247
314
|
}, 400);
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
reason: "invalid_format",
|
|
254
|
-
message: "Model reference must be in \"provider/model\" format"
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
if (!await isProviderConfigured(parsed.provider)) return c.json({
|
|
258
|
-
ok: true,
|
|
259
|
-
payload: {
|
|
260
|
-
valid: false,
|
|
261
|
-
reason: "provider_not_configured",
|
|
262
|
-
message: `Provider "${parsed.provider}" is not configured. Set the API key first.`,
|
|
263
|
-
provider: parsed.provider
|
|
264
|
-
}
|
|
315
|
+
const prepared = prepareImageGenerationSetup(service.currentConfig, c.req.param("agentId"), {
|
|
316
|
+
providerId: body.providerId,
|
|
317
|
+
...typeof body.modelId === "string" ? { modelId: body.modelId } : {},
|
|
318
|
+
...body.region === "cn" || body.region === "intl" ? { region: body.region } : {},
|
|
319
|
+
...typeof body.baseUrl === "string" ? { baseUrl: body.baseUrl } : {}
|
|
265
320
|
});
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
321
|
+
if (prepared.ok === false) return c.json({
|
|
322
|
+
ok: false,
|
|
323
|
+
error: { message: prepared.error }
|
|
324
|
+
}, 400);
|
|
325
|
+
const resolver = new CredentialResolver();
|
|
326
|
+
const previousKey = await resolver.revealGatewayStoredApiKey(prepared.providerId);
|
|
327
|
+
const suppliedKey = typeof body.apiKey === "string" ? body.apiKey.trim() : "";
|
|
328
|
+
if (!(suppliedKey || await resolver.resolveApiKey(prepared.providerId))) return c.json({
|
|
329
|
+
ok: false,
|
|
330
|
+
error: { message: "API key is required" }
|
|
331
|
+
}, 400);
|
|
332
|
+
const verification = suppliedKey ? await verifyImageGenerationCredential({
|
|
333
|
+
providerId: prepared.providerId,
|
|
334
|
+
apiKey: suppliedKey,
|
|
335
|
+
baseUrl: typeof body.baseUrl === "string" ? body.baseUrl : void 0
|
|
336
|
+
}) : {
|
|
337
|
+
verified: false,
|
|
338
|
+
supported: false
|
|
339
|
+
};
|
|
340
|
+
if (verification.supported && !verification.verified) return c.json({
|
|
341
|
+
ok: false,
|
|
342
|
+
error: { message: verification.message ?? "Credential verification failed" }
|
|
343
|
+
}, 400);
|
|
344
|
+
if (suppliedKey) await resolver.saveApiKey(prepared.providerId, suppliedKey, { profileName: "default" });
|
|
345
|
+
const saved = await service.saveConfig(prepared.config);
|
|
346
|
+
if (!saved.saved) {
|
|
347
|
+
if (suppliedKey) if (previousKey) await resolver.saveApiKey(prepared.providerId, previousKey, { profileName: "default" });
|
|
348
|
+
else await resolver.deleteProfile(`${prepared.providerId}:default`);
|
|
269
349
|
return c.json({
|
|
270
|
-
ok:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
reason: "model_not_found",
|
|
274
|
-
message: `Model not found in registry: ${modelRef}`,
|
|
275
|
-
provider: parsed.provider,
|
|
276
|
-
model: parsed.model
|
|
277
|
-
}
|
|
278
|
-
});
|
|
350
|
+
ok: false,
|
|
351
|
+
error: { message: saved.error ?? "Failed to save configuration" }
|
|
352
|
+
}, 500);
|
|
279
353
|
}
|
|
280
354
|
return c.json({
|
|
281
355
|
ok: true,
|
|
282
356
|
payload: {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
authenticated.get("/api/image/providers", (c) => {
|
|
290
|
-
const cfg = deps.service.currentConfig;
|
|
291
|
-
const providers = listImageGenerationProvidersSummary(cfg).map((p) => {
|
|
292
|
-
const provider = getImageGenerationProvider(p.id, cfg);
|
|
293
|
-
let configured = false;
|
|
294
|
-
try {
|
|
295
|
-
configured = provider?.isConfigured?.({ cfg }) === true;
|
|
296
|
-
} catch {
|
|
297
|
-
configured = false;
|
|
357
|
+
agent: getAgentImageGenerationConfig(service.currentConfig, c.req.param("agentId")),
|
|
358
|
+
providers: getImageGenerationCatalog(service.currentConfig),
|
|
359
|
+
verification
|
|
298
360
|
}
|
|
299
|
-
return {
|
|
300
|
-
...p,
|
|
301
|
-
configured
|
|
302
|
-
};
|
|
303
|
-
});
|
|
304
|
-
return c.json({
|
|
305
|
-
ok: true,
|
|
306
|
-
payload: { providers }
|
|
307
361
|
});
|
|
308
362
|
});
|
|
309
|
-
authenticated.post("/api/image/providers/:
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
const provider = getImageGenerationProvider(id, cfg);
|
|
313
|
-
if (!provider) return c.json({
|
|
363
|
+
authenticated.post("/api/image-generation/providers/:providerId/verify", strictRateLimitMiddleware, async (c) => {
|
|
364
|
+
const body = await c.req.json().catch(() => null);
|
|
365
|
+
if (!body || typeof body.apiKey !== "string") return c.json({
|
|
314
366
|
ok: false,
|
|
315
|
-
error: { message:
|
|
316
|
-
},
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (!configured) reason = "Missing API key (set via config or environment).";
|
|
322
|
-
} catch (err) {
|
|
323
|
-
reason = err instanceof Error ? err.message : String(err);
|
|
324
|
-
}
|
|
325
|
-
return c.json({
|
|
326
|
-
ok: true,
|
|
327
|
-
payload: {
|
|
328
|
-
id: provider.id,
|
|
329
|
-
configured,
|
|
330
|
-
...reason ? { reason } : {},
|
|
331
|
-
defaultModel: provider.defaultModel ?? null
|
|
332
|
-
}
|
|
367
|
+
error: { message: "apiKey is required" }
|
|
368
|
+
}, 400);
|
|
369
|
+
const result = await verifyImageGenerationCredential({
|
|
370
|
+
providerId: c.req.param("providerId"),
|
|
371
|
+
apiKey: body.apiKey,
|
|
372
|
+
baseUrl: typeof body.baseUrl === "string" ? body.baseUrl : void 0
|
|
333
373
|
});
|
|
334
|
-
});
|
|
335
|
-
/**
|
|
336
|
-
* POST /api/image/providers/:id/reveal-api-key — return `cfg.providers.<id>.apiKey` plaintext for the
|
|
337
|
-
* gateway console (same auth as PATCH /api/config). Does not resolve env vars or credential files.
|
|
338
|
-
*/
|
|
339
|
-
authenticated.post("/api/image/providers/:id/reveal-api-key", strictRateLimitMiddleware, async (c) => {
|
|
340
|
-
const rawId = c.req.param("id");
|
|
341
|
-
const cfg = deps.service.currentConfig;
|
|
342
|
-
const provider = getImageGenerationProvider(rawId, cfg);
|
|
343
|
-
if (!provider) return c.json({
|
|
344
|
-
ok: false,
|
|
345
|
-
error: { message: `Image generation provider not found: ${rawId}` }
|
|
346
|
-
}, 404);
|
|
347
|
-
const apiKey = readProviderApiKeyFromConfigFileOnly(cfg, provider.id);
|
|
348
374
|
return c.json({
|
|
349
375
|
ok: true,
|
|
350
|
-
payload:
|
|
351
|
-
id: provider.id,
|
|
352
|
-
apiKey: apiKey ?? null,
|
|
353
|
-
source: apiKey ? "config" : "none"
|
|
354
|
-
}
|
|
376
|
+
payload: result
|
|
355
377
|
});
|
|
356
378
|
});
|
|
357
379
|
authenticated.get("/api/providers", async (c) => {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { findTaskOutcomeForAssistant, getTaskOutcome, listTaskOutcomes, summarizeTaskOutcomes, updateTaskOutcome } from "../../../storage/sqlite/task-outcome-repository.js";
|
|
2
|
+
import "../../../storage/sqlite/index.js";
|
|
3
|
+
import { replayTaskEvaluation } from "../../../agent/outcomes/task-evaluation.js";
|
|
4
|
+
//#region src/gateway/hono/routes/task-outcomes.ts
|
|
5
|
+
function parseLimit(raw) {
|
|
6
|
+
if (!raw) return void 0;
|
|
7
|
+
const value = Number.parseInt(raw, 10);
|
|
8
|
+
return Number.isFinite(value) ? value : void 0;
|
|
9
|
+
}
|
|
10
|
+
function isStringArray(value) {
|
|
11
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
12
|
+
}
|
|
13
|
+
function isTaskContract(value) {
|
|
14
|
+
if (!value || typeof value !== "object") return false;
|
|
15
|
+
const contract = value;
|
|
16
|
+
return typeof contract.objective === "string" && isStringArray(contract.deliverables) && isStringArray(contract.acceptanceCriteria) && isStringArray(contract.constraints) && isStringArray(contract.approvalRequired);
|
|
17
|
+
}
|
|
18
|
+
function isTaskEvidence(value) {
|
|
19
|
+
return Array.isArray(value) && value.every((item) => {
|
|
20
|
+
if (!item || typeof item !== "object") return false;
|
|
21
|
+
const evidence = item;
|
|
22
|
+
return (evidence.kind === "artifact" || evidence.kind === "test" || evidence.kind === "state" || evidence.kind === "source") && typeof evidence.title === "string" && typeof evidence.summary === "string" && (evidence.uri === void 0 || typeof evidence.uri === "string") && (evidence.verifies === void 0 || isStringArray(evidence.verifies));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function registerTaskOutcomeRoutes(authenticated, _deps) {
|
|
26
|
+
authenticated.get("/api/task-outcomes", (c) => {
|
|
27
|
+
const items = listTaskOutcomes({
|
|
28
|
+
sessionKey: c.req.query("sessionKey")?.trim() || void 0,
|
|
29
|
+
limit: parseLimit(c.req.query("limit"))
|
|
30
|
+
});
|
|
31
|
+
return c.json({
|
|
32
|
+
ok: true,
|
|
33
|
+
items
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
authenticated.get("/api/task-outcomes/metrics", (c) => {
|
|
37
|
+
return c.json({
|
|
38
|
+
ok: true,
|
|
39
|
+
metrics: summarizeTaskOutcomes()
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
authenticated.get("/api/task-outcomes/evaluation", (c) => {
|
|
43
|
+
const items = listTaskOutcomes({ limit: parseLimit(c.req.query("limit")) ?? 100 });
|
|
44
|
+
return c.json({
|
|
45
|
+
ok: true,
|
|
46
|
+
evaluation: replayTaskEvaluation(items)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
authenticated.get("/api/task-outcomes/for-assistant", (c) => {
|
|
50
|
+
const sessionKey = c.req.query("sessionKey")?.trim() ?? "";
|
|
51
|
+
const assistantTimestamp = Number(c.req.query("assistantTimestamp"));
|
|
52
|
+
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0) return c.json({
|
|
53
|
+
ok: false,
|
|
54
|
+
error: "sessionKey and assistantTimestamp are required"
|
|
55
|
+
}, 400);
|
|
56
|
+
const outcome = findTaskOutcomeForAssistant(sessionKey, assistantTimestamp);
|
|
57
|
+
return outcome ? c.json({
|
|
58
|
+
ok: true,
|
|
59
|
+
outcome
|
|
60
|
+
}) : c.json({
|
|
61
|
+
ok: false,
|
|
62
|
+
error: "Task outcome not found"
|
|
63
|
+
}, 404);
|
|
64
|
+
});
|
|
65
|
+
authenticated.get("/api/task-outcomes/:runId", (c) => {
|
|
66
|
+
const outcome = getTaskOutcome(c.req.param("runId"));
|
|
67
|
+
return outcome ? c.json({
|
|
68
|
+
ok: true,
|
|
69
|
+
outcome
|
|
70
|
+
}) : c.json({
|
|
71
|
+
ok: false,
|
|
72
|
+
error: "Task outcome not found"
|
|
73
|
+
}, 404);
|
|
74
|
+
});
|
|
75
|
+
authenticated.patch("/api/task-outcomes/:runId", async (c) => {
|
|
76
|
+
const body = await c.req.json().catch(() => null);
|
|
77
|
+
if (!body || typeof body !== "object") return c.json({
|
|
78
|
+
ok: false,
|
|
79
|
+
error: "Invalid JSON body"
|
|
80
|
+
}, 400);
|
|
81
|
+
if (body.contract !== void 0 && !isTaskContract(body.contract)) return c.json({
|
|
82
|
+
ok: false,
|
|
83
|
+
error: "Invalid task contract"
|
|
84
|
+
}, 400);
|
|
85
|
+
if (body.evidence !== void 0 && !isTaskEvidence(body.evidence)) return c.json({
|
|
86
|
+
ok: false,
|
|
87
|
+
error: "Invalid task evidence"
|
|
88
|
+
}, 400);
|
|
89
|
+
if (body.summary !== void 0 && typeof body.summary !== "string") return c.json({
|
|
90
|
+
ok: false,
|
|
91
|
+
error: "Invalid task summary"
|
|
92
|
+
}, 400);
|
|
93
|
+
const outcome = updateTaskOutcome({
|
|
94
|
+
runId: c.req.param("runId"),
|
|
95
|
+
...body.contract === void 0 ? {} : { contract: body.contract },
|
|
96
|
+
...body.evidence === void 0 ? {} : { evidence: body.evidence },
|
|
97
|
+
...body.summary === void 0 ? {} : { summary: body.summary }
|
|
98
|
+
});
|
|
99
|
+
return outcome ? c.json({
|
|
100
|
+
ok: true,
|
|
101
|
+
outcome
|
|
102
|
+
}) : c.json({
|
|
103
|
+
ok: false,
|
|
104
|
+
error: "Task outcome not found"
|
|
105
|
+
}, 404);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { registerTaskOutcomeRoutes };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
2
|
import type { MemoryRecord } from '../../../agent/memory/types.js';
|
|
3
|
+
import { type PersonalPlaybookContext } from '../../../user-context/personal-playbook.js';
|
|
3
4
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
4
5
|
export declare function buildPersonalPlaybooks(records: MemoryRecord[]): {
|
|
5
|
-
id: "
|
|
6
|
+
id: "execution" | "communication" | "routines";
|
|
6
7
|
enabled: boolean;
|
|
7
8
|
rules: {
|
|
8
9
|
id: string;
|
|
@@ -10,6 +11,13 @@ export declare function buildPersonalPlaybooks(records: MemoryRecord[]): {
|
|
|
10
11
|
origin: import("../../../agent/memory/types.js").MemoryExplicitness;
|
|
11
12
|
enabled: boolean;
|
|
12
13
|
order: number;
|
|
14
|
+
context: PersonalPlaybookContext;
|
|
15
|
+
versions: {
|
|
16
|
+
id: string;
|
|
17
|
+
statement: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
current: boolean;
|
|
20
|
+
}[];
|
|
13
21
|
}[];
|
|
14
22
|
updatedAt: string;
|
|
15
23
|
}[];
|
|
@@ -17,7 +25,7 @@ export declare function buildInsightSuggestions(records: MemoryRecord[]): {
|
|
|
17
25
|
id: string;
|
|
18
26
|
insight: string;
|
|
19
27
|
kind: import("../../../agent/memory/types.js").MemoryKind;
|
|
20
|
-
action: "make_repeatable" | "start_progress";
|
|
28
|
+
action: "make_repeatable" | "add_playbook" | "start_progress";
|
|
21
29
|
evidenceCount: number;
|
|
22
30
|
confidence: number;
|
|
23
31
|
sourceName: string;
|