@xopcai/xopc 0.0.170 → 0.0.172
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/gateway/static/root/assets/{activity-store-CkUp1qvf.js → activity-store-C3Y-bESI.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DDuem4HM.js → agent-avatar-dicebear-CPyev9P7.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bf_kK2Ay.js +2 -0
- package/dist/gateway/static/root/assets/{api-BnuPQhJW.js → api-B7qEr_Rw.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DdZw8Hi1.js → app-management-settings-panel-Br_9-7fs.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BN8Vk2bX.js → appearance-settings-uyLcRPai.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DXFCP5-1.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C82MaDQj.js → archive-plugin-B19REnR5.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-uilrwSdW.js → attachment-load-DLWCC4Yi.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CkDZjAmy.js → automation-suggestion-card-ky5S5lly.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-D8pT1o2O.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B7NTL0_T.js → binary-plugins-CtPEzLlo.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D_LDNlB-.js → block-editor-CQVR4Xij.js} +32 -32
- package/dist/gateway/static/root/assets/browser-settings-page-Bav_skKN.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-UFVUzn4v.js → browser-workflow-inputs-CimCGbhq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CGgC0N92.js → browser-workflows-page-DewuCw3p.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BHaYYo9E.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DUIorGUd.js → capability-presets-api-B5RTs-Az.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-PTz00nR4.js → capability-presets-settings-panel-BgchTh81.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-BYwSB8c6.js → channel-recipient-api-Czu0YzIZ.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BP0e62wt.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DBWKfeGe.js +1 -0
- package/dist/gateway/static/root/assets/connector-logo-Di3gnR_D.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-CC5kh0de.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CkT98fPT.js → desktop-pet-D-ZUNHhn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DkbIzdA3.js → desktop-pet-settings-C3L6AI8_.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-dBQvj1sG.js → directory-picker-path-field-Dvq4iG6P.js} +1 -1
- package/dist/gateway/static/root/assets/dreaming-settings-D9i54kWO.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BfxoIiNo.js → extension-debug-page-BecQjU0J.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-EIJ3wIb7.js → extension-page-BeVkPSm-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DBBec51N.js → extension-settings-page-DMoo2mKx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-4_u53Ufq.js → gateway-config-api-Bthb3_6v.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-v9kJM59H.js → gateway-settings-Bh8nPvJQ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CXITih5d.js → gateway-startup-retry-D3USVm9D.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-Dp0AyDHI.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-CNt7nrdS.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-D54YQPon.js → goals-config-api-C_2QWBtb.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-Bm_NZFiZ.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DDezXaVi.js → goals-settings-DhL643tc.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CRsIUeZN.js → heartbeat-settings-COVFwp7C.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-CY6cQUHL.js → image-generation-api-BNQlnwpU.js} +1 -1
- package/dist/gateway/static/root/assets/index-C_XSKOH6.css +1 -0
- package/dist/gateway/static/root/assets/{index-Dfq2laZe.js → index-DUasAutC.js} +67 -67
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D9k7EDdY.js → keyboard-shortcuts-settings-DfdJRJVy.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DZwkD1co.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DbaiBolh.js → local-apps-page-BvCPOgoi.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dqp9H2Uf.js → locale-store-BP0vD37A.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DoCY0Mm9.js → logs-page-dNL0Y1dA.js} +3 -3
- package/dist/gateway/static/root/assets/{markdown-split-BGlQR-Be.js → markdown-split-YO1rDk9m.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BpaeV6f_.js → media-plugins-CU_RRf-q.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BWtP5TFz.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-Cd2HpciM.js → notes-page-CeFiOK3S.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-B8MKxpZb.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-DyimBUp_.js → page-tabs-tiHmRJUA.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BKZulEYr.js → preview-open-alternatives-CU6XgaCz.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Bjz9BxBY.js → product-open-page-Dn4_qor4.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CWBuuX-S.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BJSsLsXH.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DXJDb8vB.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BPTqb2_r.js → save-bar-controls-edDUIbXo.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-YN0D81Dk.js → schedule-field-DqJO_5Yb.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BmY5PSS2.js → schema-form-CMh0jzy5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DeHpWgxM.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cf-TEYUd.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B-RhgD_p.js → settings-form-section-Bb0Bc3nJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkPupX2B.js → settings-loading-skeleton-DQhADvz1.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-2QBMvaxj.js → settings-page-b0M5HukN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CtrW-LD6.js → settings-page-layout-hvjtIjvh.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BFyfed_g.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BezIW1n9.js → share-preview-page-rbeaOpTg.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CYnH9sTt.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-Cr8_m-jS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Chtc1xDO.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-WAFhKyAu.js → system-settings-panel-BHo_hgnL.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BiC0gIBa.js → theme-store-C3KnnjcU.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-D-G-uwVJ.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-WAQO3F_8.js → typed-models-lib-DtRnG-YI.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CKlfsSeU.js → use-channel-catalog-CWWItX2g.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-D7qMR26X.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BAFHF0_v.js → voice-api-key-field-BTnltQHZ.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CpqFZze9.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-t4dXpGC0.js +1 -0
- package/dist/gateway/static/root/assets/work-page-BXwDKiMZ.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-1OP4HyvS.js → workflow-run-setup-panel-D7vKChFZ.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bos9HyqT.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +71 -24
- package/dist/src/agent/embedded/run-turn.js +68 -4
- package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
- package/dist/src/agent/inbound/inbound-loop.js +0 -2
- package/dist/src/agent/memory/builtin-provider.js +4 -4
- package/dist/src/agent/memory/compaction-planner.d.ts +16 -0
- package/dist/src/agent/memory/compaction-planner.js +152 -0
- package/dist/src/agent/memory/compaction-policy.d.ts +10 -0
- package/dist/src/agent/memory/compaction-policy.js +24 -0
- package/dist/src/agent/memory/compaction.d.ts +21 -22
- package/dist/src/agent/memory/compaction.js +220 -194
- package/dist/src/agent/memory/context-budget.d.ts +40 -0
- package/dist/src/agent/memory/context-budget.js +106 -0
- package/dist/src/agent/memory/manager.d.ts +4 -1
- package/dist/src/agent/memory/manager.js +8 -3
- package/dist/src/agent/memory/understanding/service.d.ts +2 -0
- package/dist/src/agent/memory/understanding/service.js +11 -9
- package/dist/src/agent/orchestration/context-overflow.d.ts +1 -0
- package/dist/src/agent/orchestration/context-overflow.js +19 -0
- package/dist/src/agent/orchestration/loop-guard.js +13 -9
- package/dist/src/agent/reply/post-compaction-context.d.ts +4 -0
- package/dist/src/agent/reply/post-compaction-context.js +5 -3
- package/dist/src/agent/service/process-direct-one-shot.js +1 -2
- package/dist/src/agent/service/process-direct-streaming.js +1 -2
- package/dist/src/agent/service.d.ts +1 -2
- package/dist/src/agent/service.js +16 -44
- package/dist/src/agent/session/session-inspector.js +10 -2
- package/dist/src/automations/domain/validation.d.ts +8 -8
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +17 -1
- package/dist/src/connectors/composio-sessions.d.ts +1 -0
- package/dist/src/connectors/composio-sessions.js +14 -5
- package/dist/src/connectors/composio-triggers.d.ts +1 -1
- package/dist/src/connectors/composio-triggers.js +4 -3
- package/dist/src/connectors/composio.js +1 -0
- package/dist/src/connectors/{connector-memory-sync.d.ts → connected-source-ingestion.d.ts} +11 -4
- package/dist/src/connectors/{connector-memory-sync.js → connected-source-ingestion.js} +49 -101
- package/dist/src/connectors/connected-source-normalizers.d.ts +15 -0
- package/dist/src/connectors/connected-source-normalizers.js +186 -0
- package/dist/src/connectors/connector-identity.d.ts +2 -0
- package/dist/src/connectors/connector-identity.js +29 -0
- package/dist/src/connectors/learning-coordinator.d.ts +25 -0
- package/dist/src/connectors/learning-coordinator.js +214 -0
- package/dist/src/connectors/learning-recipes.d.ts +22 -0
- package/dist/src/connectors/learning-recipes.js +121 -0
- package/dist/src/connectors/runtime-status.d.ts +1 -8
- package/dist/src/connectors/runtime-status.js +4 -29
- package/dist/src/gateway/hono/lib/config-payload.d.ts +23 -0
- package/dist/src/gateway/hono/lib/config-payload.js +3 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +28 -0
- package/dist/src/gateway/hono/routes/connectors.js +76 -118
- package/dist/src/gateway/hono/routes/models.js +24 -0
- package/dist/src/gateway/hono/routes/public-gateway.js +3 -2
- package/dist/src/gateway/hono/routes/sessions.js +17 -42
- package/dist/src/gateway/hono/routes/you.js +86 -5
- package/dist/src/gateway/service/sessions-api.d.ts +2 -3
- package/dist/src/gateway/service/sessions-api.js +4 -7
- package/dist/src/gateway/service.d.ts +5 -2
- package/dist/src/gateway/service.js +16 -11
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +19 -0
- package/dist/src/knowledge/connected-understanding-pipeline.js +268 -0
- package/dist/src/knowledge/index.d.ts +1 -0
- package/dist/src/knowledge/index.js +2 -1
- package/dist/src/knowledge/ingestion-service.d.ts +6 -4
- package/dist/src/knowledge/ingestion-service.js +13 -10
- package/dist/src/knowledge/local-folder-adapter.js +1 -0
- package/dist/src/knowledge/people-graph.js +43 -110
- package/dist/src/knowledge/types.d.ts +3 -0
- package/dist/src/providers/xopc-cloud-account-service.d.ts +40 -0
- package/dist/src/providers/xopc-cloud-account-service.js +65 -0
- package/dist/src/session/index.d.ts +1 -2
- package/dist/src/session/index.js +1 -2
- package/dist/src/session/init-session-turn.d.ts +0 -1
- package/dist/src/session/init-session-turn.js +1 -2
- package/dist/src/session/manager.d.ts +11 -17
- package/dist/src/session/manager.js +11 -14
- package/dist/src/session/session-context-for-llm.d.ts +19 -1
- package/dist/src/session/session-context-for-llm.js +87 -129
- package/dist/src/session/store.d.ts +28 -23
- package/dist/src/session/store.js +94 -83
- package/dist/src/session/transcript-format.d.ts +2 -8
- package/dist/src/session/types.d.ts +8 -6
- package/dist/src/session/user-round-delete.d.ts +3 -6
- package/dist/src/session/user-round-delete.js +12 -16
- package/dist/src/storage/sqlite/connector-learning-repository.d.ts +47 -0
- package/dist/src/storage/sqlite/connector-learning-repository.js +110 -0
- package/dist/src/storage/sqlite/index.d.ts +4 -2
- package/dist/src/storage/sqlite/index.js +5 -3
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +4 -2
- package/dist/src/storage/sqlite/knowledge-repository.js +24 -13
- package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +45 -0
- package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +2 -0
- package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +27 -0
- package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +14 -0
- package/dist/src/storage/sqlite/migrations/064_user_claims.sql +60 -0
- package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +116 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -19
- package/dist/src/storage/sqlite/transcript-repository.d.ts +6 -11
- package/dist/src/storage/sqlite/transcript-repository.js +90 -84
- package/dist/src/storage/sqlite/user-claims-repository.d.ts +101 -0
- package/dist/src/storage/sqlite/user-claims-repository.js +241 -0
- package/dist/src/user-context/config.d.ts +67 -2
- package/dist/src/user-context/config.js +36 -3
- package/dist/src/user-context/projection.d.ts +36 -1
- package/dist/src/user-context/projection.js +84 -6
- package/dist/src/work-discovery/service.js +1 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-BiaQhiQp.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-CuL8Q4yF.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-TZOluRNp.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C-l6O68Z.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BW8c0xPp.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-h9CsE0GT.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-C058Mcfr.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-CsbegNqi.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BWALafGW.js +0 -2
- package/dist/gateway/static/root/assets/dreaming-settings-DkdnKMZx.js +0 -3
- package/dist/gateway/static/root/assets/goal-create-dialog-y2Y3p7_k.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DuzL-alv.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-OeLtfKI2.js +0 -2
- package/dist/gateway/static/root/assets/index-o4uaOGKT.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-3ssYIEK6.js +0 -2
- package/dist/gateway/static/root/assets/messages-KEk-hTFt.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CatZNAPc.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DJUOgqm4.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BQQAD_nu.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-fIGXTTnA.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BuU-8FCe.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DlKoeZm3.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BSUcDFnb.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bk2-SwGJ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-e_Fx1kVC.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D_cCADfj.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-fqRXpNJV.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-9Ov4htPW.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DGN2FxWv.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-HmyWSgUo.js +0 -1
- package/dist/gateway/static/root/assets/work-page-D3iKVjFq.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B5L4SFw4.js +0 -11
- package/dist/src/agent/lifecycle/handlers/compaction.d.ts +0 -13
- package/dist/src/agent/lifecycle/handlers/compaction.js +0 -18
- package/dist/src/connectors/memory-sync-coordinator.d.ts +0 -28
- package/dist/src/connectors/memory-sync-coordinator.js +0 -162
- package/dist/src/connectors/memory-sync-profile.d.ts +0 -13
- package/dist/src/connectors/memory-sync-profile.js +0 -73
- package/dist/src/session/compaction-checkpoints.d.ts +0 -8
- package/dist/src/session/compaction-checkpoints.js +0 -19
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { listConnectorLearningJobs } from "../../../storage/sqlite/connector-learning-repository.js";
|
|
1
2
|
import { decideConnectorApproval, getConnectorApproval, listConnectorApprovals, listConnectorConnections } from "../../../storage/sqlite/connector-repository.js";
|
|
2
3
|
import "../../../storage/sqlite/index.js";
|
|
3
4
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
@@ -15,11 +16,10 @@ import { composioLogoResponse } from "../../../connectors/composio-logo.js";
|
|
|
15
16
|
import { appendComposioTriggerEvent, listComposioTriggerEvents } from "../../../connectors/composio-triggers.js";
|
|
16
17
|
import { buildConnectedPeopleGraph } from "../../../knowledge/people-graph.js";
|
|
17
18
|
import "../../../knowledge/index.js";
|
|
18
|
-
import {
|
|
19
|
+
import { ingestLocalFolderSource } from "../../../connectors/connected-source-ingestion.js";
|
|
19
20
|
import { previewConnectorDefinition, testConnectorInstance } from "../../../connectors/health.js";
|
|
20
21
|
import { setConnectorEnabled } from "../../../connectors/lifecycle.js";
|
|
21
|
-
import {
|
|
22
|
-
import { projectComposioRuntimeStatus } from "../../../connectors/runtime-status.js";
|
|
22
|
+
import { projectComposioConnectionStatus } from "../../../connectors/runtime-status.js";
|
|
23
23
|
//#region src/gateway/hono/routes/connectors.ts
|
|
24
24
|
init_agent_scope();
|
|
25
25
|
function errorMessage(error) {
|
|
@@ -39,45 +39,13 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
|
-
authenticated.get("/api/connectors/installed",
|
|
42
|
+
authenticated.get("/api/connectors/installed", (c) => {
|
|
43
43
|
const config = service.currentConfig;
|
|
44
44
|
const instances = listConnectorInstances(config);
|
|
45
|
-
const composioInstances = instances.filter((instance) => instance.materialized.type === "composio" && instance.materialized.role === "toolkit");
|
|
46
|
-
if (composioInstances.length === 0) return c.json({
|
|
47
|
-
ok: true,
|
|
48
|
-
payload: { instances }
|
|
49
|
-
});
|
|
50
|
-
const checkedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
51
|
-
let connectionError;
|
|
52
|
-
try {
|
|
53
|
-
await listComposioConnections();
|
|
54
|
-
} catch (error) {
|
|
55
|
-
connectionError = errorMessage(error);
|
|
56
|
-
}
|
|
57
|
-
const probes = await Promise.all([...new Map(composioInstances.map((instance) => [instance.connectorId, instance])).values()].map(async (instance) => {
|
|
58
|
-
try {
|
|
59
|
-
const tools = await listComposioTools(instance.materialized.type === "composio" ? instance.materialized.toolkit : "", config);
|
|
60
|
-
return {
|
|
61
|
-
connectorId: instance.connectorId,
|
|
62
|
-
checkedAt,
|
|
63
|
-
toolCount: tools.length,
|
|
64
|
-
...connectionError ? {
|
|
65
|
-
error: connectionError,
|
|
66
|
-
connectionError: true
|
|
67
|
-
} : {}
|
|
68
|
-
};
|
|
69
|
-
} catch (error) {
|
|
70
|
-
return {
|
|
71
|
-
connectorId: instance.connectorId,
|
|
72
|
-
checkedAt,
|
|
73
|
-
error: errorMessage(error)
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
45
|
const connections = listConnectorConnections({ principalId: "local-owner" });
|
|
78
46
|
return c.json({
|
|
79
47
|
ok: true,
|
|
80
|
-
payload: { instances:
|
|
48
|
+
payload: { instances: projectComposioConnectionStatus(instances, connections) }
|
|
81
49
|
});
|
|
82
50
|
});
|
|
83
51
|
authenticated.post("/api/connectors/setup/request-secret", strictRateLimitMiddleware, async (c) => {
|
|
@@ -118,6 +86,54 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
118
86
|
}, 400);
|
|
119
87
|
}
|
|
120
88
|
});
|
|
89
|
+
authenticated.get("/api/connectors/learning", (c) => {
|
|
90
|
+
return c.json({
|
|
91
|
+
ok: true,
|
|
92
|
+
payload: { jobs: listConnectorLearningJobs({ limit: 100 }) }
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
authenticated.post("/api/connectors/composio/connections/:id/learning", strictRateLimitMiddleware, async (c) => {
|
|
96
|
+
try {
|
|
97
|
+
await listComposioConnections();
|
|
98
|
+
const config = service.currentConfig;
|
|
99
|
+
if (!config.userContext.memory.sources.includes("connectedSources")) {
|
|
100
|
+
config.userContext.memory.sources = [...config.userContext.memory.sources, "connectedSources"];
|
|
101
|
+
const saved = await service.saveConfig(config);
|
|
102
|
+
if (!saved.saved) return c.json({
|
|
103
|
+
ok: false,
|
|
104
|
+
error: saved.error
|
|
105
|
+
}, 500);
|
|
106
|
+
}
|
|
107
|
+
const job = service.requestConnectorLearning(c.req.param("id"), { reason: "manual" });
|
|
108
|
+
if (!job) return c.json({
|
|
109
|
+
ok: false,
|
|
110
|
+
error: "The connection is not active or does not support learning."
|
|
111
|
+
}, 409);
|
|
112
|
+
return c.json({
|
|
113
|
+
ok: true,
|
|
114
|
+
payload: { job }
|
|
115
|
+
}, 202);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
return c.json({
|
|
118
|
+
ok: false,
|
|
119
|
+
error: errorMessage(error)
|
|
120
|
+
}, 400);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
authenticated.post("/api/connectors/composio/connections/:id/learning/pause", strictRateLimitMiddleware, (c) => {
|
|
124
|
+
const changed = service.setConnectorLearningPaused(c.req.param("id"), true);
|
|
125
|
+
return c.json({
|
|
126
|
+
ok: true,
|
|
127
|
+
payload: { changed }
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
authenticated.post("/api/connectors/composio/connections/:id/learning/resume", strictRateLimitMiddleware, (c) => {
|
|
131
|
+
const changed = service.setConnectorLearningPaused(c.req.param("id"), false);
|
|
132
|
+
return c.json({
|
|
133
|
+
ok: true,
|
|
134
|
+
payload: { changed }
|
|
135
|
+
});
|
|
136
|
+
});
|
|
121
137
|
authenticated.patch("/api/connectors/composio/connections/:id", strictRateLimitMiddleware, async (c) => {
|
|
122
138
|
const body = await c.req.json().catch(() => ({}));
|
|
123
139
|
const row = body && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
@@ -153,7 +169,9 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
153
169
|
});
|
|
154
170
|
authenticated.delete("/api/connectors/composio/connections/:id", strictRateLimitMiddleware, async (c) => {
|
|
155
171
|
try {
|
|
156
|
-
|
|
172
|
+
const connectionId = c.req.param("id");
|
|
173
|
+
await revokeComposioConnection(connectionId);
|
|
174
|
+
service.setConnectorLearningPaused(connectionId, true);
|
|
157
175
|
return c.json({
|
|
158
176
|
ok: true,
|
|
159
177
|
payload: { revoked: true }
|
|
@@ -275,7 +293,7 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
275
293
|
const body = await c.req.json().catch(() => ({}));
|
|
276
294
|
try {
|
|
277
295
|
const event = await appendComposioTriggerEvent(service.currentConfig, body);
|
|
278
|
-
service.
|
|
296
|
+
if (event.toolkit) service.requestConnectorLearningForToolkit(event.toolkit);
|
|
279
297
|
return c.json({
|
|
280
298
|
ok: true,
|
|
281
299
|
payload: { event }
|
|
@@ -313,43 +331,6 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
313
331
|
})
|
|
314
332
|
});
|
|
315
333
|
});
|
|
316
|
-
authenticated.get("/api/connectors/:id/memory-sync-profile", (c) => {
|
|
317
|
-
const profile = getComposioMemorySyncProfile(service.currentConfig, c.req.param("id"));
|
|
318
|
-
return c.json({
|
|
319
|
-
ok: true,
|
|
320
|
-
payload: { profile: profile ?? null }
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
authenticated.patch("/api/connectors/:id/memory-sync-profile", strictRateLimitMiddleware, async (c) => {
|
|
324
|
-
const body = await c.req.json().catch(() => ({}));
|
|
325
|
-
const row = body && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
326
|
-
try {
|
|
327
|
-
const config = service.currentConfig;
|
|
328
|
-
const profile = updateComposioMemorySyncProfile(config, c.req.param("id"), {
|
|
329
|
-
enabled: row.enabled === true,
|
|
330
|
-
actionId: typeof row.actionId === "string" ? row.actionId : "",
|
|
331
|
-
arguments: row.arguments && typeof row.arguments === "object" && !Array.isArray(row.arguments) ? row.arguments : {},
|
|
332
|
-
agentId: typeof row.agentId === "string" ? row.agentId : "",
|
|
333
|
-
connectionId: typeof row.connectionId === "string" ? row.connectionId : void 0,
|
|
334
|
-
intervalMinutes: Number(row.intervalMinutes),
|
|
335
|
-
triggerSync: row.triggerSync !== false
|
|
336
|
-
});
|
|
337
|
-
const saved = await service.saveConfig(config);
|
|
338
|
-
if (!saved.saved) return c.json({
|
|
339
|
-
ok: false,
|
|
340
|
-
error: saved.error
|
|
341
|
-
}, 500);
|
|
342
|
-
return c.json({
|
|
343
|
-
ok: true,
|
|
344
|
-
payload: { profile }
|
|
345
|
-
});
|
|
346
|
-
} catch (error) {
|
|
347
|
-
return c.json({
|
|
348
|
-
ok: false,
|
|
349
|
-
error: errorMessage(error)
|
|
350
|
-
}, 400);
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
334
|
authenticated.get("/api/connectors/:id", (c) => {
|
|
354
335
|
const connectorId = c.req.param("id");
|
|
355
336
|
const connector = getConnectorDefinition(connectorId);
|
|
@@ -395,48 +376,6 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
395
376
|
payload: { health }
|
|
396
377
|
});
|
|
397
378
|
});
|
|
398
|
-
authenticated.post("/api/connectors/:id/memory-sync", strictRateLimitMiddleware, async (c) => {
|
|
399
|
-
const body = await c.req.json().catch(() => ({}));
|
|
400
|
-
const row = body && typeof body === "object" && !Array.isArray(body) ? body : {};
|
|
401
|
-
const actionId = typeof row.actionId === "string" ? row.actionId.trim() : "";
|
|
402
|
-
const config = service.currentConfig;
|
|
403
|
-
const agentId = typeof row.agentId === "string" && row.agentId.trim() ? row.agentId.trim() : resolveDefaultAgentId(config);
|
|
404
|
-
try {
|
|
405
|
-
const connectorId = c.req.param("id");
|
|
406
|
-
if (getConnectorDefinition(connectorId)?.runtime.type === "memorySource") {
|
|
407
|
-
const result = await syncLocalFolderToMemory({
|
|
408
|
-
config,
|
|
409
|
-
connectorId,
|
|
410
|
-
agentId
|
|
411
|
-
});
|
|
412
|
-
return c.json({
|
|
413
|
-
ok: true,
|
|
414
|
-
payload: result
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
if (!actionId) return c.json({
|
|
418
|
-
ok: false,
|
|
419
|
-
error: "actionId is required for Composio memory sync."
|
|
420
|
-
}, 400);
|
|
421
|
-
const result = await syncComposioResultToMemory({
|
|
422
|
-
config,
|
|
423
|
-
connectorId,
|
|
424
|
-
actionId,
|
|
425
|
-
agentId,
|
|
426
|
-
connectionId: typeof row.connectionId === "string" ? row.connectionId : void 0,
|
|
427
|
-
arguments: row.arguments && typeof row.arguments === "object" && !Array.isArray(row.arguments) ? row.arguments : {}
|
|
428
|
-
});
|
|
429
|
-
return c.json({
|
|
430
|
-
ok: true,
|
|
431
|
-
payload: result
|
|
432
|
-
});
|
|
433
|
-
} catch (error) {
|
|
434
|
-
return c.json({
|
|
435
|
-
ok: false,
|
|
436
|
-
error: errorMessage(error)
|
|
437
|
-
}, 400);
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
379
|
authenticated.get("/api/connectors/composio/:toolkit/policy", (c) => {
|
|
441
380
|
const config = service.currentConfig;
|
|
442
381
|
try {
|
|
@@ -632,6 +571,25 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
632
571
|
}, 500);
|
|
633
572
|
}
|
|
634
573
|
});
|
|
574
|
+
authenticated.post("/api/connectors/:id/source-sync", strictRateLimitMiddleware, async (c) => {
|
|
575
|
+
const config = service.currentConfig;
|
|
576
|
+
try {
|
|
577
|
+
const result = await ingestLocalFolderSource({
|
|
578
|
+
config,
|
|
579
|
+
connectorId: c.req.param("id"),
|
|
580
|
+
agentId: resolveDefaultAgentId(config)
|
|
581
|
+
});
|
|
582
|
+
return c.json({
|
|
583
|
+
ok: true,
|
|
584
|
+
payload: result
|
|
585
|
+
});
|
|
586
|
+
} catch (error) {
|
|
587
|
+
return c.json({
|
|
588
|
+
ok: false,
|
|
589
|
+
error: errorMessage(error)
|
|
590
|
+
}, 400);
|
|
591
|
+
}
|
|
592
|
+
});
|
|
635
593
|
authenticated.post("/api/connectors/:id/config", strictRateLimitMiddleware, async (c) => {
|
|
636
594
|
const instanceId = c.req.param("id");
|
|
637
595
|
const body = await c.req.json().catch(() => ({}));
|
|
@@ -16,6 +16,7 @@ import { getAgentImageGenerationConfig, getImageGenerationCatalog, prepareImageG
|
|
|
16
16
|
import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
|
|
17
17
|
import { respondStartupUnavailable } from "../lib/startup-unavailable.js";
|
|
18
18
|
import { auditModelReferences } from "../../../providers/model-reference-auditor.js";
|
|
19
|
+
import { XopcCloudAccountError, XopcCloudAccountService } from "../../../providers/xopc-cloud-account-service.js";
|
|
19
20
|
//#region src/gateway/hono/routes/models.ts
|
|
20
21
|
init_models_json();
|
|
21
22
|
init_resolve_config_value();
|
|
@@ -66,6 +67,7 @@ function mapPluginModel(providerId, model, available) {
|
|
|
66
67
|
function registerModelsRoutes(authenticated, deps) {
|
|
67
68
|
const { service, strictRateLimitMiddleware } = deps;
|
|
68
69
|
const catalogSync = service.getModelCatalogSync();
|
|
70
|
+
const xopcCloudAccount = new XopcCloudAccountService();
|
|
69
71
|
authenticated.get("/api/models/catalog/status", (c) => c.json({
|
|
70
72
|
ok: true,
|
|
71
73
|
payload: catalogSync.getStatus()
|
|
@@ -90,6 +92,28 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
90
92
|
payload: result
|
|
91
93
|
});
|
|
92
94
|
});
|
|
95
|
+
authenticated.get("/api/models/xopc-cloud/account-summary", async (c) => {
|
|
96
|
+
try {
|
|
97
|
+
const summary = await xopcCloudAccount.getSummary();
|
|
98
|
+
if (!summary) return c.json({
|
|
99
|
+
ok: false,
|
|
100
|
+
error: { message: "XOPC Cloud is not configured" }
|
|
101
|
+
}, 404);
|
|
102
|
+
return c.json({
|
|
103
|
+
ok: true,
|
|
104
|
+
payload: summary
|
|
105
|
+
});
|
|
106
|
+
} catch (error) {
|
|
107
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
108
|
+
return c.json({
|
|
109
|
+
ok: false,
|
|
110
|
+
error: {
|
|
111
|
+
message,
|
|
112
|
+
...error instanceof XopcCloudAccountError && error.code ? { code: error.code } : {}
|
|
113
|
+
}
|
|
114
|
+
}, 502);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
93
117
|
authenticated.get("/api/models-json", async (c) => {
|
|
94
118
|
const path = resolveModelsJsonPath();
|
|
95
119
|
const { config, error } = loadModelsJson(path);
|
|
@@ -68,9 +68,10 @@ function registerPublicGatewayRoutes(app, service) {
|
|
|
68
68
|
data: payload
|
|
69
69
|
};
|
|
70
70
|
const normalized = normalizeComposioTriggerPayload(archivedPayload, webhookId);
|
|
71
|
-
applyComposioConnectionLifecycleEvent(archivedPayload);
|
|
71
|
+
const inactiveConnectionId = applyComposioConnectionLifecycleEvent(archivedPayload);
|
|
72
|
+
if (inactiveConnectionId) service.setConnectorLearningPaused(inactiveConnectionId, true);
|
|
72
73
|
const event = await appendComposioTriggerEvent(service.currentConfig, archivedPayload);
|
|
73
|
-
service.
|
|
74
|
+
if (normalized.toolkit) service.requestConnectorLearningForToolkit(normalized.toolkit);
|
|
74
75
|
const runs = await service.automationServiceInstance.triggerEvent({
|
|
75
76
|
type: `connector.${normalized.trigger ?? normalized.type}`,
|
|
76
77
|
source: normalized.toolkit ? `composio:${normalized.toolkit}` : "composio",
|
|
@@ -5,7 +5,6 @@ import { evictEmbeddedSessionRunner } from "../../../agent/embedded/session-runn
|
|
|
5
5
|
import { messagesToClientHistory } from "../../../session/client-history.js";
|
|
6
6
|
import { deleteMediaUrisNoLongerReferenced } from "../../../media/session-references.js";
|
|
7
7
|
import { createGatewayRouteLogger, logRouteError } from "../lib/route-logger.js";
|
|
8
|
-
import { computeUserRoundDeleteRange } from "../../../session/user-round-delete.js";
|
|
9
8
|
import { respondStartupUnavailable } from "../lib/startup-unavailable.js";
|
|
10
9
|
import { randomUUID } from "node:crypto";
|
|
11
10
|
//#region src/gateway/hono/routes/sessions.ts
|
|
@@ -459,48 +458,35 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
459
458
|
evictEmbeddedSessionRunner(key, "gateway_bash_execution_appended");
|
|
460
459
|
return c.json({ ok: true });
|
|
461
460
|
});
|
|
462
|
-
authenticated.get("/api/sessions/:key/compaction/
|
|
461
|
+
authenticated.get("/api/sessions/:key/compaction/boundaries", async (c) => {
|
|
463
462
|
const key = c.req.param("key");
|
|
464
463
|
if (!await service.sessionIndexInstance.getSessionMetadata(key)) return c.json({
|
|
465
464
|
ok: false,
|
|
466
465
|
error: "Session not found"
|
|
467
466
|
}, 404);
|
|
468
|
-
const
|
|
467
|
+
const boundaries = await service.sessions.listCompactionBoundaries(key);
|
|
469
468
|
return c.json({
|
|
470
469
|
ok: true,
|
|
471
|
-
payload: {
|
|
472
|
-
});
|
|
473
|
-
});
|
|
474
|
-
authenticated.get("/api/sessions/:key/compaction/checkpoints/:checkpointId", async (c) => {
|
|
475
|
-
const key = c.req.param("key");
|
|
476
|
-
const checkpointId = c.req.param("checkpointId");
|
|
477
|
-
const checkpoint = await service.sessions.getCompactionCheckpoint(key, checkpointId);
|
|
478
|
-
if (!checkpoint) return c.json({
|
|
479
|
-
ok: false,
|
|
480
|
-
error: "Checkpoint not found"
|
|
481
|
-
}, 404);
|
|
482
|
-
return c.json({
|
|
483
|
-
ok: true,
|
|
484
|
-
payload: { checkpoint }
|
|
470
|
+
payload: { boundaries }
|
|
485
471
|
});
|
|
486
472
|
});
|
|
487
473
|
authenticated.post("/api/sessions/:key/compaction/restore", async (c) => {
|
|
488
474
|
const key = c.req.param("key");
|
|
489
475
|
const body = await c.req.json().catch(() => ({}));
|
|
490
|
-
const
|
|
491
|
-
if (!
|
|
476
|
+
const compactionId = typeof body.compactionId === "string" ? body.compactionId.trim() : "";
|
|
477
|
+
if (!compactionId) return c.json({
|
|
492
478
|
ok: false,
|
|
493
|
-
error: "
|
|
479
|
+
error: "compactionId required"
|
|
494
480
|
}, 400);
|
|
495
481
|
try {
|
|
496
|
-
await service.sessions.
|
|
482
|
+
await service.sessions.restoreBeforeCompactionBoundary(key, compactionId);
|
|
497
483
|
} catch (err) {
|
|
498
484
|
logRouteError(log, c, err, "gateway.route.sessions", {
|
|
499
|
-
operation: "
|
|
485
|
+
operation: "restoreCompactionBoundary",
|
|
500
486
|
sessionKey: key
|
|
501
487
|
});
|
|
502
488
|
const msg = err instanceof Error ? err.message : String(err);
|
|
503
|
-
if (msg.includes("not found")
|
|
489
|
+
if (msg.includes("not found")) return c.json({
|
|
504
490
|
ok: false,
|
|
505
491
|
error: msg
|
|
506
492
|
}, 404);
|
|
@@ -695,30 +681,19 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
695
681
|
authenticated.delete("/api/sessions/:key/messages", async (c) => {
|
|
696
682
|
const key = c.req.param("key");
|
|
697
683
|
const body = await c.req.json().catch(() => ({}));
|
|
698
|
-
const loaded = await service.sessionIndexInstance.loadMessages(key);
|
|
699
|
-
if (!loaded) return c.json({ error: "Session not found" }, 404);
|
|
700
|
-
let startIndex = typeof body.startIndex === "number" ? body.startIndex : -1;
|
|
701
|
-
let count = typeof body.count === "number" ? body.count : 0;
|
|
702
684
|
const userRoundIndex = typeof body.userRoundIndex === "number" ? body.userRoundIndex : void 0;
|
|
703
|
-
if (userRoundIndex
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
startIndex = range.startIndex;
|
|
707
|
-
count = range.count;
|
|
708
|
-
}
|
|
709
|
-
if (startIndex < 0 || count <= 0) return c.json({ error: "Invalid startIndex or count" }, 400);
|
|
710
|
-
if (startIndex >= loaded.length) return c.json({ error: "Index out of range" }, 400);
|
|
711
|
-
const deleteCount = Math.min(count, loaded.length - startIndex);
|
|
712
|
-
const removed = loaded.slice(startIndex, startIndex + deleteCount);
|
|
713
|
-
const next = loaded.slice(0, startIndex).concat(loaded.slice(startIndex + deleteCount));
|
|
714
|
-
await service.sessionIndexInstance.saveMessages(key, next);
|
|
685
|
+
if (userRoundIndex === void 0 || !Number.isInteger(userRoundIndex) || userRoundIndex < 0) return c.json({ error: "userRoundIndex must be a non-negative integer" }, 400);
|
|
686
|
+
const result = await service.sessionIndexInstance.deleteUserRound(key, userRoundIndex);
|
|
687
|
+
if (!result) return c.json({ error: "User round index out of range" }, 400);
|
|
715
688
|
await deleteMediaUrisNoLongerReferenced({
|
|
716
|
-
removed,
|
|
717
|
-
remaining:
|
|
689
|
+
removed: result.removedMessages,
|
|
690
|
+
remaining: result.remainingMessages
|
|
718
691
|
});
|
|
692
|
+
evictEmbeddedSessionRunner(key, "gateway_user_round_deleted");
|
|
693
|
+
service.agentService.evictSessionAgent(key);
|
|
719
694
|
return c.json({
|
|
720
695
|
ok: true,
|
|
721
|
-
deleted:
|
|
696
|
+
deleted: result.deleted
|
|
722
697
|
});
|
|
723
698
|
});
|
|
724
699
|
authenticated.post("/api/sessions/:key/reset", async (c) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
|
|
2
|
+
import { getUserClaim, linkUserClaimMemoryRecord, listUserClaimEvidence, listUserClaimStatsBySource, listUserClaims, removeUserClaimEvidenceForSource, setUserClaimDecision } from "../../../storage/sqlite/user-claims-repository.js";
|
|
3
|
+
import { listConnectorLearningJobs } from "../../../storage/sqlite/connector-learning-repository.js";
|
|
2
4
|
import { getRelationshipSettings, updateRelationshipSettings } from "../../../storage/sqlite/relationship-settings-repository.js";
|
|
3
5
|
import { deleteMemoryRecord, getMemoryRecord, listMemoryRecords, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
|
|
4
6
|
import { listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
|
|
@@ -19,6 +21,7 @@ import { nextMemoryReviewAt, resolveMemoryStability } from "../../../agent/memor
|
|
|
19
21
|
import { PERSONAL_PLAYBOOK_DISABLED_TAG, PERSONAL_PLAYBOOK_ORDER_PREFIX, PERSONAL_PLAYBOOK_RULE_TAG, patchPersonalPlaybookContextTags, personalPlaybookContext } from "../../../user-context/personal-playbook.js";
|
|
20
22
|
import { listConnectorInstances } from "../../../connectors/instances.js";
|
|
21
23
|
import { uninstallConnector } from "../../../connectors/install.js";
|
|
24
|
+
import { renderUserClaim } from "../../../knowledge/connected-understanding-pipeline.js";
|
|
22
25
|
import { readUserProfileFile, writeUserProfileFile } from "../../agents-admin.js";
|
|
23
26
|
import { isUserContextMemoryKind, isUserContextRecord, projectPersonalContextSources, projectUserContextRecord, recordsDerivedFromPersonalContextSource } from "../../../user-context/projection.js";
|
|
24
27
|
import { prepareUserContextImport } from "../../../user-context/import.js";
|
|
@@ -321,10 +324,12 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
321
324
|
const trustPolicy = getUserTrustPolicy();
|
|
322
325
|
const sourceDefinitions = listConnectorCatalog();
|
|
323
326
|
const sourceInstances = listConnectorInstances(config);
|
|
324
|
-
const sources = projectPersonalContextSources(sourceDefinitions, sourceInstances,
|
|
327
|
+
const sources = projectPersonalContextSources(sourceDefinitions, sourceInstances, {
|
|
325
328
|
sourceItems: listKnowledgeSourceItems({ limit: 500 }),
|
|
326
329
|
syncRuns: listKnowledgeSyncRuns({ limit: 500 }),
|
|
327
|
-
connections: listConnectorConnections({ principalId: "local-owner" })
|
|
330
|
+
connections: listConnectorConnections({ principalId: "local-owner" }),
|
|
331
|
+
learningJobs: listConnectorLearningJobs({ limit: 500 }),
|
|
332
|
+
claimStatsBySource: listUserClaimStatsBySource()
|
|
328
333
|
});
|
|
329
334
|
const activeGoals = new GoalService().list({
|
|
330
335
|
agentId,
|
|
@@ -344,6 +349,13 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
344
349
|
},
|
|
345
350
|
...profileBundle,
|
|
346
351
|
understanding: records.map(projectUserContextRecord),
|
|
352
|
+
connectedClaims: listUserClaims({
|
|
353
|
+
agentId,
|
|
354
|
+
limit: 100
|
|
355
|
+
}).map((claim) => ({
|
|
356
|
+
...claim,
|
|
357
|
+
evidence: listUserClaimEvidence(claim.id)
|
|
358
|
+
})),
|
|
347
359
|
consentRequests: consents.filter((consent) => consent.status === "pending").flatMap((consent) => {
|
|
348
360
|
const record = recordById.get(consent.recordId);
|
|
349
361
|
return record ? [projectReferenceConsent(consent, record)] : [];
|
|
@@ -404,6 +416,64 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
404
416
|
relationship: updateRelationshipSettings(patch)
|
|
405
417
|
});
|
|
406
418
|
});
|
|
419
|
+
authenticated.patch("/api/you/claims/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
420
|
+
const body = await c.req.json().catch(() => ({}));
|
|
421
|
+
const action = body.action === "confirm" || body.action === "reject" ? body.action : void 0;
|
|
422
|
+
if (!action) return c.json({ error: "Action must be confirm or reject" }, 400);
|
|
423
|
+
const claim = runSqliteWriteTransaction(() => {
|
|
424
|
+
const updated = setUserClaimDecision(c.req.param("id"), action === "confirm" ? "confirmed" : "rejected");
|
|
425
|
+
if (!updated) return updated;
|
|
426
|
+
const existing = updated.memoryRecordId ? getMemoryRecord(updated.memoryRecordId) : void 0;
|
|
427
|
+
if (existing) preserveRecord(existing, {
|
|
428
|
+
status: action === "confirm" ? "active" : "rejected",
|
|
429
|
+
...action === "confirm" ? { reviewAfter: nextMemoryReviewAt(existing) } : {}
|
|
430
|
+
});
|
|
431
|
+
else if (action === "confirm") {
|
|
432
|
+
const candidate = renderUserClaim(updated);
|
|
433
|
+
const evidence = listUserClaimEvidence(updated.id);
|
|
434
|
+
const record = upsertMemoryRecord({
|
|
435
|
+
providerId: "connected-understanding",
|
|
436
|
+
kind: candidate.kind,
|
|
437
|
+
sourceAgentId: updated.agentId,
|
|
438
|
+
content: candidate.content,
|
|
439
|
+
canonicalKey: candidate.canonicalKey,
|
|
440
|
+
source: { provider: "connected-sources" },
|
|
441
|
+
confidence: 1,
|
|
442
|
+
status: "active",
|
|
443
|
+
sensitivity: candidate.sensitivity,
|
|
444
|
+
explicitness: "explicit",
|
|
445
|
+
durability: candidate.durability,
|
|
446
|
+
importance: candidate.importance,
|
|
447
|
+
disclosurePolicy: candidate.disclosurePolicy,
|
|
448
|
+
tags: [...new Set([
|
|
449
|
+
"user-understanding",
|
|
450
|
+
...candidate.tags ?? [],
|
|
451
|
+
"user-confirmed"
|
|
452
|
+
])],
|
|
453
|
+
evidence: evidence.map((item) => ({
|
|
454
|
+
sourceItemId: item.sourceItemId,
|
|
455
|
+
relation: item.relation === "contradicts" ? "contradicts" : "supports",
|
|
456
|
+
observedAt: item.observedAt,
|
|
457
|
+
confidence: updated.confidence
|
|
458
|
+
})),
|
|
459
|
+
reviewAfter: nextMemoryReviewAt({
|
|
460
|
+
durability: candidate.durability,
|
|
461
|
+
explicitness: "explicit"
|
|
462
|
+
})
|
|
463
|
+
});
|
|
464
|
+
linkUserClaimMemoryRecord(updated.id, record.id);
|
|
465
|
+
}
|
|
466
|
+
return getUserClaim(updated.id);
|
|
467
|
+
});
|
|
468
|
+
if (!claim) return c.json({ error: "Connected claim not found" }, 404);
|
|
469
|
+
return c.json({
|
|
470
|
+
ok: true,
|
|
471
|
+
claim: {
|
|
472
|
+
...claim,
|
|
473
|
+
evidence: listUserClaimEvidence(claim.id)
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
});
|
|
407
477
|
authenticated.get("/api/you/profile", async (c) => {
|
|
408
478
|
return c.json(await readProfileBundle(deps.service.currentConfig));
|
|
409
479
|
});
|
|
@@ -889,17 +959,28 @@ function registerYouRoutes(authenticated, deps) {
|
|
|
889
959
|
return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
|
|
890
960
|
}
|
|
891
961
|
let deletedUnderstandingCount = 0;
|
|
962
|
+
let deletedClaimCount = 0;
|
|
892
963
|
if (body.deleteDerivedUnderstanding) {
|
|
893
964
|
const sourceInstanceId = connection ? `composio:${connection.connectorId}:${connection.id}` : instanceId;
|
|
894
965
|
const targets = recordsDerivedFromPersonalContextSource(listAllUserContextRecords(ALL_MEMORY_STATUSES), sourceInstanceId);
|
|
895
966
|
runSqliteWriteTransaction(() => {
|
|
896
|
-
|
|
967
|
+
const claimRemoval = removeUserClaimEvidenceForSource(sourceInstanceId);
|
|
968
|
+
deletedClaimCount = claimRemoval.deletedClaimCount;
|
|
969
|
+
const retainedMemoryIds = new Set(claimRemoval.retainedClaims.map((claim) => claim.memoryRecordId));
|
|
970
|
+
const deleteIds = new Set([...claimRemoval.deletedMemoryRecordIds, ...targets.filter((record) => !retainedMemoryIds.has(record.id)).map((record) => record.id)]);
|
|
971
|
+
for (const recordId of deleteIds) deleteMemoryRecord(recordId);
|
|
972
|
+
for (const retained of claimRemoval.retainedClaims) {
|
|
973
|
+
if (retained.state === "active") continue;
|
|
974
|
+
const record = getMemoryRecord(retained.memoryRecordId);
|
|
975
|
+
if (record) preserveRecord(record, { status: retained.state === "rejected" ? "rejected" : "stale" });
|
|
976
|
+
}
|
|
977
|
+
deletedUnderstandingCount = deleteIds.size;
|
|
897
978
|
});
|
|
898
|
-
deletedUnderstandingCount = targets.length;
|
|
899
979
|
}
|
|
900
980
|
return c.json({
|
|
901
981
|
ok: true,
|
|
902
|
-
deletedUnderstandingCount
|
|
982
|
+
deletedUnderstandingCount,
|
|
983
|
+
deletedClaimCount
|
|
903
984
|
});
|
|
904
985
|
});
|
|
905
986
|
authenticated.patch("/api/you/understanding/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
@@ -92,9 +92,8 @@ export declare class GatewaySessionsApi {
|
|
|
92
92
|
verboseLevel?: string;
|
|
93
93
|
workingDirectory?: string;
|
|
94
94
|
}): Promise<import("../../agent/session/session-config-service.js").PatchSessionAgentConfigResult>;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
restoreCompactionCheckpoint(key: string, checkpointId: string): Promise<void>;
|
|
95
|
+
listCompactionBoundaries(key: string): Promise<import("../../session/types.js").CompactionBoundarySummary[]>;
|
|
96
|
+
restoreBeforeCompactionBoundary(key: string, compactionId: string): Promise<void>;
|
|
98
97
|
runCompaction(key: string, options?: {
|
|
99
98
|
instructions?: string;
|
|
100
99
|
force?: boolean;
|
|
@@ -93,14 +93,11 @@ var GatewaySessionsApi = class {
|
|
|
93
93
|
patchAgentConfig(sessionKey, body) {
|
|
94
94
|
return this.opts.getAgentService().sessionConfig.patch(sessionKey, body);
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
return this.opts.sessionIndex.
|
|
96
|
+
listCompactionBoundaries(key) {
|
|
97
|
+
return this.opts.sessionIndex.listCompactionBoundaries(key);
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
async restoreCompactionCheckpoint(key, checkpointId) {
|
|
103
|
-
await this.opts.sessionIndex.restoreCompactionCheckpoint(key, checkpointId);
|
|
99
|
+
async restoreBeforeCompactionBoundary(key, compactionId) {
|
|
100
|
+
await this.opts.sessionIndex.restoreBeforeCompactionBoundary(key, compactionId);
|
|
104
101
|
this.opts.getAgentService().evictSessionAgent(key);
|
|
105
102
|
}
|
|
106
103
|
async runCompaction(key, options) {
|
|
@@ -18,6 +18,7 @@ import { GatewayMarketplaceService } from './service/marketplace-service.js';
|
|
|
18
18
|
import { GatewayAgentRunner } from './service/agent-runner.js';
|
|
19
19
|
import type { GatewayServiceConfig, ServiceEvent } from './service/types.js';
|
|
20
20
|
import { type GatewayReadinessSnapshot } from './startup-readiness.js';
|
|
21
|
+
import { type ConnectorLearningCoordinator } from '../connectors/learning-coordinator.js';
|
|
21
22
|
import { type ProductLanguage } from '../voice/language-profile.js';
|
|
22
23
|
export type { GatewayChannelStartupPhase1Metrics, GatewayChannelStartupPhase2Metrics, GatewayServiceConfig, ServiceEvent, } from './service/types.js';
|
|
23
24
|
export declare class GatewayService {
|
|
@@ -63,7 +64,7 @@ export declare class GatewayService {
|
|
|
63
64
|
private goalNotifications;
|
|
64
65
|
private mobileNotifications;
|
|
65
66
|
private connectorSupervisor;
|
|
66
|
-
private
|
|
67
|
+
private connectorLearningCoordinator;
|
|
67
68
|
private connectedKnowledgeCoordinator;
|
|
68
69
|
private stopAutomationProductEventBridge;
|
|
69
70
|
private stopSessionTranscriptAutomationEvents;
|
|
@@ -207,7 +208,9 @@ export declare class GatewayService {
|
|
|
207
208
|
requestHeartbeatNow(opts?: {
|
|
208
209
|
reason?: string;
|
|
209
210
|
}): void;
|
|
210
|
-
|
|
211
|
+
requestConnectorLearning(connectionId: string, request?: Parameters<ConnectorLearningCoordinator['enqueueConnection']>[1]): ReturnType<ConnectorLearningCoordinator['enqueueConnection']>;
|
|
212
|
+
requestConnectorLearningForToolkit(toolkit: string): ReturnType<ConnectorLearningCoordinator['enqueueToolkit']>;
|
|
213
|
+
setConnectorLearningPaused(connectionId: string, paused: boolean): number;
|
|
211
214
|
/**
|
|
212
215
|
* Register graceful shutdown used after spawning a replacement gateway process (foreground CLI server).
|
|
213
216
|
*/
|