@xopcai/xopc 0.0.323 → 0.0.325
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/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -9
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DFzmThVi.js → agent-avatar-dicebear-CxfXpPWs.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CDHe8gJf.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DYFYiuig.js → agent-plugin-dialog-DMv-udoZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BqIlB5Co.js → agents-D_xOAXgj.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BgvMRGWe.js → app-management-settings-panel-p7fZB4dT.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CliHU03A.js → appearance-settings-C-clVcfp.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Dz2g7eAN.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DnuPpm0u.js → archive-plugin-Xm6xChUX.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BiwaK0ie.js → attachment-load-Di8kuG4L.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CJSISGQH.js → automations-page-GUZgDhKj.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BUZhG9aJ.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-KDjduQZO.js → binary-plugins-OCrDjC9O.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-bclvgove.js → block-editor-m9tqvu7x.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CfQ2T9t6.js → browser-automation-inputs-DSWXq9lI.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Cxq38Nnp.js → browser-automations-page-DuOaridE.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-D2_PgHep.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-7Y_pJqyt.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-B-Igy1ro.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DKQC62nQ.js → chat-terminal-dock-BfnVh8oo.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-D1whpIqL.js → computer-settings-page-aRG2lU4w.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BAuYTgf5.js → connector-service-page-B5EhnfJH.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-7HfRt1LW.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-CtDyij_x.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-DOuVO2M1.js → dependency-picker-z6ouWxmz.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-D9tu6Bhu.js → desktop-pet-BsIYCAkG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CQPXub2f.js → desktop-pet-settings-z-0aQ5ct.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DxkOYSut.js → device-pairing-wizard-DlmhQvY5.js} +1 -1
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CtWClPz-.js → extension-debug-page-Ct9pABNW.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BHh9HLCz.js → extension-page-BktsR4hj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BdT3v5Uh.js → extension-settings-page-BQJc-vXH.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-1eqyz9vZ.js → gateway-config-swr-CoQVulMd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CZas_Ekx.js → gateway-settings-BfDVlvy6.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C4rsW6vJ.js → gateway-startup-retry-B5GJ-CQV.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CI_eQTPL.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B5DXMylk.js → image-generation-api-DvWDkbk1.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-B1JH0G5j.js → imports-page-DFpQfHVU.js} +1 -1
- package/dist/gateway/static/root/assets/index-19rMUT3d.js +121 -0
- package/dist/gateway/static/root/assets/{index-CNc4N4TX.css → index-BKL5tg2f.css} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGrLJ8Yh.js → keyboard-shortcuts-settings-ctJLm8TP.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-C9kaP3Dy.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DqjStqbL.js → local-apps-page-BxC_LTqq.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BIkcRr3t.js → locale-store-BPZR8x9b.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Ok5SpG-G.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-gCfH4cwH.js → management-settings-aOzRaQHM.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Ck_5MADq.js → markdown-view-Dft8ASFD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DTsZqgo6.js → media-plugins-ni5zJ4Ok.js} +1 -1
- package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C9OEltN9.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dj9rMgdi.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DTI_g4tz.js → page-context-capture-button-BJA3d8vU.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-CfW_Q-K5.js → page-tabs-Dyc3wKkl.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CuPN-vAn.js → preview-open-alternatives-tIOIQbNX.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BHjxRz1E.js → product-open-page-DQctU8z3.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dy-EwZcc.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-Bk-es4i9.js → projects-page-JaGKa6rM.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BAAZUGnU.js → registry-api-DWWO6ajd.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cb8-nd60.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CHJBJKL1.js → runtime-tools-settings-panel-xhOSYfiX.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-ClBkFdRY.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-FQAit5HL.js → schema-form-z8IeSdBp.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BYW5l_nY.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDNwmXuH.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BDc6bw1q.js → settings-form-section-BXTJAser.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DnhxBJjV.js → settings-page-Br9no5e4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D3KNSQ5g.js → settings-page-layout-D6745w0p.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D2N9764S.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DVQCRxwK.js → share-preview-page-CE0SER59.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dk3_QOKQ.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CPt61fEv.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Db6PB2C6.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-mDwC9UJ-.js → skills-page.utils-DrtW5FBy.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Bk7GrMij.js → system-settings-panel-CuY1Zh5s.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-o7RiDUMi.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-D3Aquraj.js → tunnel-api-PGHDgvWb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C1xQ-sHn.js → use-autosave-B55oBQUt.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DspelwAa.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DCNECvcp.js → voice-api-key-field-By6Lgbse.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B-_niUTU.js → voice-config-api-BaxITrwZ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BrGx_JS_.js → work-discovery-overlay-DdhgIlyf.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CmmC2Pdr.js → workflow-run-setup-panel-BOJYQaxX.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-6ObD0IQZ.js +6 -0
- package/dist/gateway/static/root/index.html +11 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/home.js +284 -55
- package/dist/packages/gateway-contract/src/index.js +0 -2
- package/dist/packages/gateway-contract/src/notifications.js +3 -10
- package/dist/src/activity/emitter.js +2 -1
- package/dist/src/activity/service.js +2 -1
- package/dist/src/agent/agent-manager.d.ts +3 -2
- package/dist/src/agent/agent-manager.js +36 -44
- package/dist/src/agent/agent-scope.d.ts +19 -48
- package/dist/src/agent/agent-scope.js +47 -169
- package/dist/src/agent/background-review/run-background-review.js +5 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/commands/command-registry.js +7 -3
- package/dist/src/agent/context/coordinator.js +1 -1
- package/dist/src/agent/context/execution-context.js +2 -1
- package/dist/src/agent/context/execution-scope.js +2 -1
- package/dist/src/agent/context/workspace-seed.d.ts +1 -2
- package/dist/src/agent/context/workspace-seed.js +3 -3
- package/dist/src/agent/context/workspace-state.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +2 -2
- package/dist/src/agent/embedded/run-turn.js +2 -1
- package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.js +2 -1
- package/dist/src/agent/external-tools/composio-provider.js +2 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/index.js +2 -3
- package/dist/src/agent/external-tools/mcp-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +4 -5
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/socket.js +3 -3
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -2
- package/dist/src/agent/models/manager.d.ts +1 -1
- package/dist/src/agent/models/manager.js +2 -2
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +1 -1
- package/dist/src/agent/prompt/response-language.js +2 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +6 -3
- package/dist/src/agent/prompt/system-prompt.js +2 -1
- package/dist/src/agent/reply/post-compaction-context.js +2 -2
- package/dist/src/agent/service/build-direct-message-content.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -1
- package/dist/src/agent/service/parse-outbound-session-key.js +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service/webchat-tts.js +2 -1
- package/dist/src/agent/service.d.ts +1 -1
- package/dist/src/agent/service.js +12 -11
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/session/session-inspector.js +4 -5
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +5 -0
- package/dist/src/agent/starter-agents.d.ts +4 -5
- package/dist/src/agent/starter-agents.js +21 -20
- package/dist/src/agent/tasks/task-judge-service.js +2 -2
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +31 -1
- package/dist/src/agent/tools/delegation-parent-policy.js +2 -3
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +10 -9
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/workflow-tool.js +2 -3
- package/dist/src/agent/tools/xopc-use-tool.d.ts +3 -2
- package/dist/src/agent/tools/xopc-use-tool.js +54 -6
- package/dist/src/agent/workflow/workflow-child-tools.js +1 -2
- package/dist/src/agent/workspace-runtime/registry.d.ts +1 -1
- package/dist/src/agent/workspace-runtime/registry.js +2 -2
- package/dist/src/agent-catalog/capabilities.d.ts +3 -0
- package/dist/src/agent-catalog/capabilities.js +238 -0
- package/dist/src/agent-catalog/id.d.ts +15 -0
- package/dist/src/agent-catalog/id.js +101 -0
- package/dist/src/agent-catalog/index.d.ts +6 -0
- package/dist/src/agent-catalog/index.js +10 -0
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.d.ts +11 -0
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +195 -0
- package/dist/src/agent-catalog/repository.d.ts +39 -0
- package/dist/src/agent-catalog/repository.js +319 -0
- package/dist/src/agent-catalog/service.d.ts +33 -0
- package/dist/src/agent-catalog/service.js +202 -0
- package/dist/src/agent-catalog/test-support.d.ts +14 -0
- package/dist/src/agent-catalog/test-support.js +34 -0
- package/dist/src/agent-catalog/types.d.ts +26 -0
- package/dist/src/agent-catalog/types.js +1 -0
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/schema.d.ts +1 -172
- package/dist/src/agent-config/schema.js +2 -41
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/sync-provider-auth.d.ts +1 -1
- package/dist/src/auth/sync-provider-auth.js +5 -9
- package/dist/src/automations/capabilities/drafts.js +8 -7
- package/dist/src/automations/service/action-executor.js +2 -1
- package/dist/src/bootstrap/application-state.d.ts +10 -0
- package/dist/src/bootstrap/application-state.js +26 -0
- package/dist/src/browser/automations/repository.js +2 -1
- package/dist/src/browser/automations/schema.d.ts +1 -1
- package/dist/src/browser/automations/service.d.ts +1 -1
- package/dist/src/browser/native-messaging-host.js +5 -4
- package/dist/src/browser/providers/extension.js +4 -2
- package/dist/src/browser/providers/realtime-extension.js +2 -1
- package/dist/src/capabilities/readiness/from-config.js +7 -4
- package/dist/src/capabilities/runtime/dispatcher.d.ts +1 -0
- package/dist/src/capabilities/runtime/dispatcher.js +10 -4
- package/dist/src/capabilities/runtime/product.js +2 -0
- package/dist/src/channels/catalog/channel-catalog-service.js +7 -13
- package/dist/src/chat-commands/agent-edit.js +4 -3
- package/dist/src/chat-commands/builtins/config.js +6 -8
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/builtins/workflow.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/chat-commands/context.js +2 -3
- package/dist/src/chat-previews/store.js +2 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agent.js +4 -4
- package/dist/src/cli/commands/agents.d.ts +1 -1
- package/dist/src/cli/commands/agents.js +36 -48
- package/dist/src/cli/commands/auth.js +2 -1
- package/dist/src/cli/commands/browser-cli-helpers.js +1 -2
- package/dist/src/cli/commands/channels.js +2 -4
- package/dist/src/cli/commands/config.js +4 -5
- package/dist/src/cli/commands/connectors.js +1 -2
- package/dist/src/cli/commands/doctor/checks/channel-config.js +2 -4
- package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -2
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -2
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +4 -4
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -2
- package/dist/src/cli/commands/doctor/checks/gateway-service.js +1 -2
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +13 -11
- package/dist/src/cli/commands/doctor/checks/security-audit.js +1 -2
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +3 -3
- package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -2
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +5 -7
- package/dist/src/cli/commands/extension-agent-plugin.js +1 -2
- package/dist/src/cli/commands/extension-dev.js +2 -4
- package/dist/src/cli/commands/extension-marketplace.js +1 -2
- package/dist/src/cli/commands/extension-pack.js +1 -2
- package/dist/src/cli/commands/extension.js +1 -2
- package/dist/src/cli/commands/gateway/run-foreground.js +3 -3
- package/dist/src/cli/commands/gateway/shared.js +1 -1
- package/dist/src/cli/commands/history.js +2 -1
- package/dist/src/cli/commands/image.js +2 -2
- package/dist/src/cli/commands/init.js +11 -30
- package/dist/src/cli/commands/mcp.js +1 -2
- package/dist/src/cli/commands/models.js +13 -11
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -2
- package/dist/src/cli/commands/onboard/gateway.js +1 -2
- package/dist/src/cli/commands/onboard/model.d.ts +1 -1
- package/dist/src/cli/commands/onboard/model.js +18 -26
- package/dist/src/cli/commands/onboard.js +4 -2
- package/dist/src/cli/commands/platform.js +1 -0
- package/dist/src/cli/commands/project.js +3 -3
- package/dist/src/cli/commands/providers.js +2 -1
- package/dist/src/cli/commands/runtime.js +1 -2
- package/dist/src/cli/commands/search.js +1 -2
- package/dist/src/cli/commands/skills.js +1 -2
- package/dist/src/cli/commands/tui-runner.js +3 -2
- package/dist/src/cli/commands/tui.js +6 -8
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/voice.js +1 -2
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/cli/index.js +4 -2
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +15 -16
- package/dist/src/cli/utils/session.js +1 -2
- package/dist/src/computer/model-config.d.ts +3 -3
- package/dist/src/computer/model-config.js +10 -20
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/agent-model-intents.js +2 -2
- package/dist/src/config/agent-profile.d.ts +5 -6
- package/dist/src/config/agent-profile.js +19 -19
- package/dist/src/config/config-surface.d.ts +0 -3
- package/dist/src/config/default-model.js +2 -6
- package/dist/src/config/index.js +7 -8
- package/dist/src/config/loader.js +12 -18
- package/dist/src/config/models-json.d.ts +6 -6
- package/dist/src/config/paths.d.ts +18 -19
- package/dist/src/config/paths.js +35 -35
- package/dist/src/config/reload.d.ts +0 -1
- package/dist/src/config/reload.js +1 -6
- package/dist/src/config/rules.js +0 -15
- package/dist/src/config/schema.d.ts +3 -406
- package/dist/src/config/schema.js +24 -86
- package/dist/src/config/validate-channel-configs.js +8 -14
- package/dist/src/config/workspace-dirs.d.ts +3 -4
- package/dist/src/config/workspace-dirs.js +9 -8
- package/dist/src/config/workspace-path-helpers.d.ts +1 -1
- package/dist/src/config/workspace-path-helpers.js +2 -2
- package/dist/src/connectors/cli/lifecycle.js +2 -1
- package/dist/src/connectors/composio-managed-events.js +2 -1
- package/dist/src/connectors/connected-source-ingestion.js +2 -1
- package/dist/src/connectors/connected-source-understanding.js +4 -2
- package/dist/src/connectors/content-enrichment.js +2 -1
- package/dist/src/connectors/learning-coordinator.js +2 -1
- package/dist/src/connectors/runtime-adapter-registry.js +2 -1
- package/dist/src/connectors/workflow-preflight.d.ts +8 -1
- package/dist/src/connectors/workflow-preflight.js +11 -3
- package/dist/src/discussions/analyzer.js +2 -2
- package/dist/src/endpoint-tools/runtime.js +2 -1
- package/dist/src/execution-environments/subject.js +2 -1
- package/dist/src/extensions/activation-context.js +3 -16
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/discover-extensions.js +9 -15
- package/dist/src/extensions/extension-metadata-snapshot.d.ts +1 -1
- package/dist/src/extensions/extension-metadata-snapshot.js +9 -16
- package/dist/src/extensions/index.js +4 -10
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/loader.js +7 -14
- package/dist/src/extensions/manifest-registry.js +93 -98
- package/dist/src/extensions/marketplace.js +5 -2
- package/dist/src/extensions/normalize-manifest.js +12 -17
- package/dist/src/extensions/update.js +1 -2
- package/dist/src/files/file-service.js +7 -8
- package/dist/src/gateway/agents-admin.d.ts +23 -27
- package/dist/src/gateway/agents-admin.js +109 -130
- package/dist/src/gateway/file-path-classifier.js +3 -3
- package/dist/src/gateway/file-space-service.js +2 -1
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -4
- package/dist/src/gateway/global-defaults-admin.js +21 -20
- package/dist/src/gateway/hono/app.js +2 -1
- package/dist/src/gateway/hono/lib/config-payload.js +12 -9
- package/dist/src/gateway/hono/middleware/auth.js +2 -1
- package/dist/src/gateway/hono/middleware/scopes.js +2 -1
- package/dist/src/gateway/hono/routes/agents.js +22 -49
- package/dist/src/gateway/hono/routes/browser.js +4 -2
- package/dist/src/gateway/hono/routes/channels.js +1 -2
- package/dist/src/gateway/hono/routes/cli-connectors.js +2 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +3 -1
- package/dist/src/gateway/hono/routes/composer-history.js +2 -1
- package/dist/src/gateway/hono/routes/config-patch/index.d.ts +1 -3
- package/dist/src/gateway/hono/routes/config-patch/index.js +1 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -11
- package/dist/src/gateway/hono/routes/config.js +0 -2
- package/dist/src/gateway/hono/routes/connectors.js +8 -4
- package/dist/src/gateway/hono/routes/context-sources.js +4 -3
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +2 -1
- package/dist/src/gateway/hono/routes/device-push.js +3 -2
- package/dist/src/gateway/hono/routes/devices.js +6 -3
- package/dist/src/gateway/hono/routes/discussions.js +2 -1
- package/dist/src/gateway/hono/routes/endpoint-tools.js +2 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +8 -16
- package/dist/src/gateway/hono/routes/home.js +93 -4
- package/dist/src/gateway/hono/routes/interaction-state.js +2 -1
- package/dist/src/gateway/hono/routes/models.js +8 -7
- package/dist/src/gateway/hono/routes/notes.js +4 -5
- package/dist/src/gateway/hono/routes/projects.js +6 -6
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +4 -2
- package/dist/src/gateway/hono/routes/shares.js +4 -3
- package/dist/src/gateway/hono/routes/site-shares.js +2 -2
- package/dist/src/gateway/hono/routes/status.js +2 -3
- package/dist/src/gateway/hono/routes/tasks.js +1 -2
- package/dist/src/gateway/hono/routes/user-model-refresh.js +2 -1
- package/dist/src/gateway/hono/routes/user-model.js +3 -2
- package/dist/src/gateway/hono/routes/work-discovery.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/image-generation-setup.d.ts +19 -10
- package/dist/src/gateway/image-generation-setup.js +59 -23
- package/dist/src/gateway/index.js +1 -4
- package/dist/src/gateway/lock.js +13 -18
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +4 -3
- package/dist/src/gateway/run-loop.js +2 -3
- package/dist/src/gateway/security/gateway-scopes.js +6 -2
- package/dist/src/gateway/security/index.js +4 -1
- package/dist/src/gateway/service/agent-runner.js +4 -2
- package/dist/src/gateway/service/app-context-access.js +2 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +0 -1
- package/dist/src/gateway/service/config-coordinator.js +4 -22
- package/dist/src/gateway/service/marketplace-service.js +3 -1
- package/dist/src/gateway/service/run-gateway-agent.js +4 -2
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service.d.ts +5 -0
- package/dist/src/gateway/service.js +109 -33
- package/dist/src/gateway/session-context-summary.js +4 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +15 -10
- package/dist/src/home-intelligence/application-service.d.ts +31 -0
- package/dist/src/home-intelligence/application-service.js +134 -0
- package/dist/src/home-intelligence/capability-preflight.d.ts +32 -0
- package/dist/src/home-intelligence/capability-preflight.js +118 -0
- package/dist/src/home-intelligence/evaluation.d.ts +34 -0
- package/dist/src/home-intelligence/evaluation.js +49 -0
- package/dist/src/home-intelligence/generator.d.ts +125 -0
- package/dist/src/home-intelligence/generator.js +227 -0
- package/dist/src/home-intelligence/host.d.ts +53 -0
- package/dist/src/home-intelligence/host.js +257 -0
- package/dist/src/home-intelligence/notification.d.ts +8 -0
- package/dist/src/home-intelligence/notification.js +20 -0
- package/dist/src/home-intelligence/policy.d.ts +16 -0
- package/dist/src/home-intelligence/policy.js +152 -0
- package/dist/src/home-intelligence/repository.d.ts +81 -0
- package/dist/src/home-intelligence/repository.js +495 -0
- package/dist/src/home-intelligence/snapshot.d.ts +43 -0
- package/dist/src/home-intelligence/snapshot.js +133 -0
- package/dist/src/home-intelligence/strategy.d.ts +14 -0
- package/dist/src/home-intelligence/strategy.js +10 -0
- package/dist/src/home-intelligence/types.d.ts +13 -0
- package/dist/src/home-intelligence/types.js +1 -0
- package/dist/src/infra/update-restart.js +4 -2
- package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -1
- package/dist/src/knowledge/ingestion-service.js +2 -1
- package/dist/src/knowledge-memory/repository.js +2 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/local-apps/store.js +2 -1
- package/dist/src/mcp/channel-bridge.js +1 -2
- package/dist/src/mcp/channel-server.js +1 -2
- package/dist/src/mcp/gateway-http-client.js +1 -2
- package/dist/src/media/session-references.js +2 -1
- package/dist/src/memory-maintenance/service.js +2 -1
- package/dist/src/migrations/memory-config.js +1 -2
- package/dist/src/notes/agent-context.js +2 -1
- package/dist/src/notes/attachment-ref.js +8 -4
- package/dist/src/notes/note-attachment-sync.js +2 -1
- package/dist/src/notes/note-index-meta.js +14 -7
- package/dist/src/notes/note-markdown.js +13 -7
- package/dist/src/notes/service.js +6 -3
- package/dist/src/notes/store.js +4 -2
- package/dist/src/notifications/device-store.js +1 -1
- package/dist/src/notifications/planner.js +24 -0
- package/dist/src/notifications/service.d.ts +7 -14
- package/dist/src/notifications/service.js +13 -3
- package/dist/src/notifications/store.js +1 -1
- package/dist/src/notifications/types.d.ts +1 -1
- package/dist/src/notifications/types.js +1 -1
- package/dist/src/projects/capabilities/write.js +2 -1
- package/dist/src/projects/project-agent-suggestion.js +1 -1
- package/dist/src/projects/project-agent.js +4 -4
- package/dist/src/projects/project-service.js +2 -1
- package/dist/src/projects/workspace.js +3 -2
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-reference-auditor.d.ts +1 -2
- package/dist/src/providers/model-reference-auditor.js +8 -5
- package/dist/src/realtime/runtime.js +2 -1
- package/dist/src/routing/binding-schema.d.ts +41 -0
- package/dist/src/routing/binding-schema.js +26 -0
- package/dist/src/routing/bindings.d.ts +4 -2
- package/dist/src/routing/bindings.js +4 -4
- package/dist/src/routing/index.d.ts +1 -1
- package/dist/src/routing/resolve-route.d.ts +7 -24
- package/dist/src/routing/resolve-route.js +17 -18
- package/dist/src/routing/resolve-tui-session-key.d.ts +1 -4
- package/dist/src/routing/resolve-tui-session-key.js +10 -9
- package/dist/src/scenes/execution.d.ts +1 -1
- package/dist/src/scenes/model.js +1 -1
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +1 -1
- package/dist/src/scenes/taskFollowUp/service.js +6 -4
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/session/config-store.js +2 -1
- package/dist/src/session/init-session-turn.js +2 -1
- package/dist/src/session/resolve-session.js +2 -1
- package/dist/src/session/session-workspace.js +1 -1
- package/dist/src/session/store.js +3 -2
- package/dist/src/storage/sqlite/activity-repository.js +6 -2
- package/dist/src/storage/sqlite/browser-tab-binding-repository.js +6 -2
- package/dist/src/storage/sqlite/clarification-wait-repository.js +13 -8
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +8 -3
- package/dist/src/storage/sqlite/composer-input-history-repository.js +8 -3
- package/dist/src/storage/sqlite/config-repository.js +9 -5
- package/dist/src/storage/sqlite/connector-learning-repository.js +6 -2
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +6 -2
- package/dist/src/storage/sqlite/context-evidence-repository.js +8 -3
- package/dist/src/storage/sqlite/context-extraction-repository.js +8 -3
- package/dist/src/storage/sqlite/device-access-repository.js +15 -9
- package/dist/src/storage/sqlite/device-pairing-approval.js +6 -2
- package/dist/src/storage/sqlite/device-pairing-repository.js +10 -5
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +6 -2
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +6 -2
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +6 -2
- package/dist/src/storage/sqlite/gateway-identity-repository.js +6 -2
- package/dist/src/storage/sqlite/home-attention-repository.js +6 -2
- package/dist/src/storage/sqlite/index.d.ts +0 -1
- package/dist/src/storage/sqlite/index.js +72 -42
- package/dist/src/storage/sqlite/interaction-state-repository.js +10 -4
- package/dist/src/storage/sqlite/knowledge-repository.js +6 -2
- package/dist/src/storage/sqlite/migrations/203_remove_retired_proactive_contracts.sql +70 -0
- package/dist/src/storage/sqlite/migrations/204_home_intelligence.sql +78 -0
- package/dist/src/storage/sqlite/migrations/205_agent_catalog.sql +66 -0
- package/dist/src/storage/sqlite/migrations/206_home_advice_strategy_version.sql +3 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +8 -4
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.d.ts +7 -1
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +2 -2
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +4 -4
- package/dist/src/storage/sqlite/note-agent-context-repository.js +6 -2
- package/dist/src/storage/sqlite/notes-repository.js +9 -4
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-task-plan-repository.js +14 -9
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +9 -5
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +14 -9
- package/dist/src/storage/sqlite/transcript-repository.js +10 -6
- package/dist/src/storage/sqlite/user-people-repository.js +8 -3
- package/dist/src/storage/sqlite/user-trust-repository.js +8 -3
- package/dist/src/tasks/attention-governor.d.ts +0 -1
- package/dist/src/tasks/attention-governor.js +1 -7
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/execution-context.d.ts +2 -2
- package/dist/src/tasks/execution-context.js +6 -5
- package/dist/src/tasks/home-query-service.d.ts +3 -2
- package/dist/src/tasks/home-query-service.js +23 -44
- package/dist/src/tasks/task-context-assembler.js +2 -1
- package/dist/src/tasks/task-context-repository.d.ts +1 -1
- package/dist/src/tasks/task-contract-planner.d.ts +0 -3
- package/dist/src/tasks/task-contract-planner.js +1 -4
- package/dist/src/tasks/task-handoff-service.d.ts +0 -2
- package/dist/src/tasks/task-handoff-service.js +3 -3
- package/dist/src/tasks/task-value-metrics-service.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +12 -14
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-commands.js +5 -3
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +3 -3
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/registration-proof.js +2 -1
- package/dist/src/user-context/access-policy.js +2 -1
- package/dist/src/user-context/domain.d.ts +1 -1
- package/dist/src/user-context/domain.js +18 -13
- package/dist/src/user-context/extraction/registry.js +2 -1
- package/dist/src/user-context/interaction-state.js +4 -1
- package/dist/src/user-context/relationship-continuity.js +2 -1
- package/dist/src/user-context/trust-policy.js +13 -8
- package/dist/src/user-model/bootstrap.js +2 -1
- package/dist/src/user-model/capture/executor.js +4 -2
- package/dist/src/user-model/capture/semantic.d.ts +1 -1
- package/dist/src/user-model/capture/semantic.js +1 -1
- package/dist/src/user-model/domain.js +7 -2
- package/dist/src/user-model/goals.js +2 -1
- package/dist/src/user-model/index.js +4 -1
- package/dist/src/user-model/repository.js +2 -1
- package/dist/src/utils/helpers.js +1 -4
- package/dist/src/utils/index.js +2 -2
- package/dist/src/utils/logger/index.d.ts +1 -1
- package/dist/src/utils/logger/index.js +2 -2
- package/dist/src/utils/logger/redact.d.ts +2 -0
- package/dist/src/utils/logger/redact.js +11 -3
- package/dist/src/utils/logger.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +2 -1
- package/dist/src/voice/realtime/persona-context.js +6 -6
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/work-discovery/analyzer.js +3 -3
- package/dist/src/work-discovery/investigator.js +1 -1
- package/dist/src/work-discovery/service.js +12 -11
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +4 -5
- package/dist/src/workflows/store/paths.js +1 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CAFHadiy.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Drt3Foi9.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-B-Eduqwz.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-Dwgir6mu.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-H5L5vynP.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-uFKh3Hd0.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-RFBRYe5S.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Px-v3Q6Q.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-CfCo3lqh.js +0 -1
- package/dist/gateway/static/root/assets/home-page-w3_aWeNt.js +0 -1
- package/dist/gateway/static/root/assets/index--3c0awkr.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-BYKrJpFF.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Dl4kM4Na.js +0 -2
- package/dist/gateway/static/root/assets/messages-7VAhscYe.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-j6sioeL1.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CMvvHv0f.js +0 -8
- package/dist/gateway/static/root/assets/popover-select-B-GDnZO9.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-C9K_e-EV.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CLGJNA42.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-ClLAD1pz.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-Xj8MkXN1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DwALV8mi.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-F0rCQ-2a.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C7hf6Cov.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-xPrFejRE.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-RdDYu7Yj.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-2A966jFY.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CnBxPBVe.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BZVpqw4T.js +0 -6
- package/dist/packages/gateway-contract/src/proactive.js +0 -136
- package/dist/src/commands/agents.config.d.ts +0 -31
- package/dist/src/commands/agents.config.js +0 -129
- package/dist/src/gateway/hono/routes/config-patch/agents.d.ts +0 -2
- package/dist/src/gateway/hono/routes/config-patch/agents.js +0 -6
- package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +0 -17
- package/dist/src/storage/sqlite/relationship-settings-repository.js +0 -65
|
@@ -1,135 +1,51 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
3
|
+
import { DEFAULT_AGENT_ID, STRICT_AGENT_ID_RE, deriveAgentIdFromDisplayName, init_id, normalizeAgentId, validateAgentIdForNewAgent } from "../agent-catalog/id.js";
|
|
4
|
+
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
3
5
|
import { expandWorkspacePathString, init_workspace_path } from "../config/workspace-path.js";
|
|
4
6
|
import { init_workspace_defaults, resolveDefaultAgentWorkspaceDir } from "../config/workspace-defaults.js";
|
|
5
7
|
import { basename, isAbsolute, join, relative, resolve } from "node:path";
|
|
6
8
|
import fs from "node:fs";
|
|
7
9
|
//#region src/agent/agent-scope.ts
|
|
8
|
-
/**
|
|
9
|
-
* Agent path and list resolution (config is the single source of truth).
|
|
10
|
-
*/
|
|
11
|
-
function normalizeLowercaseStringOrEmpty(s) {
|
|
12
|
-
return s.trim().toLowerCase();
|
|
13
|
-
}
|
|
14
|
-
/** Path-safe agent id. */
|
|
15
|
-
function normalizeAgentId(value) {
|
|
16
|
-
const trimmed = (value ?? "").trim();
|
|
17
|
-
if (!trimmed) return DEFAULT_AGENT_ID;
|
|
18
|
-
const normalized = normalizeLowercaseStringOrEmpty(trimmed);
|
|
19
|
-
if (VALID_ID_RE.test(trimmed)) return normalized;
|
|
20
|
-
return normalized.replace(INVALID_CHARS_RE, "-").replace(LEADING_DASH_RE, "").replace(TRAILING_DASH_RE, "").slice(0, 64) || "main";
|
|
21
|
-
}
|
|
22
|
-
function hashAgentDisplayName(value) {
|
|
23
|
-
let hash = 2166136261;
|
|
24
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
25
|
-
hash ^= value.charCodeAt(index);
|
|
26
|
-
hash = Math.imul(hash, 16777619);
|
|
27
|
-
}
|
|
28
|
-
return (hash >>> 0).toString(36).padStart(7, "0");
|
|
29
|
-
}
|
|
30
|
-
/** Derive a folder-safe id, including for display names with no ASCII characters. */
|
|
31
|
-
function deriveAgentIdFromDisplayName(displayName) {
|
|
32
|
-
const normalizedName = displayName.trim().normalize("NFKC").toLowerCase();
|
|
33
|
-
const asciiId = normalizeAgentId(normalizedName);
|
|
34
|
-
if (asciiId !== "main" || normalizedName === "main") return asciiId;
|
|
35
|
-
return normalizedName ? `agent-${hashAgentDisplayName(normalizedName)}` : DEFAULT_AGENT_ID;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Validate agent id for new agents (folder-safe path segment).
|
|
39
|
-
* When `explicitId` is set, it must already match {@link STRICT_AGENT_ID_RE} (case-insensitive input, stored lowercase).
|
|
40
|
-
* When omitted, id is derived from `displayNameForDerivation`, with a stable hashed fallback
|
|
41
|
-
* for names that contain no ASCII id characters.
|
|
42
|
-
*/
|
|
43
|
-
function validateAgentIdForNewAgent(explicitId, displayNameForDerivation) {
|
|
44
|
-
const explicit = explicitId?.trim();
|
|
45
|
-
if (explicit) {
|
|
46
|
-
const id = explicit.toLowerCase();
|
|
47
|
-
if (!STRICT_AGENT_ID_RE.test(id)) return {
|
|
48
|
-
ok: false,
|
|
49
|
-
error: "Invalid agent id: use 1–64 characters; letters, digits, underscores, and hyphens only; start with a letter or digit."
|
|
50
|
-
};
|
|
51
|
-
if (id === "main") return {
|
|
52
|
-
ok: false,
|
|
53
|
-
error: `"${DEFAULT_AGENT_ID}" is reserved`
|
|
54
|
-
};
|
|
55
|
-
if (WINDOWS_RESERVED_AGENT_IDS.has(id)) return {
|
|
56
|
-
ok: false,
|
|
57
|
-
error: `Agent id "${id}" is reserved (Windows device name).`
|
|
58
|
-
};
|
|
59
|
-
return {
|
|
60
|
-
ok: true,
|
|
61
|
-
agentId: id
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
const agentId = deriveAgentIdFromDisplayName(displayNameForDerivation);
|
|
65
|
-
if (agentId === "main") return {
|
|
66
|
-
ok: false,
|
|
67
|
-
error: "Display name cannot produce a valid agent folder id. Set an explicit Agent id (letters, digits, underscores, hyphens only)."
|
|
68
|
-
};
|
|
69
|
-
if (WINDOWS_RESERVED_AGENT_IDS.has(agentId)) return {
|
|
70
|
-
ok: false,
|
|
71
|
-
error: `That display name resolves to "${agentId}", which is reserved. Use a different display name or set an explicit Agent id.`
|
|
72
|
-
};
|
|
73
|
-
if (!STRICT_AGENT_ID_RE.test(agentId)) return {
|
|
74
|
-
ok: false,
|
|
75
|
-
error: "Could not derive a folder-safe agent id from the display name. Set an explicit Agent id (letters, digits, underscores, hyphens only)."
|
|
76
|
-
};
|
|
77
|
-
return {
|
|
78
|
-
ok: true,
|
|
79
|
-
agentId
|
|
80
|
-
};
|
|
81
|
-
}
|
|
10
|
+
/** Agent path and list resolution backed by the SQLite Agent catalog. */
|
|
82
11
|
/** Expand `~` and resolve to an absolute path. */
|
|
83
12
|
function resolveUserPath(raw) {
|
|
84
13
|
return resolve(expandWorkspacePathString(raw.trim()));
|
|
85
14
|
}
|
|
86
|
-
function listAgentEntries(
|
|
87
|
-
|
|
88
|
-
if (!Array.isArray(list)) return [];
|
|
89
|
-
return list.filter((e) => Boolean(e && typeof e === "object"));
|
|
15
|
+
function listAgentEntries() {
|
|
16
|
+
return catalog.snapshot().agents;
|
|
90
17
|
}
|
|
91
|
-
function resolveDefaultAgentId(
|
|
92
|
-
|
|
93
|
-
if (explicit) return normalizeAgentId(explicit);
|
|
94
|
-
const agents = listAgentEntries(cfg);
|
|
95
|
-
if (agents.length === 0) return DEFAULT_AGENT_ID;
|
|
96
|
-
const chosen = agents.find((entry) => entry.default === true)?.id?.trim() ?? agents[0]?.id?.trim();
|
|
97
|
-
return chosen ? normalizeAgentId(chosen) : DEFAULT_AGENT_ID;
|
|
18
|
+
function resolveDefaultAgentId() {
|
|
19
|
+
return catalog.getSettings().defaultAgentId;
|
|
98
20
|
}
|
|
99
|
-
function resolveAgentEntry(
|
|
21
|
+
function resolveAgentEntry(agentId) {
|
|
100
22
|
const id = normalizeAgentId(agentId);
|
|
101
|
-
return listAgentEntries(
|
|
23
|
+
return listAgentEntries().find((entry) => entry.id === id);
|
|
102
24
|
}
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
*/
|
|
106
|
-
function resolveAgentWorkspaceDir(cfg, agentId) {
|
|
25
|
+
/** Markdown workspace root for an Agent. */
|
|
26
|
+
function resolveAgentWorkspaceDir(agentId) {
|
|
107
27
|
const id = normalizeAgentId(agentId);
|
|
108
|
-
const
|
|
109
|
-
const configured = (typeof workspace === "string" ? workspace : workspace?.root)?.trim();
|
|
28
|
+
const configured = resolveAgentEntry(id)?.workspace?.trim();
|
|
110
29
|
if (configured) return resolveUserPath(configured);
|
|
111
|
-
if (id === resolveDefaultAgentId(
|
|
30
|
+
if (id === resolveDefaultAgentId()) return resolveDefaultAgentWorkspaceDir(process.env);
|
|
112
31
|
return join(resolveStateDir(process.env), `workspace-${id}`);
|
|
113
32
|
}
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
function resolveAgentDir(cfg, agentId) {
|
|
118
|
-
const id = normalizeAgentId(agentId);
|
|
119
|
-
return join(resolveStateDir(process.env), "agents", id, "agent");
|
|
33
|
+
/** Internal Agent state dir: credentials, `agent.json`, pid, inbox (`…/agent/`). */
|
|
34
|
+
function resolveAgentDir(agentId) {
|
|
35
|
+
return join(resolveStateDir(process.env), "agents", normalizeAgentId(agentId), "agent");
|
|
120
36
|
}
|
|
121
37
|
/** Parent of `sessions/` and `agent/`: `<stateDir>/agents/<id>/`. */
|
|
122
|
-
function resolveAgentHomeDir(
|
|
38
|
+
function resolveAgentHomeDir(agentId) {
|
|
123
39
|
return join(resolveStateDir(process.env), "agents", normalizeAgentId(agentId));
|
|
124
40
|
}
|
|
125
41
|
/** Profile Markdown + gateway avatar files: `<stateDir>/agents/<id>/profile/`. */
|
|
126
|
-
function resolveAgentProfileDir(
|
|
127
|
-
return join(resolveAgentHomeDir(
|
|
42
|
+
function resolveAgentProfileDir(agentId) {
|
|
43
|
+
return join(resolveAgentHomeDir(agentId), "profile");
|
|
128
44
|
}
|
|
129
45
|
/** Resolved path for a single profile Markdown basename (e.g. `SOUL.md`). */
|
|
130
|
-
function resolveAgentProfileMarkdownPath(
|
|
46
|
+
function resolveAgentProfileMarkdownPath(agentId, filename) {
|
|
131
47
|
const base = basename(filename.trim().replace(/\\/g, "/"));
|
|
132
|
-
return join(resolveAgentProfileDir(
|
|
48
|
+
return join(resolveAgentProfileDir(agentId), base);
|
|
133
49
|
}
|
|
134
50
|
function normalizePathForComparison(input) {
|
|
135
51
|
const resolved = resolve(resolveUserPath(input));
|
|
@@ -137,94 +53,56 @@ function normalizePathForComparison(input) {
|
|
|
137
53
|
try {
|
|
138
54
|
normalized = fs.realpathSync.native(resolved);
|
|
139
55
|
} catch {}
|
|
140
|
-
|
|
141
|
-
return normalized;
|
|
56
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
142
57
|
}
|
|
143
58
|
function isPathWithinRoot(candidatePath, rootPath) {
|
|
144
59
|
const rel = relative(rootPath, candidatePath);
|
|
145
60
|
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
146
61
|
}
|
|
147
62
|
/** Agent ids whose workspace root contains `workspacePath` (longest match first). */
|
|
148
|
-
function resolveAgentIdsByWorkspacePath(
|
|
63
|
+
function resolveAgentIdsByWorkspacePath(workspacePath) {
|
|
149
64
|
const normalizedWorkspacePath = normalizePathForComparison(workspacePath);
|
|
150
|
-
const entries = listAgentEntries(
|
|
65
|
+
const entries = listAgentEntries();
|
|
151
66
|
const matches = [];
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (!isPathWithinRoot(normalizedWorkspacePath, workspaceDir)) continue;
|
|
157
|
-
matches.push({
|
|
158
|
-
id,
|
|
67
|
+
entries.forEach((entry, order) => {
|
|
68
|
+
const workspaceDir = normalizePathForComparison(resolveAgentWorkspaceDir(entry.id));
|
|
69
|
+
if (isPathWithinRoot(normalizedWorkspacePath, workspaceDir)) matches.push({
|
|
70
|
+
id: entry.id,
|
|
159
71
|
workspaceDir,
|
|
160
|
-
order
|
|
72
|
+
order
|
|
161
73
|
});
|
|
162
|
-
}
|
|
163
|
-
const defaultId = resolveDefaultAgentId(
|
|
164
|
-
if (!entries.some((
|
|
165
|
-
const workspaceDir = normalizePathForComparison(resolveAgentWorkspaceDir(
|
|
74
|
+
});
|
|
75
|
+
const defaultId = resolveDefaultAgentId();
|
|
76
|
+
if (!entries.some((entry) => entry.id === defaultId)) {
|
|
77
|
+
const workspaceDir = normalizePathForComparison(resolveAgentWorkspaceDir(defaultId));
|
|
166
78
|
if (isPathWithinRoot(normalizedWorkspacePath, workspaceDir)) matches.push({
|
|
167
79
|
id: defaultId,
|
|
168
80
|
workspaceDir,
|
|
169
81
|
order: entries.length
|
|
170
82
|
});
|
|
171
83
|
}
|
|
172
|
-
matches.sort((left, right) =>
|
|
173
|
-
const workspaceLengthDelta = right.workspaceDir.length - left.workspaceDir.length;
|
|
174
|
-
if (workspaceLengthDelta !== 0) return workspaceLengthDelta;
|
|
175
|
-
return left.order - right.order;
|
|
176
|
-
});
|
|
84
|
+
matches.sort((left, right) => right.workspaceDir.length - left.workspaceDir.length || left.order - right.order);
|
|
177
85
|
return matches.map((entry) => entry.id);
|
|
178
86
|
}
|
|
179
|
-
/** Best-matching
|
|
180
|
-
function resolveAgentIdByWorkspacePath(
|
|
181
|
-
return resolveAgentIdsByWorkspacePath(
|
|
87
|
+
/** Best-matching Agent id for cwd, or `undefined` when no workspace contains the path. */
|
|
88
|
+
function resolveAgentIdByWorkspacePath(workspacePath) {
|
|
89
|
+
return resolveAgentIdsByWorkspacePath(workspacePath)[0];
|
|
182
90
|
}
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
*/
|
|
187
|
-
function resolveAgentIdForWorkspacePath(cfg, resolvedWorkspacePath) {
|
|
188
|
-
return resolveAgentIdByWorkspacePath(cfg, resolvedWorkspacePath) ?? resolveDefaultAgentId(cfg);
|
|
91
|
+
/** Resolve an Agent from a workspace, falling back to the catalog default. */
|
|
92
|
+
function resolveAgentIdForWorkspacePath(resolvedWorkspacePath) {
|
|
93
|
+
return resolveAgentIdByWorkspacePath(resolvedWorkspacePath) ?? resolveDefaultAgentId();
|
|
189
94
|
}
|
|
190
|
-
function getDefaultWorkspacePath(
|
|
191
|
-
return resolveAgentWorkspaceDir(
|
|
95
|
+
function getDefaultWorkspacePath() {
|
|
96
|
+
return resolveAgentWorkspaceDir(resolveDefaultAgentId());
|
|
192
97
|
}
|
|
193
|
-
var
|
|
98
|
+
var catalog;
|
|
194
99
|
var init_agent_scope = __esmMin((() => {
|
|
100
|
+
init_id();
|
|
101
|
+
init_repository();
|
|
195
102
|
init_paths_state();
|
|
196
|
-
init_workspace_path();
|
|
197
103
|
init_workspace_defaults();
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
INVALID_CHARS_RE = /[^a-z0-9_-]+/g;
|
|
201
|
-
LEADING_DASH_RE = /^-+/;
|
|
202
|
-
TRAILING_DASH_RE = /-+$/;
|
|
203
|
-
STRICT_AGENT_ID_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
204
|
-
WINDOWS_RESERVED_AGENT_IDS = new Set([
|
|
205
|
-
"con",
|
|
206
|
-
"prn",
|
|
207
|
-
"aux",
|
|
208
|
-
"nul",
|
|
209
|
-
"com1",
|
|
210
|
-
"com2",
|
|
211
|
-
"com3",
|
|
212
|
-
"com4",
|
|
213
|
-
"com5",
|
|
214
|
-
"com6",
|
|
215
|
-
"com7",
|
|
216
|
-
"com8",
|
|
217
|
-
"com9",
|
|
218
|
-
"lpt1",
|
|
219
|
-
"lpt2",
|
|
220
|
-
"lpt3",
|
|
221
|
-
"lpt4",
|
|
222
|
-
"lpt5",
|
|
223
|
-
"lpt6",
|
|
224
|
-
"lpt7",
|
|
225
|
-
"lpt8",
|
|
226
|
-
"lpt9"
|
|
227
|
-
]);
|
|
104
|
+
init_workspace_path();
|
|
105
|
+
catalog = new AgentCatalogRepository();
|
|
228
106
|
}));
|
|
229
107
|
//#endregion
|
|
230
108
|
init_agent_scope();
|
|
@@ -3,12 +3,12 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { finishContextExtractionRun } from "../../storage/sqlite/context-extraction-repository.js";
|
|
4
4
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
5
5
|
import { loadCompactionSourceSnapshot } from "../../storage/sqlite/transcript-repository.js";
|
|
6
|
-
import "../../storage/sqlite/index.js";
|
|
6
|
+
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
7
|
+
import { extractTextContent } from "../context/workspace.js";
|
|
7
8
|
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
8
9
|
import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
|
|
9
10
|
import { getApiKeySync, init_providers, resolveModel } from "../../providers/index.js";
|
|
10
11
|
import { createExtensionAwareStreamFn } from "../../providers/extension-stream-bridge.js";
|
|
11
|
-
import { extractTextContent } from "../context/workspace.js";
|
|
12
12
|
import { listUserAssertions } from "../../user-model/repository.js";
|
|
13
13
|
import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
14
14
|
import { isAssistantTurnAborted, isAssistantTurnFailed } from "../orchestration/llm-turn-retry.js";
|
|
@@ -23,6 +23,7 @@ import { Agent } from "@earendil-works/pi-agent-core";
|
|
|
23
23
|
//#region src/agent/background-review/run-background-review.ts
|
|
24
24
|
init_sync_provider_auth();
|
|
25
25
|
init_providers();
|
|
26
|
+
init_sqlite();
|
|
26
27
|
init_logger();
|
|
27
28
|
const log = createLogger("UserModelInterpreter");
|
|
28
29
|
function isReviewMessage(value) {
|
|
@@ -96,7 +97,7 @@ function resolveInterpreterRuntime(params) {
|
|
|
96
97
|
const processingPolicy = config?.userContext.userModel.processingPolicy ?? "remote_allowed";
|
|
97
98
|
let model;
|
|
98
99
|
if (config) {
|
|
99
|
-
const agentId = extractProfileAgentId(params.conversationId
|
|
100
|
+
const agentId = extractProfileAgentId(params.conversationId);
|
|
100
101
|
const ref = resolveModelIntentRef(config, agentId, "understanding");
|
|
101
102
|
if (ref) try {
|
|
102
103
|
model = resolveModel(ref);
|
|
@@ -188,7 +189,7 @@ async function executeReview(params) {
|
|
|
188
189
|
}
|
|
189
190
|
try {
|
|
190
191
|
const config = params.getConfig();
|
|
191
|
-
const agentId = config ? extractProfileAgentId(params.conversationId
|
|
192
|
+
const agentId = config ? extractProfileAgentId(params.conversationId) : "main";
|
|
192
193
|
const write = config?.userContext.userModel.writePolicy ?? "deny";
|
|
193
194
|
const result = executeUserModelInterpretation({
|
|
194
195
|
interpretation,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { DEFAULT_AGENTS_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME } from "../context/workspace.js";
|
|
1
2
|
import { isCronConversationId, isSubagentConversationId } from "../../routing/agent-session-key.js";
|
|
2
3
|
import { init_session_key } from "../../routing/session-key.js";
|
|
3
|
-
import { DEFAULT_AGENTS_FILENAME, DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME } from "../context/workspace.js";
|
|
4
4
|
//#region src/agent/bootstrap/filter-bootstrap-files.ts
|
|
5
5
|
init_session_key();
|
|
6
6
|
const MINIMAL_BOOTSTRAP_ALLOWLIST = new Set([
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { resolveStateDir } from "../../config/paths-state.js";
|
|
2
|
+
import { redactSensitiveOutput } from "../../utils/logger/redact.js";
|
|
3
|
+
import { init_logger } from "../../utils/logger.js";
|
|
2
4
|
import { init_global_singleton, resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
3
5
|
import { init_paths } from "../../config/paths.js";
|
|
4
6
|
import { spawnProcess } from "../../process/run-process.js";
|
|
@@ -11,6 +13,7 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
11
13
|
//#region src/agent/commands/command-registry.ts
|
|
12
14
|
init_paths();
|
|
13
15
|
init_global_singleton();
|
|
16
|
+
init_logger();
|
|
14
17
|
const DEFAULT_COMMAND_TIMEOUT_MS = 30 * 6e4;
|
|
15
18
|
const MAX_COMMAND_TIMEOUT_MS = 240 * 6e4;
|
|
16
19
|
const MAX_LOG_BYTES = 8 * 1024 * 1024;
|
|
@@ -56,7 +59,7 @@ var CommandRegistry = class {
|
|
|
56
59
|
isolation: input.isolation?.mode ?? "host",
|
|
57
60
|
...launch.containerName ? { containerName: launch.containerName } : {},
|
|
58
61
|
id,
|
|
59
|
-
command: input.command,
|
|
62
|
+
command: redactSensitiveOutput(input.command),
|
|
60
63
|
cwd: input.cwd,
|
|
61
64
|
status: "running",
|
|
62
65
|
exitCode: null,
|
|
@@ -82,8 +85,9 @@ var CommandRegistry = class {
|
|
|
82
85
|
let closed = false;
|
|
83
86
|
let containerCleanup;
|
|
84
87
|
const append = (stream, chunk) => {
|
|
85
|
-
const
|
|
86
|
-
|
|
88
|
+
const raw = String(chunk);
|
|
89
|
+
const value = redactSensitiveOutput(raw);
|
|
90
|
+
result.totalOutputBytes += Buffer.byteLength(raw);
|
|
87
91
|
result.captureTruncated ||= result[stream].length + value.length > limit || result.aggregatedOutput.length + value.length > limit;
|
|
88
92
|
result[stream] = (result[stream] + value).slice(-limit);
|
|
89
93
|
result.aggregatedOutput = (result.aggregatedOutput + value).slice(-limit);
|
|
@@ -30,7 +30,7 @@ var ExecutionContextCoordinator = class {
|
|
|
30
30
|
if (!config || !config.userContext.contextPlanning.enabled || !access.userModel && !access.knowledge) return empty();
|
|
31
31
|
await this.options.ensureMemoryReady(conversationId);
|
|
32
32
|
const task = assembleTaskContext(conversationId, extractAgentUserPlainText(userMessage));
|
|
33
|
-
const agentId = extractProfileAgentId(conversationId
|
|
33
|
+
const agentId = extractProfileAgentId(conversationId);
|
|
34
34
|
const workspaceId = this.options.getWorkspaceIdForSession(conversationId);
|
|
35
35
|
const projectId = this.options.getProjectIdForSession(conversationId);
|
|
36
36
|
const maxKnowledge = Math.min(config.userContext.contextPlanning.maxKnowledge, task.allocation.maxResults);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
import { listCollaborationRules } from "../../storage/sqlite/collaboration-rule-repository.js";
|
|
2
|
+
import { init_collaboration_rule_repository, listCollaborationRules } from "../../storage/sqlite/collaboration-rule-repository.js";
|
|
3
3
|
import { searchKnowledgeItems } from "../../knowledge-memory/repository.js";
|
|
4
4
|
import "../../knowledge-memory/index.js";
|
|
5
5
|
import { retrievalLexicalSimilarity } from "../../retrieval/textFeatures.js";
|
|
@@ -11,6 +11,7 @@ import { buildUserContextBlock } from "../memory/context-fence.js";
|
|
|
11
11
|
import { randomUUID } from "node:crypto";
|
|
12
12
|
//#region src/agent/context/execution-context.ts
|
|
13
13
|
init_transaction();
|
|
14
|
+
init_collaboration_rule_repository();
|
|
14
15
|
function scopeVisible(scope, context) {
|
|
15
16
|
if (scope.type === "global") return true;
|
|
16
17
|
return scope.id === {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
2
2
|
import { TaskRepository, init_task_repository } from "../../tasks/task-repository.js";
|
|
3
3
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
4
|
-
import "../../storage/sqlite/index.js";
|
|
4
|
+
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
5
5
|
import { sanitizeForPromptLiteral } from "../prompt/sanitize-for-prompt.js";
|
|
6
6
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
7
7
|
import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
|
|
8
8
|
import { buildActiveProjectContextForPrompt } from "./project-context.js";
|
|
9
9
|
//#region src/agent/context/execution-scope.ts
|
|
10
|
+
init_sqlite();
|
|
10
11
|
init_task_repository();
|
|
11
12
|
const MAX_OBJECTIVE_TEXT = 1200;
|
|
12
13
|
const MAX_CRITERIA = 12;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Seed profile Markdown files into `agents/<agentId>/profile/` (and optionally `git init` the Markdown workspace).
|
|
3
3
|
* Resolution order per file: `XOPC_TEMPLATE_PATH` or repo `docs/reference/templates`, then bundled `./workspace-templates/`.
|
|
4
4
|
*/
|
|
5
|
-
import type { Config } from '../../config/schema.js';
|
|
6
5
|
/** Marker in bundled/reference `IDENTITY.md` templates; replaced on agent creation when a display name is known. */
|
|
7
6
|
export declare const IDENTITY_NAME_PLACEHOLDER = "_(pick something you like)_";
|
|
8
7
|
export type SeedWorkspaceProfileMarkdownOptions = {
|
|
@@ -18,4 +17,4 @@ export declare function seedAgentProfileMarkdownFiles(profileDir: string, markdo
|
|
|
18
17
|
/**
|
|
19
18
|
* Ensure default (`main`) agent has reference profile Markdown templates (missing files only).
|
|
20
19
|
*/
|
|
21
|
-
export declare function seedMainAgentProfileMarkdown(
|
|
20
|
+
export declare function seedMainAgentProfileMarkdown(): void;
|
|
@@ -105,9 +105,9 @@ function ensureGitRepo(markdownWorkspaceDir, isBrandNew) {
|
|
|
105
105
|
/**
|
|
106
106
|
* Ensure default (`main`) agent has reference profile Markdown templates (missing files only).
|
|
107
107
|
*/
|
|
108
|
-
function seedMainAgentProfileMarkdown(
|
|
109
|
-
const agentId = resolveDefaultAgentId(
|
|
110
|
-
seedAgentProfileMarkdownFiles(resolveAgentProfileDir(
|
|
108
|
+
function seedMainAgentProfileMarkdown() {
|
|
109
|
+
const agentId = resolveDefaultAgentId();
|
|
110
|
+
seedAgentProfileMarkdownFiles(resolveAgentProfileDir(agentId), resolveAgentWorkspaceDir(agentId), { displayName: agentId });
|
|
111
111
|
}
|
|
112
112
|
//#endregion
|
|
113
113
|
export { IDENTITY_NAME_PLACEHOLDER, seedAgentProfileMarkdownFiles, seedMainAgentProfileMarkdown };
|
|
@@ -44,7 +44,7 @@ function resolveWorkspaceStatePathForMarkdownWorkspace(markdownWorkspaceDir) {
|
|
|
44
44
|
}
|
|
45
45
|
/** Resolve workspace state path from config + agent id. */
|
|
46
46
|
function resolveAgentWorkspaceStatePath(config, agentId) {
|
|
47
|
-
return resolveWorkspaceStatePath(
|
|
47
|
+
return resolveWorkspaceStatePath(agentId);
|
|
48
48
|
}
|
|
49
49
|
/** Record profile Markdown seed time (idempotent). */
|
|
50
50
|
function markProfileMarkdownSeeded(statePath) {
|
|
@@ -109,7 +109,7 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
109
109
|
const systemPrompt = appendDynamicPromptSection([agent.state.systemPrompt ?? "", params.presentation === "voice" ? voicePresentationPrompt : ""].filter(Boolean).join("\n\n"), params.dynamicSystemContext ?? "");
|
|
110
110
|
const thinkingLevel = params.thinkingOverride ?? agent.state.thinkingLevel;
|
|
111
111
|
const workspaceDir = agentManager.getResolvedWorkspaceForSession(conversationId);
|
|
112
|
-
const promptCachePolicy = resolvePromptCachePolicy(config ? resolveEffectiveAgentProfileForSession(
|
|
112
|
+
const promptCachePolicy = resolvePromptCachePolicy(config ? resolveEffectiveAgentProfileForSession(conversationId).config.runtime.promptCache : void 0);
|
|
113
113
|
let userMessageForTurn = userMessage;
|
|
114
114
|
if (params.applyStartupContext !== false) {
|
|
115
115
|
userMessageForTurn = await applyStartupContextToUserMessage({
|
|
@@ -191,7 +191,7 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
191
191
|
try {
|
|
192
192
|
const turnResult = await runWithEmbeddedExecutionSession(conversationId, () => runXopcEmbeddedTurn({
|
|
193
193
|
conversationId,
|
|
194
|
-
verifyChanges: config ? resolveEffectiveAgentProfileForSession(
|
|
194
|
+
verifyChanges: config ? resolveEffectiveAgentProfileForSession(conversationId).agentId === "coder" : false,
|
|
195
195
|
runId,
|
|
196
196
|
userMessage: userMessageForTurn,
|
|
197
197
|
images: params.llmImages,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { getClarification, getClarificationResumeInput, isClarificationSuspended } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
3
|
+
import { getClarification, getClarificationResumeInput, init_clarification_wait_repository, isClarificationSuspended } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
4
4
|
import { getConnectionResumeInput, init_connection_wait_repository, isConnectionSuspended } from "../../storage/sqlite/connection-wait-repository.js";
|
|
5
5
|
import { runWithEmbeddedExecutionSession } from "./execution-context.js";
|
|
6
6
|
import { isComputerControlActive, isComputerLeaseTool, stopComputerControl } from "../../computer/control-guard.js";
|
|
@@ -27,6 +27,7 @@ import { withDelegationScope } from "../orchestration/delegation-scope.js";
|
|
|
27
27
|
import { createAssistantMessageEventStream, getCurrentSystemPrompt, getCurrentTools, isRecoverableLength } from "@earendil-works/pi-ai";
|
|
28
28
|
//#region src/agent/embedded/run-turn.ts
|
|
29
29
|
init_connection_wait_repository();
|
|
30
|
+
init_clarification_wait_repository();
|
|
30
31
|
init_logger();
|
|
31
32
|
const log = createLogger("EmbeddedRun");
|
|
32
33
|
const LOG_PREVIEW_MAX_CHARS = 300;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { requireXopcDatabase } from "../../storage/sqlite/connection.js";
|
|
2
2
|
import { ensureSessionRecord } from "../../storage/sqlite/session-repository.js";
|
|
3
3
|
import { loadTranscriptRowsForSession } from "../../storage/sqlite/transcript-repository.js";
|
|
4
|
-
import "../../storage/sqlite/index.js";
|
|
4
|
+
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
5
5
|
import { storedRowsToFileEntries } from "../../session/stored-rows-to-file-entries.js";
|
|
6
6
|
import { repairAssistantUsageInSessionManager } from "./session-manager-init.js";
|
|
7
7
|
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
8
8
|
//#region src/agent/embedded/sqlite-hydrating-session-manager.ts
|
|
9
|
+
init_sqlite();
|
|
9
10
|
/**
|
|
10
11
|
* Open an in-memory pi SessionManager hydrated from the SQLite transcript.
|
|
11
12
|
* File persistence is disabled; writes flow through the tool-result guard into SQLite.
|
|
@@ -4,7 +4,7 @@ import { getSessionInputState, init_session_input_repository } from "../../stora
|
|
|
4
4
|
import { getConnectorAccount, init_connector_account_repository } from "../../storage/sqlite/connector-account-repository.js";
|
|
5
5
|
import { appendConnectorExecutionAudit, consumeConnectorApproval, createConnectorApproval, getConnectorApproval, getConnectorConnection, getConnectorInstallation, init_connector_repository } from "../../storage/sqlite/connector-repository.js";
|
|
6
6
|
import { connectorObjectiveScope, init_connection_wait_repository, publishConnectionWait, requireSessionConnection } from "../../storage/sqlite/connection-wait-repository.js";
|
|
7
|
-
import "../../storage/sqlite/index.js";
|
|
7
|
+
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
8
8
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
9
9
|
import { ExternalEffectNotAppliedError, executeExternalOperation } from "../../capabilities/runtime/external-operations.js";
|
|
10
10
|
import "../../capabilities/runtime/dispatcher.js";
|
|
@@ -23,6 +23,7 @@ import { join } from "node:path";
|
|
|
23
23
|
import { randomUUID } from "node:crypto";
|
|
24
24
|
import { writeFile } from "node:fs/promises";
|
|
25
25
|
//#region src/agent/external-tools/cliProvider.ts
|
|
26
|
+
init_sqlite();
|
|
26
27
|
init_connector_account_repository();
|
|
27
28
|
init_connector_repository();
|
|
28
29
|
init_connection_wait_repository();
|
|
@@ -4,7 +4,7 @@ import { getSessionInputState, init_session_input_repository } from "../../stora
|
|
|
4
4
|
import { getConnectorAccount } from "../../storage/sqlite/connector-account-repository.js";
|
|
5
5
|
import { consumeConnectorApproval, createConnectorApproval, getConnectorApproval, getConnectorConnection, getConnectorInstallation, listConnectorActionMetadata, listConnectorConnections, listConnectorInstallations, upsertConnectorActionMetadata, upsertConnectorInstallation } from "../../storage/sqlite/connector-repository.js";
|
|
6
6
|
import { bindObjectiveAccount, connectionBinding, connectionBindings, connectorObjectiveScope, init_connection_wait_repository, publishConnectionWait, requireSessionConnection } from "../../storage/sqlite/connection-wait-repository.js";
|
|
7
|
-
import "../../storage/sqlite/index.js";
|
|
7
|
+
import { init_sqlite } from "../../storage/sqlite/index.js";
|
|
8
8
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
9
9
|
import { ExternalEffectNotAppliedError, executeExternalOperation } from "../../capabilities/runtime/external-operations.js";
|
|
10
10
|
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
@@ -22,6 +22,7 @@ import { ExternalToolSearchError } from "./search-error.js";
|
|
|
22
22
|
//#region src/agent/external-tools/composio-provider.ts
|
|
23
23
|
init_session_input_repository();
|
|
24
24
|
init_connection_wait_repository();
|
|
25
|
+
init_sqlite();
|
|
25
26
|
init_logger();
|
|
26
27
|
const CONNECTION_ARGUMENT = "xopcAccountId";
|
|
27
28
|
const log = createLogger("ComposioToolProvider");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { COMPUTER_CONTROL_TOOL, init_src } from "../../../packages/computer-control-contract/src/index.js";
|
|
2
|
-
import { BROWSER_CONTROL_ENDPOINT_TOOL_NAME } from "../../../packages/browser-control-contract/src/index.js";
|
|
3
1
|
import { executeExternalOperation } from "../../capabilities/runtime/external-operations.js";
|
|
4
2
|
import { canonicalCapabilityJson } from "../../capabilities/runtime/dispatcher.js";
|
|
3
|
+
import { COMPUTER_CONTROL_TOOL, init_src } from "../../../packages/computer-control-contract/src/index.js";
|
|
4
|
+
import { BROWSER_CONTROL_ENDPOINT_TOOL_NAME } from "../../../packages/browser-control-contract/src/index.js";
|
|
5
5
|
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
//#region src/agent/external-tools/endpoint-provider.ts
|
|
@@ -50,10 +50,9 @@ function createDefaultExternalToolGatewayTools(deps) {
|
|
|
50
50
|
getCurrentContext: deps.getCurrentContext
|
|
51
51
|
}));
|
|
52
52
|
return createExternalToolGatewayTools(providers.map((provider) => withExternalReadPolicy(provider, (toolRef) => {
|
|
53
|
-
|
|
54
|
-
if (!config) return void 0;
|
|
53
|
+
if (!deps.getConfig()) return void 0;
|
|
55
54
|
const conversationId = deps.getCurrentContext()?.conversationId;
|
|
56
|
-
return (conversationId ? resolveEffectiveAgentConfigForSession(
|
|
55
|
+
return (conversationId ? resolveEffectiveAgentConfigForSession(conversationId) : deps.agentId ? resolveEffectiveAgentConfigForAgent(deps.agentId) : resolveEffectiveAgentConfigForSession(void 0)).config.tools[toolRef];
|
|
57
56
|
})), deps.getCurrentContext);
|
|
58
57
|
}
|
|
59
58
|
//#endregion
|
|
@@ -173,14 +173,14 @@ var McpToolProvider = class {
|
|
|
173
173
|
isAllowed(tool) {
|
|
174
174
|
const cfg = this.deps.getConfig();
|
|
175
175
|
const conversationId = this.deps.getConversationId();
|
|
176
|
-
const profile = cfg && conversationId ? resolveEffectiveAgentProfileForSession(
|
|
176
|
+
const profile = cfg && conversationId ? resolveEffectiveAgentProfileForSession(conversationId) : void 0;
|
|
177
177
|
const policyName = policyToolId(tool);
|
|
178
178
|
return !profile?.tools.denied.has(policyName);
|
|
179
179
|
}
|
|
180
180
|
executionSignal(tool, signal) {
|
|
181
181
|
const cfg = this.deps.getConfig();
|
|
182
182
|
const conversationId = this.deps.getConversationId();
|
|
183
|
-
const timeoutMs = (cfg && conversationId ? resolveEffectiveAgentProfileForSession(
|
|
183
|
+
const timeoutMs = (cfg && conversationId ? resolveEffectiveAgentProfileForSession(conversationId) : void 0)?.config.tools[policyToolId(tool)]?.timeoutMs;
|
|
184
184
|
if (!timeoutMs) return signal;
|
|
185
185
|
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
186
186
|
return signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "../../config/schema.js";
|
|
2
1
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
|
|
2
|
+
import { getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "../../config/schema.js";
|
|
3
3
|
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
4
4
|
import { getDefaultModelSync, getModelsByProvider, init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
5
5
|
import { resolveAgentModelFallbackValues, resolveAgentModelPrimaryValue } from "../../config/model-input.js";
|
|
@@ -13,7 +13,7 @@ function hasToolModelConfig(model) {
|
|
|
13
13
|
return Boolean(model?.primary?.trim() || (model?.fallbacks ?? []).some((entry) => entry.trim().length > 0));
|
|
14
14
|
}
|
|
15
15
|
function resolveDefaultModelRef(cfg) {
|
|
16
|
-
const ref = cfg ? getAgentDefaultModelRef(
|
|
16
|
+
const ref = cfg ? getAgentDefaultModelRef() : void 0;
|
|
17
17
|
if (ref) {
|
|
18
18
|
const p = parseModelRef(ref);
|
|
19
19
|
if (p) return p;
|
|
@@ -36,14 +36,13 @@ function coerceToolModelConfig(model) {
|
|
|
36
36
|
function resolveEffectiveModelsConfig(params) {
|
|
37
37
|
if (!params.cfg) return;
|
|
38
38
|
try {
|
|
39
|
-
|
|
40
|
-
return resolveEffectiveAgentConfigForAgent(params.cfg, agentId).config.models;
|
|
39
|
+
return resolveEffectiveAgentConfigForAgent(params.agentId?.trim() || resolveDefaultAgentId()).config.models;
|
|
41
40
|
} catch {
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
function resolveConfiguredImageModelConfig(params) {
|
|
46
|
-
return coerceToolModelConfig(resolveEffectiveModelsConfig(params)?.imageUnderstanding ?? (params.cfg ? getAgentDefaultImageModelConfig(
|
|
45
|
+
return coerceToolModelConfig(resolveEffectiveModelsConfig(params)?.imageUnderstanding ?? (params.cfg ? getAgentDefaultImageModelConfig() : void 0));
|
|
47
46
|
}
|
|
48
47
|
function modelRefSupportsImage(modelRef) {
|
|
49
48
|
try {
|
|
@@ -88,7 +88,7 @@ async function buildTranscriptUserMessage(opts) {
|
|
|
88
88
|
appendMediaAttachedLines(textParts, prepared.filter((m) => !isImageInboundAttachment(m)), opts.suppressMediaPromptUris);
|
|
89
89
|
if (imageRefs.length > 0 && strategy !== "native") {
|
|
90
90
|
const images = await Promise.all(imageRefs.map((ref) => readImageBase64FromRef(ref)));
|
|
91
|
-
const agentId = opts.config ? extractProfileAgentId(opts.conversationId
|
|
91
|
+
const agentId = opts.config ? extractProfileAgentId(opts.conversationId) : void 0;
|
|
92
92
|
const parts = await resolveInboundImageContentParts({
|
|
93
93
|
modelRef: opts.modelRef,
|
|
94
94
|
cfg: opts.config,
|
|
@@ -15,7 +15,7 @@ var AgentBus = class {
|
|
|
15
15
|
unsubscribe;
|
|
16
16
|
constructor(appConfig, _stateDir, agentId) {
|
|
17
17
|
this.appConfig = appConfig;
|
|
18
|
-
this.agentId = agentId ?? resolveDefaultAgentId(
|
|
18
|
+
this.agentId = agentId ?? resolveDefaultAgentId();
|
|
19
19
|
this.inbox = AgentInbox.forAgent(appConfig, this.agentId);
|
|
20
20
|
}
|
|
21
21
|
/**
|