@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
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled } from "../rate-limit/env-flags.js";
|
|
4
|
+
import { init_rate_limit } from "../rate-limit/index.js";
|
|
3
5
|
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../auth.js";
|
|
4
6
|
import { resolveGatewayListenPlan } from "../listen.js";
|
|
5
7
|
import { collectExposureConflicts, isRemoteGatewayInsecure, isTailnetBindUnavailable } from "../../remote-access/exposure-guards.js";
|
|
6
|
-
import { isAuthRateLimitGloballyDisabled, isGatewayStrictSecurityEnabled } from "../rate-limit/env-flags.js";
|
|
7
|
-
import "../rate-limit/index.js";
|
|
8
8
|
import { assertGatewayRuntimeConfig } from "../runtime-config.js";
|
|
9
9
|
//#region src/gateway/security/audit.ts
|
|
10
|
+
init_rate_limit();
|
|
10
11
|
init_logger();
|
|
11
12
|
const log = createLogger("SecurityAudit");
|
|
12
13
|
/** Minimum token length to resist brute-force even with rate limiting. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { isLoopbackHost } from "../host.js";
|
|
1
|
+
import { init_host, isLoopbackHost } from "../host.js";
|
|
2
2
|
import { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
|
3
3
|
//#region src/gateway/security/browser-session.ts
|
|
4
|
+
init_host();
|
|
4
5
|
function origin(c) {
|
|
5
6
|
return new URL(`http://${c.req.header("host") ?? new URL(c.req.url).host}`);
|
|
6
7
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import type { DeviceRecord } from '../../storage/sqlite/device-access-repository.js';
|
|
3
|
+
export declare const REQUEST_PROOF_WINDOW_MS = 120000;
|
|
4
|
+
export declare const PROOF_HEADER = "X-Xopc-Proof";
|
|
5
|
+
export declare const SIGNED_REQUEST_HEADERS: readonly ["content-type", "idempotency-key", "x-xopc-expected-session-key", "x-endpoint-id", "x-endpoint-upload-token"];
|
|
6
|
+
/** Bounds buffered uploads through route completion, after signature verification. */
|
|
7
|
+
export declare function acquireProofBodyBudget(deviceId: string): (() => void) | undefined;
|
|
8
|
+
export declare function proofDigest(bytes: crypto.BinaryLike): string;
|
|
9
|
+
export interface RequestProof {
|
|
10
|
+
timestamp: number;
|
|
11
|
+
nonce: string;
|
|
12
|
+
digest: string;
|
|
13
|
+
signature: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function parseRequestProof(header: string | undefined): RequestProof | undefined;
|
|
16
|
+
export declare function requestProofMessage(input: {
|
|
17
|
+
gatewayId: string;
|
|
18
|
+
credential: string;
|
|
19
|
+
method: string;
|
|
20
|
+
target: string;
|
|
21
|
+
headers: (name: string) => string | undefined;
|
|
22
|
+
proof: Pick<RequestProof, 'timestamp' | 'nonce' | 'digest'>;
|
|
23
|
+
}): string;
|
|
24
|
+
export declare function verifyRequestProofSignature(device: DeviceRecord, proof: RequestProof, message: string): boolean;
|
|
25
|
+
/** The unique insert happens before business effects; expiry includes future-dated proofs. */
|
|
26
|
+
export declare function consumeRequestNonce(deviceId: string, proof: RequestProof, now?: number): boolean;
|
|
27
|
+
/** Native WebSocket upgrades bind the first ticket to the device key without another round trip. */
|
|
28
|
+
export declare function verifyDeviceConnectionProof(principalId: string, ticket: string, path: string, header: string | undefined): boolean;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
+
import { getDevice, init_device_access_repository } from "../../storage/sqlite/device-access-repository.js";
|
|
3
|
+
import { getOrCreateGatewayIdentity, init_gateway_identity_repository } from "../../storage/sqlite/gateway-identity-repository.js";
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
//#region src/gateway/security/device-request-proof.ts
|
|
6
|
+
init_device_access_repository();
|
|
7
|
+
init_gateway_identity_repository();
|
|
8
|
+
init_transaction();
|
|
9
|
+
const REQUEST_PROOF_WINDOW_MS = 12e4;
|
|
10
|
+
const PROOF_HEADER = "X-Xopc-Proof";
|
|
11
|
+
const SIGNED_REQUEST_HEADERS = [
|
|
12
|
+
"content-type",
|
|
13
|
+
"idempotency-key",
|
|
14
|
+
"x-xopc-expected-session-key",
|
|
15
|
+
"x-endpoint-id",
|
|
16
|
+
"x-endpoint-upload-token"
|
|
17
|
+
];
|
|
18
|
+
const MAX_PENDING_NONCES = 1e5;
|
|
19
|
+
const nonceBudgets = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
let activeProofBodies = 0;
|
|
21
|
+
const activeDeviceBodies = /* @__PURE__ */ new Map();
|
|
22
|
+
/** Bounds buffered uploads through route completion, after signature verification. */
|
|
23
|
+
function acquireProofBodyBudget(deviceId) {
|
|
24
|
+
const count = activeDeviceBodies.get(deviceId) ?? 0;
|
|
25
|
+
if (activeProofBodies >= 16 || count >= 8) return void 0;
|
|
26
|
+
activeProofBodies++;
|
|
27
|
+
activeDeviceBodies.set(deviceId, count + 1);
|
|
28
|
+
let held = true;
|
|
29
|
+
return () => {
|
|
30
|
+
if (!held) return;
|
|
31
|
+
held = false;
|
|
32
|
+
activeProofBodies--;
|
|
33
|
+
const remaining = (activeDeviceBodies.get(deviceId) ?? 1) - 1;
|
|
34
|
+
if (remaining) activeDeviceBodies.set(deviceId, remaining);
|
|
35
|
+
else activeDeviceBodies.delete(deviceId);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function proofDigest(bytes) {
|
|
39
|
+
return crypto.createHash("sha256").update(bytes).digest("hex");
|
|
40
|
+
}
|
|
41
|
+
function parseRequestProof(header) {
|
|
42
|
+
if (!header || header.length > 256) return void 0;
|
|
43
|
+
const parts = header.split(".");
|
|
44
|
+
if (parts.length !== 4 || !/^\d{13}$/.test(parts[0]) || !/^[A-Za-z0-9_-]{22,64}$/.test(parts[1]) || !/^[a-f0-9]{64}$/.test(parts[2]) || !/^[A-Za-z0-9_-]{86}$/.test(parts[3])) return void 0;
|
|
45
|
+
return {
|
|
46
|
+
timestamp: Number(parts[0]),
|
|
47
|
+
nonce: parts[1],
|
|
48
|
+
digest: parts[2],
|
|
49
|
+
signature: parts[3]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function requestProofMessage(input) {
|
|
53
|
+
return [
|
|
54
|
+
"xopc-request-v1",
|
|
55
|
+
input.gatewayId,
|
|
56
|
+
proofDigest(input.credential),
|
|
57
|
+
input.method,
|
|
58
|
+
input.target,
|
|
59
|
+
input.proof.digest,
|
|
60
|
+
...SIGNED_REQUEST_HEADERS.map((name) => input.headers(name) ?? ""),
|
|
61
|
+
String(input.proof.timestamp),
|
|
62
|
+
input.proof.nonce
|
|
63
|
+
].join("\n");
|
|
64
|
+
}
|
|
65
|
+
function verifyRequestProofSignature(device, proof, message) {
|
|
66
|
+
try {
|
|
67
|
+
const key = crypto.createPublicKey({
|
|
68
|
+
key: device.publicKeyJwk,
|
|
69
|
+
format: "jwk"
|
|
70
|
+
});
|
|
71
|
+
return crypto.verify("sha256", Buffer.from(message), {
|
|
72
|
+
key,
|
|
73
|
+
dsaEncoding: "ieee-p1363"
|
|
74
|
+
}, Buffer.from(proof.signature, "base64url"));
|
|
75
|
+
} catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** The unique insert happens before business effects; expiry includes future-dated proofs. */
|
|
80
|
+
function consumeRequestNonce(deviceId, proof, now = Date.now()) {
|
|
81
|
+
return runSqliteWriteTransaction((db) => {
|
|
82
|
+
let budget = nonceBudgets.get(db);
|
|
83
|
+
if (!budget || now >= budget.cleanupAt) {
|
|
84
|
+
db.prepare("DELETE FROM device_request_nonces WHERE expires_at < ?").run(now);
|
|
85
|
+
const count = db.prepare("SELECT count(*) AS total FROM device_request_nonces").get();
|
|
86
|
+
budget = {
|
|
87
|
+
cleanupAt: now + 3e4,
|
|
88
|
+
total: count.total
|
|
89
|
+
};
|
|
90
|
+
nonceBudgets.set(db, budget);
|
|
91
|
+
}
|
|
92
|
+
if (Math.abs(now - proof.timestamp) > 12e4 || budget.total >= MAX_PENDING_NONCES) return false;
|
|
93
|
+
const inserted = db.prepare("INSERT OR IGNORE INTO device_request_nonces (device_id, nonce, expires_at) VALUES (?, ?, ?)").run(deviceId, proof.nonce, proof.timestamp + REQUEST_PROOF_WINDOW_MS).changes === 1;
|
|
94
|
+
if (inserted) budget.total++;
|
|
95
|
+
return inserted;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Native WebSocket upgrades bind the first ticket to the device key without another round trip. */
|
|
99
|
+
function verifyDeviceConnectionProof(principalId, ticket, path, header) {
|
|
100
|
+
let device;
|
|
101
|
+
try {
|
|
102
|
+
device = getDevice(principalId);
|
|
103
|
+
} catch {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (!device) return !header;
|
|
107
|
+
if (device.revokedAt !== void 0) return false;
|
|
108
|
+
if (!device.requestProofVersion && !header) return true;
|
|
109
|
+
const proof = parseRequestProof(header);
|
|
110
|
+
if (!proof || Math.abs(Date.now() - proof.timestamp) > 12e4 || proof.digest !== proofDigest("")) return false;
|
|
111
|
+
const message = requestProofMessage({
|
|
112
|
+
gatewayId: getOrCreateGatewayIdentity().id,
|
|
113
|
+
credential: ticket,
|
|
114
|
+
method: "CONNECT",
|
|
115
|
+
target: path,
|
|
116
|
+
headers: () => void 0,
|
|
117
|
+
proof
|
|
118
|
+
});
|
|
119
|
+
return verifyRequestProofSignature(device, proof, message) && consumeRequestNonce(device.id, proof);
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
export { PROOF_HEADER, REQUEST_PROOF_WINDOW_MS, SIGNED_REQUEST_HEADERS, acquireProofBodyBudget, consumeRequestNonce, parseRequestProof, proofDigest, requestProofMessage, verifyDeviceConnectionProof, verifyRequestProofSignature };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_host, isLoopbackHost } from "../host.js";
|
|
2
3
|
//#region src/gateway/security/loopback.ts
|
|
3
|
-
/**
|
|
4
|
-
* Loopback / browser-origin classification helpers used by rate-limit policy
|
|
5
|
-
* and other security middleware. Pure functions, no I/O.
|
|
6
|
-
*/
|
|
7
4
|
function isLoopbackClientIp(clientIp) {
|
|
8
5
|
if (!clientIp || clientIp === "unknown") return false;
|
|
9
6
|
const trimmed = clientIp.trim();
|
|
@@ -39,5 +36,9 @@ function getClientIpFromHeaders(headers) {
|
|
|
39
36
|
if (cf) return cf;
|
|
40
37
|
return "unknown";
|
|
41
38
|
}
|
|
39
|
+
var init_loopback = __esmMin((() => {
|
|
40
|
+
init_host();
|
|
41
|
+
}));
|
|
42
42
|
//#endregion
|
|
43
|
-
|
|
43
|
+
init_loopback();
|
|
44
|
+
export { getClientIpFromHeaders, init_loopback, isLoopbackBrowserOrigin, isLoopbackClientIp, isLoopbackEmbeddedBrowserClient };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
2
2
|
import { init_session_repository } from "../../storage/sqlite/session-repository.js";
|
|
3
|
-
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
4
3
|
import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
4
|
+
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
5
5
|
import { getPersonalAgentByConversation } from "../../personal-agent/repository.js";
|
|
6
6
|
import { resolveProjectAgentId } from "../../projects/project-agent.js";
|
|
7
7
|
import "../../projects/index.js";
|
|
@@ -8,6 +8,10 @@ import { init_logger } from "../utils/logger.js";
|
|
|
8
8
|
import { closeXopcDatabase } from "../storage/sqlite/connection.js";
|
|
9
9
|
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
10
10
|
import { getBrowserTabBindingById, init_browser_tab_binding_repository } from "../storage/sqlite/browser-tab-binding-repository.js";
|
|
11
|
+
import { buckets } from "./rate-limit/buckets.js";
|
|
12
|
+
import { init_host, resolveEffectiveGatewayPort } from "./host.js";
|
|
13
|
+
import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
|
|
14
|
+
import { init_rate_limit } from "./rate-limit/index.js";
|
|
11
15
|
import { bumpSessionInputRevision, findSessionInput, init_session_input_repository, insertSessionInput } from "../storage/sqlite/session-input-repository.js";
|
|
12
16
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
13
17
|
import { TaskRunRepository, init_task_run_repository } from "../tasks/task-run-repository.js";
|
|
@@ -16,21 +20,22 @@ import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js
|
|
|
16
20
|
import { init_session_repository, listSessionMetadata, patchSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
17
21
|
import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
|
|
18
22
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
23
|
+
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
24
|
+
import { init_config, resolveKnowledgeReadPolicy } from "../user-context/config.js";
|
|
25
|
+
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
26
|
+
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
27
|
+
import "../knowledge-memory/index.js";
|
|
19
28
|
import { normalizeAgentId } from "../agent-catalog/id.js";
|
|
20
29
|
import { init_agent_scope, listAgentEntries, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
21
|
-
import {
|
|
30
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
31
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
22
32
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
23
33
|
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
24
34
|
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
25
|
-
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
26
|
-
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
27
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
28
35
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
29
36
|
import { flushTracing } from "../observability/runtime.js";
|
|
30
37
|
import { AI_USAGE_RETENTION_MS, markStaleAiUsageEventsUnknown, pruneAiUsageEvents } from "../storage/sqlite/ai-usage-repository.js";
|
|
31
|
-
import {
|
|
32
|
-
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
33
|
-
import "../knowledge-memory/index.js";
|
|
38
|
+
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
34
39
|
import { getPersonalAgentByConversation } from "../personal-agent/repository.js";
|
|
35
40
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
36
41
|
import { getEmbeddedExecutionSession } from "../agent/embedded/execution-context.js";
|
|
@@ -38,7 +43,6 @@ import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
|
38
43
|
import { ProjectService } from "../projects/project-service.js";
|
|
39
44
|
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
40
45
|
import "../projects/index.js";
|
|
41
|
-
import { resolveEffectiveGatewayPort } from "./host.js";
|
|
42
46
|
import { runMemoryMaintenance } from "../memory-maintenance/service.js";
|
|
43
47
|
import "../memory-maintenance/index.js";
|
|
44
48
|
import { RealtimeExtensionBrowserProvider } from "../browser/providers/realtime-extension.js";
|
|
@@ -74,7 +78,6 @@ import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
|
74
78
|
import { ChannelManager } from "../channels/manager.js";
|
|
75
79
|
import { ChatPreviewService } from "../chat-previews/service.js";
|
|
76
80
|
import "../chat-previews/index.js";
|
|
77
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
78
81
|
import "../config/index.js";
|
|
79
82
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
80
83
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
@@ -91,10 +94,6 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
91
94
|
import "../discussions/index.js";
|
|
92
95
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
93
96
|
import "../endpoint-tools/index.js";
|
|
94
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
95
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
96
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
97
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
98
97
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
99
98
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
100
99
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
@@ -124,9 +123,6 @@ import { wireTunnelEventsToGateway } from "../tunnel/gateway-lifecycle.js";
|
|
|
124
123
|
import { getExposureManager } from "../remote-access/exposure-manager.js";
|
|
125
124
|
import { sanitizeTunnelConfig } from "../tunnel/tunnel-config.js";
|
|
126
125
|
import { assertGatewayAuthNotKnownWeak } from "./security/known-weak-secrets.js";
|
|
127
|
-
import { buckets } from "./rate-limit/buckets.js";
|
|
128
|
-
import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
|
|
129
|
-
import "./rate-limit/index.js";
|
|
130
126
|
import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
131
127
|
import { auditGatewayConfig } from "./security/audit.js";
|
|
132
128
|
import { getXopcCloudCatalogCoordinator } from "../providers/xopc-cloud-catalog-coordinator.js";
|
|
@@ -159,6 +155,10 @@ import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decisio
|
|
|
159
155
|
import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
|
|
160
156
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
161
157
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
158
|
+
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
159
|
+
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
160
|
+
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
161
|
+
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
162
162
|
import crypto from "node:crypto";
|
|
163
163
|
//#region src/gateway/service.ts
|
|
164
164
|
init_session_repository();
|
|
@@ -169,6 +169,8 @@ init_config_repository();
|
|
|
169
169
|
init_changes();
|
|
170
170
|
init_agent_scope();
|
|
171
171
|
init_schema();
|
|
172
|
+
init_host();
|
|
173
|
+
init_rate_limit();
|
|
172
174
|
init_providers();
|
|
173
175
|
init_logger();
|
|
174
176
|
init_log_stream();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { init_host, isLoopbackHost } from "./host.js";
|
|
1
2
|
import { readTailscaleWhoisIdentity } from "../infra/tailscale.js";
|
|
2
|
-
import { isLoopbackHost } from "./host.js";
|
|
3
3
|
//#region src/gateway/tailscale-auth.ts
|
|
4
|
+
init_host();
|
|
4
5
|
function parseTailscaleAuthHeaders(headers) {
|
|
5
6
|
return {
|
|
6
7
|
forwardedFor: headers["x-forwarded-for"]?.split(",")[0]?.trim(),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { isLoopbackHost } from "./host.js";
|
|
1
|
+
import { init_host, isLoopbackHost } from "./host.js";
|
|
2
2
|
import net from "node:net";
|
|
3
3
|
//#region src/gateway/ws-security.ts
|
|
4
4
|
/**
|
|
5
5
|
* WebSocket / gateway URL transport security (OpenClaw-aligned).
|
|
6
6
|
*/
|
|
7
|
+
init_host();
|
|
7
8
|
function isPrivateOrLoopbackHost(hostname) {
|
|
8
9
|
const host = hostname.trim().toLowerCase();
|
|
9
10
|
if (isLoopbackHost(host)) return true;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
2
|
-
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
3
2
|
import { getModelCatalogStore, init_model_catalog_store } from "../providers/model-catalog-store.js";
|
|
4
3
|
import { getAvailableModels, init_providers } from "../providers/index.js";
|
|
5
4
|
import { compareCatalogModels } from "../providers/model-catalog-ranking.js";
|
|
5
|
+
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
6
6
|
import { prepareUpdateGlobalDefaults } from "./global-defaults-admin.js";
|
|
7
7
|
//#region src/gateway/xopc-cloud-capability-setup.ts
|
|
8
8
|
init_repository();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveModelSelector } from "../config/agent-model-intents.js";
|
|
3
3
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
4
4
|
import { completeWithResolvedCredentials, isLocalModelBaseUrl } from "../providers/model-call.js";
|
|
5
|
-
import {
|
|
5
|
+
import { extractAssistantText, getAssistantMessageErrorReason } from "../providers/model-response.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/home-intelligence/generator.ts
|
|
8
8
|
init_agent_scope();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
3
4
|
import { homePatternKey } from "./strategy.js";
|
|
5
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
4
6
|
import { HomeIntelligenceRepository } from "./repository.js";
|
|
5
7
|
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
6
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
7
|
-
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
8
8
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
//#region src/home-intelligence/host.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_paths, resolveSkillsDir } from "../config/paths.js";
|
|
2
1
|
import { listKnowledgeItems } from "../knowledge-memory/repository.js";
|
|
3
2
|
import "../knowledge-memory/index.js";
|
|
3
|
+
import { init_paths, resolveSkillsDir } from "../config/paths.js";
|
|
4
4
|
import { ProjectService } from "../projects/project-service.js";
|
|
5
5
|
import { resolveWorkspaceSkillsDir } from "../agent/skills/workspace-skills-dir.js";
|
|
6
6
|
import { ImportError } from "./types.js";
|
|
@@ -1,98 +1,86 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { KeyedStore, init_keyed_store } from "./keyed-store.js";
|
|
2
3
|
//#region src/infra/rate-limit/failure-limiter.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
clock;
|
|
25
|
-
maxFailures;
|
|
26
|
-
windowMs;
|
|
27
|
-
blockDurationMs;
|
|
28
|
-
burstCoalesceMs;
|
|
29
|
-
constructor(cfg) {
|
|
30
|
-
this.maxFailures = Math.max(1, Math.floor(cfg.maxFailures));
|
|
31
|
-
this.windowMs = Math.max(1e3, Math.floor(cfg.windowMs));
|
|
32
|
-
this.blockDurationMs = Math.max(1e3, Math.floor(cfg.blockDurationMs));
|
|
33
|
-
this.burstCoalesceMs = Math.max(0, Math.floor(cfg.burstCoalesceMs ?? DEFAULT_BURST_COALESCE_MS));
|
|
34
|
-
this.clock = cfg.clock ?? Date.now;
|
|
35
|
-
this.store = new KeyedStore({
|
|
36
|
-
staleAfterMs: cfg.staleAfterMs ?? this.windowMs + this.blockDurationMs,
|
|
37
|
-
clock: this.clock
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
check(key) {
|
|
41
|
-
const now = this.clock();
|
|
42
|
-
const state = this.store.get(key);
|
|
43
|
-
if (!state?.blockedUntil) return { blocked: false };
|
|
44
|
-
if (now >= state.blockedUntil) {
|
|
45
|
-
state.blockedUntil = void 0;
|
|
46
|
-
state.count = 0;
|
|
47
|
-
state.windowStart = now;
|
|
48
|
-
state.lastTouchedMs = now;
|
|
49
|
-
return { blocked: false };
|
|
4
|
+
var DEFAULT_BURST_COALESCE_MS, FailureLimiter;
|
|
5
|
+
var init_failure_limiter = __esmMin((() => {
|
|
6
|
+
init_keyed_store();
|
|
7
|
+
DEFAULT_BURST_COALESCE_MS = 1e3;
|
|
8
|
+
FailureLimiter = class {
|
|
9
|
+
store;
|
|
10
|
+
clock;
|
|
11
|
+
maxFailures;
|
|
12
|
+
windowMs;
|
|
13
|
+
blockDurationMs;
|
|
14
|
+
burstCoalesceMs;
|
|
15
|
+
constructor(cfg) {
|
|
16
|
+
this.maxFailures = Math.max(1, Math.floor(cfg.maxFailures));
|
|
17
|
+
this.windowMs = Math.max(1e3, Math.floor(cfg.windowMs));
|
|
18
|
+
this.blockDurationMs = Math.max(1e3, Math.floor(cfg.blockDurationMs));
|
|
19
|
+
this.burstCoalesceMs = Math.max(0, Math.floor(cfg.burstCoalesceMs ?? DEFAULT_BURST_COALESCE_MS));
|
|
20
|
+
this.clock = cfg.clock ?? Date.now;
|
|
21
|
+
this.store = new KeyedStore({
|
|
22
|
+
staleAfterMs: cfg.staleAfterMs ?? this.windowMs + this.blockDurationMs,
|
|
23
|
+
clock: this.clock
|
|
24
|
+
});
|
|
50
25
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
26
|
+
check(key) {
|
|
27
|
+
const now = this.clock();
|
|
28
|
+
const state = this.store.get(key);
|
|
29
|
+
if (!state?.blockedUntil) return { blocked: false };
|
|
30
|
+
if (now >= state.blockedUntil) {
|
|
31
|
+
state.blockedUntil = void 0;
|
|
32
|
+
state.count = 0;
|
|
33
|
+
state.windowStart = now;
|
|
34
|
+
state.lastTouchedMs = now;
|
|
35
|
+
return { blocked: false };
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
blocked: true,
|
|
39
|
+
retryAfterSec: Math.max(1, Math.ceil((state.blockedUntil - now) / 1e3))
|
|
64
40
|
};
|
|
65
|
-
this.store.set(key, state);
|
|
66
41
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
state
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
fail(key) {
|
|
43
|
+
const now = this.clock();
|
|
44
|
+
let state = this.store.get(key);
|
|
45
|
+
if (!state) {
|
|
46
|
+
state = {
|
|
47
|
+
windowStart: now,
|
|
48
|
+
count: 0,
|
|
49
|
+
lastTouchedMs: now
|
|
50
|
+
};
|
|
51
|
+
this.store.set(key, state);
|
|
52
|
+
}
|
|
53
|
+
state.lastTouchedMs = now;
|
|
54
|
+
if (state.blockedUntil && now < state.blockedUntil) return;
|
|
55
|
+
if (state.blockedUntil && now >= state.blockedUntil) {
|
|
56
|
+
state.blockedUntil = void 0;
|
|
57
|
+
state.count = 0;
|
|
58
|
+
state.windowStart = now;
|
|
59
|
+
}
|
|
60
|
+
if (now - state.windowStart > this.windowMs) {
|
|
61
|
+
state.count = 0;
|
|
62
|
+
state.windowStart = now;
|
|
63
|
+
}
|
|
64
|
+
if (state.lastFailureAtMs !== void 0 && now - state.lastFailureAtMs < this.burstCoalesceMs) {
|
|
65
|
+
state.lastFailureAtMs = now;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
state.lastFailureAtMs = now;
|
|
69
|
+
state.count += 1;
|
|
70
|
+
if (state.count >= this.maxFailures) state.blockedUntil = now + this.blockDurationMs;
|
|
73
71
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
state.windowStart = now;
|
|
72
|
+
succeed(key) {
|
|
73
|
+
this.store.delete(key);
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
/** @internal Test hook. */
|
|
76
|
+
resetForTests() {
|
|
77
|
+
this.store.clear();
|
|
78
|
+
}
|
|
79
|
+
destroy() {
|
|
80
|
+
this.store.destroy();
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (state.count >= this.maxFailures) state.blockedUntil = now + this.blockDurationMs;
|
|
85
|
-
}
|
|
86
|
-
succeed(key) {
|
|
87
|
-
this.store.delete(key);
|
|
88
|
-
}
|
|
89
|
-
/** @internal Test hook. */
|
|
90
|
-
resetForTests() {
|
|
91
|
-
this.store.clear();
|
|
92
|
-
}
|
|
93
|
-
destroy() {
|
|
94
|
-
this.store.destroy();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
82
|
+
};
|
|
83
|
+
}));
|
|
97
84
|
//#endregion
|
|
98
|
-
|
|
85
|
+
init_failure_limiter();
|
|
86
|
+
export { FailureLimiter, init_failure_limiter };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { RateLimiter, init_rate_limiter } from "./rate-limiter.js";
|
|
3
|
+
import { FailureLimiter, init_failure_limiter } from "./failure-limiter.js";
|
|
4
|
+
//#region src/infra/rate-limit/index.ts
|
|
5
|
+
var init_rate_limit = __esmMin((() => {
|
|
6
|
+
init_rate_limiter();
|
|
7
|
+
init_failure_limiter();
|
|
8
|
+
}));
|
|
9
|
+
//#endregion
|
|
10
|
+
init_rate_limit();
|
|
11
|
+
export { FailureLimiter, RateLimiter, init_rate_limit };
|