@xopcai/xopc 0.0.373 → 0.0.375
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear--kDkSTqC.js → agent-avatar-dicebear-B2Popl59.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-z4_2-Kn2.js → agent-defaults-settings-panel-BnF3HrHY.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BYndK83K.js → agent-plugin-dialog-CwP6OrUs.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CVo96cx1.js → agents-n3IremKl.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D9oOJKiH.js → app-management-settings-panel-DNkXIPxK.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B0-8Cdyv.js → appearance-settings-p1_NpH8a.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DasVc6i4.js → apps-page-CP2u5iEh.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BlCNqy2i.js → automations-page-CjYiGOov.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-C8ipDP05.js → automations-workspace-BAHiUQbe.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Cktlez6g.js → block-editor-DiOou1HO.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-KRfDl8ej.js → browser-automations-page-nArl2uwX.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BraQ4wnh.js → browser-settings-page-Bd8tF-gg.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-B3m8xGzd.js → capabilities-page-Cx4cdgse.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-VQ4fHuBV.js → capabilities-settings-panel-DpWceNd0.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-f5Ido4Eg.js → capability-header-actions-AeBubNQK.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-N4Vc2nEG.js → channels-Cd1Rf0Vk.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BwvTKwsn.js → chat-terminal-dock-DrVlbq_P.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-CAwUsKpw.js → computer-settings-page-TUzZnurj.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-C0HuAMuH.js → connector-service-page-BlpwjGW7.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BcBmW8JT.js → connectors-page-j8VFMD4o.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-DiQxRpe-.js → date-picker-CjKRpA8X.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Ds0_BJbN.js → dependency-picker-J9_0obij.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-ZMEOYwrR.js → desktop-pet-DySwgreF.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DkyTqD07.js → desktop-pet-settings-B1-oyKBG.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CvaI5ZJZ.js → device-pairing-wizard-C5rjPAyc.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Bfv93eK1.js → directory-picker-path-field-BY7MwiZd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-JXKGtIdM.js → extension-page-JoSFhfb6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-lsQ2xvbr.js → extension-settings-page-B7LtTNx7.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-7bG0AND1.js → fallback-models-DKSWcBt_.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BpbcoPx9.js → gateway-settings-CGm-lbsX.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BxctC0aJ.js → home-page-CX3uWkyH.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Bq8CazCb.js → imports-page-DS_RFtWf.js} +1 -1
- package/dist/gateway/static/root/assets/{index-B40-KDN8.js → index-CgvOIDy_.js} +6 -6
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-kkAevkl2.js → keyboard-shortcuts-settings-BxwXR2qA.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-abLaf1hW.js → local-app-workbench-page-BWd4RMBE.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-nwsnwYjK.js → local-apps-page-BsgcA6-N.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BEgYS-Xg.js → logs-page-CLP5pu2j.js} +1 -1
- package/dist/gateway/static/root/assets/management-settings-CZAZwCpE.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-CCnfurBR.js → note-detail-panel-BeAHgdtw.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-D9u_znxM.js → notes-page-MP21Zf_R.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BO3FoRej.js → page-context-capture-button-BZADmKcV.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-BbaTGmE-.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-Dso2_hyl.js → product-open-page-CBnKsW4p.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-CkvVb3EA.js → product-preview-content-B0gGexdG.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-UjrrzE3H.js → project-detail-page-ZjQSv_NG.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-C1h63P2M.js → projects-page-Bf7Sd_Ck.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BJifH8AB.js → remote-access-hub-Bl8aPuXU.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-vG1wqcEb.js → runtime-tools-settings-panel-CQZ1c-re.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-CwoAoYMX.js → scenes-page-1xGRBOJO.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BIsHdyz7.js → schema-form-BYqugMox.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BcCLp3yU.js → sessions-page-DjMSVXU3.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BJuMTtyI.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-z9Jlk0BL.js → settings-page-CSqi5fmN.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CrpXECqe.js → setup-status-panel-D5bM0TvA.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-D9XpTJXP.js → shares-settings-C-V9WllF.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DtPOf1aW.js → skill-api-CFtEHy5e.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-Bq9-2b9U.js → skills-page-B-olXUVH.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-P7T729uD.js → system-settings-panel-DBMR9ks_.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CsB9AFx6.js → task-detail-page-CGe34vxR.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CuowqIZ7.js → tunnel-api-CzNIlgdJ.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-avX3msoZ.js → usage-page-O3abwewp.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-Bx2JlCpj.js +2 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BgJNz2tH.js → work-discovery-overlay-D967-fVj.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-1I2q2J_U.js → workflow-run-setup-panel-BJ945m7G.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DhJl9pnO.js → workflows-page-DUpVeIuw.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CnPBP1V_.js → xopc-cloud-account-card-Bq9ubffP.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/realtime-protocol/src/voice.js +11 -0
- package/dist/src/agent/agent-manager.d.ts +2 -7
- package/dist/src/agent/agent-manager.js +21 -50
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +6 -0
- package/dist/src/agent/background-review/prompts.js +7 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +3 -0
- package/dist/src/agent/background-review/run-background-review.js +185 -17
- package/dist/src/agent/context/coordinator.d.ts +1 -0
- package/dist/src/agent/context/coordinator.js +11 -2
- package/dist/src/agent/context/execution-context.js +40 -4
- package/dist/src/agent/context/project-context.js +11 -3
- package/dist/src/agent/embedded/run-for-session.js +2 -2
- package/dist/src/agent/embedded/run-turn.js +4 -4
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.d.ts +2 -0
- package/dist/src/agent/memory/compaction-promotion.js +33 -2
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.js +5 -5
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +2 -2
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/knowledge-memory-tool.js +14 -6
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent/workspace-runtime/registry.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-config/schema.d.ts +9 -0
- package/dist/src/agent-config/schema.js +1 -0
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/service/action-executor.js +1 -1
- package/dist/src/bootstrap/application-state.js +2 -2
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/gateway/shared.js +2 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/agent-model-intents.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/gateway-bind.js +2 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +8 -8
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +18 -12
- package/dist/src/config/schema.js +12 -8
- package/dist/src/connectors/connected-source-ingestion.js +45 -7
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +59 -67
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/learning-coordinator.js +2 -2
- package/dist/src/daemon/constants.js +14 -9
- package/dist/src/daemon/index.js +4 -1
- package/dist/src/daemon/install-plan.js +2 -1
- package/dist/src/daemon/launchd.js +2 -1
- package/dist/src/daemon/schtasks.js +2 -1
- package/dist/src/daemon/service-audit.js +2 -1
- package/dist/src/daemon/service.js +2 -1
- package/dist/src/daemon/systemd.js +2 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/client-ip.js +2 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/app.js +2 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/middleware/auth.d.ts +3 -5
- package/dist/src/gateway/hono/middleware/auth.js +56 -14
- package/dist/src/gateway/hono/middleware/logger.js +2 -1
- package/dist/src/gateway/hono/middleware/public-device-rate-limit.d.ts +16 -0
- package/dist/src/gateway/hono/middleware/public-device-rate-limit.js +43 -0
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +3 -2
- package/dist/src/gateway/hono/oauth-async.js +2 -1
- package/dist/src/gateway/hono/routes/browser.js +2 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +5 -5
- package/dist/src/gateway/hono/routes/config.js +2 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +2 -2
- package/dist/src/gateway/hono/routes/device-pairing-approval.d.ts +3 -8
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +5 -20
- package/dist/src/gateway/hono/routes/devices.js +25 -9
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -0
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/memory-learning.d.ts +3 -0
- package/dist/src/gateway/hono/routes/memory-learning.js +76 -0
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/personal-agent.js +3 -2
- package/dist/src/gateway/hono/routes/projects.js +3 -3
- package/dist/src/gateway/hono/routes/public-gateway.js +6 -6
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/shares.js +2 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
- package/dist/src/gateway/hono/routes/user-model.js +5 -3
- package/dist/src/gateway/hono/routes/voice.js +1 -0
- package/dist/src/gateway/host.js +9 -4
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/index.js +8 -4
- package/dist/src/gateway/listen.js +2 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/rate-limit/auth-policy.js +7 -11
- package/dist/src/gateway/rate-limit/buckets.d.ts +6 -0
- package/dist/src/gateway/rate-limit/buckets.js +211 -189
- package/dist/src/gateway/rate-limit/env-flags.js +4 -1
- package/dist/src/gateway/rate-limit/index.js +13 -4
- package/dist/src/gateway/runtime-config.js +5 -3
- package/dist/src/gateway/security/audit.js +3 -2
- package/dist/src/gateway/security/browser-session.js +2 -1
- package/dist/src/gateway/security/device-request-proof.d.ts +28 -0
- package/dist/src/gateway/security/device-request-proof.js +122 -0
- package/dist/src/gateway/security/loopback.js +7 -6
- package/dist/src/gateway/service/session-command-service.js +1 -1
- package/dist/src/gateway/service.js +18 -16
- package/dist/src/gateway/tailscale-auth.js +2 -1
- package/dist/src/gateway/ws-security.js +2 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +2 -2
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/imports/inventory.js +1 -1
- package/dist/src/infra/rate-limit/failure-limiter.js +78 -90
- package/dist/src/infra/rate-limit/index.js +11 -3
- package/dist/src/infra/rate-limit/keyed-store.js +52 -47
- package/dist/src/infra/rate-limit/rate-limiter.js +55 -58
- package/dist/src/infra/update-service-refresh.js +2 -1
- package/dist/src/knowledge/chunks.d.ts +10 -0
- package/dist/src/knowledge/chunks.js +28 -0
- package/dist/src/knowledge/connected-knowledge-pipeline.js +67 -33
- package/dist/src/knowledge/index.js +1 -1
- package/dist/src/knowledge/ingestion-service.js +5 -1
- package/dist/src/knowledge/local-folder-adapter.d.ts +2 -1
- package/dist/src/knowledge/local-folder-adapter.js +22 -13
- package/dist/src/knowledge-memory/domain.d.ts +4 -0
- package/dist/src/knowledge-memory/index.d.ts +1 -0
- package/dist/src/knowledge-memory/index.js +2 -1
- package/dist/src/knowledge-memory/repair-evidence.d.ts +2 -0
- package/dist/src/knowledge-memory/repair-evidence.js +57 -0
- package/dist/src/knowledge-memory/repository.d.ts +8 -0
- package/dist/src/knowledge-memory/repository.js +48 -27
- package/dist/src/knowledge-memory/search-text.d.ts +3 -0
- package/dist/src/knowledge-memory/search-text.js +32 -0
- package/dist/src/knowledge-memory/usage-policy.d.ts +6 -0
- package/dist/src/knowledge-memory/usage-policy.js +61 -0
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/memory-learning/repository.d.ts +24 -0
- package/dist/src/memory-learning/repository.js +96 -0
- package/dist/src/memory-learning/service.d.ts +17 -0
- package/dist/src/memory-learning/service.js +105 -0
- package/dist/src/memory-learning/source-learning.d.ts +7 -0
- package/dist/src/memory-learning/source-learning.js +235 -0
- package/dist/src/memory-learning/task-receipts.d.ts +3 -0
- package/dist/src/memory-learning/task-receipts.js +95 -0
- package/dist/src/memory-learning/work-capture.d.ts +51 -0
- package/dist/src/memory-learning/work-capture.js +140 -0
- package/dist/src/memory-maintenance/service.js +5 -5
- package/dist/src/personal-agent/proactivity/service.js +2 -2
- package/dist/src/personal-agent/prompt-context.js +4 -4
- package/dist/src/personal-agent/reply-composer.js +1 -1
- package/dist/src/personal-agent/repository.d.ts +3 -0
- package/dist/src/personal-agent/repository.js +1 -0
- package/dist/src/personal-agent/service.d.ts +6 -2
- package/dist/src/personal-agent/service.js +6 -5
- package/dist/src/platform/client.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +1 -1
- package/dist/src/providers/local-model.d.ts +2 -0
- package/dist/src/providers/local-model.js +16 -0
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/realtime/runtime.js +6 -0
- package/dist/src/realtime/tickets.d.ts +1 -0
- package/dist/src/realtime/tickets.js +4 -0
- package/dist/src/remote-access/exposure-guards.js +2 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/scenes/taskFollowUp/service.js +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/share/share-rate-limit.js +2 -1
- package/dist/src/share/share-url.js +2 -1
- package/dist/src/share/site-share-router.js +2 -1
- package/dist/src/storage/sqlite/device-access-repository.d.ts +7 -0
- package/dist/src/storage/sqlite/device-access-repository.js +22 -4
- package/dist/src/storage/sqlite/knowledge-repository.js +6 -0
- package/dist/src/storage/sqlite/migrations/243_voice_opening_greetings.sql +12 -0
- package/dist/src/storage/sqlite/migrations/244_device_request_proofs.sql +8 -0
- package/dist/src/storage/sqlite/migrations/245_memory_learning.sql +125 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +6 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-main-update-decision-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +4 -4
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/tunnel/broker-client.js +2 -0
- package/dist/src/tunnel/tunnel-config.js +2 -2
- package/dist/src/tunnel/tunnel-rate-limit.js +2 -1
- package/dist/src/user-context/access-policy.js +2 -1
- package/dist/src/user-context/config.d.ts +10 -0
- package/dist/src/user-context/config.js +5 -0
- package/dist/src/user-context/extraction/registry.d.ts +1 -1
- package/dist/src/user-context/extraction/registry.js +10 -0
- package/dist/src/user-context/identity-bindings.d.ts +10 -0
- package/dist/src/user-context/identity-bindings.js +24 -0
- package/dist/src/user-context/sources/consent-fields.d.ts +2 -0
- package/dist/src/user-context/sources/consent-fields.js +66 -0
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +1 -1
- package/dist/src/user-model/capture/semantic.d.ts +3 -1
- package/dist/src/user-model/capture/semantic.js +14 -6
- package/dist/src/user-model/index.js +1 -1
- package/dist/src/user-model/usage-policy.js +34 -0
- package/dist/src/utils/logger/redact.js +4 -1
- package/dist/src/voice/platform-streams.d.ts +6 -0
- package/dist/src/voice/platform-streams.js +44 -4
- package/dist/src/voice/realtime/agentEngine.js +138 -83
- package/dist/src/voice/realtime/engine.d.ts +6 -0
- package/dist/src/voice/realtime/memory-context.js +19 -5
- package/dist/src/voice/realtime/opening-greeting.d.ts +12 -0
- package/dist/src/voice/realtime/opening-greeting.js +22 -0
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.js +90 -1
- package/dist/src/voice/realtime/runtime.types.d.ts +4 -0
- package/dist/src/work-discovery/incremental-repository.js +1 -1
- package/dist/src/work-discovery/service.js +6 -6
- package/dist/src/workflows/service/workflow-run-service.js +2 -2
- package/dist/src/workflows/service/workflow-session-bridge.js +38 -10
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/management-settings-D_JQ6_X0.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BJn6UHAF.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D114UdRI.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DGDBWw7P.js +0 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { buckets } from "../../rate-limit/buckets.js";
|
|
2
|
+
import { init_rate_limit } from "../../rate-limit/index.js";
|
|
3
|
+
import { resolveClientIpFromRequest } from "../../client-ip.js";
|
|
4
|
+
import { createMiddleware } from "hono/factory";
|
|
5
|
+
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
6
|
+
//#region src/gateway/hono/middleware/public-device-rate-limit.ts
|
|
7
|
+
init_rate_limit();
|
|
8
|
+
function pairingClientKey(c, options) {
|
|
9
|
+
let remoteAddress;
|
|
10
|
+
try {
|
|
11
|
+
remoteAddress = getConnInfo(c).remote.address;
|
|
12
|
+
} catch {
|
|
13
|
+
remoteAddress = void 0;
|
|
14
|
+
}
|
|
15
|
+
const proxy = options?.getTrustedProxyContext?.();
|
|
16
|
+
return resolveClientIpFromRequest({
|
|
17
|
+
remoteAddress,
|
|
18
|
+
getHeader: (name) => c.req.header(name),
|
|
19
|
+
trustedProxies: proxy?.trustedProxies,
|
|
20
|
+
allowRealIpFallback: proxy?.allowRealIpFallback
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Shared local-hop budgets allow normal mobile polling while bounding pre-auth work. */
|
|
24
|
+
function publicDeviceRateLimit(family, options) {
|
|
25
|
+
return createMiddleware(async (c, next) => {
|
|
26
|
+
const source = buckets.publicDeviceSource().consume(`${family}:${pairingClientKey(c, options)}`);
|
|
27
|
+
const total = buckets.publicDeviceGlobal().consume(family);
|
|
28
|
+
if (!source.allowed || !total.allowed) {
|
|
29
|
+
const retry = Math.max(source.retryAfterMs, total.retryAfterMs);
|
|
30
|
+
c.header("Retry-After", String(Math.max(1, Math.ceil(retry / 1e3))));
|
|
31
|
+
return c.json({
|
|
32
|
+
ok: false,
|
|
33
|
+
error: {
|
|
34
|
+
code: "RATE_LIMITED",
|
|
35
|
+
message: "Too many requests"
|
|
36
|
+
}
|
|
37
|
+
}, 429);
|
|
38
|
+
}
|
|
39
|
+
return next();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { pairingClientKey, publicDeviceRateLimit };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
-
import { resolveClientIpFromRequest } from "../../client-ip.js";
|
|
4
3
|
import { buckets } from "../../rate-limit/buckets.js";
|
|
5
|
-
import "../../rate-limit/index.js";
|
|
4
|
+
import { init_rate_limit } from "../../rate-limit/index.js";
|
|
5
|
+
import { resolveClientIpFromRequest } from "../../client-ip.js";
|
|
6
6
|
import { createMiddleware } from "hono/factory";
|
|
7
7
|
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
8
8
|
//#region src/gateway/hono/middleware/strict-rate-limit.ts
|
|
@@ -10,6 +10,7 @@ import { getConnInfo } from "@hono/node-server/conninfo";
|
|
|
10
10
|
* Per-client request-rate gate for sensitive admin/mutation endpoints.
|
|
11
11
|
* Backed by `buckets.strictApi()` — see {@link ../../rate-limit/buckets.ts}.
|
|
12
12
|
*/
|
|
13
|
+
init_rate_limit();
|
|
13
14
|
init_logger();
|
|
14
15
|
const log = createLogger("Hono:StrictRateLimit");
|
|
15
16
|
function resolveClientIp(c, deps) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { init_host, isLoopbackHost } from "../host.js";
|
|
3
4
|
import { getOAuthProviderInterfaces, init_registry } from "../../auth/oauth/registry.js";
|
|
4
5
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
5
|
-
import { isLoopbackHost } from "../host.js";
|
|
6
6
|
import { resolveReverseProxyPublicUrl } from "../public-url.js";
|
|
7
7
|
import { buildCapabilityPlansForConfig } from "../../capabilities/readiness/from-config.js";
|
|
8
8
|
import "../../capabilities/readiness/index.js";
|
|
@@ -18,6 +18,7 @@ import { Hono } from "hono";
|
|
|
18
18
|
*/
|
|
19
19
|
init_registry();
|
|
20
20
|
init_credentials();
|
|
21
|
+
init_host();
|
|
21
22
|
init_logger();
|
|
22
23
|
const log = createLogger("OAuthAsync");
|
|
23
24
|
function buildOAuthCompletionReadiness(config, catalog) {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { deleteBrowserTabBinding, getBrowserTabBinding, init_browser_tab_binding_repository, setBrowserTabBinding } from "../../../storage/sqlite/browser-tab-binding-repository.js";
|
|
2
2
|
import { browserTabBindingRequestSchema } from "../../../../packages/gateway-contract/src/browser-tab-binding.js";
|
|
3
3
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
4
|
+
import { init_loopback, isLoopbackClientIp } from "../../security/loopback.js";
|
|
4
5
|
import { getDevice, init_device_access_repository } from "../../../storage/sqlite/device-access-repository.js";
|
|
5
6
|
import "../../../../packages/browser-control-contract/src/index.js";
|
|
6
7
|
import { createBrowserDriver } from "../../../browser/drivers/create-driver.js";
|
|
7
8
|
import { checkBrowserReadiness } from "../../../browser/readiness.js";
|
|
8
|
-
import { isLoopbackClientIp } from "../../security/loopback.js";
|
|
9
9
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
10
10
|
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
11
11
|
//#region src/gateway/hono/routes/browser.ts
|
|
12
12
|
/** Browser Control status and driver diagnostics. */
|
|
13
13
|
init_src();
|
|
14
|
+
init_loopback();
|
|
14
15
|
init_device_access_repository();
|
|
15
16
|
init_browser_tab_binding_repository();
|
|
16
17
|
async function extensionStatus(service, includeLocalArtifacts) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config } from "../../../../user-context/config.js";
|
|
1
2
|
import { BindingsSchema, init_binding_schema } from "../../../../routing/binding-schema.js";
|
|
2
|
-
import {
|
|
3
|
-
import { ComputerConfigSchema, init_config } from "../../../../computer/config.js";
|
|
4
|
-
import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config as init_config$1 } from "../../../../user-context/config.js";
|
|
3
|
+
import { ComputerConfigSchema, init_config as init_config$1 } from "../../../../computer/config.js";
|
|
5
4
|
import { BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
6
5
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
7
6
|
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
7
|
+
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
8
8
|
import { mergeGatewaySkillsMarketplacePatch, mergeSessionConfigPatch, mergeUpdateConfigPatch } from "../../../../config/web-patch.js";
|
|
9
9
|
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../../../auth.js";
|
|
10
10
|
import { isMaskedSecretPatchValue } from "../../lib/mask-secret-length.js";
|
|
@@ -14,11 +14,11 @@ import { assertGatewayRuntimeConfig } from "../../../runtime-config.js";
|
|
|
14
14
|
import { mergeRealtimeVoiceConfigPatch, mergeSttConfigPatch, mergeTtsConfigPatch } from "../../lib/safe-voice-config.js";
|
|
15
15
|
import { PATCH_OK, patchError } from "./result.js";
|
|
16
16
|
//#region src/gateway/hono/routes/config-patch/misc.ts
|
|
17
|
-
init_config();
|
|
17
|
+
init_config$1();
|
|
18
18
|
init_schema();
|
|
19
19
|
init_binding_schema();
|
|
20
20
|
init_credentials();
|
|
21
|
-
init_config
|
|
21
|
+
init_config();
|
|
22
22
|
async function applyMiscPatch(config, body) {
|
|
23
23
|
if (body.update !== void 0 && typeof body.update === "object" && body.update !== null) {
|
|
24
24
|
const updateResult = mergeUpdateConfigPatch(config, body.update);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { enumerateLanGatewayCandidates } from "../../host.js";
|
|
1
|
+
import { enumerateLanGatewayCandidates, init_host } from "../../host.js";
|
|
2
2
|
import { getTunnelService } from "../../../tunnel/tunnel-service.js";
|
|
3
3
|
import { buildSafeWebConfigPayload } from "../lib/config-payload.js";
|
|
4
4
|
import { applyChannelsPatch } from "./config-patch/channels.js";
|
|
@@ -6,6 +6,7 @@ import { applyGatewayPatch } from "./config-patch/gateway.js";
|
|
|
6
6
|
import { applyMiscPatch, validateGatewayAfterPatch } from "./config-patch/misc.js";
|
|
7
7
|
import "./config-patch/index.js";
|
|
8
8
|
//#region src/gateway/hono/routes/config.ts
|
|
9
|
+
init_host();
|
|
9
10
|
function localeFromRequest(c) {
|
|
10
11
|
return c.req.query("locale") ?? c.req.header("X-XOPC-Locale") ?? c.req.header("Accept-Language")?.split(",")[0];
|
|
11
12
|
}
|
|
@@ -6,6 +6,7 @@ import { getConnectorAccount, init_connector_account_repository, listConnectorAc
|
|
|
6
6
|
import { decideConnectorApproval, getConnectorApproval, listConnectorApprovals, listConnectorConnections } from "../../../storage/sqlite/connector-repository.js";
|
|
7
7
|
import { getConnectorSyncPolicy, upsertConnectorSyncPolicy } from "../../../storage/sqlite/connector-sync-policy-repository.js";
|
|
8
8
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
9
|
+
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
9
10
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
10
11
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
11
12
|
import { activateComposioBackend, addComposioBackend, ensureComposioBackend, getComposioBackend, listComposioBackends, removeComposioBackend } from "../../../connectors/composio-backends.js";
|
|
@@ -27,7 +28,6 @@ import { composioLogoResponse } from "../../../connectors/composio-logo.js";
|
|
|
27
28
|
import { inspectManagedComposioStatus } from "../../../connectors/composio-managed-client.js";
|
|
28
29
|
import { appendComposioTriggerEvent, listComposioTriggerEvents } from "../../../connectors/composio-triggers.js";
|
|
29
30
|
import { ingestLocalFolderSource } from "../../../connectors/connected-source-ingestion.js";
|
|
30
|
-
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
31
31
|
import { testConnectorInstance } from "../../../connectors/health.js";
|
|
32
32
|
import { setConnectorEnabled } from "../../../connectors/lifecycle.js";
|
|
33
33
|
import { projectComposioConnectionStatus } from "../../../connectors/runtime-status.js";
|
|
@@ -2,11 +2,11 @@ import { getSqliteDatabase, init_transaction } from "../../../storage/sqlite/tra
|
|
|
2
2
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
3
|
import { countKnowledgeSourceItems, deleteKnowledgeSourceItems } from "../../../storage/sqlite/knowledge-repository.js";
|
|
4
4
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
5
|
+
import { getActiveUnderstandingConsent } from "../../../user-context/sources/consent-repository.js";
|
|
6
|
+
import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUnderstandingSourceRuns, revokeUnderstandingSourceGrant, updateUnderstandingSourceGrantPolicies } from "../../../user-context/sources/repository.js";
|
|
5
7
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
6
8
|
import { listUserModelObservations } from "../../../user-model/observation-repository.js";
|
|
7
9
|
import "../../../user-model/index.js";
|
|
8
|
-
import { getActiveUnderstandingConsent } from "../../../user-context/sources/consent-repository.js";
|
|
9
|
-
import { getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUnderstandingSourceRuns, revokeUnderstandingSourceGrant, updateUnderstandingSourceGrantPolicies } from "../../../user-context/sources/repository.js";
|
|
10
10
|
import { listConnectedContentCandidates, readConnectedContent } from "../../../connectors/content-enrichment.js";
|
|
11
11
|
import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
|
|
12
12
|
//#region src/gateway/hono/routes/context-sources.ts
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
trustedProxies?: string[];
|
|
5
|
-
allowRealIpFallback?: boolean;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export declare function pairingClientKey(c: Context, options?: PairingPublicRouteOptions): string;
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import { type PairingPublicRouteOptions } from '../middleware/public-device-rate-limit.js';
|
|
3
|
+
export { pairingClientKey, type PairingPublicRouteOptions } from '../middleware/public-device-rate-limit.js';
|
|
9
4
|
export declare function registerPairingApprovalPublicRoutes(app: Hono, options?: PairingPublicRouteOptions): void;
|
|
10
5
|
export declare function registerPairingApprovalAdminRoutes(app: Hono): void;
|
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import { devicePairingCompleteSchema, devicePairingProofSchema, devicePairingRequestSchema } from "../../../../packages/gateway-contract/src/device-pairing.js";
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
-
import { getOrCreateGatewayIdentity, init_gateway_identity_repository, signGatewayPayload } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
4
|
-
import { resolveClientIpFromRequest } from "../../client-ip.js";
|
|
5
3
|
import { buckets } from "../../rate-limit/buckets.js";
|
|
6
|
-
import "../../rate-limit/index.js";
|
|
4
|
+
import { init_rate_limit } from "../../rate-limit/index.js";
|
|
5
|
+
import { getOrCreateGatewayIdentity, init_gateway_identity_repository, signGatewayPayload } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
6
|
+
import { pairingClientKey, publicDeviceRateLimit } from "../middleware/public-device-rate-limit.js";
|
|
7
7
|
import { DevicePairingError, cancelDevicePairingSetup, decideDevicePairingRequest, operateDevicePairingRequest, readDevicePairingSetup, submitDevicePairingRequest } from "../../../storage/sqlite/device-pairing-approval.js";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { bodyLimit } from "hono/body-limit";
|
|
11
|
-
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
12
11
|
//#region src/gateway/hono/routes/device-pairing-approval.ts
|
|
13
12
|
init_src();
|
|
14
13
|
init_gateway_identity_repository();
|
|
15
|
-
|
|
16
|
-
let remoteAddress;
|
|
17
|
-
try {
|
|
18
|
-
remoteAddress = getConnInfo(c).remote.address;
|
|
19
|
-
} catch {
|
|
20
|
-
remoteAddress = void 0;
|
|
21
|
-
}
|
|
22
|
-
const proxy = options?.getTrustedProxyContext?.();
|
|
23
|
-
return resolveClientIpFromRequest({
|
|
24
|
-
remoteAddress,
|
|
25
|
-
getHeader: (name) => c.req.header(name),
|
|
26
|
-
trustedProxies: proxy?.trustedProxies,
|
|
27
|
-
allowRealIpFallback: proxy?.allowRealIpFallback
|
|
28
|
-
});
|
|
29
|
-
}
|
|
14
|
+
init_rate_limit();
|
|
30
15
|
function pairingBlocked(c, key) {
|
|
31
16
|
const blocked = buckets.pairingExchange().check(key);
|
|
32
17
|
if (!blocked.blocked) return void 0;
|
|
@@ -63,7 +48,7 @@ function registerPairingApprovalPublicRoutes(app, options) {
|
|
|
63
48
|
"cancel"
|
|
64
49
|
]) {
|
|
65
50
|
const path = action === "request" ? "/api/device-pairing/requests" : `/api/device-pairing/requests/:id/${action}`;
|
|
66
|
-
app.post(path, bodyLimit({ maxSize: 4 * 1024 }), async (c) => {
|
|
51
|
+
app.post(path, publicDeviceRateLimit("pairing", options), bodyLimit({ maxSize: 4 * 1024 }), async (c) => {
|
|
67
52
|
const clientKey = pairingClientKey(c, options);
|
|
68
53
|
const blocked = pairingBlocked(c, clientKey);
|
|
69
54
|
if (blocked) return blocked;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { browserPairingInvitationPayloadSchema, devicePairingTargetKindSchema, formatBrowserPairingInvitation, formatMobilePairingInvitation } from "../../../../packages/gateway-contract/src/device-pairing.js";
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { buckets } from "../../rate-limit/buckets.js";
|
|
4
|
+
import { init_rate_limit } from "../../rate-limit/index.js";
|
|
5
|
+
import { DeviceRefreshRateLimitError, init_device_access_repository, listDevices, revokeDevice, rotateDeviceRefreshToken } from "../../../storage/sqlite/device-access-repository.js";
|
|
4
6
|
import { getGatewayIdentityPublicKeyRaw, getOrCreateGatewayIdentity, init_gateway_identity_repository, signGatewayPayload } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
5
7
|
import { createDevicePairingSetup, init_device_pairing_repository, isDevicePairingSetupActive } from "../../../storage/sqlite/device-pairing-repository.js";
|
|
6
8
|
import { resolveSecureDeviceRoutes } from "../../device-routes.js";
|
|
7
|
-
import { buckets } from "../../rate-limit/buckets.js";
|
|
8
|
-
import "../../rate-limit/index.js";
|
|
9
9
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
10
|
-
import { pairingClientKey,
|
|
10
|
+
import { pairingClientKey, publicDeviceRateLimit } from "../middleware/public-device-rate-limit.js";
|
|
11
|
+
import { registerPairingApprovalAdminRoutes, registerPairingApprovalPublicRoutes } from "./device-pairing-approval.js";
|
|
11
12
|
import os from "node:os";
|
|
12
13
|
import { z } from "zod";
|
|
13
14
|
import { bodyLimit } from "hono/body-limit";
|
|
@@ -16,18 +17,20 @@ init_src();
|
|
|
16
17
|
init_device_access_repository();
|
|
17
18
|
init_device_pairing_repository();
|
|
18
19
|
init_gateway_identity_repository();
|
|
20
|
+
init_rate_limit();
|
|
19
21
|
const refreshRequestSchema = z.strictObject({
|
|
20
22
|
refreshToken: z.string().min(1).max(256),
|
|
21
23
|
timestamp: z.number().int().positive(),
|
|
22
24
|
nonce: z.string().min(16).max(128),
|
|
23
25
|
requestId: z.string().uuid(),
|
|
24
26
|
nextRefreshToken: z.string().min(80).max(256),
|
|
25
|
-
signature: z.string().min(1).max(256)
|
|
27
|
+
signature: z.string().min(1).max(256),
|
|
28
|
+
requestProofVersion: z.literal(1).optional()
|
|
26
29
|
});
|
|
27
30
|
const pairingProbeSchema = z.strictObject({ pairingId: z.string().uuid() });
|
|
28
31
|
const pairingSetupSchema = z.strictObject({ targetKind: devicePairingTargetKindSchema });
|
|
29
32
|
function registerDeviceAuthPublicRoutes(app, options) {
|
|
30
|
-
app.post("/api/gateway-identity/challenge", bodyLimit({ maxSize: 512 }), async (c) => {
|
|
33
|
+
app.post("/api/gateway-identity/challenge", publicDeviceRateLimit("challenge", options), bodyLimit({ maxSize: 512 }), async (c) => {
|
|
31
34
|
const budget = buckets.identityChallenge().consume("gateway");
|
|
32
35
|
if (!budget.allowed) {
|
|
33
36
|
c.header("Retry-After", String(Math.ceil(budget.retryAfterMs / 1e3)));
|
|
@@ -40,6 +43,8 @@ function registerDeviceAuthPublicRoutes(app, options) {
|
|
|
40
43
|
purpose: "gateway-route-v1",
|
|
41
44
|
gatewayId: identity.id,
|
|
42
45
|
nonce: parsed.data.nonce,
|
|
46
|
+
serverTime: Date.now(),
|
|
47
|
+
requestProofVersion: 1,
|
|
43
48
|
expiresAt: Date.now() + 3e4
|
|
44
49
|
})).toString("base64url");
|
|
45
50
|
c.header("Cache-Control", "no-store");
|
|
@@ -49,7 +54,7 @@ function registerDeviceAuthPublicRoutes(app, options) {
|
|
|
49
54
|
});
|
|
50
55
|
});
|
|
51
56
|
registerPairingApprovalPublicRoutes(app, options);
|
|
52
|
-
app.post("/api/device-auth/refresh", async (c) => {
|
|
57
|
+
app.post("/api/device-auth/refresh", publicDeviceRateLimit("refresh", options), bodyLimit({ maxSize: 4096 }), async (c) => {
|
|
53
58
|
const parsed = refreshRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
54
59
|
if (!parsed.success) return c.json({
|
|
55
60
|
ok: false,
|
|
@@ -66,6 +71,7 @@ function registerDeviceAuthPublicRoutes(app, options) {
|
|
|
66
71
|
requestId: parsed.data.requestId,
|
|
67
72
|
nonce: parsed.data.nonce,
|
|
68
73
|
expiresAt: Date.now() + 3e4,
|
|
74
|
+
requestProofVersion: parsed.data.requestProofVersion ?? 0,
|
|
69
75
|
tokens
|
|
70
76
|
})).toString("base64url");
|
|
71
77
|
return c.json({
|
|
@@ -74,16 +80,26 @@ function registerDeviceAuthPublicRoutes(app, options) {
|
|
|
74
80
|
signature: signGatewayPayload(signedPayload)
|
|
75
81
|
});
|
|
76
82
|
} catch (error) {
|
|
83
|
+
if (error instanceof DeviceRefreshRateLimitError) {
|
|
84
|
+
c.header("Retry-After", String(Math.max(1, Math.ceil(error.retryAfterMs / 1e3))));
|
|
85
|
+
return c.json({
|
|
86
|
+
ok: false,
|
|
87
|
+
error: {
|
|
88
|
+
code: "RATE_LIMITED",
|
|
89
|
+
message: "Too many requests"
|
|
90
|
+
}
|
|
91
|
+
}, 429);
|
|
92
|
+
}
|
|
77
93
|
return c.json({
|
|
78
94
|
ok: false,
|
|
79
95
|
error: {
|
|
80
96
|
code: "REFRESH_DENIED",
|
|
81
|
-
message:
|
|
97
|
+
message: "Refresh denied"
|
|
82
98
|
}
|
|
83
99
|
}, 401);
|
|
84
100
|
}
|
|
85
101
|
});
|
|
86
|
-
app.post("/api/device-pairing/probe", bodyLimit({ maxSize: 512 }), async (c) => {
|
|
102
|
+
app.post("/api/device-pairing/probe", publicDeviceRateLimit("pairing", options), bodyLimit({ maxSize: 512 }), async (c) => {
|
|
87
103
|
const clientKey = pairingClientKey(c, options);
|
|
88
104
|
const blocked = buckets.pairingExchange().check(clientKey);
|
|
89
105
|
if (blocked.blocked) {
|
|
@@ -71,6 +71,7 @@ function registerEndpointToolRoutes(authenticated, deps) {
|
|
|
71
71
|
...lastSeenAt ? { lastSeenAt } : {},
|
|
72
72
|
access: access ? {
|
|
73
73
|
scopes: access.scopes,
|
|
74
|
+
requestProofVersion: access.requestProofVersion,
|
|
74
75
|
createdAt: access.createdAt,
|
|
75
76
|
...access.lastSeenAt ? { lastSeenAt: access.lastSeenAt } : {},
|
|
76
77
|
...access.revokedAt ? { revokedAt: access.revokedAt } : {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
1
2
|
import { isManagedConnectorServer } from "../../../connectors/materialize.js";
|
|
2
3
|
import { loadMergedMcpConfig } from "../../../agent/mcp/config.js";
|
|
3
|
-
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
4
4
|
//#region src/gateway/hono/routes/mcp.ts
|
|
5
5
|
function registerMcpRoutes(app, deps) {
|
|
6
6
|
app.get("/api/mcp/servers", (c) => {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction } from "../../../storage/sqlite/transaction.js";
|
|
2
|
+
import { getSessionMetadata } from "../../../storage/sqlite/session-read-repository.js";
|
|
3
|
+
import { init_session_repository } from "../../../storage/sqlite/session-repository.js";
|
|
4
|
+
import { getSessionConfig, init_config_repository } from "../../../storage/sqlite/config-repository.js";
|
|
5
|
+
import { bindOwnerIdentity } from "../../../user-context/identity-bindings.js";
|
|
6
|
+
import { canUseKnowledge, knowledgeExclusion } from "../../../knowledge-memory/usage-policy.js";
|
|
7
|
+
import { getKnowledgeItem } from "../../../knowledge-memory/repository.js";
|
|
8
|
+
import { init_config, resolveKnowledgeReadPolicy } from "../../../user-context/config.js";
|
|
9
|
+
import { enqueueConversationLearning, learningStatus } from "../../../memory-learning/repository.js";
|
|
10
|
+
import "../../../knowledge-memory/index.js";
|
|
11
|
+
import { resolveEffectiveAgentProfileForSession } from "../../../config/agent-profile.js";
|
|
12
|
+
//#region src/gateway/hono/routes/memory-learning.ts
|
|
13
|
+
init_config_repository();
|
|
14
|
+
init_transaction();
|
|
15
|
+
init_session_repository();
|
|
16
|
+
init_config();
|
|
17
|
+
function registerMemoryLearningRoutes(app, deps) {
|
|
18
|
+
app.get("/api/memory-learning/status", (c) => c.json(learningStatus(deps.service.currentConfig)));
|
|
19
|
+
app.get("/api/memory-learning/jobs/:id", (c) => {
|
|
20
|
+
const job = getSqliteDatabase().prepare(`SELECT job_id AS id, state, attempts, error_code AS errorCode,
|
|
21
|
+
created_at AS createdAt, updated_at AS updatedAt FROM memory_learning_jobs WHERE job_id = ? AND principal_id = 'local-owner'`).get(c.req.param("id"));
|
|
22
|
+
return job ? c.json({ job }) : c.json({ error: "Learning job not found" }, 404);
|
|
23
|
+
});
|
|
24
|
+
app.post("/api/memory-learning/rebuild", deps.strictRateLimitMiddleware, async (c) => {
|
|
25
|
+
const input = await c.req.json().catch(() => null);
|
|
26
|
+
if (!input || typeof input.conversationId !== "string") return c.json({ error: "conversationId is required" }, 400);
|
|
27
|
+
if (!getSessionMetadata(input.conversationId)) return c.json({ error: "Conversation not found" }, 404);
|
|
28
|
+
const jobId = enqueueConversationLearning(deps.service.currentConfig, input.conversationId, getSessionConfig(input.conversationId)?.workingDirectoryOverride ?? resolveEffectiveAgentProfileForSession(input.conversationId).resolvedWorkspacePath, true);
|
|
29
|
+
return jobId ? c.json({ jobId }, 202) : c.json({
|
|
30
|
+
queued: false,
|
|
31
|
+
reason: "not_eligible_or_already_queued"
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
app.post("/api/memory-learning/owner-identities", deps.strictRateLimitMiddleware, async (c) => {
|
|
35
|
+
const input = await c.req.json().catch(() => null);
|
|
36
|
+
if (!input || ![
|
|
37
|
+
"channel",
|
|
38
|
+
"accountId",
|
|
39
|
+
"peerId"
|
|
40
|
+
].every((key) => typeof input[key] === "string" && input[key].trim())) return c.json({ error: "channel, accountId and peerId are required" }, 400);
|
|
41
|
+
bindOwnerIdentity(input);
|
|
42
|
+
return c.json({ ok: true });
|
|
43
|
+
});
|
|
44
|
+
app.get("/api/memory-learning/owner-identities", (c) => c.json({ identities: getSqliteDatabase().prepare(`
|
|
45
|
+
SELECT channel, account_id AS accountId, peer_id AS peerId, verified_at AS verifiedAt
|
|
46
|
+
FROM owner_identity_bindings WHERE principal_id = 'local-owner' AND revoked_at IS NULL ORDER BY verified_at DESC`).all() }));
|
|
47
|
+
app.delete("/api/memory-learning/owner-identities", deps.strictRateLimitMiddleware, async (c) => {
|
|
48
|
+
const input = await c.req.json().catch(() => null);
|
|
49
|
+
if (!input || ![
|
|
50
|
+
"channel",
|
|
51
|
+
"accountId",
|
|
52
|
+
"peerId"
|
|
53
|
+
].every((key) => typeof input[key] === "string")) return c.json({ error: "Identity fields are required" }, 400);
|
|
54
|
+
getSqliteDatabase().prepare("UPDATE owner_identity_bindings SET revoked_at = ? WHERE channel = ? AND account_id = ? AND peer_id = ?").run(Date.now(), input.channel, input.accountId, input.peerId);
|
|
55
|
+
return c.json({ ok: true });
|
|
56
|
+
});
|
|
57
|
+
app.get("/api/knowledge-memory/:id/evidence", (c) => {
|
|
58
|
+
const item = getKnowledgeItem(c.req.param("id"));
|
|
59
|
+
const context = {
|
|
60
|
+
agentId: c.req.query("agentId") ?? item?.sourceAgentId ?? "main",
|
|
61
|
+
workspaceId: c.req.query("workspaceId") ?? (item?.scope.type === "workspace" ? item.scope.id : ""),
|
|
62
|
+
conversationId: c.req.query("conversationId") ?? item?.sourceConversationId ?? "",
|
|
63
|
+
projectId: c.req.query("projectId") ?? (item?.scope.type === "project" ? item.scope.id : void 0)
|
|
64
|
+
};
|
|
65
|
+
if (!item || !canUseKnowledge(item, context, resolveKnowledgeReadPolicy(deps.service.currentConfig.userContext.knowledgeMemory))) return c.json({
|
|
66
|
+
error: "Knowledge evidence not available",
|
|
67
|
+
reason: item ? knowledgeExclusion(item, context, resolveKnowledgeReadPolicy(deps.service.currentConfig.userContext.knowledgeMemory)) : "not_found"
|
|
68
|
+
}, 404);
|
|
69
|
+
const evidence = getSqliteDatabase().prepare(`SELECT e.source_type AS sourceType, e.source_ref AS sourceRef,
|
|
70
|
+
e.observed_at AS observedAt, e.redacted_excerpt AS excerpt FROM knowledge_evidence_links l
|
|
71
|
+
JOIN context_evidence e ON e.evidence_id = l.evidence_id WHERE l.knowledge_id = ?`).all(item.id);
|
|
72
|
+
return c.json({ evidence });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { registerMemoryLearningRoutes };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
1
2
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
2
3
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
3
4
|
import { computerModelProfile, init_model_policy, isDedicatedComputerModel } from "../../../computer/model-policy.js";
|
|
@@ -9,7 +10,6 @@ import "../../../providers/constants.js";
|
|
|
9
10
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
10
11
|
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured, isProviderConfiguredSync } from "../../../providers/index.js";
|
|
11
12
|
import { XopcCloudAccountError, XopcCloudAccountService } from "../../../providers/xopc-cloud-account-service.js";
|
|
12
|
-
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
13
13
|
import { buildCapabilityPlansForConfig } from "../../../capabilities/readiness/from-config.js";
|
|
14
14
|
import "../../../capabilities/readiness/index.js";
|
|
15
15
|
import { getModelThinking } from "../../../providers/model-thinking.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NoteDeleteOutputSchema, NoteGetOutputSchema, ProductReadContracts } from "../../../../packages/gateway-contract/src/capabilities.js";
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
-
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
4
|
-
import "../../../capabilities/runtime/dispatcher.js";
|
|
5
3
|
import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
|
|
6
4
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
5
|
+
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
6
|
+
import "../../../capabilities/runtime/dispatcher.js";
|
|
7
7
|
import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
|
|
8
8
|
import { getShareStore } from "../../../share/share-store.js";
|
|
9
9
|
import { resolveShareUrl } from "../../../share/share-url.js";
|
|
@@ -40,6 +40,7 @@ const OnboardingSchema = z.object({
|
|
|
40
40
|
draft: PersonalOnboardingDraftSchema
|
|
41
41
|
}).strict();
|
|
42
42
|
const ProfileSchema = z.object({
|
|
43
|
+
voiceCallPreferences: z.object({ openingGreetingEnabled: z.boolean() }).strict().optional(),
|
|
43
44
|
revision: z.number().int().positive(),
|
|
44
45
|
displayName: z.string().trim().min(1).max(60),
|
|
45
46
|
appearance: PersonalAppearanceSchema,
|
|
@@ -348,7 +349,7 @@ function registerPersonalAgentRoutes(authenticated, deps) {
|
|
|
348
349
|
ok: false,
|
|
349
350
|
error: "Invalid profile"
|
|
350
351
|
}, 400);
|
|
351
|
-
const { revision, displayName, appearance, preferences, voicePreference } = parsed.data;
|
|
352
|
+
const { revision, displayName, appearance, preferences, voicePreference, voiceCallPreferences } = parsed.data;
|
|
352
353
|
if (voicePreference) {
|
|
353
354
|
const { resolveStreamingTts } = await import("../../../voice/realtime/runtime.js");
|
|
354
355
|
const route = resolveStreamingTts(deps.service.currentConfig);
|
|
@@ -364,7 +365,7 @@ function registerPersonalAgentRoutes(authenticated, deps) {
|
|
|
364
365
|
error: "Selected voice is unavailable"
|
|
365
366
|
}, 400);
|
|
366
367
|
}
|
|
367
|
-
const updated = await patchPersonalProfile(deps.service, ownerId, revision, displayName, preferences, appearance, voicePreference);
|
|
368
|
+
const updated = await patchPersonalProfile(deps.service, ownerId, revision, displayName, preferences, appearance, voicePreference, voiceCallPreferences);
|
|
368
369
|
return updated ? c.json({
|
|
369
370
|
ok: true,
|
|
370
371
|
payload: updated
|
|
@@ -7,12 +7,12 @@ import { loadTranscriptRowsForSession } from "../../../storage/sqlite/transcript
|
|
|
7
7
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
8
8
|
import { ActivityService } from "../../../activity/service.js";
|
|
9
9
|
import "../../../activity/index.js";
|
|
10
|
-
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
11
|
-
import "../../../capabilities/runtime/dispatcher.js";
|
|
12
|
-
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
13
10
|
import { listKnowledgeItems, writeKnowledgeItem } from "../../../knowledge-memory/repository.js";
|
|
14
11
|
import "../../../knowledge-memory/index.js";
|
|
12
|
+
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
15
13
|
import { TaskReadModelProjector } from "../../../tasks/task-read-model-projector.js";
|
|
14
|
+
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
15
|
+
import "../../../capabilities/runtime/dispatcher.js";
|
|
16
16
|
import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError } from "../../../projects/workspace-project.js";
|
|
17
17
|
import { inferProjectExecutionMode, inferProjectKind } from "../../../projects/project-kind.js";
|
|
18
18
|
import { ProjectDeletionBlockedError, ProjectWorkspaceInUseError } from "../../../projects/project-service.js";
|
|
@@ -25,18 +25,18 @@ function secretsEqual(actual, expected) {
|
|
|
25
25
|
}
|
|
26
26
|
function registerPublicGatewayRoutes(app, service) {
|
|
27
27
|
app.get("/health", (c) => {
|
|
28
|
-
|
|
28
|
+
const health = service.getHealth();
|
|
29
|
+
return c.json({
|
|
30
|
+
status: health.ready ? "ok" : "starting",
|
|
31
|
+
ready: health.ready
|
|
32
|
+
});
|
|
29
33
|
});
|
|
30
34
|
/** Public liveness probe (no auth) — minimal payload for CLI / load balancers. */
|
|
31
35
|
app.get("/api/health", (c) => {
|
|
32
36
|
const health = service.getHealth();
|
|
33
37
|
return c.json({
|
|
34
38
|
status: health.ready ? "ok" : "starting",
|
|
35
|
-
ready: health.ready
|
|
36
|
-
httpListening: health.httpListening,
|
|
37
|
-
version: health.version,
|
|
38
|
-
uptime: health.uptime,
|
|
39
|
-
startupDurationMs: health.startupDurationMs
|
|
39
|
+
ready: health.ready
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
app.post("/api/connectors/composio/webhook", async (c) => {
|
|
@@ -5,9 +5,9 @@ import { endpointContextSchema } from "../../../../packages/gateway-contract/src
|
|
|
5
5
|
import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packages/gateway-contract/src/user-turn-document.js";
|
|
6
6
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
7
7
|
import { endpointTurnClaimSchema, init_src as init_src$1 } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
8
|
+
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
8
9
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
9
10
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
10
|
-
import { init_providers, resolveModel } from "../../../providers/index.js";
|
|
11
11
|
import { getModelThinking } from "../../../providers/model-thinking.js";
|
|
12
12
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
13
13
|
import { isTaskDestructiveCommand } from "../../../session/reset-triggers.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getClientIpFromHeaders, init_loopback } from "../../security/loopback.js";
|
|
1
2
|
import { loadCompactionSourceSnapshot } from "../../../storage/sqlite/transcript-repository.js";
|
|
2
3
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
3
4
|
import { FileServiceError } from "../../../files/file-service.js";
|
|
@@ -16,7 +17,6 @@ import { resolveReverseProxyPublicUrl } from "../../public-url.js";
|
|
|
16
17
|
import { audienceDefaults, cleanupStagedSite, decideShareKind, forgetStagedSite, makeDescription, makeTitle, probeShareTarget, rememberStagedSite, stageSingleHtmlAsSite } from "../../../share/share-auto.js";
|
|
17
18
|
import { deleteThumbnail, placeholderSvg, readThumbnail, scheduleThumbnail, thumbnailContentType, thumbnailExists } from "../../../share/share-thumbnail.js";
|
|
18
19
|
import { getGatewayFileSpaceService } from "../../file-space-service.js";
|
|
19
|
-
import { getClientIpFromHeaders } from "../../security/loopback.js";
|
|
20
20
|
import { SHARED_HTML_CSP } from "../../security/csp.js";
|
|
21
21
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
22
22
|
import { renderFolderLandingPage, renderShareExpiredPage, renderShareLandingPage, renderSnapshotShareLandingPage } from "../../../share/share-landing.js";
|
|
@@ -31,6 +31,7 @@ import { createHash } from "node:crypto";
|
|
|
31
31
|
import { stat } from "node:fs/promises";
|
|
32
32
|
import { Readable } from "node:stream";
|
|
33
33
|
//#region src/gateway/hono/routes/shares.ts
|
|
34
|
+
init_loopback();
|
|
34
35
|
init_sqlite();
|
|
35
36
|
function getShareUrlContext(service) {
|
|
36
37
|
const gateway = service.currentConfig.gateway;
|
|
@@ -6,9 +6,9 @@ import { hasGatewayScope, init_gateway_scopes } from "../../security/gateway-sco
|
|
|
6
6
|
import { enqueueTaskChangedEvent, init_task_change_events } from "../../../tasks/task-change-events.js";
|
|
7
7
|
import { TaskRepository, init_task_repository } from "../../../tasks/task-repository.js";
|
|
8
8
|
import { TaskRunRepository, init_task_run_repository } from "../../../tasks/task-run-repository.js";
|
|
9
|
+
import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
|
|
9
10
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
10
11
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
11
|
-
import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
|
|
12
12
|
import { TaskCriterionReviewRepository } from "../../../tasks/task-criterion-review-repository.js";
|
|
13
13
|
import { TaskContextMutationOutputSchema } from "../../../tasks/capabilities/relations.js";
|
|
14
14
|
import { TaskDeleteOutputSchema } from "../../../tasks/capabilities/management.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { listConnectorLearningJobs } from "../../../storage/sqlite/connector-learning-repository.js";
|
|
2
2
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
3
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
4
|
-
import { getWorkDiscoveryRun } from "../../../work-discovery/repository.js";
|
|
5
4
|
import { getConnectorUnderstandingSourceRun } from "../../../user-context/sources/repository.js";
|
|
5
|
+
import { getWorkDiscoveryRun } from "../../../work-discovery/repository.js";
|
|
6
6
|
import { isLocalUnderstandingSourceId } from "../../../user-context/sources/local-source-contract.js";
|
|
7
7
|
import { normalizeUnderstandingSourceItems } from "../../../work-discovery/service.js";
|
|
8
8
|
import { UnderstandingRefreshService } from "../../../user-context/sources/refresh-service.js";
|