@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,8 +1,8 @@
|
|
|
1
1
|
import { TaskRepository, init_task_repository } from "./task-repository.js";
|
|
2
2
|
import { TaskRunRepository, init_task_run_repository } from "./task-run-repository.js";
|
|
3
|
-
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
4
3
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
5
4
|
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
5
|
+
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
6
6
|
import { getPersonalAgentByConversation } from "../personal-agent/repository.js";
|
|
7
7
|
import { TaskCollaborationRepository } from "./task-collaboration-repository.js";
|
|
8
8
|
//#region src/tasks/task-main-update-decision-service.ts
|
|
@@ -8,13 +8,13 @@ import { cancelQueuedSessionInput, claimNextSessionInput, finishSessionInputRun,
|
|
|
8
8
|
import { appendComposerInputHistory, listComposerInputHistory } from "../../storage/sqlite/composer-input-history-repository.js";
|
|
9
9
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
10
10
|
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
11
|
+
import { init_agent_session_key, resolveAgentIdFromConversationId } from "../../routing/agent-session-key.js";
|
|
11
12
|
import { normalizeAgentId } from "../../agent-catalog/id.js";
|
|
12
13
|
import { init_agent_scope, listAgentEntries } from "../../agent/agent-scope.js";
|
|
13
|
-
import {
|
|
14
|
+
import { resolveEffectiveAgentProfile } from "../../config/agent-profile.js";
|
|
14
15
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
15
16
|
import { init_paths } from "../../config/paths.js";
|
|
16
|
-
import {
|
|
17
|
-
import { resolveEffectiveAgentProfile } from "../../config/agent-profile.js";
|
|
17
|
+
import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
|
|
18
18
|
import { effectiveWorkspacePathForSession } from "../../session/session-workspace.js";
|
|
19
19
|
import { ProjectService } from "../../projects/project-service.js";
|
|
20
20
|
import { inferSuggestedProjectDefaultAgentId } from "../../projects/project-agent-suggestion.js";
|
|
@@ -23,6 +23,7 @@ import { buildSessionTimeline } from "../../session/transcript-outline.js";
|
|
|
23
23
|
import { transcriptRowsToClientHistory } from "../../session/client-history.js";
|
|
24
24
|
import { createCreateShareTool, isShareToolAvailable } from "../../agent/tools/create-share-tool.js";
|
|
25
25
|
import { evictEmbeddedSessionRunner } from "../../agent/embedded/session-runner.js";
|
|
26
|
+
import { AgentCatalogService } from "../../agent-catalog/service.js";
|
|
26
27
|
import { SessionIndex } from "../../session/manager.js";
|
|
27
28
|
import "../../session/index.js";
|
|
28
29
|
import { parseModelRef } from "../../agent/models/selection.js";
|
|
@@ -31,7 +32,6 @@ import { buildReviewContext, resolveGitRoot } from "../../review/review-git.js";
|
|
|
31
32
|
import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
|
|
32
33
|
import "../../infra/bus/index.js";
|
|
33
34
|
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
34
|
-
import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
|
|
35
35
|
import "../../config/index.js";
|
|
36
36
|
import { buildWorkflowChildTools } from "../../agent/workflow/workflow-child-tools.js";
|
|
37
37
|
import { WorkflowRunService } from "../../workflows/service/workflow-run-service.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_paths, resolveExtensionsDir } from "../../config/paths.js";
|
|
4
|
+
import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
|
|
4
5
|
import { ExtensionLoader } from "../../extensions/loader.js";
|
|
5
6
|
import { loadConfig } from "../../config/loader.js";
|
|
6
|
-
import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
|
|
7
7
|
import "../../config/index.js";
|
|
8
8
|
//#region src/tui/extension-host/load-extensions.ts
|
|
9
9
|
init_paths();
|
|
@@ -2,8 +2,8 @@ import { closeXopcDatabase, isXopcDatabaseOpen, openXopcDatabase } from "../stor
|
|
|
2
2
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
3
3
|
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
4
4
|
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
5
|
-
import { resolveConfigPath } from "../config/paths.js";
|
|
6
5
|
import { init_agent_session_key, isValidAgentId, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
6
|
+
import { resolveConfigPath } from "../config/paths.js";
|
|
7
7
|
import { init_providers, providerSupportsOAuth } from "../providers/index.js";
|
|
8
8
|
import { ProjectService } from "../projects/project-service.js";
|
|
9
9
|
import { isValidProjectAgentId, normalizeProjectAgentId } from "../projects/project-agent.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_paths, resolveBundledSkillsDir } from "../config/paths.js";
|
|
3
|
+
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
3
4
|
import { loadSkills } from "../agent/skills/index.js";
|
|
4
5
|
import { loadConfig } from "../config/loader.js";
|
|
5
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
6
6
|
import "../config/index.js";
|
|
7
7
|
//#region src/tui/tui-skills-autocomplete.ts
|
|
8
8
|
init_paths();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { resolveStateDir } from "../config/paths-state.js";
|
|
2
|
-
import { init_paths, resolveAgentProfileDir, resolveBundledSkillsDir } from "../config/paths.js";
|
|
3
2
|
import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
3
|
+
import { init_paths, resolveAgentProfileDir, resolveBundledSkillsDir } from "../config/paths.js";
|
|
4
|
+
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
4
5
|
import { resolveBootstrapFilesSync } from "../agent/bootstrap/bootstrap-files.js";
|
|
5
6
|
import { listConnectorInstances } from "../connectors/instances.js";
|
|
6
7
|
import { createSkillConfigManager, isSkillEnabled } from "../agent/skills/config.js";
|
|
7
8
|
import { loadSkills } from "../agent/skills/index.js";
|
|
8
9
|
import { createWorkflowCatalog } from "../agent/workflow/catalog.js";
|
|
9
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
10
10
|
import "../config/index.js";
|
|
11
11
|
import { basename } from "node:path";
|
|
12
12
|
//#region src/tui/tui-startup-resources.ts
|
package/dist/src/tui/tui.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { version } from "../../package.js";
|
|
2
2
|
import { resolveStateDir, resolveXopcDatabasePath } from "../config/paths-state.js";
|
|
3
|
-
import { init_paths } from "../config/paths.js";
|
|
4
3
|
import { init_agent_session_key, normalizeAgentId } from "../routing/agent-session-key.js";
|
|
5
|
-
import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
6
4
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
5
|
+
import { init_paths } from "../config/paths.js";
|
|
6
|
+
import { getAllModels, getAllProviders, getApiKey, init_providers, isProviderConfiguredSync } from "../providers/index.js";
|
|
7
7
|
import { isTerminalWorkflowRunStatus } from "../workflows/domain/run.js";
|
|
8
8
|
import "../workflows/domain/index.js";
|
|
9
9
|
import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
|
|
@@ -29,6 +29,8 @@ const registrationResponseSchema = z.object({
|
|
|
29
29
|
var TunnelBrokerClient = class {
|
|
30
30
|
constructor(baseUrl) {
|
|
31
31
|
this.baseUrl = baseUrl;
|
|
32
|
+
const url = new URL(baseUrl);
|
|
33
|
+
if (url.protocol !== "https:" || url.username || url.password) throw new Error("Tunnel broker requires HTTPS without URL credentials");
|
|
32
34
|
}
|
|
33
35
|
apiUrl(path) {
|
|
34
36
|
return `${this.baseUrl.replace(/\/+$/, "")}${path.startsWith("/") ? path : `/${path}`}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TunnelConfigSchema, TunnelConsentSchema, init_schema } from "../config/schema.js";
|
|
1
|
+
import { TunnelBrokerUrlSchema, TunnelConfigSchema, TunnelConsentSchema, init_schema } from "../config/schema.js";
|
|
2
2
|
import { getTunnelRegistrationSecretMeta, isMaskedTunnelSecretPatchValue } from "./env.js";
|
|
3
3
|
import { assertTunnelAutoStartAllowed, buildTunnelConsentRecord, hasValidTunnelConsent } from "./consent.js";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
init_schema();
|
|
7
7
|
const TunnelConfigPatchSchema = z.object({
|
|
8
8
|
enabled: z.boolean().optional(),
|
|
9
|
-
brokerUrl:
|
|
9
|
+
brokerUrl: TunnelBrokerUrlSchema.optional(),
|
|
10
10
|
registrationSecret: z.union([z.string(), z.null()]).optional(),
|
|
11
11
|
autoStart: z.boolean().optional(),
|
|
12
12
|
subdomain: z.string().optional(),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { buckets } from "../gateway/rate-limit/buckets.js";
|
|
4
|
-
import "../gateway/rate-limit/index.js";
|
|
4
|
+
import { init_rate_limit } from "../gateway/rate-limit/index.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
//#region src/tunnel/tunnel-rate-limit.ts
|
|
7
|
+
init_rate_limit();
|
|
7
8
|
init_logger();
|
|
8
9
|
const log = createLogger("TunnelRateLimit");
|
|
9
10
|
function tokenKey(token) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getSessionConfig, init_config_repository } from "../storage/sqlite/config-repository.js";
|
|
2
|
+
import { isOwnerIdentity } from "./identity-bindings.js";
|
|
2
3
|
import { init_config, resolveKnowledgeReadPolicy } from "./config.js";
|
|
3
4
|
import { getConversationRouting } from "../storage/sqlite/conversation-repository.js";
|
|
4
5
|
import { init_session_key } from "../routing/session-key.js";
|
|
@@ -20,7 +21,7 @@ function resolveUserContextSessionAccess(config, conversationId) {
|
|
|
20
21
|
};
|
|
21
22
|
const session = getConversationRouting(conversationId);
|
|
22
23
|
const mode = getSessionConfig(conversationId)?.userContextMode ?? "enabled";
|
|
23
|
-
const enabled = Boolean(config.userContext.enabled && session?.peerKind === "direct" && mode === "enabled");
|
|
24
|
+
const enabled = Boolean(config.userContext.enabled && session?.peerKind === "direct" && isOwnerIdentity(session) && mode === "enabled");
|
|
24
25
|
return {
|
|
25
26
|
enabled,
|
|
26
27
|
userModel: enabled && config.userContext.userModel.enabled,
|
|
@@ -115,6 +115,11 @@ export declare const KnowledgeMemoryConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
115
115
|
allow: "allow";
|
|
116
116
|
deny: "deny";
|
|
117
117
|
}>>;
|
|
118
|
+
learning: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
idleFlushMs: z.ZodDefault<z.ZodNumber>;
|
|
120
|
+
maxBatchChars: z.ZodDefault<z.ZodNumber>;
|
|
121
|
+
maxDailyBatches: z.ZodDefault<z.ZodNumber>;
|
|
122
|
+
}, z.core.$strict>>;
|
|
118
123
|
readScopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
119
124
|
project: "project";
|
|
120
125
|
session: "session";
|
|
@@ -244,6 +249,11 @@ export declare const UserContextConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
244
249
|
allow: "allow";
|
|
245
250
|
deny: "deny";
|
|
246
251
|
}>>;
|
|
252
|
+
learning: z.ZodOptional<z.ZodObject<{
|
|
253
|
+
idleFlushMs: z.ZodDefault<z.ZodNumber>;
|
|
254
|
+
maxBatchChars: z.ZodDefault<z.ZodNumber>;
|
|
255
|
+
maxDailyBatches: z.ZodDefault<z.ZodNumber>;
|
|
256
|
+
}, z.core.$strict>>;
|
|
247
257
|
readScopes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
248
258
|
project: "project";
|
|
249
259
|
session: "session";
|
|
@@ -150,6 +150,11 @@ var init_config = __esmMin((() => {
|
|
|
150
150
|
KnowledgeMemoryConfigSchema = z.object({
|
|
151
151
|
enabled: z.boolean().default(true),
|
|
152
152
|
writePolicy: z.enum(["deny", "allow"]).default("allow"),
|
|
153
|
+
learning: z.object({
|
|
154
|
+
idleFlushMs: z.number().int().min(1e3).max(6e5).default(6e4),
|
|
155
|
+
maxBatchChars: z.number().int().min(4e3).max(12e4).default(3e4),
|
|
156
|
+
maxDailyBatches: z.number().int().min(1).max(1e4).default(100)
|
|
157
|
+
}).strict().optional(),
|
|
153
158
|
readScopes: z.array(z.enum([
|
|
154
159
|
"global",
|
|
155
160
|
"agent",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ContextExtractionRun } from '../../storage/sqlite/index.js';
|
|
2
2
|
import type { UnderstandingKind } from '../domain.js';
|
|
3
|
-
export type ExtractorId = 'turn-semantics' | 'transcript-synthesis' | 'connector-semantic';
|
|
3
|
+
export type ExtractorId = 'turn-semantics' | 'transcript-synthesis' | 'source-work-synthesis' | 'connector-semantic';
|
|
4
4
|
export type ExtractorDefinition = {
|
|
5
5
|
id: ExtractorId;
|
|
6
6
|
version: string;
|
|
@@ -15,6 +15,16 @@ const UNDERSTANDING_KINDS = [
|
|
|
15
15
|
"derived_insight"
|
|
16
16
|
];
|
|
17
17
|
const DEFINITIONS = {
|
|
18
|
+
"source-work-synthesis": {
|
|
19
|
+
id: "source-work-synthesis",
|
|
20
|
+
version: "1",
|
|
21
|
+
inputKinds: ["file", "connector"],
|
|
22
|
+
requiredProcessingPolicy: "local_only",
|
|
23
|
+
authorityCeiling: "external_untrusted",
|
|
24
|
+
candidateKinds: ["project_context", "task_lesson"],
|
|
25
|
+
maxAutomaticStatus: "active",
|
|
26
|
+
timeoutMs: 3e4
|
|
27
|
+
},
|
|
18
28
|
"turn-semantics": {
|
|
19
29
|
id: "turn-semantics",
|
|
20
30
|
version: "1",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
2
|
+
//#region src/user-context/identity-bindings.ts
|
|
3
|
+
init_transaction();
|
|
4
|
+
function bindOwnerIdentity(input) {
|
|
5
|
+
if (![
|
|
6
|
+
input.channel,
|
|
7
|
+
input.accountId,
|
|
8
|
+
input.peerId
|
|
9
|
+
].every((value) => value.trim())) throw new Error("Identity fields are required.");
|
|
10
|
+
getSqliteDatabase().prepare(`INSERT INTO owner_identity_bindings(principal_id, channel, account_id, peer_id, verified_at)
|
|
11
|
+
VALUES ('local-owner', ?, ?, ?, ?) ON CONFLICT(channel, account_id, peer_id) DO UPDATE
|
|
12
|
+
SET verified_at = excluded.verified_at, revoked_at = NULL`).run(input.channel, input.accountId, input.peerId, Date.now());
|
|
13
|
+
}
|
|
14
|
+
function isOwnerIdentity(input) {
|
|
15
|
+
if ([
|
|
16
|
+
"webchat",
|
|
17
|
+
"cli",
|
|
18
|
+
"tui"
|
|
19
|
+
].includes(input.source)) return true;
|
|
20
|
+
return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM owner_identity_bindings
|
|
21
|
+
WHERE principal_id = 'local-owner' AND channel = ? AND account_id = ? AND peer_id = ? AND revoked_at IS NULL`).get(input.source, input.accountId, input.peerId));
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { bindOwnerIdentity, isOwnerIdentity };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/user-context/sources/consent-fields.ts
|
|
2
|
+
const FIELD_KEYS = {
|
|
3
|
+
title: [
|
|
4
|
+
"title",
|
|
5
|
+
"subject",
|
|
6
|
+
"name",
|
|
7
|
+
"fullName",
|
|
8
|
+
"repository"
|
|
9
|
+
],
|
|
10
|
+
content: [
|
|
11
|
+
"content",
|
|
12
|
+
"body",
|
|
13
|
+
"text",
|
|
14
|
+
"snippet",
|
|
15
|
+
"description",
|
|
16
|
+
"summary"
|
|
17
|
+
],
|
|
18
|
+
participants: [
|
|
19
|
+
"from",
|
|
20
|
+
"to",
|
|
21
|
+
"cc",
|
|
22
|
+
"bcc",
|
|
23
|
+
"sender",
|
|
24
|
+
"author",
|
|
25
|
+
"organizer",
|
|
26
|
+
"attendees",
|
|
27
|
+
"participants",
|
|
28
|
+
"assignee",
|
|
29
|
+
"owners"
|
|
30
|
+
],
|
|
31
|
+
status: [
|
|
32
|
+
"status",
|
|
33
|
+
"state",
|
|
34
|
+
"labels"
|
|
35
|
+
],
|
|
36
|
+
timestamps: [
|
|
37
|
+
"createdAt",
|
|
38
|
+
"updatedAt",
|
|
39
|
+
"modifiedAt",
|
|
40
|
+
"start",
|
|
41
|
+
"end",
|
|
42
|
+
"created_at",
|
|
43
|
+
"updated_at",
|
|
44
|
+
"modified_at"
|
|
45
|
+
],
|
|
46
|
+
owner_activity: [
|
|
47
|
+
"user",
|
|
48
|
+
"username",
|
|
49
|
+
"owner"
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
/** Restrict source fields before either model processing or searchable chunk persistence. */
|
|
53
|
+
function consentFilteredText(value, allowedFields) {
|
|
54
|
+
if (!value) return;
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(value);
|
|
57
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return;
|
|
58
|
+
const keys = new Set([...allowedFields].flatMap((field) => FIELD_KEYS[field] ?? []));
|
|
59
|
+
const selected = Object.entries(parsed).filter(([key]) => keys.has(key));
|
|
60
|
+
return selected.length ? JSON.stringify(Object.fromEntries(selected)) : void 0;
|
|
61
|
+
} catch {
|
|
62
|
+
return !/^\s*[\[{]/.test(value) && allowedFields.has("content") ? value : void 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { consentFilteredText };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCollaborationRule, init_collaboration_rule_repository, listCollaborationRules } from "../storage/sqlite/collaboration-rule-repository.js";
|
|
2
|
-
import { reconcileAssertion } from "./repository.js";
|
|
3
2
|
import { createPriorityWindow, createUserGoal, listPriorityWindows, listUserGoals } from "./goals.js";
|
|
3
|
+
import { reconcileAssertion } from "./repository.js";
|
|
4
4
|
import { applyUserProfilePatch } from "./profile.js";
|
|
5
5
|
//#region src/user-model/bootstrap.ts
|
|
6
6
|
init_collaboration_rule_repository();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCollaborationRule, init_collaboration_rule_repository, listCollaborationRules } from "../../storage/sqlite/collaboration-rule-repository.js";
|
|
2
2
|
import { createContextEvidence, init_context_evidence_repository } from "../../storage/sqlite/context-evidence-repository.js";
|
|
3
|
-
import { deleteUserAssertion, getAssertionSlot, getUserAssertion, linkAssertionEvidence, mergeAssertionObservation, reconcileAssertion, setAssertionStatus } from "../repository.js";
|
|
4
3
|
import { createUserGoal, listUserGoals } from "../goals.js";
|
|
4
|
+
import { deleteUserAssertion, getAssertionSlot, getUserAssertion, linkAssertionEvidence, mergeAssertionObservation, reconcileAssertion, setAssertionStatus } from "../repository.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
//#region src/user-model/capture/executor.ts
|
|
7
7
|
init_context_evidence_repository();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type WorkCandidate } from '../../memory-learning/work-capture.js';
|
|
1
2
|
import type { AssertionCandidate } from '../domain.js';
|
|
2
3
|
export declare const USER_MODEL_CAPTURE_INTENTS: readonly ["remember", "query", "confirm", "correct", "forget", "user_assertion", "task", "none"];
|
|
3
4
|
export type UserModelCaptureIntent = typeof USER_MODEL_CAPTURE_INTENTS[number];
|
|
4
5
|
export interface CaptureEvidence {
|
|
5
6
|
ref: string;
|
|
6
|
-
role: 'user' | 'assistant';
|
|
7
|
+
role: 'user' | 'assistant' | 'toolResult';
|
|
7
8
|
text: string;
|
|
8
9
|
createdAt: number;
|
|
9
10
|
}
|
|
@@ -32,6 +33,7 @@ export interface ParsedCollaborationRuleCandidate {
|
|
|
32
33
|
evidenceRefs: string[];
|
|
33
34
|
}
|
|
34
35
|
export interface UserModelInterpretation {
|
|
36
|
+
knowledge?: WorkCandidate[];
|
|
35
37
|
intent: UserModelCaptureIntent;
|
|
36
38
|
assertions: ParsedAssertionOperation[];
|
|
37
39
|
goals?: ParsedGoalCandidate[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WorkCandidateSchema } from "../../memory-learning/work-capture.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
//#region src/user-model/capture/semantic.ts
|
|
3
4
|
const USER_MODEL_CAPTURE_INTENTS = [
|
|
@@ -30,6 +31,7 @@ const ScopeSchema = z.object({
|
|
|
30
31
|
});
|
|
31
32
|
});
|
|
32
33
|
const AssertionOperationSchema = z.object({
|
|
34
|
+
intent: z.enum(USER_MODEL_CAPTURE_INTENTS).optional(),
|
|
33
35
|
action: z.enum([
|
|
34
36
|
"create",
|
|
35
37
|
"merge",
|
|
@@ -122,6 +124,7 @@ const AssertionOperationSchema = z.object({
|
|
|
122
124
|
});
|
|
123
125
|
});
|
|
124
126
|
const GroundingSchema = z.object({
|
|
127
|
+
intent: z.enum(USER_MODEL_CAPTURE_INTENTS).optional(),
|
|
125
128
|
evidence: z.array(z.object({
|
|
126
129
|
ref: z.string().min(1),
|
|
127
130
|
quote: z.string().min(1)
|
|
@@ -150,6 +153,7 @@ const CollaborationRuleSchema = z.object({
|
|
|
150
153
|
statement: z.string().min(4).max(600)
|
|
151
154
|
}).merge(GroundingSchema).strict();
|
|
152
155
|
const InterpretationSchema = z.object({
|
|
156
|
+
knowledge: z.array(WorkCandidateSchema).max(8).default([]),
|
|
153
157
|
intent: z.enum(USER_MODEL_CAPTURE_INTENTS),
|
|
154
158
|
assertions: z.array(AssertionOperationSchema).max(8),
|
|
155
159
|
goals: z.array(GoalSchema).max(4).default([]),
|
|
@@ -198,7 +202,8 @@ function parseUserModelInterpretation(raw, evidence, allowedTargetIds = []) {
|
|
|
198
202
|
]);
|
|
199
203
|
const allowed = new Set(allowedTargetIds);
|
|
200
204
|
const assertions = [];
|
|
201
|
-
|
|
205
|
+
for (const item of parsed.assertions) {
|
|
206
|
+
if (!assertionIntents.has(item.intent ?? parsed.intent)) continue;
|
|
202
207
|
const evidenceRefs = groundedEvidenceRefs(item, evidenceByRef);
|
|
203
208
|
if (!evidenceRefs) continue;
|
|
204
209
|
if (item.action !== "create" && (!item.targetAssertionId || !allowed.has(item.targetAssertionId))) continue;
|
|
@@ -214,7 +219,7 @@ function parseUserModelInterpretation(raw, evidence, allowedTargetIds = []) {
|
|
|
214
219
|
value: item.value,
|
|
215
220
|
normalizedValue: item.normalizedValue,
|
|
216
221
|
statement: item.statement,
|
|
217
|
-
authority: effectiveAuthority(parsed.intent, item.authority),
|
|
222
|
+
authority: effectiveAuthority(item.intent ?? parsed.intent, item.authority),
|
|
218
223
|
confidence: item.confidence,
|
|
219
224
|
...item.declaredImportance === void 0 ? {} : { declaredImportance: item.declaredImportance },
|
|
220
225
|
inferredImportance: item.inferredImportance,
|
|
@@ -242,7 +247,8 @@ function parseUserModelInterpretation(raw, evidence, allowedTargetIds = []) {
|
|
|
242
247
|
"correct",
|
|
243
248
|
"user_assertion"
|
|
244
249
|
]);
|
|
245
|
-
const goals =
|
|
250
|
+
const goals = parsed.goals.flatMap((item) => {
|
|
251
|
+
if (!structuredIntents.has(item.intent ?? parsed.intent)) return [];
|
|
246
252
|
const evidenceRefs = groundedEvidenceRefs(item, evidenceByRef);
|
|
247
253
|
if (!evidenceRefs) return [];
|
|
248
254
|
return [{
|
|
@@ -253,8 +259,9 @@ function parseUserModelInterpretation(raw, evidence, allowedTargetIds = []) {
|
|
|
253
259
|
...item.targetAt === void 0 ? {} : { targetAt: parseTime(item.targetAt) },
|
|
254
260
|
evidenceRefs
|
|
255
261
|
}];
|
|
256
|
-
})
|
|
257
|
-
const collaborationRules =
|
|
262
|
+
});
|
|
263
|
+
const collaborationRules = parsed.collaborationRules.flatMap((item) => {
|
|
264
|
+
if (!structuredIntents.has(item.intent ?? parsed.intent)) return [];
|
|
258
265
|
const evidenceRefs = groundedEvidenceRefs(item, evidenceByRef);
|
|
259
266
|
if (!evidenceRefs || item.scope.type === "agent") return [];
|
|
260
267
|
return [{
|
|
@@ -265,8 +272,9 @@ function parseUserModelInterpretation(raw, evidence, allowedTargetIds = []) {
|
|
|
265
272
|
statement: item.statement,
|
|
266
273
|
evidenceRefs
|
|
267
274
|
}];
|
|
268
|
-
})
|
|
275
|
+
});
|
|
269
276
|
return {
|
|
277
|
+
knowledge: parsed.knowledge,
|
|
270
278
|
intent: parsed.intent,
|
|
271
279
|
assertions,
|
|
272
280
|
goals,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PERSONAL_DOMAINS, USER_MODEL_PRINCIPAL_ID, defaultAssertionDomain, defaultAssertionLayer, init_domain, validateCandidate, validateScope } from "./domain.js";
|
|
2
|
+
import { createPriorityWindow, createUserGoal, listPriorityWindows, listUserGoals, setUserGoalStatus, updatePriorityWindow, updateUserGoal } from "./goals.js";
|
|
2
3
|
import { defaultReviewAt, isAssertionValidAt, requiresBoundedValidity, resolveCurrentAssertion } from "./temporal.js";
|
|
3
4
|
import { deleteUserAssertion, getActiveAssertionByPredicate, getActiveAssertionForSlot, getAssertionSlot, getUserAssertion, getUserTimezone, linkAssertionEvidence, listSlotAssertions, listUserAssertionSources, listUserAssertions, mergeAssertionObservation, reconcileAssertion, setAssertionStatus, setUserAssertionScope } from "./repository.js";
|
|
4
5
|
import { listActionRuleSuggestions } from "./action-rule-suggestions.js";
|
|
5
6
|
import { calculateExecutionValue } from "./importance.js";
|
|
6
|
-
import { createPriorityWindow, createUserGoal, listPriorityWindows, listUserGoals, setUserGoalStatus, updatePriorityWindow, updateUserGoal } from "./goals.js";
|
|
7
7
|
import { deleteUserModelObservationsForGrant, linkUserAssertions, listUserAssertionEdges, listUserModelObservations, recordUserModelObservation } from "./observation-repository.js";
|
|
8
8
|
import { applyUserProfilePatch, getUserProfileSnapshot } from "./profile.js";
|
|
9
9
|
import { bootstrapUserModel } from "./bootstrap.js";
|
|
@@ -1,9 +1,43 @@
|
|
|
1
|
+
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
|
+
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
3
|
+
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
4
|
+
import { init_session_repository } from "../storage/sqlite/session-repository.js";
|
|
5
|
+
import { init_sqlite } from "../storage/sqlite/index.js";
|
|
6
|
+
import { getUnderstandingConsent } from "../user-context/sources/consent-repository.js";
|
|
7
|
+
import { isOwnerIdentity } from "../user-context/identity-bindings.js";
|
|
1
8
|
//#region src/user-model/usage-policy.ts
|
|
9
|
+
init_sqlite();
|
|
10
|
+
init_transaction();
|
|
11
|
+
init_session_repository();
|
|
2
12
|
/** Automatic personalization never grants execution authority. */
|
|
3
13
|
function isWorkingAssumption(assertion) {
|
|
4
14
|
return (assertion.status === "candidate" || assertion.status === "active") && (assertion.authority === "user_observed" || assertion.authority === "system_inferred") && assertion.confidence >= .7 && (assertion.consequence === "low" || assertion.consequence === "medium") && assertion.sensitivity === "normal" && assertion.disclosurePolicy !== "ask_before_reference";
|
|
5
15
|
}
|
|
6
16
|
function canUseAssertion(assertion, asOf = Date.now(), context = {}) {
|
|
17
|
+
if (assertion.consentReceiptId) {
|
|
18
|
+
if (!isXopcDatabaseOpen()) return false;
|
|
19
|
+
const consent = getUnderstandingConsent(assertion.consentReceiptId);
|
|
20
|
+
if (!consent || consent.revokedAt !== void 0 || !consent.allowedDomains.includes(assertion.domain)) return false;
|
|
21
|
+
if (!getSqliteDatabase().prepare("SELECT 1 FROM understanding_source_grants WHERE grant_id = ? AND status = 'active'").get(consent.grantId)) return false;
|
|
22
|
+
}
|
|
23
|
+
if (isXopcDatabaseOpen() && assertion.id) {
|
|
24
|
+
const db = getSqliteDatabase();
|
|
25
|
+
const evidence = db.prepare(`SELECT e.source_type, e.source_item_id, e.conversation_id, e.content_hash,
|
|
26
|
+
link.content_hash AS linked_hash FROM user_assertion_evidence link JOIN context_evidence e ON e.evidence_id = link.evidence_id
|
|
27
|
+
WHERE link.assertion_id = ? AND link.relation = 'supports'`).all(assertion.id);
|
|
28
|
+
if (assertion.createdBy === "connector" && (!assertion.consentReceiptId || !evidence.length)) return false;
|
|
29
|
+
for (const link of evidence) {
|
|
30
|
+
if (link.conversation_id) {
|
|
31
|
+
const session = getSessionMetadata(link.conversation_id);
|
|
32
|
+
if (!session?.routing || session.routing.peerKind !== "direct" || !isOwnerIdentity(session.routing)) return false;
|
|
33
|
+
}
|
|
34
|
+
if (link.source_type === "connector") {
|
|
35
|
+
if (!link.source_item_id || !link.linked_hash || link.linked_hash !== link.content_hash) return false;
|
|
36
|
+
const source = db.prepare("SELECT content_hash, deleted_at FROM knowledge_source_items WHERE item_id = ?").get(link.source_item_id);
|
|
37
|
+
if (!source || source.deleted_at || source.content_hash !== link.linked_hash) return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
7
41
|
return (assertion.validFrom === void 0 || assertion.validFrom <= asOf) && (assertion.validTo === void 0 || assertion.validTo >= asOf) && (assertion.deleteAfter === void 0 || assertion.deleteAfter > asOf) && (assertion.reviewAt === void 0 || assertion.reviewAt > asOf) && (!context.use || !assertion.allowedUses || assertion.allowedUses.includes(context.use)) && (!assertion.allowedAgentIds || Boolean(context.agentId && assertion.allowedAgentIds.includes(context.agentId))) && assertion.sensitivity !== "secret" && assertion.sensitivity !== "regulated" && assertion.disclosurePolicy !== "ask_before_reference" && (assertion.status === "active" && assertion.authority === "user_explicit" || isWorkingAssumption(assertion));
|
|
8
42
|
}
|
|
9
43
|
//#endregion
|
|
@@ -62,8 +62,9 @@ var init_redact = __esmMin((() => {
|
|
|
62
62
|
KEEP_PREFIX_LENGTH = 6;
|
|
63
63
|
KEEP_SUFFIX_LENGTH = 4;
|
|
64
64
|
DEFAULT_REDACT_PATTERNS = [
|
|
65
|
+
/X-Xopc-Proof\s*[:=]\s*([A-Za-z0-9._-]+)/gi,
|
|
65
66
|
/\b[A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD)\b\s*[=:]\s*((?:\\?["'])?)([^\s"'\\]+)\1/gi,
|
|
66
|
-
/"(?:apiKey|token|secret|password|passwd|accessToken|refreshToken|privateKey)"\s*:\s*"([^"]+)"/gi,
|
|
67
|
+
/"(?:apiKey|token|secret|password|passwd|accessToken|refreshToken|privateKey|signature|x-xopc-proof)"\s*:\s*"([^"]+)"/gi,
|
|
67
68
|
/(?:__Host-xopc-session|xopc-local-session)=([A-Za-z0-9_-]{43})/g,
|
|
68
69
|
/Authorization\s*[:=]\s*Bearer\s+([A-Za-z0-9._\-+=]+)/gi,
|
|
69
70
|
/\b(sk-[A-Za-z0-9_-]{8,})\b/gi,
|
|
@@ -88,6 +89,8 @@ var init_redact = __esmMin((() => {
|
|
|
88
89
|
"cookie",
|
|
89
90
|
"set-cookie",
|
|
90
91
|
"signedpayload",
|
|
92
|
+
"signature",
|
|
93
|
+
"x-xopc-proof",
|
|
91
94
|
"credential",
|
|
92
95
|
"credentials"
|
|
93
96
|
]);
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { StreamingSttOpenRequest, StreamingSttSession } from '../media-understanding/types.js';
|
|
2
2
|
import type { SpeechSynthesisStreamResult } from './tts/speech-provider-types.js';
|
|
3
|
+
export declare class PlatformVoiceError extends Error {
|
|
4
|
+
readonly status?: number;
|
|
5
|
+
readonly code?: string;
|
|
6
|
+
constructor(message: string, status?: number, code?: string);
|
|
7
|
+
get clientMessage(): string;
|
|
8
|
+
}
|
|
3
9
|
export declare function openPlatformStt(request: StreamingSttOpenRequest): Promise<StreamingSttSession>;
|
|
4
10
|
export declare function openPlatformTts(request: {
|
|
5
11
|
baseUrl: string;
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import WebSocket from "ws";
|
|
2
2
|
//#region src/voice/platform-streams.ts
|
|
3
3
|
const MAX_BUFFERED_BYTES = 512 * 1024;
|
|
4
|
+
const MAX_ERROR_BODY_BYTES = 16 * 1024;
|
|
5
|
+
var PlatformVoiceError = class extends Error {
|
|
6
|
+
constructor(message, status, code) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.name = "PlatformVoiceError";
|
|
11
|
+
}
|
|
12
|
+
get clientMessage() {
|
|
13
|
+
if (this.code === "realtime_quota_session_limit") return "The funded transcription duration has been reached. Start a new voice session to continue.";
|
|
14
|
+
if (this.code === "realtime_quota_workspace_budget") return "XOPC Cloud voice workspace budget is exhausted. Increase the workspace budget or choose another voice provider.";
|
|
15
|
+
if (this.status === 402 || this.code === "realtime_quota_user_credits") return "XOPC Cloud voice has insufficient Credit or quota. Check your Cloud balance and workspace budget, or choose another voice provider.";
|
|
16
|
+
if (this.status === 401 || this.status === 403) return "XOPC Cloud voice authorization failed. Sign in again and check your access to this voice model.";
|
|
17
|
+
if (this.status === 429 || this.code?.startsWith("realtime_quota_")) return "XOPC Cloud voice quota or rate limit reached. Try again later or choose another voice provider.";
|
|
18
|
+
return "XOPC Cloud voice is unavailable. Try again later or choose another voice provider.";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
4
21
|
function connect(url, token, signal, onEvent, onFailure) {
|
|
5
22
|
signal.throwIfAborted();
|
|
6
23
|
const socket = new WebSocket(url, {
|
|
@@ -30,15 +47,38 @@ function connect(url, token, signal, onEvent, onFailure) {
|
|
|
30
47
|
if (binary) throw new Error("Unexpected platform binary event");
|
|
31
48
|
const event = JSON.parse(raw.toString());
|
|
32
49
|
if (!event || typeof event.type !== "string") throw new Error("Invalid platform voice event");
|
|
33
|
-
if (event.type === "error") throw new
|
|
50
|
+
if (event.type === "error") throw new PlatformVoiceError(event.error?.message ?? "Platform voice failed", void 0, event.error?.code);
|
|
34
51
|
onEvent(event);
|
|
35
52
|
} catch (error) {
|
|
36
53
|
fail(error instanceof Error ? error : /* @__PURE__ */ new Error("Invalid platform voice event"));
|
|
37
54
|
}
|
|
38
55
|
});
|
|
39
56
|
socket.on("unexpected-response", (_request, response) => {
|
|
40
|
-
response.
|
|
41
|
-
|
|
57
|
+
const fallback = `Platform voice rejected connection (${response.statusCode})`;
|
|
58
|
+
let bytes = 0;
|
|
59
|
+
const chunks = [];
|
|
60
|
+
const reject = () => {
|
|
61
|
+
let detail;
|
|
62
|
+
try {
|
|
63
|
+
detail = JSON.parse(Buffer.concat(chunks).toString("utf8"))?.error;
|
|
64
|
+
} catch {}
|
|
65
|
+
const code = typeof detail?.code === "string" && /^[a-zA-Z0-9_-]{1,128}$/.test(detail.code) ? detail.code : void 0;
|
|
66
|
+
const message = typeof detail?.message === "string" ? detail.message.slice(0, 1e3) : void 0;
|
|
67
|
+
fail(new PlatformVoiceError(`${fallback}${code ? `: ${code}` : ""}${message ? `: ${message}` : ""}`, response.statusCode, code));
|
|
68
|
+
};
|
|
69
|
+
response.on("data", (chunk) => {
|
|
70
|
+
bytes += chunk.length;
|
|
71
|
+
if (bytes > MAX_ERROR_BODY_BYTES) {
|
|
72
|
+
chunks.length = 0;
|
|
73
|
+
reject();
|
|
74
|
+
response.destroy();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
chunks.push(chunk);
|
|
78
|
+
});
|
|
79
|
+
response.once("end", reject);
|
|
80
|
+
response.once("error", reject);
|
|
81
|
+
response.once("aborted", reject);
|
|
42
82
|
});
|
|
43
83
|
socket.on("error", fail);
|
|
44
84
|
socket.on("close", () => fail(/* @__PURE__ */ new Error("Platform voice disconnected before completion")));
|
|
@@ -265,4 +305,4 @@ async function openPlatformTts(request) {
|
|
|
265
305
|
};
|
|
266
306
|
}
|
|
267
307
|
//#endregion
|
|
268
|
-
export { openPlatformStt, openPlatformTts };
|
|
308
|
+
export { PlatformVoiceError, openPlatformStt, openPlatformTts };
|