@xopcai/xopc 0.0.314 → 0.0.316
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/src/plugin.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BFkjfurL.js → agent-avatar-dicebear-XIyH14Sn.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DJl_o7Xf.js +1 -0
- package/dist/gateway/static/root/assets/agents-CGFhxPFv.js +1 -0
- package/dist/gateway/static/root/assets/{api-BYhRsTAc.js → api-Dy056n2_.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B4kihr-A.js → app-management-settings-panel-Dp7Fcj2Z.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-N9sYmNOx.js → appearance-settings-CSUffLjx.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BMcy10_s.js → apps-page-DtIcKfJG.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-k_SuYWyV.js → archive-plugin-D3SdndlF.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DRv5QWUK.js → attachment-load-BgxXYRkd.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CkJV3DN0.js → automations-page-krhofMgL.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-EbpneB06.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Dg3h3TA7.js → binary-plugins-w6lazTqo.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DVhdHntT.js → block-editor-CxHqPODE.js} +5 -5
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BMRYUW8_.js → browser-automation-inputs-hNdEgfGG.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Byv6-FY2.js → browser-automations-page-BYsGJ_xs.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CP_c5q0V.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-ljW3s3vv.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-CR9SRgFp.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D4AHa51o.js → chat-terminal-dock-medSiQoQ.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-eXPe500D.js → computer-settings-page-DJxO0CfY.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BQTFlq_k.js → connector-service-page-WaoUqr8a.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-KIi15pQl.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-7MtovynY.js → date-picker-DalDr0E6.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Bj_xkXID.js → dependency-picker-ONChq2Yr.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CTmba9zH.js → desktop-pet-b1a37SVn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DNM_BlWN.js → desktop-pet-settings-CwqZxGv4.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C_MNpS30.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-J_olaL7e.js → extension-debug-page-CGthPGca.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-pK5RvqN8.js → extension-page-CExNJs0G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BwroEN08.js → extension-settings-page-DBfxzKR8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-FuJTIg_a.js → gateway-config-swr-DFjsI4QK.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BlpheZrf.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CKg_gu8_.js → gateway-startup-retry-oRRqSoe9.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BvdT-uaI.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Bo6NZ7zb.js → image-generation-api-CyDy_Sxu.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C8-hX8gS.js → imports-page-Dnp2hmFL.js} +1 -1
- package/dist/gateway/static/root/assets/index-BYKatjhB.css +1 -0
- package/dist/gateway/static/root/assets/index-DhCnwCI9.js +89 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BkBEjUZD.js → keyboard-shortcuts-settings-1DUcGrYh.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BW2-80Og.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CrbKIixo.js → local-apps-page-C7_2zyV_.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CvGwNbml.js → locale-store-D6VmRI5e.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DBHlZts9.js → logs-page-Cbr7bPM6.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-G7GcFx2_.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-nXo5nrsv.js → markdown-view-B5MfZeKH.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-upxXJ-4l.js → media-plugins-IbcEpV96.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BCqLsIZK.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C4DiKkDf.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-DgHQmpVq.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-DUyA-K4L.js → page-context-capture-button-B5rZ_F0R.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-Cl-NFPNr.js → page-tabs-B84Yghg5.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DX81PwJ3.js → preview-open-alternatives-CaEtDmZO.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CrfIGwm8.js → product-open-page-BK9z5b-v.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Qj8Xb9qS.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-nM9a9XNS.js → projects-page-BOp6swwM.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CHxgohY0.js → registry-api-sOL6E5LU.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-yb8l4ppq.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D3dLOW04.js → runtime-tools-settings-panel-BAvzw1T0.js} +1 -1
- package/dist/gateway/static/root/assets/scenes-page-CiAgb7hf.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-ZxuIvD2_.js → schema-form-Dytkw9RZ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-43hcOW84.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C414vr2V.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-TZRfg4yo.js → settings-form-section-DBJlmKQV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-a8qcJpdZ.js → settings-page-C9GbP-ZG.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BfvlRT9q.js → settings-page-layout-OvBOGen7.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BCMym4xj.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DCt1pTWB.js → share-preview-page-D-sx26yN.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-EdNGhsuF.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DYYM1qVn.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-BIOcg44X.js → skills-page-Cgrfnet5.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CgZdzT4I.js → skills-page.utils-COPGVfmB.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-_YaRncA6.js → system-settings-panel-B9tptggE.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BrsM6Xmm.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-uOupJOoS.js → tunnel-api-qb33IFGP.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BezzHBLE.js → use-autosave-DfhqCGRX.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-Sg94U7zz.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BmYifdwL.js → voice-api-key-field-taBVzvtI.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-D_5Q2_A3.js → voice-config-api-B4yjd1Kb.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-4DmyEckJ.js → work-discovery-overlay-DWGTB3Uk.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DeZe8bTZ.js → workflow-run-setup-panel-CP58uTNh.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Clka1xiQ.js +6 -0
- package/dist/gateway/static/root/index.html +8 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +18 -17
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +28 -15
- package/dist/src/agent/embedded/system-prompt-override.js +14 -3
- package/dist/src/agent/embedded/xopc-stream-bridge.js +13 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +39 -0
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +32 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +11 -0
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +2 -1
- package/dist/src/agent/mcp/mcp-resource-id.d.ts +6 -0
- package/dist/src/agent/mcp/mcp-resource-id.js +19 -0
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/memory/context-budget.js +1 -1
- package/dist/src/agent/orchestration/agent-turn-policy.d.ts +2 -2
- package/dist/src/agent/prompt/agent-system-prompt.d.ts +3 -0
- package/dist/src/agent/prompt/agent-system-prompt.js +16 -0
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/source-context/browser-tab.d.ts +3 -0
- package/dist/src/agent/source-context/browser-tab.js +29 -0
- package/dist/src/agent/source-context/file-context.d.ts +3 -0
- package/dist/src/agent/source-context/file-context.js +64 -0
- package/dist/src/agent/source-context/index.d.ts +4 -0
- package/dist/src/agent/source-context/index.js +5 -1
- package/dist/src/agent/source-context/injector.js +1 -1
- package/dist/src/agent/source-context/mcp-resource-context.d.ts +8 -0
- package/dist/src/agent/source-context/mcp-resource-context.js +30 -0
- package/dist/src/agent/source-context/session-context.d.ts +8 -0
- package/dist/src/agent/source-context/session-context.js +33 -0
- package/dist/src/agent/source-context/types.d.ts +9 -3
- package/dist/src/agent/source-context/types.js +3 -2
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/knowledge-memory-tool.js +1 -0
- package/dist/src/agent-config/schema.d.ts +8 -8
- package/dist/src/ai-assist/text-assist.js +3 -2
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/manager.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.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 +3 -3
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.d.ts +8 -8
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/schema.d.ts +5 -5
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.d.ts +1 -0
- package/dist/src/connectors/connected-source-ingestion.js +1 -0
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +91 -31
- package/dist/src/connectors/content-enrichment.d.ts +1 -0
- package/dist/src/connectors/content-enrichment.js +3 -1
- package/dist/src/connectors/learning-coordinator.js +24 -24
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +12 -6
- package/dist/src/gateway/chat-stream/protocol.d.ts +2 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +2 -2
- package/dist/src/gateway/hono/routes/browser.js +32 -0
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +0 -16
- package/dist/src/gateway/hono/routes/endpoint-tools.js +86 -30
- package/dist/src/gateway/hono/routes/mcp.js +32 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +6 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +4 -4
- package/dist/src/gateway/hono/routes/user-model-refresh.js +2 -2
- package/dist/src/gateway/service/agent-runner.d.ts +1 -1
- package/dist/src/gateway/service/agent-runner.js +2 -2
- package/dist/src/gateway/service/app-context-access.d.ts +0 -4
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +3 -3
- package/dist/src/gateway/service.js +47 -10
- package/dist/src/gateway/workspace-file-search.js +25 -12
- package/dist/src/knowledge/ingestion-service.d.ts +5 -2
- package/dist/src/knowledge/ingestion-service.js +24 -15
- package/dist/src/knowledge-memory/domain.d.ts +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/platform/client.d.ts +2 -2
- package/dist/src/platform/contracts.d.ts +2 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/extension-stream-bridge.js +6 -4
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-call.js +3 -3
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/presentation.js +4 -3
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/client-history.d.ts +2 -1
- package/dist/src/session/client-history.js +3 -2
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +1 -2
- package/dist/src/storage/sqlite/context-extraction-repository.js +1 -9
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +15 -1
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +39 -6
- package/dist/src/storage/sqlite/index.d.ts +2 -3
- package/dist/src/storage/sqlite/index.js +3 -4
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +3 -0
- package/dist/src/storage/sqlite/migrations/200_connected_work_threads.sql +92 -0
- package/dist/src/storage/sqlite/migrations/201_connector_extraction_audit.sql +127 -0
- 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/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +1 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/user-context/domain.d.ts +0 -13
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +10 -0
- package/dist/src/user-context/sources/repository.js +19 -4
- package/dist/src/user-context/sources/types.d.ts +1 -0
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BdOZ6q8Z.js +0 -1
- package/dist/gateway/static/root/assets/agents-CCcavsHq.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BEa2doeR.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-DRCHGFpO.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-mxRP0gl0.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-DBt_6GsB.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BKeBWwcI.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-C2XE0QhT.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CLLDp23J.js +0 -1
- package/dist/gateway/static/root/assets/home-page-B5Epb1PH.js +0 -1
- package/dist/gateway/static/root/assets/index-14F1yGJI.js +0 -89
- package/dist/gateway/static/root/assets/index-cB7rWIDY.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-6jC3vQpY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-DsUWLu5m.js +0 -1
- package/dist/gateway/static/root/assets/messages-B_AwRroN.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-0Q9TOtJG.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-D0NmcwNw.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BVfVrYmn.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C8b_k88G.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-DEowreZV.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-B_nPhera.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BqhIOuus.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CRj5Ruqn.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BNbXPk--.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNMCLbav.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CAcfAG-c.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BFFeneDq.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Sv4hEc6W.js +0 -6
- package/dist/src/storage/sqlite/context-relation-repository.d.ts +0 -50
- package/dist/src/storage/sqlite/context-relation-repository.js +0 -98
|
@@ -7,6 +7,7 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
7
7
|
import { init_logger } from "../utils/logger.js";
|
|
8
8
|
import { closeXopcDatabase, openXopcDatabase } from "../storage/sqlite/connection.js";
|
|
9
9
|
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
10
|
+
import { getBrowserTabBindingById } from "../storage/sqlite/browser-tab-binding-repository.js";
|
|
10
11
|
import { findSessionInput, init_session_input_repository, insertSessionInput } from "../storage/sqlite/session-input-repository.js";
|
|
11
12
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
12
13
|
import { TaskRunRepository, init_task_run_repository } from "../tasks/task-run-repository.js";
|
|
@@ -17,17 +18,17 @@ import { getSessionConfig } from "../storage/sqlite/config-repository.js";
|
|
|
17
18
|
import "../storage/sqlite/index.js";
|
|
18
19
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
19
20
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
20
|
-
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
21
|
-
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
22
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
23
|
-
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
24
21
|
import { init_paths, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
22
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
25
23
|
import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
|
|
26
24
|
import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
|
|
27
25
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, init_channel_catalog_service } from "../channels/catalog/channel-catalog-service.js";
|
|
28
26
|
import { loadConfig, saveConfig } from "../config/loader.js";
|
|
29
|
-
import {
|
|
27
|
+
import { init_agent_session_key, resolveAgentMainConversationId } from "../routing/agent-session-key.js";
|
|
28
|
+
import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
|
|
29
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
30
30
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
31
|
+
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
31
32
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
32
33
|
import { getEmbeddedExecutionSession } from "../agent/embedded/execution-context.js";
|
|
33
34
|
import { disposeAllSessionMcpRuntimes } from "../agent/mcp/bundle-mcp-runtime.js";
|
|
@@ -37,6 +38,7 @@ import { ProjectService } from "../projects/project-service.js";
|
|
|
37
38
|
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
38
39
|
import "../projects/index.js";
|
|
39
40
|
import { resolveEffectiveGatewayPort } from "./host.js";
|
|
41
|
+
import { RealtimeExtensionBrowserProvider } from "../browser/providers/realtime-extension.js";
|
|
40
42
|
import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
41
43
|
import { buildNoteAgentContext } from "../notes/agent-context.js";
|
|
42
44
|
import { NotesStore } from "../notes/store.js";
|
|
@@ -59,6 +61,9 @@ import "../infra/bus/index.js";
|
|
|
59
61
|
import { collectMediaUrisFromMessages, deleteMediaUris } from "../media/session-references.js";
|
|
60
62
|
import { AgentService } from "../agent/service.js";
|
|
61
63
|
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
64
|
+
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
65
|
+
import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
66
|
+
import { ChannelManager } from "../channels/manager.js";
|
|
62
67
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
63
68
|
import "../config/index.js";
|
|
64
69
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
@@ -77,16 +82,18 @@ import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
|
77
82
|
import "../endpoint-tools/index.js";
|
|
78
83
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
79
84
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
80
|
-
import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
81
85
|
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
86
|
+
import { getGatewayFileSpaceService } from "./file-space-service.js";
|
|
82
87
|
import { createBackgroundTask } from "../infra/background-task.js";
|
|
83
88
|
import { buildTaskAgentContext } from "../agent/source-context/task-context.js";
|
|
89
|
+
import { buildFileAgentContext } from "../agent/source-context/file-context.js";
|
|
90
|
+
import { buildSessionAgentContext } from "../agent/source-context/session-context.js";
|
|
91
|
+
import { buildMcpResourceAgentContext } from "../agent/source-context/mcp-resource-context.js";
|
|
92
|
+
import { buildBrowserTabAgentContext } from "../agent/source-context/browser-tab.js";
|
|
84
93
|
import { WorkDiscoveryService } from "../work-discovery/service.js";
|
|
85
94
|
import { buildVoiceMemoryContext } from "../voice/realtime/memory-context.js";
|
|
86
95
|
import { buildVoicePersonaContext } from "../voice/realtime/persona-context.js";
|
|
87
96
|
import { voiceMemoryBudget, voicePersonaBudget } from "../voice/realtime/conversation-context.js";
|
|
88
|
-
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
89
|
-
import { ChannelManager } from "../channels/manager.js";
|
|
90
97
|
import "../notes/index.js";
|
|
91
98
|
import { buildWorkflowChildTools } from "../agent/workflow/workflow-child-tools.js";
|
|
92
99
|
import { WorkflowRunService } from "../workflows/service/workflow-run-service.js";
|
|
@@ -470,9 +477,39 @@ var GatewayService = class {
|
|
|
470
477
|
getAgentService: () => this.ensureAgentService(),
|
|
471
478
|
getChannelManager: () => this.channelManager,
|
|
472
479
|
getConfig: () => this.config,
|
|
473
|
-
resolveTurnContext: async (ref) => {
|
|
480
|
+
resolveTurnContext: async (ref, conversationId) => {
|
|
474
481
|
if (ref.kind === "task") return buildTaskAgentContext(new TaskRepository().get(ref.sourceId), ref.expectedVersion);
|
|
475
|
-
if (ref.kind
|
|
482
|
+
if (ref.kind === "file") {
|
|
483
|
+
const files = getGatewayFileSpaceService(this);
|
|
484
|
+
const space = await files.forContext("session", conversationId).catch(() => null);
|
|
485
|
+
if (!space) return null;
|
|
486
|
+
return buildFileAgentContext(files, ref.sourceId, ref.expectedVersion, space.id);
|
|
487
|
+
}
|
|
488
|
+
if (ref.kind === "session") {
|
|
489
|
+
const [metadata, messages] = await Promise.all([this.sessionIndex.getSessionMetadata(ref.sourceId), this.sessionIndex.getStore().loadMessages(ref.sourceId)]);
|
|
490
|
+
return buildSessionAgentContext(metadata, messages, ref.expectedVersion);
|
|
491
|
+
}
|
|
492
|
+
if (ref.kind === "mcp_resource") return buildMcpResourceAgentContext({
|
|
493
|
+
workspaceDir: this.currentWorkspacePath,
|
|
494
|
+
config: this.config,
|
|
495
|
+
sourceId: ref.sourceId,
|
|
496
|
+
expectedVersion: ref.expectedVersion
|
|
497
|
+
});
|
|
498
|
+
if (ref.kind === "browser_tab") {
|
|
499
|
+
const binding = getBrowserTabBindingById(ref.sourceId);
|
|
500
|
+
if (!binding || binding.conversationId !== conversationId || ref.expectedVersion && ref.expectedVersion !== binding.documentId) return null;
|
|
501
|
+
const wire = await new RealtimeExtensionBrowserProvider(this.endpointTools).send({
|
|
502
|
+
action: "observe",
|
|
503
|
+
sessionId: `context:${binding.conversationId}`,
|
|
504
|
+
target: {
|
|
505
|
+
kind: "attached_tab",
|
|
506
|
+
bindingId: binding.id
|
|
507
|
+
},
|
|
508
|
+
visual: "never"
|
|
509
|
+
}).catch(() => null);
|
|
510
|
+
if (!wire?.result.ok || !wire.result.receipt.observation) return null;
|
|
511
|
+
return buildBrowserTabAgentContext(ref.sourceId, wire.result.receipt.observation, ref.expectedVersion);
|
|
512
|
+
}
|
|
476
513
|
const note = await this.notesService.getNote(ref.sourceId);
|
|
477
514
|
if (!note || note.status === "trashed") return null;
|
|
478
515
|
if (ref.expectedVersion && ref.expectedVersion !== String(note.updatedAt)) return null;
|
|
@@ -35,13 +35,29 @@ async function fuzzySearchWorkspaceFiles(workspaceRoot, query, limit) {
|
|
|
35
35
|
}
|
|
36
36
|
const q = query.trim();
|
|
37
37
|
const capped = Math.min(Math.max(limit, 1), 50);
|
|
38
|
+
const directories = /* @__PURE__ */ new Set();
|
|
39
|
+
for (const file of files) {
|
|
40
|
+
const parts = file.split("/");
|
|
41
|
+
for (let end = 1; end < parts.length; end += 1) {
|
|
42
|
+
const directory = parts.slice(0, end).join("/");
|
|
43
|
+
if (directory) directories.add(directory);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const candidates = [...directories].map((path) => ({
|
|
47
|
+
name: basename(path),
|
|
48
|
+
path,
|
|
49
|
+
isDirectory: true
|
|
50
|
+
}));
|
|
51
|
+
candidates.push(...files.map((path) => ({
|
|
52
|
+
name: basename(path),
|
|
53
|
+
path,
|
|
54
|
+
isDirectory: false
|
|
55
|
+
})));
|
|
38
56
|
const rows = [];
|
|
39
57
|
if (!q) {
|
|
40
|
-
const sorted =
|
|
41
|
-
for (const
|
|
42
|
-
|
|
43
|
-
path: rel,
|
|
44
|
-
isDirectory: false,
|
|
58
|
+
const sorted = candidates.sort((a, b) => a.path.localeCompare(b.path));
|
|
59
|
+
for (const candidate of sorted.slice(0, capped)) rows.push({
|
|
60
|
+
...candidate,
|
|
45
61
|
score: 0
|
|
46
62
|
});
|
|
47
63
|
return rows.map(({ name, path, isDirectory }) => ({
|
|
@@ -50,16 +66,13 @@ async function fuzzySearchWorkspaceFiles(workspaceRoot, query, limit) {
|
|
|
50
66
|
isDirectory
|
|
51
67
|
}));
|
|
52
68
|
}
|
|
53
|
-
for (const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const scoreName = fuzzySubsequenceScore(q, name);
|
|
69
|
+
for (const candidate of candidates) {
|
|
70
|
+
const scorePath = fuzzySubsequenceScore(q, candidate.path);
|
|
71
|
+
const scoreName = fuzzySubsequenceScore(q, candidate.name);
|
|
57
72
|
const score = Math.max(scorePath ?? -Infinity, scoreName ?? -Infinity);
|
|
58
73
|
if (score === -Infinity) continue;
|
|
59
74
|
rows.push({
|
|
60
|
-
|
|
61
|
-
path: rel,
|
|
62
|
-
isDirectory: false,
|
|
75
|
+
...candidate,
|
|
63
76
|
score
|
|
64
77
|
});
|
|
65
78
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { KnowledgeSourceAdapter, KnowledgeSourceItemInput, KnowledgeSyncRun } from './types.js';
|
|
2
|
+
export type KnowledgeIngestionResult = KnowledgeSyncRun & {
|
|
3
|
+
changedItemIds: string[];
|
|
4
|
+
};
|
|
2
5
|
export interface KnowledgeSourceStateStore {
|
|
3
6
|
getCursor(instanceId: string, collectionScope: string): string | undefined;
|
|
4
7
|
setCursor(instanceId: string, collectionScope: string, cursor: string | undefined): void;
|
|
@@ -17,12 +20,12 @@ export declare class KnowledgeIngestionService {
|
|
|
17
20
|
items: KnowledgeSourceItemInput[];
|
|
18
21
|
cursorAfter?: string;
|
|
19
22
|
warnings?: string[];
|
|
20
|
-
}):
|
|
23
|
+
}): KnowledgeIngestionResult;
|
|
21
24
|
sync(params: {
|
|
22
25
|
adapterKind: string;
|
|
23
26
|
instanceId: string;
|
|
24
27
|
collectionScope: string;
|
|
25
28
|
windowStart?: string;
|
|
26
29
|
signal?: AbortSignal;
|
|
27
|
-
}): Promise<
|
|
30
|
+
}): Promise<KnowledgeIngestionResult>;
|
|
28
31
|
}
|
|
@@ -64,15 +64,18 @@ var KnowledgeIngestionService = class {
|
|
|
64
64
|
try {
|
|
65
65
|
const stored = upsertKnowledgeSourceItems(params.items);
|
|
66
66
|
this.state.setCursor(params.instanceId, params.collectionScope, params.cursorAfter);
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
return {
|
|
68
|
+
...finishKnowledgeSyncRun({
|
|
69
|
+
runId: run.id,
|
|
70
|
+
status: params.warnings?.length ? "partial" : "succeeded",
|
|
71
|
+
cursorAfter: params.cursorAfter,
|
|
72
|
+
itemsSeen: params.items.length,
|
|
73
|
+
itemsCreated: stored.created,
|
|
74
|
+
itemsUpdated: stored.updated,
|
|
75
|
+
warnings: params.warnings
|
|
76
|
+
}),
|
|
77
|
+
changedItemIds: stored.changedItemIds
|
|
78
|
+
};
|
|
76
79
|
} catch (err) {
|
|
77
80
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
78
81
|
finishKnowledgeSyncRun({
|
|
@@ -139,7 +142,10 @@ var KnowledgeIngestionService = class {
|
|
|
139
142
|
itemsUpdated: stored.updated,
|
|
140
143
|
itemsDeleted: tombstones.length
|
|
141
144
|
}, "Knowledge source sync completed");
|
|
142
|
-
return
|
|
145
|
+
return {
|
|
146
|
+
...completed,
|
|
147
|
+
changedItemIds: stored.changedItemIds
|
|
148
|
+
};
|
|
143
149
|
} catch (err) {
|
|
144
150
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
145
151
|
const status = signal.aborted ? "cancelled" : "failed";
|
|
@@ -148,11 +154,14 @@ var KnowledgeIngestionService = class {
|
|
|
148
154
|
runId: run.id,
|
|
149
155
|
sourceInstanceId: params.instanceId
|
|
150
156
|
}, `Knowledge source sync ${status}: ${errorMessage}`);
|
|
151
|
-
return
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
return {
|
|
158
|
+
...finishKnowledgeSyncRun({
|
|
159
|
+
runId: run.id,
|
|
160
|
+
status,
|
|
161
|
+
error: errorMessage
|
|
162
|
+
}),
|
|
163
|
+
changedItemIds: []
|
|
164
|
+
};
|
|
156
165
|
}
|
|
157
166
|
}
|
|
158
167
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UserModelScope } from '../user-model/domain.js';
|
|
2
|
-
export type KnowledgeKind = 'project_fact' | 'workspace_fact' | 'decision' | 'task_lesson' | 'commitment' | 'open_question' | 'episode' | 'note';
|
|
2
|
+
export type KnowledgeKind = 'work_thread' | 'project_fact' | 'workspace_fact' | 'decision' | 'task_lesson' | 'commitment' | 'open_question' | 'episode' | 'note';
|
|
3
3
|
export type KnowledgeStatus = 'candidate' | 'active' | 'needs_review' | 'stale' | 'archived' | 'rejected';
|
|
4
4
|
export type KnowledgeReviewAction = 'approve' | 'edit_and_approve' | 'reject' | 'archive';
|
|
5
5
|
export type KnowledgeStatusActor = 'user' | 'agent' | 'runtime' | 'maintenance' | 'migration';
|
|
@@ -7,9 +7,9 @@ import { parseNoteMarkdown } from "./note-markdown.js";
|
|
|
7
7
|
import { listNoteProjectSummaries } from "../storage/sqlite/notes-repository.js";
|
|
8
8
|
import { changedFieldsFromPatch, emitActivity, previewText, systemActivityActor, systemActivitySource } from "../activity/emitter.js";
|
|
9
9
|
import { getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
10
|
+
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
10
11
|
import { DomainOutboxDispatcher } from "../infra/domain-outbox-dispatcher.js";
|
|
11
12
|
import { publishAutomationProductEvent } from "../automations/product-events.js";
|
|
12
|
-
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
13
13
|
import { partitionAttachmentsByReference } from "./note-attachment-sync.js";
|
|
14
14
|
import { buildNoteAgentContextArtifact, getCachedNoteAgentContextArtifact } from "./agent-context.js";
|
|
15
15
|
import { revokeNoteShareRecords } from "../share/note-share-revocation.js";
|
|
@@ -33,10 +33,10 @@ export declare const RuntimeCommandSchema: z.ZodObject<{
|
|
|
33
33
|
intents: z.ZodArray<z.ZodEnum<{
|
|
34
34
|
review: "review";
|
|
35
35
|
coding: "coding";
|
|
36
|
-
understanding: "understanding";
|
|
37
36
|
fast: "fast";
|
|
38
37
|
reasoning: "reasoning";
|
|
39
38
|
vision: "vision";
|
|
39
|
+
understanding: "understanding";
|
|
40
40
|
}>>;
|
|
41
41
|
allow: z.ZodArray<z.ZodString>;
|
|
42
42
|
}, z.core.$strict>;
|
|
@@ -66,10 +66,10 @@ export declare const RuntimeCommandSchema: z.ZodObject<{
|
|
|
66
66
|
read: "read";
|
|
67
67
|
write: "write";
|
|
68
68
|
execute: "execute";
|
|
69
|
+
admin: "admin";
|
|
69
70
|
send: "send";
|
|
70
71
|
purchase: "purchase";
|
|
71
72
|
publish: "publish";
|
|
72
|
-
admin: "admin";
|
|
73
73
|
}>>;
|
|
74
74
|
}, z.core.$strict>;
|
|
75
75
|
data: z.ZodObject<{
|
|
@@ -119,10 +119,10 @@ export declare const AgentManifestSchema: z.ZodObject<{
|
|
|
119
119
|
intents: z.ZodArray<z.ZodEnum<{
|
|
120
120
|
review: "review";
|
|
121
121
|
coding: "coding";
|
|
122
|
-
understanding: "understanding";
|
|
123
122
|
fast: "fast";
|
|
124
123
|
reasoning: "reasoning";
|
|
125
124
|
vision: "vision";
|
|
125
|
+
understanding: "understanding";
|
|
126
126
|
}>>;
|
|
127
127
|
allow: z.ZodArray<z.ZodString>;
|
|
128
128
|
}, z.core.$strict>;
|
|
@@ -152,10 +152,10 @@ export declare const AgentManifestSchema: z.ZodObject<{
|
|
|
152
152
|
read: "read";
|
|
153
153
|
write: "write";
|
|
154
154
|
execute: "execute";
|
|
155
|
+
admin: "admin";
|
|
155
156
|
send: "send";
|
|
156
157
|
purchase: "purchase";
|
|
157
158
|
publish: "publish";
|
|
158
|
-
admin: "admin";
|
|
159
159
|
}>>;
|
|
160
160
|
}, z.core.$strict>;
|
|
161
161
|
data: z.ZodObject<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
2
1
|
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
2
|
+
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
3
3
|
import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
|
|
4
4
|
//#region src/providers/auth-runtime/resolve-auth.ts
|
|
5
5
|
init_env_keys();
|
|
@@ -4,7 +4,7 @@ import "./constants.js";
|
|
|
4
4
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
5
5
|
import { init_providers } from "./index.js";
|
|
6
6
|
import { stripPromptCacheBoundary } from "../agent/prompt/cache-boundary.js";
|
|
7
|
-
import { createAssistantMessageEventStream, streamSimple } from "@earendil-works/pi-ai/compat";
|
|
7
|
+
import { createAssistantMessageEventStream, getCurrentSystemPrompt, getCurrentTools, streamSimple } from "@earendil-works/pi-ai/compat";
|
|
8
8
|
//#region src/providers/extension-stream-bridge.ts
|
|
9
9
|
init_plugin_registry();
|
|
10
10
|
init_providers();
|
|
@@ -78,11 +78,13 @@ function createExtensionAwareStreamFn() {
|
|
|
78
78
|
modelId: model.id
|
|
79
79
|
}, "Streaming via extension provider");
|
|
80
80
|
const stream = createAssistantMessageEventStream();
|
|
81
|
+
const systemPrompt = getCurrentSystemPrompt(context.messages);
|
|
82
|
+
const tools = getCurrentTools(context.messages);
|
|
81
83
|
const params = {
|
|
82
84
|
model: model.id,
|
|
83
|
-
systemPrompt:
|
|
84
|
-
messages: context.messages,
|
|
85
|
-
tools
|
|
85
|
+
systemPrompt: systemPrompt ? stripPromptCacheBoundary(systemPrompt) : void 0,
|
|
86
|
+
messages: context.messages.filter((message) => message.role !== "system"),
|
|
87
|
+
tools,
|
|
86
88
|
temperature: options?.temperature,
|
|
87
89
|
maxTokens: options?.maxTokens,
|
|
88
90
|
apiKey: options?.apiKey,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
3
|
-
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
4
|
-
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
5
3
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
6
4
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
7
5
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
6
|
+
import { getModelOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
8
7
|
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
8
|
+
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
9
9
|
import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
|
|
10
10
|
import { applyOfficialModelMetadataCorrections, getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
11
11
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_constants } from "./constants.js";
|
|
2
2
|
import { getApiKey, init_providers } from "./index.js";
|
|
3
3
|
import { createExtensionAwareStreamFn } from "./extension-stream-bridge.js";
|
|
4
|
-
import { completeSimple } from "@earendil-works/pi-ai/compat";
|
|
4
|
+
import { completeSimple, normalizeContext } from "@earendil-works/pi-ai/compat";
|
|
5
5
|
//#region src/providers/model-call.ts
|
|
6
6
|
init_constants();
|
|
7
7
|
init_providers();
|
|
@@ -42,7 +42,7 @@ async function resolveModelCallOptions(model, options = {}, credentialOptions) {
|
|
|
42
42
|
*/
|
|
43
43
|
async function completeWithResolvedCredentials(model, context, options = {}, credentialOptions) {
|
|
44
44
|
const resolvedOptions = await resolveModelCallOptions(model, options, credentialOptions);
|
|
45
|
-
if (model.baseUrl === "extension://provider-plugin") return await (await createExtensionAwareStreamFn()(model, context, resolvedOptions)).result();
|
|
45
|
+
if (model.baseUrl === "extension://provider-plugin") return await (await createExtensionAwareStreamFn()(model, normalizeContext(context), resolvedOptions)).result();
|
|
46
46
|
return await completeSimple(model, context, resolvedOptions);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
@@ -52,7 +52,7 @@ async function completeWithResolvedCredentials(model, context, options = {}, cre
|
|
|
52
52
|
*/
|
|
53
53
|
async function createResolvedModelStream(model, context, options = {}, credentialOptions) {
|
|
54
54
|
const resolvedOptions = await resolveModelCallOptions(model, options, credentialOptions);
|
|
55
|
-
return await createExtensionAwareStreamFn()(model, context, resolvedOptions);
|
|
55
|
+
return await createExtensionAwareStreamFn()(model, normalizeContext(context), resolvedOptions);
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
export { completeWithResolvedCredentials, createResolvedModelStream, isLocalModelBaseUrl, resolveModelCallApiKey, resolveModelCallOptions, supportsModelTemperature };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { init_paths_state, resolveXopcCloudCatalogCachePath } from "../config/paths-state.js";
|
|
3
|
-
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
3
|
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
4
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
5
|
import { voiceManifestSchema } from "../../packages/realtime-protocol/src/voice-catalog.js";
|
|
6
6
|
import { init_voice } from "../../packages/realtime-protocol/src/voice.js";
|
|
7
7
|
import { readFileSync, rmSync } from "node:fs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
5
4
|
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
5
|
+
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
6
6
|
import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
|
|
7
7
|
import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
8
8
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
@@ -207,9 +207,10 @@ const RECOMMENDED_MODEL_PATTERNS = {
|
|
|
207
207
|
"zhipu-cn": [/^glm-5\.2$/i],
|
|
208
208
|
zai: [/^glm-5\.2$/i],
|
|
209
209
|
"zai-coding-cn": [
|
|
210
|
-
/^glm-5\.
|
|
211
|
-
/^glm-5\.
|
|
212
|
-
/^glm-5-
|
|
210
|
+
/^glm-5\.3$/i,
|
|
211
|
+
/^glm-5\.3-highspeed$/i,
|
|
212
|
+
/^glm-5\.3-flash$/i,
|
|
213
|
+
/^glm-4\.6v$/i
|
|
213
214
|
],
|
|
214
215
|
"zai-coding-global": [/^glm-5\.2$/i],
|
|
215
216
|
"zhipu-coding-cn": [/^glm-5\.2$/i],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
3
2
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
3
|
+
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
4
4
|
import { XOPC_CLOUD_PROVIDER_ID, init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
5
5
|
//#region src/providers/register-runtime-providers.ts
|
|
6
6
|
function registerRuntimeProvider(modelRuntime, source) {
|
|
@@ -15,7 +15,7 @@ export interface ClientHistoryMessage {
|
|
|
15
15
|
/** Whitelisted display metadata; never includes source snapshot text. */
|
|
16
16
|
metadata?: {
|
|
17
17
|
sourceContexts?: Array<{
|
|
18
|
-
kind: 'note' | 'task' | 'browser_page';
|
|
18
|
+
kind: 'note' | 'task' | 'file' | 'session' | 'browser_tab' | 'browser_page' | 'mcp_resource';
|
|
19
19
|
sourceId: string;
|
|
20
20
|
version: string;
|
|
21
21
|
title: string;
|
|
@@ -24,6 +24,7 @@ export interface ClientHistoryMessage {
|
|
|
24
24
|
url?: string;
|
|
25
25
|
capturedAt?: number;
|
|
26
26
|
documentId?: string;
|
|
27
|
+
fileKind?: 'file' | 'directory';
|
|
27
28
|
}>;
|
|
28
29
|
turnOutcome?: TurnOutcome;
|
|
29
30
|
};
|
|
@@ -11,7 +11,7 @@ function sourceContextDisplayMetadata(metadata) {
|
|
|
11
11
|
const sourceContexts = rows.flatMap((value) => {
|
|
12
12
|
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
13
13
|
const row = value;
|
|
14
|
-
if (row.kind !== "note" && row.kind !== "task" && row.kind !== "browser_page" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
|
|
14
|
+
if (row.kind !== "note" && row.kind !== "task" && row.kind !== "file" && row.kind !== "session" && row.kind !== "browser_tab" && row.kind !== "browser_page" && row.kind !== "mcp_resource" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
|
|
15
15
|
return [{
|
|
16
16
|
kind: row.kind,
|
|
17
17
|
sourceId: row.sourceId,
|
|
@@ -21,7 +21,8 @@ function sourceContextDisplayMetadata(metadata) {
|
|
|
21
21
|
...row.truncated === true ? { truncated: true } : {},
|
|
22
22
|
...typeof row.url === "string" ? { url: row.url } : {},
|
|
23
23
|
...typeof row.capturedAt === "number" ? { capturedAt: row.capturedAt } : {},
|
|
24
|
-
...typeof row.documentId === "string" ? { documentId: row.documentId } : {}
|
|
24
|
+
...typeof row.documentId === "string" ? { documentId: row.documentId } : {},
|
|
25
|
+
...row.kind === "file" && (row.fileKind === "file" || row.fileKind === "directory") ? { fileKind: row.fileKind } : {}
|
|
25
26
|
}];
|
|
26
27
|
});
|
|
27
28
|
return sourceContexts.length ? { sourceContexts } : void 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ContextExtractionStatus = 'running' | 'completed' | 'skipped' | 'failed';
|
|
2
|
-
export type ContextObjectType = '
|
|
2
|
+
export type ContextObjectType = 'assertion' | 'rule' | 'goal' | 'knowledge';
|
|
3
3
|
export type ContextExtractionRun = {
|
|
4
4
|
id: string;
|
|
5
5
|
principalId: string;
|
|
@@ -54,4 +54,3 @@ export declare function listContextExtractionRuns(filter?: {
|
|
|
54
54
|
}): ContextExtractionRun[];
|
|
55
55
|
export declare function getContextExtractionRun(id: string): ContextExtractionRun | null;
|
|
56
56
|
export declare function listContextExtractionOutputs(runId: string): ContextExtractionOutput[];
|
|
57
|
-
export declare function hasIndependentExtractionOutput(runIds: string[], objectType: ContextObjectType, objectId: string): boolean;
|
|
@@ -108,13 +108,5 @@ function listContextExtractionOutputs(runId) {
|
|
|
108
108
|
return getSqliteDatabase().prepare(`SELECT * FROM context_extraction_outputs
|
|
109
109
|
WHERE extraction_run_id = ? ORDER BY ordinal`).all(runId).map(outputFromRow);
|
|
110
110
|
}
|
|
111
|
-
function hasIndependentExtractionOutput(runIds, objectType, objectId) {
|
|
112
|
-
if (!runIds.length) return false;
|
|
113
|
-
const placeholders = runIds.map(() => "?").join(", ");
|
|
114
|
-
return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM context_extraction_outputs o
|
|
115
|
-
JOIN context_extraction_runs r ON r.extraction_run_id = o.extraction_run_id
|
|
116
|
-
WHERE o.extraction_run_id NOT IN (${placeholders}) AND o.object_type = ? AND o.object_id = ?
|
|
117
|
-
AND r.status = 'completed' LIMIT 1`).get(...runIds, objectType, objectId));
|
|
118
|
-
}
|
|
119
111
|
//#endregion
|
|
120
|
-
export { claimContextExtractionRun, finishContextExtractionRun, getContextExtractionRun,
|
|
112
|
+
export { claimContextExtractionRun, finishContextExtractionRun, getContextExtractionRun, listContextExtractionOutputs, listContextExtractionRuns };
|
|
@@ -22,4 +22,18 @@ export declare function finishEndpointToolInvocationAudit(params: {
|
|
|
22
22
|
errorMessage?: string;
|
|
23
23
|
completedAt?: number;
|
|
24
24
|
}): void;
|
|
25
|
-
export
|
|
25
|
+
export interface EndpointToolInvocationAuditPage {
|
|
26
|
+
items: EndpointToolInvocationAudit[];
|
|
27
|
+
page: number;
|
|
28
|
+
pageSize: number;
|
|
29
|
+
total: number;
|
|
30
|
+
totalPages: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function listEndpointToolInvocationAuditPage(options?: {
|
|
33
|
+
page?: number;
|
|
34
|
+
pageSize?: number;
|
|
35
|
+
query?: string;
|
|
36
|
+
principalId?: string;
|
|
37
|
+
status?: EndpointToolInvocationAudit['status'];
|
|
38
|
+
effect?: EndpointEffect;
|
|
39
|
+
}): EndpointToolInvocationAuditPage;
|
|
@@ -33,11 +33,44 @@ function finishEndpointToolInvocationAudit(params) {
|
|
|
33
33
|
WHERE id = ? AND status = 'running'
|
|
34
34
|
`).run(params.status, params.errorCode ?? null, params.errorMessage?.slice(0, 2e3) ?? null, params.completedAt ?? Date.now(), params.id);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
function listEndpointToolInvocationAuditPage(options = {}) {
|
|
37
|
+
const page = Math.max(1, Math.trunc(options.page ?? 1));
|
|
38
|
+
const pageSize = Math.max(1, Math.min(100, Math.trunc(options.pageSize ?? 20)));
|
|
39
|
+
const clauses = [];
|
|
40
|
+
const values = [];
|
|
41
|
+
const query = options.query?.trim();
|
|
42
|
+
if (query) {
|
|
43
|
+
const pattern = `%${query.replace(/[\\%_]/g, "\\$&")}%`;
|
|
44
|
+
clauses.push("(tool_name LIKE ? ESCAPE '\\' OR endpoint_id LIKE ? ESCAPE '\\' OR error_message LIKE ? ESCAPE '\\')");
|
|
45
|
+
values.push(pattern, pattern, pattern);
|
|
46
|
+
}
|
|
47
|
+
if (options.principalId) {
|
|
48
|
+
clauses.push("principal_id = ?");
|
|
49
|
+
values.push(options.principalId);
|
|
50
|
+
}
|
|
51
|
+
if (options.status) {
|
|
52
|
+
clauses.push("status = ?");
|
|
53
|
+
values.push(options.status);
|
|
54
|
+
}
|
|
55
|
+
if (options.effect) {
|
|
56
|
+
clauses.push("effect = ?");
|
|
57
|
+
values.push(options.effect);
|
|
58
|
+
}
|
|
59
|
+
const where = clauses.length > 0 ? `WHERE ${clauses.join(" AND ")}` : "";
|
|
60
|
+
const db = getSqliteDatabase();
|
|
61
|
+
const total = db.prepare(`SELECT COUNT(*) AS count FROM endpoint_tool_invocations ${where}`).get(...values).count;
|
|
62
|
+
return {
|
|
63
|
+
items: db.prepare(`
|
|
64
|
+
SELECT * FROM endpoint_tool_invocations
|
|
65
|
+
${where}
|
|
66
|
+
ORDER BY started_at DESC, id DESC
|
|
67
|
+
LIMIT ? OFFSET ?
|
|
68
|
+
`).all(...values, pageSize, (page - 1) * pageSize).map(fromRow),
|
|
69
|
+
page,
|
|
70
|
+
pageSize,
|
|
71
|
+
total,
|
|
72
|
+
totalPages: Math.max(1, Math.ceil(total / pageSize))
|
|
73
|
+
};
|
|
41
74
|
}
|
|
42
75
|
//#endregion
|
|
43
|
-
export { finishEndpointToolInvocationAudit,
|
|
76
|
+
export { finishEndpointToolInvocationAudit, listEndpointToolInvocationAuditPage, startEndpointToolInvocationAudit };
|
|
@@ -10,8 +10,7 @@ export { deleteBrowserTabBinding, deleteBrowserTabBindingsByEndpoint, deleteBrow
|
|
|
10
10
|
export { authenticateDeviceAccessToken, buildRefreshProofMessage, createDevice, getDevice, issueDeviceTokenPair, listDevices, revokeDevice, rotateDeviceRefreshToken, type DeviceAccessIdentity, type DevicePlatform, type DevicePublicKeyJwk, type DeviceRecord, type DeviceTokenPair, } from './device-access-repository.js';
|
|
11
11
|
export { clearGatewayIdentityForTest, getOrCreateGatewayIdentity, signGatewayPayload, type GatewayIdentity, } from './gateway-identity-repository.js';
|
|
12
12
|
export { createDevicePairingSetup, isDevicePairingSetupActive, type DevicePairingSetup, type DeviceRoute, } from './device-pairing-repository.js';
|
|
13
|
-
export { claimContextExtractionRun, finishContextExtractionRun, getContextExtractionRun,
|
|
14
|
-
export { closeTemporalAssertions, createTemporalAssertion, linkContextObjects, listContextObjectRelations, listTemporalAssertions, type ContextObjectRelation, type ContextTemporalAssertion, } from './context-relation-repository.js';
|
|
13
|
+
export { claimContextExtractionRun, finishContextExtractionRun, getContextExtractionRun, listContextExtractionOutputs, listContextExtractionRuns, type ContextExtractionOutput, type ContextExtractionRun, type ContextExtractionStatus, type ContextObjectType, } from './context-extraction-repository.js';
|
|
15
14
|
export { createCollaborationRule, getCollaborationRule, listCollaborationRules, setCollaborationRuleStatus, type CollaborationRule, } from './collaboration-rule-repository.js';
|
|
16
15
|
export { createContextEvidence, type ContextEvidence } from './context-evidence-repository.js';
|
|
17
16
|
export { getUserPerson, getUserPeopleIndexState, listUserPeople, mergeUserPeople, replaceUserPeopleIndex, summarizeUserPeople, updateUserPerson, } from './user-people-repository.js';
|
|
@@ -22,7 +21,7 @@ export { acknowledgeHomeAttention, isHomeAttentionAcknowledged, type HomeAttenti
|
|
|
22
21
|
export { claimNextConnectorLearningJob, enqueueConnectorLearningJob, listConnectorLearningJobs, recoverStaleConnectorLearningJobs, setConnectorLearningPaused, updateConnectorLearningJob, type ConnectorLearningJob, type ConnectorLearningMode, type ConnectorLearningPhase, type ConnectorLearningStatus, } from './connector-learning-repository.js';
|
|
23
22
|
export { appendComposerInputHistory, clearComposerInputHistory, listComposerInputHistory, COMPOSER_INPUT_HISTORY_LIMIT, type ComposerInputHistoryItem, } from './composer-input-history-repository.js';
|
|
24
23
|
export { bindEndpointPrincipal, createEndpointPrincipal, getEndpointPrincipal, listEndpointPrincipals, revokeEndpointPrincipal, touchEndpointPrincipal, type EndpointPrincipal, } from './endpoint-principal-repository.js';
|
|
25
|
-
export { finishEndpointToolInvocationAudit,
|
|
24
|
+
export { finishEndpointToolInvocationAudit, listEndpointToolInvocationAuditPage, startEndpointToolInvocationAudit, type EndpointToolInvocationAudit, type EndpointToolInvocationAuditPage, } from './endpoint-tool-invocation-repository.js';
|
|
26
25
|
export { getInteractionState, setInteractionState, updateInteractionStateFromMessage, type InteractionState, } from './interaction-state-repository.js';
|
|
27
26
|
export { getSessionTaskPlan, setSessionTaskPlan, type SessionTaskPlan, type SessionTaskPlanItem, type SessionTaskPlanItemStatus, } from './session-task-plan-repository.js';
|
|
28
27
|
export { buildRelationshipPrompt, getRelationshipSettings, isProactiveSupportAllowed, updateRelationshipSettings, type RelationshipSettings, type SupportMode, } from './relationship-settings-repository.js';
|