@xopcai/xopc 0.0.215 → 0.0.218
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/README.md +4 -4
- package/README.zh-CN.md +4 -4
- 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-k-mNF_Dq.js → activity-store-DF2dYXG1.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-0Am1Zsai.js → agent-avatar-dicebear-Dw9rF5o1.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Dj86bHkl.js +68 -0
- package/dist/gateway/static/root/assets/{api-BjN2udFQ.js → api-_H0Bam-t.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-D-M6GN-8.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-CoB0hGf9.js → appearance-settings-XDhmzdIc.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-sfO835uz.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BczSorEI.js → archive-plugin-DZCOhXch.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D1SDGB0m.js → attachment-load-Bjb0FH2B.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BTgWPOP6.js → automations-page-D4N3ZDhu.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-PptuZgoo.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-6tFOQHNC.js → binary-plugins-uXPt0s47.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Cm7txOU2.js → block-editor-gukkIEro.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-BoCmzMFV.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-Coz8pWzP.js → browser-workflow-inputs-DAhdS-XZ.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DJGD7LOd.js → browser-workflows-page-LKjYzXS_.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DhkJsU8Z.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BF3G84qe.js → capability-presets-api-BBUkH833.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-v85bB-Lt.js → capability-presets-settings-panel-Dm7T61fE.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-8Uz95P40.js → channel-recipient-api-E5mo8M3a.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-dG6UFVqt.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DioZkaaj.js → chat-terminal-dock-CT5yoSMD.js} +2 -2
- package/dist/gateway/static/root/assets/circle-check-C23XjkUj.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BC6Ft9SU.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BTNvqkwt.js → cron-expression-BGNuaqvI.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-k7mkklMU.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-PlfH-GH8.js → dependency-picker-DZVSgLXH.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C3nO_ocM.js → desktop-pet-p9EZyGzV.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Bw4cCFzI.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BIqsbDII.js → directory-picker-path-field-Cbst7IXR.js} +1 -1
- package/dist/gateway/static/root/assets/electron-env-DH5wF8X8.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-C1o3Jn7L.js → extension-debug-page-Cd4BMKm_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Drjulq3q.js → extension-page-CzEGCkOa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-XsMPJFYn.js → extension-settings-page-C1PAKSy2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-D9xHVpb9.js → gateway-config-api-Bch9vO6t.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-l2w9ecXl.js → gateway-config-swr-DNrttVr2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BaVojQd4.js → gateway-settings-DkDxZFGG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-XUzMGmLZ.js → gateway-startup-retry-B1vD3vRb.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-dQH2-fGh.js → heartbeat-settings-DXNMxy5b.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CMqS6l_m.js → home-page-CYcpVFNT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-CDoOrDMq.js → image-generation-api-BTR0Wk_k.js} +1 -1
- package/dist/gateway/static/root/assets/index-Dgb1R07E.css +2 -0
- package/dist/gateway/static/root/assets/index-DlOYwVFK.js +108 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CYlS4RGA.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-BFrgPwGE.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-8w0FZ7TD.js → local-apps-page-CNppYVew.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BIOMAhmR.js → locale-store-gf9Bg2gb.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-FiVowm1N.js → logs-page-CPweLw3k.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-DdYouU4o.js → management-settings-IYk9xLgt.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-D_kDeT-f.js → markdown-split-D8e6pRMH.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BMDQYc6E.js → markdown-view-D0fiJjBQ.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BDgbIz9p.js → media-plugins-CCq6TtEf.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-lKPk0Voa.js → notes-api-BBtWnlUU.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-Bw2MQ4M8.js → notes-page-BKe1xa3U.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-wieRAd1y.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-B7dlng5v.js → page-tabs-Bsluqyfb.js} +1 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BrpTWv44.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page--m0DziFF.js → product-open-page-DXe5iWI6.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cww6V7HJ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D0LKhCCw.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFwvRxBn.js → registry-api-xj5gOva_.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Sf4Pde6Z.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-6QadzIxb.js → runtime-tools-settings-panel-BJTvmBCA.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-ChJycivC.js → schema-form-DvGBa_7R.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-S5gvgfu5.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DRazyNED.js → settings-form-section-CiGFtdD8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CdEdSb5L.js → settings-loading-skeleton-sbef7GTm.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BL0rlziB.js → settings-page-BNGxxXZe.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CGU_Mxjr.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CKK5swgV.js → share-preview-page-C1523ij3.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-k0UQ8WxO.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-OuHd9GcN.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-4_15-T3G.js → skills-page.utils-Ditgz7Vo.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-CERqCsz2.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input.utils-BP3NH_du.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BnRNL2sn.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BrbF9cgL.js → theme-store-DgSjes3O.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CzB0r79r.js → typed-models-lib-abEJNkCO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-D_fuJIDo.js → use-autosave-Bp_qFZkl.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-hbzDfErG.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CSgiFeW2.js → work-discovery-overlay-DZVib-04.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DstMFHA8.js → workflow-run-setup-panel-C2RKay1p.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +5 -0
- package/dist/gateway/static/root/index.html +13 -11
- package/dist/package.js +1 -1
- package/dist/packages/realtime-client/src/index.js +17 -2
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +4 -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/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- 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/tasks/task-judge-service.js +3 -3
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- 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/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +21 -4
- package/dist/src/connectors/connected-source-normalizers.js +51 -4
- package/dist/src/connectors/connected-source-understanding.d.ts +19 -0
- package/dist/src/connectors/connected-source-understanding.js +132 -0
- package/dist/src/connectors/content-enrichment.d.ts +1 -0
- package/dist/src/connectors/content-enrichment.js +11 -7
- package/dist/src/connectors/learning-coordinator.js +55 -4
- package/dist/src/connectors/learning-recipes.js +2 -2
- package/dist/src/document-understanding/extract.d.ts +1 -1
- package/dist/src/document-understanding/extract.js +54 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/lib/static-ui.js +1 -0
- package/dist/src/gateway/hono/oauth-async.d.ts +4 -0
- package/dist/src/gateway/hono/oauth-async.js +24 -1
- package/dist/src/gateway/hono/oauth.js +14 -1
- package/dist/src/gateway/hono/routes/config.js +3 -0
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +16 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +25 -7
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/rate-limit/buckets.d.ts +1 -1
- package/dist/src/gateway/rate-limit/buckets.js +2 -2
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +10 -12
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +41 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +142 -0
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/user-context/sources/catalog.js +9 -2
- package/dist/src/user-context/sources/local-source-contract.d.ts +1 -1
- package/dist/src/user-context/sources/local-source-contract.js +1 -0
- package/dist/src/user-context/understanding-writing.d.ts +1 -0
- package/dist/src/user-context/understanding-writing.js +4 -0
- package/dist/src/voice/language-profile.d.ts +0 -2
- package/dist/src/voice/language-profile.js +2 -30
- package/dist/src/voice/local/provider-switch.d.ts +4 -0
- package/dist/src/voice/local/provider-switch.js +36 -0
- package/dist/src/work-discovery/analyzer.d.ts +6 -0
- package/dist/src/work-discovery/analyzer.js +181 -57
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/probe.js +20 -0
- package/dist/src/work-discovery/service.d.ts +9 -0
- package/dist/src/work-discovery/service.js +18 -6
- package/dist/src/work-discovery/types.d.ts +5 -0
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-BhWSwa4h.js +0 -68
- package/dist/gateway/static/root/assets/app-management-settings-panel-BCHmLiA7.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DloObQ8z.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CbOSi-Uh.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-UhIguuT0.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BPe2vu-c.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-Dj3wNboO.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-NfU9X-P5.js +0 -1
- package/dist/gateway/static/root/assets/connectors-api-DHBX8LgY.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-B8Z692Fe.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-wMj_1toq.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-BZSODwlA.js +0 -1
- package/dist/gateway/static/root/assets/index-BDwfvp1w.css +0 -2
- package/dist/gateway/static/root/assets/index-CjbvsIPf.js +0 -108
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-so_XFXVC.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Dp1zGjrI.js +0 -2
- package/dist/gateway/static/root/assets/messages-CbbZKEfO.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-DpMDd8Sm.js +0 -4
- package/dist/gateway/static/root/assets/preview-open-alternatives-Bzi2ia11.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-D8AglzWN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D0X6kb12.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-MxuXgfuY.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DGZbtPXx.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DLg_9-bb.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D-nQiA7z.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-IDLLIYA5.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C_ivBD5y.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-t0eKREk9.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-CERY3Drp.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CS9BX5BO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-BvBzRI8P.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-ztq8iQAp.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-XD3Pmm1p.js +0 -5
|
@@ -14,11 +14,14 @@ import { createUnderstandingSourceRun, listUnderstandingSourceRuns, updateUnders
|
|
|
14
14
|
import { ConnectedUnderstandingPipeline } from "../knowledge/connected-understanding-pipeline.js";
|
|
15
15
|
import "../knowledge/index.js";
|
|
16
16
|
import { ingestComposioConnectedSource } from "./connected-source-ingestion.js";
|
|
17
|
+
import { deriveConnectedSourceUnderstanding } from "./connected-source-understanding.js";
|
|
18
|
+
import { listConnectedContentCandidates, readConnectedContent } from "./content-enrichment.js";
|
|
17
19
|
//#region src/connectors/learning-coordinator.ts
|
|
18
20
|
init_logger();
|
|
19
21
|
const log = createLogger("ConnectorLearning");
|
|
20
22
|
const CONNECTED_ACCOUNT_UNAVAILABLE = "connected_account_unavailable";
|
|
21
23
|
const CONNECTED_SOURCE_SYNC_FAILED = "connected_source_sync_failed";
|
|
24
|
+
const CONNECTED_SOURCE_ANALYSIS_FAILED = "connected_source_analysis_failed";
|
|
22
25
|
function learningFailureCode(error) {
|
|
23
26
|
const message = error instanceof Error ? error.message : String(error);
|
|
24
27
|
return message.includes("ToolRouterV2_InvalidConnectedAccountIds") || message.includes("Could not find connected account(s)") || message.includes("missing its provider identity") ? CONNECTED_ACCOUNT_UNAVAILABLE : CONNECTED_SOURCE_SYNC_FAILED;
|
|
@@ -178,6 +181,22 @@ function startConnectorLearningCoordinator(options) {
|
|
|
178
181
|
itemsSeen += synced.itemsSeen;
|
|
179
182
|
itemsIndexed += synced.itemsIndexed;
|
|
180
183
|
}
|
|
184
|
+
const enrichmentErrors = [];
|
|
185
|
+
if (plan.toolkit === "googledrive") {
|
|
186
|
+
const candidates = listConnectedContentCandidates({
|
|
187
|
+
agentId: job.agentId,
|
|
188
|
+
sourceInstanceId: job.sourceInstanceId,
|
|
189
|
+
limit: 5
|
|
190
|
+
});
|
|
191
|
+
if (candidates.length) {
|
|
192
|
+
const enriched = await readConnectedContent({
|
|
193
|
+
agentId: job.agentId,
|
|
194
|
+
sourceItemIds: candidates.map((candidate) => candidate.sourceItemId)
|
|
195
|
+
});
|
|
196
|
+
enrichmentErrors.push(...enriched.failed.map((failure) => failure.error));
|
|
197
|
+
itemsIndexed += enriched.completed;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
181
200
|
if (listConnectorLearningJobs({
|
|
182
201
|
accountId: job.accountId,
|
|
183
202
|
limit: 100
|
|
@@ -199,22 +218,54 @@ function startConnectorLearningCoordinator(options) {
|
|
|
199
218
|
evidenceRefs: [`connector-account:${job.accountId}`],
|
|
200
219
|
sourceRunId: sourceRun.id
|
|
201
220
|
});
|
|
221
|
+
let semantic = {
|
|
222
|
+
created: 0,
|
|
223
|
+
focusCount: 0,
|
|
224
|
+
status: "completed"
|
|
225
|
+
};
|
|
226
|
+
try {
|
|
227
|
+
semantic = await deriveConnectedSourceUnderstanding({
|
|
228
|
+
config: options.getConfig(),
|
|
229
|
+
agentId: job.agentId,
|
|
230
|
+
sourceInstanceId: job.sourceInstanceId,
|
|
231
|
+
sourceRunId: sourceRun.id,
|
|
232
|
+
memoryManager: options.getMemoryManager()
|
|
233
|
+
});
|
|
234
|
+
} catch (error) {
|
|
235
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
236
|
+
semantic = {
|
|
237
|
+
created: 0,
|
|
238
|
+
focusCount: 0,
|
|
239
|
+
status: "failed",
|
|
240
|
+
error: CONNECTED_SOURCE_ANALYSIS_FAILED
|
|
241
|
+
};
|
|
242
|
+
log.warn({
|
|
243
|
+
err: error,
|
|
244
|
+
jobId: job.id,
|
|
245
|
+
connectorId: job.connectorId
|
|
246
|
+
}, `Connected source semantic analysis failed: ${errorMessage}`);
|
|
247
|
+
}
|
|
248
|
+
const candidatesCreated = understanding.created + semantic.created + semantic.focusCount;
|
|
249
|
+
const incomplete = enrichmentErrors.length > 0 || semantic.status !== "completed";
|
|
202
250
|
const completed = updateConnectorLearningJob(job.id, {
|
|
203
251
|
status: "completed",
|
|
204
252
|
phase: "completed",
|
|
205
|
-
candidatesCreated
|
|
253
|
+
candidatesCreated,
|
|
206
254
|
nextRunAt: null,
|
|
207
255
|
finished: true
|
|
208
256
|
});
|
|
209
257
|
updateUnderstandingSourceRun(sourceRun.id, {
|
|
210
|
-
status: "completed",
|
|
258
|
+
status: incomplete ? "partial" : "completed",
|
|
211
259
|
itemsSeen,
|
|
212
260
|
cursorAfter: (/* @__PURE__ */ new Date()).toISOString(),
|
|
213
261
|
completed: true,
|
|
214
262
|
metadata: {
|
|
215
263
|
...sourceRun.metadata,
|
|
216
264
|
itemsIndexed,
|
|
217
|
-
candidatesCreated
|
|
265
|
+
candidatesCreated,
|
|
266
|
+
semanticStatus: semantic.status,
|
|
267
|
+
...semantic.error ? { semanticError: semantic.error } : {},
|
|
268
|
+
...enrichmentErrors.length ? { enrichmentFailureCount: enrichmentErrors.length } : {}
|
|
218
269
|
}
|
|
219
270
|
});
|
|
220
271
|
updateUnderstandingSourceGrantCheckpoint(sourceRun.grantId, {
|
|
@@ -258,7 +309,7 @@ function startConnectorLearningCoordinator(options) {
|
|
|
258
309
|
const definition = getConnectorDefinition(job.connectorId);
|
|
259
310
|
if (definition?.runtime.type === "composio" && definition.runtime.role === "toolkit") updateUnderstandingSourceRun(ensureUnderstandingSourceRun(job, definition.runtime.toolkit, definition.displayName).id, {
|
|
260
311
|
status: "failed",
|
|
261
|
-
errorMessage,
|
|
312
|
+
errorMessage: learningFailureCode(err),
|
|
262
313
|
completed: true
|
|
263
314
|
});
|
|
264
315
|
log.warn({
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { extname } from "node:path";
|
|
2
|
+
import AdmZip from "adm-zip";
|
|
2
3
|
//#region src/document-understanding/extract.ts
|
|
3
4
|
const MAX_EXTRACTED_CHARS = 6e4;
|
|
5
|
+
const MAX_OFFICE_XML_BYTES = 8 * 1024 * 1024;
|
|
6
|
+
const MAX_OFFICE_TOTAL_XML_BYTES = 16 * 1024 * 1024;
|
|
4
7
|
function truncate(text) {
|
|
5
8
|
return text.length > MAX_EXTRACTED_CHARS ? `${text.slice(0, MAX_EXTRACTED_CHARS)}\n\n[document extraction truncated ${text.length - MAX_EXTRACTED_CHARS} chars]` : text;
|
|
6
9
|
}
|
|
@@ -43,11 +46,61 @@ function extractPdfText(buffer) {
|
|
|
43
46
|
text: truncate(text)
|
|
44
47
|
};
|
|
45
48
|
}
|
|
49
|
+
function decodeXmlText(value) {
|
|
50
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll(""", "\"").replaceAll("'", "'");
|
|
51
|
+
}
|
|
52
|
+
function officeXmlText(buffer, extension) {
|
|
53
|
+
let zip;
|
|
54
|
+
try {
|
|
55
|
+
zip = new AdmZip(buffer);
|
|
56
|
+
} catch {
|
|
57
|
+
return {
|
|
58
|
+
ok: false,
|
|
59
|
+
reason: "Office document archive is invalid."
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const prefixes = extension === ".docx" ? ["word/document.xml"] : extension === ".pptx" ? ["ppt/slides/"] : ["xl/sharedStrings.xml", "xl/worksheets/"];
|
|
63
|
+
const entries = zip.getEntries().filter((entry) => !entry.isDirectory && entry.header.size <= MAX_OFFICE_XML_BYTES && prefixes.some((prefix) => entry.entryName.startsWith(prefix))).sort((left, right) => left.entryName.localeCompare(right.entryName));
|
|
64
|
+
const parts = [];
|
|
65
|
+
let extractedBytes = 0;
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
if (extractedBytes + entry.header.size > MAX_OFFICE_TOTAL_XML_BYTES) break;
|
|
68
|
+
extractedBytes += entry.header.size;
|
|
69
|
+
const xml = entry.getData().toString("utf8");
|
|
70
|
+
for (const match of xml.matchAll(/<(?:w:t|a:t|t)(?:\s[^>]*)?>([\s\S]*?)<\/(?:w:t|a:t|t)>/g)) {
|
|
71
|
+
const text = decodeXmlText((match[1] ?? "").replace(/<[^>]+>/g, "")).trim();
|
|
72
|
+
if (text) parts.push(text);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const text = parts.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
76
|
+
return text ? {
|
|
77
|
+
ok: true,
|
|
78
|
+
kind: "office",
|
|
79
|
+
text: truncate(text)
|
|
80
|
+
} : {
|
|
81
|
+
ok: false,
|
|
82
|
+
reason: "Office document extraction found no readable text."
|
|
83
|
+
};
|
|
84
|
+
}
|
|
46
85
|
function extractDocumentText(params) {
|
|
47
86
|
const ext = extname(params.fileName).toLowerCase();
|
|
48
87
|
const mime = params.mimeType?.toLowerCase() ?? "";
|
|
49
88
|
if (mime === "application/pdf" || ext === ".pdf") return extractPdfText(params.buffer);
|
|
50
|
-
if (
|
|
89
|
+
if ([
|
|
90
|
+
".docx",
|
|
91
|
+
".pptx",
|
|
92
|
+
".xlsx"
|
|
93
|
+
].includes(ext)) return officeXmlText(params.buffer, ext);
|
|
94
|
+
if (mime.startsWith("text/") || [
|
|
95
|
+
".csv",
|
|
96
|
+
".html",
|
|
97
|
+
".json",
|
|
98
|
+
".md",
|
|
99
|
+
".rtf",
|
|
100
|
+
".tsv",
|
|
101
|
+
".txt",
|
|
102
|
+
".xml"
|
|
103
|
+
].includes(ext)) return {
|
|
51
104
|
ok: true,
|
|
52
105
|
kind: "plain",
|
|
53
106
|
text: truncate(params.buffer.toString("utf8"))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
|
|
4
3
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
|
+
import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
7
|
import { mkdir, readFile } from "fs/promises";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
1
|
import { resolveCapabilityPresetLayer, resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
|
-
import {
|
|
2
|
+
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
4
3
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
4
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
5
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
6
6
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
7
|
import { seedAgentProfileMarkdownFiles } from "../agent/context/workspace-seed.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
-
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
3
|
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
4
|
+
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
6
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
7
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
5
4
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
6
5
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContextCompactionPolicySchema, UserContextDreamingSchema, UserContextPrivacySchema, init_config } from "../../../user-context/config.js";
|
|
2
2
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
3
3
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
4
|
-
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
5
4
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
6
5
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
6
|
+
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
7
7
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
8
8
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
9
9
|
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
@@ -15,6 +15,10 @@ export interface OAuthCompletionReadiness {
|
|
|
15
15
|
state: 'connected' | 'connected-degraded';
|
|
16
16
|
catalog: CatalogReadiness;
|
|
17
17
|
capabilities: Record<CapabilityId, 'ready' | 'unavailable' | 'disabled'>;
|
|
18
|
+
configuration?: {
|
|
19
|
+
applied: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
};
|
|
18
22
|
}
|
|
19
23
|
export declare function buildOAuthCompletionReadiness(config: Config, catalog: CatalogReadiness): OAuthCompletionReadiness;
|
|
20
24
|
export declare function refreshModelCatalogAfterOAuth(provider: string, service: Pick<GatewayService, 'getModelCatalogSync'>): Promise<CatalogReadiness | undefined>;
|
|
@@ -6,6 +6,7 @@ import { isLoopbackHost } from "../host.js";
|
|
|
6
6
|
import { resolveReverseProxyPublicUrl } from "../public-url.js";
|
|
7
7
|
import { buildCapabilityPlansForConfig } from "../../capabilities/readiness/from-config.js";
|
|
8
8
|
import "../../capabilities/readiness/index.js";
|
|
9
|
+
import { applyXopcCloudCapabilitySetup } from "../xopc-cloud-capability-setup.js";
|
|
9
10
|
import { Hono } from "hono";
|
|
10
11
|
//#region src/gateway/hono/oauth-async.ts
|
|
11
12
|
/**
|
|
@@ -327,7 +328,29 @@ async function runOAuthFlow(session, oauthProvider, service) {
|
|
|
327
328
|
await new CredentialResolver().saveOAuthCredentials(session.provider, credentials);
|
|
328
329
|
session.message = session.provider === "xopc-cloud" ? "OAuth login successful. Syncing available models..." : "OAuth login successful";
|
|
329
330
|
const catalog = await refreshModelCatalogAfterOAuth(session.provider, service);
|
|
330
|
-
if (catalog && session.provider === "xopc-cloud")
|
|
331
|
+
if (catalog && session.provider === "xopc-cloud") {
|
|
332
|
+
const setup = await applyXopcCloudCapabilitySetup(service);
|
|
333
|
+
const readiness = buildOAuthCompletionReadiness(service.currentConfig, catalog);
|
|
334
|
+
if (setup.configured === true) session.readiness = {
|
|
335
|
+
...readiness,
|
|
336
|
+
configuration: { applied: true }
|
|
337
|
+
};
|
|
338
|
+
else {
|
|
339
|
+
log.warn({
|
|
340
|
+
provider: session.provider,
|
|
341
|
+
errorMessage: setup.error,
|
|
342
|
+
missing: setup.missing
|
|
343
|
+
}, `OAuth completed, but XOPC Cloud capabilities could not be configured: ${setup.error}`);
|
|
344
|
+
session.readiness = {
|
|
345
|
+
...readiness,
|
|
346
|
+
state: "connected-degraded",
|
|
347
|
+
configuration: {
|
|
348
|
+
applied: false,
|
|
349
|
+
error: setup.error
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
}
|
|
331
354
|
session.status = "completed";
|
|
332
355
|
session.credentials = credentials;
|
|
333
356
|
session.message = session.readiness?.state === "connected-degraded" ? `OAuth login successful, but capability setup is degraded${catalog?.error ? `: ${catalog.error.message}` : ""}` : "OAuth login successful";
|
|
@@ -2,6 +2,7 @@ import { getOAuthProviderInterfaces, init_registry } from "../../auth/oauth/regi
|
|
|
2
2
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
3
|
import { getProviderAuthState, init_providers, isProviderConfigured } from "../../providers/index.js";
|
|
4
4
|
import { disconnectProvider } from "../../providers/provider-disconnect.js";
|
|
5
|
+
import { applyXopcCloudCapabilitySetup } from "../xopc-cloud-capability-setup.js";
|
|
5
6
|
import { buildOAuthCompletionReadiness, refreshModelCatalogAfterOAuth } from "./oauth-async.js";
|
|
6
7
|
import { Hono } from "hono";
|
|
7
8
|
//#region src/gateway/hono/oauth.ts
|
|
@@ -65,7 +66,19 @@ function createOAuthHandler(service) {
|
|
|
65
66
|
});
|
|
66
67
|
await new CredentialResolver().saveOAuthCredentials(provider, credentials);
|
|
67
68
|
const catalog = await refreshModelCatalogAfterOAuth(provider, service);
|
|
68
|
-
|
|
69
|
+
let capabilitySetup;
|
|
70
|
+
if (catalog && provider === "xopc-cloud") capabilitySetup = await applyXopcCloudCapabilitySetup(service);
|
|
71
|
+
const baseReadiness = catalog ? buildOAuthCompletionReadiness(service.currentConfig, catalog) : void 0;
|
|
72
|
+
const readiness = baseReadiness && capabilitySetup ? {
|
|
73
|
+
...baseReadiness,
|
|
74
|
+
...capabilitySetup.configured === true ? { configuration: { applied: true } } : {
|
|
75
|
+
state: "connected-degraded",
|
|
76
|
+
configuration: {
|
|
77
|
+
applied: false,
|
|
78
|
+
error: capabilitySetup.error
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} : baseReadiness;
|
|
69
82
|
service.emit("provider.auth.changed", {
|
|
70
83
|
provider,
|
|
71
84
|
connected: true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { enumerateLanGatewayCandidates } from "../../host.js";
|
|
2
|
+
import { prepareLocalVoiceModelAfterProviderSwitch } from "../../../voice/local/provider-switch.js";
|
|
2
3
|
import { buildSafeWebConfigPayload } from "../lib/config-payload.js";
|
|
3
4
|
import { applyAgentsPatch } from "./config-patch/agents.js";
|
|
4
5
|
import { applyChannelsPatch } from "./config-patch/channels.js";
|
|
@@ -51,6 +52,7 @@ function registerConfigRoutes(authenticated, deps) {
|
|
|
51
52
|
authenticated.patch("/api/config", strictRateLimitMiddleware, async (c) => {
|
|
52
53
|
const body = await c.req.json();
|
|
53
54
|
const config = service.currentConfig;
|
|
55
|
+
const previousSttProvider = config.tools?.media?.audio?.provider;
|
|
54
56
|
applyAgentsPatch(config, body);
|
|
55
57
|
applyChannelsPatch(config, body);
|
|
56
58
|
const gatewayResult = applyGatewayPatch(config, body);
|
|
@@ -73,6 +75,7 @@ function registerConfigRoutes(authenticated, deps) {
|
|
|
73
75
|
ok: false,
|
|
74
76
|
error: result.error
|
|
75
77
|
}, 500);
|
|
78
|
+
prepareLocalVoiceModelAfterProviderSwitch(previousSttProvider, service.currentConfig);
|
|
76
79
|
if (body.gateway?.heartbeat !== void 0 && typeof body.gateway.heartbeat === "object") service.reloadHeartbeatFromCurrentConfig();
|
|
77
80
|
const safeConfig = await buildSafeWebConfigPayload(service, { locale: localeFromRequest(c) });
|
|
78
81
|
return c.json({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
2
1
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
2
|
+
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
3
3
|
import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
4
4
|
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
5
5
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
@@ -7,6 +7,17 @@ import { serveStaticFile } from "../lib/static-ui.js";
|
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
//#region src/gateway/hono/routes/public-gateway.ts
|
|
9
9
|
init_package_version();
|
|
10
|
+
const PUBLIC_UI_ROOT_ASSETS = [
|
|
11
|
+
"apple-touch-icon.png",
|
|
12
|
+
"favicon-16x16.png",
|
|
13
|
+
"favicon-32x32.png",
|
|
14
|
+
"favicon.png",
|
|
15
|
+
"favicon.svg",
|
|
16
|
+
"notification-sw.js",
|
|
17
|
+
"pwa-192x192.png",
|
|
18
|
+
"pwa-512x512.png",
|
|
19
|
+
"site.webmanifest"
|
|
20
|
+
];
|
|
10
21
|
function registerPublicGatewayRoutes(app, service) {
|
|
11
22
|
app.get("/health", (c) => {
|
|
12
23
|
return c.json(service.getHealth());
|
|
@@ -171,6 +182,11 @@ function registerPublicGatewayRoutes(app, service) {
|
|
|
171
182
|
if (fallback) return fallback;
|
|
172
183
|
return c.text("Not found", 404);
|
|
173
184
|
});
|
|
185
|
+
for (const assetPath of PUBLIC_UI_ROOT_ASSETS) app.get(`/${assetPath}`, (c) => {
|
|
186
|
+
const response = serveStaticFile(assetPath, c.req.raw);
|
|
187
|
+
if (response) return response;
|
|
188
|
+
return c.text("Not found", 404);
|
|
189
|
+
});
|
|
174
190
|
app.get("/logo.svg", (c) => {
|
|
175
191
|
const response = serveStaticFile("logo.svg", c.req.raw);
|
|
176
192
|
if (response) return response;
|
|
@@ -2,7 +2,7 @@ import { deleteUnderstanding, listUnderstandingEvidence, listUnderstandings } fr
|
|
|
2
2
|
import { getConnectorAccount } from "../../../storage/sqlite/connector-account-repository.js";
|
|
3
3
|
import "../../../storage/sqlite/index.js";
|
|
4
4
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
5
|
-
import { deleteUserFocus, getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUserFocuses, revokeUnderstandingSourceGrant, setUserFocusStatus } from "../../../user-context/sources/repository.js";
|
|
5
|
+
import { deleteUserFocus, getUnderstandingSourceGrant, listUnderstandingSourceGrants, listUnderstandingSourceRuns, listUserFocuses, revokeUnderstandingSourceGrant, setUserFocusStatus } from "../../../user-context/sources/repository.js";
|
|
6
6
|
import { listConnectedContentCandidates, readConnectedContent } from "../../../connectors/content-enrichment.js";
|
|
7
7
|
import { getWorkDiscoveryService } from "./work-discovery.js";
|
|
8
8
|
import { listUnderstandingSourceDefinitions } from "../../../user-context/sources/catalog.js";
|
|
@@ -38,10 +38,17 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
38
38
|
sources: listUnderstandingSourceDefinitions(platform)
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
-
authenticated.get("/api/understanding/sources/grants", (c) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
authenticated.get("/api/understanding/sources/grants", (c) => {
|
|
42
|
+
const grants = listUnderstandingSourceGrants({ includeRevoked: c.req.query("includeRevoked") === "true" });
|
|
43
|
+
return c.json({
|
|
44
|
+
ok: true,
|
|
45
|
+
grants,
|
|
46
|
+
latestRuns: Object.fromEntries(grants.flatMap((grant) => {
|
|
47
|
+
const run = listUnderstandingSourceRuns(grant.id, 1)[0];
|
|
48
|
+
return run ? [[grant.id, run]] : [];
|
|
49
|
+
}))
|
|
50
|
+
});
|
|
51
|
+
});
|
|
45
52
|
authenticated.get("/api/understanding/sources/content-candidates", (c) => {
|
|
46
53
|
const agentId = resolveDefaultAgentId(deps.service.currentConfig);
|
|
47
54
|
return c.json({
|
|
@@ -71,14 +78,25 @@ function registerUnderstandingSourceRoutes(authenticated, deps) {
|
|
|
71
78
|
authenticated.delete("/api/understanding/sources/grants/:grantId", limited, (c) => {
|
|
72
79
|
const current = getUnderstandingSourceGrant(c.req.param("grantId"));
|
|
73
80
|
const accountId = typeof current?.config.accountId === "string" ? current.config.accountId : void 0;
|
|
81
|
+
const connectorId = typeof current?.config.connectorId === "string" ? current.config.connectorId : void 0;
|
|
82
|
+
const sourceInstanceId = accountId && connectorId ? `composio:${connectorId}:${accountId}` : void 0;
|
|
74
83
|
const connectionId = accountId ? getConnectorAccount(accountId)?.currentConnectionId : void 0;
|
|
75
84
|
if (connectionId) deps.service.setConnectorLearningPaused(connectionId, true);
|
|
76
85
|
const grant = revokeUnderstandingSourceGrant(c.req.param("grantId"));
|
|
77
86
|
if (grant && c.req.query("deleteDerived") === "true") {
|
|
78
87
|
const activeGrantIds = new Set(listUnderstandingSourceGrants().map((item) => item.id));
|
|
88
|
+
const activeSourceInstanceIds = new Set(listUnderstandingSourceGrants().flatMap((item) => {
|
|
89
|
+
const activeAccountId = typeof item.config.accountId === "string" ? item.config.accountId : void 0;
|
|
90
|
+
const activeConnectorId = typeof item.config.connectorId === "string" ? item.config.connectorId : void 0;
|
|
91
|
+
return activeAccountId && activeConnectorId ? [`composio:${activeConnectorId}:${activeAccountId}`] : [];
|
|
92
|
+
}));
|
|
79
93
|
for (const understanding of listUnderstandings()) {
|
|
80
|
-
const
|
|
81
|
-
|
|
94
|
+
const evidence = listUnderstandingEvidence(understanding.id);
|
|
95
|
+
const grantEvidence = evidence.map((evidence) => /^understanding-source-grant:([^:]+):/.exec(evidence.sourceRef)?.[1]).filter((id) => Boolean(id));
|
|
96
|
+
const connectorEvidence = evidence.map((item) => item.sourceInstanceId).filter((id) => Boolean(id));
|
|
97
|
+
const belongsToRevokedSource = grantEvidence.includes(grant.id) || Boolean(sourceInstanceId && connectorEvidence.includes(sourceInstanceId));
|
|
98
|
+
const hasActiveAlternative = grantEvidence.some((id) => id !== grant.id && activeGrantIds.has(id)) || connectorEvidence.some((id) => id !== sourceInstanceId && activeSourceInstanceIds.has(id));
|
|
99
|
+
if (belongsToRevokedSource && !hasActiveAlternative) deleteUnderstanding(understanding.id);
|
|
82
100
|
}
|
|
83
101
|
}
|
|
84
102
|
return grant ? c.json({
|
|
@@ -12,8 +12,8 @@ import { mergeSttConfigFromAppConfig } from "../../../voice/stt/config.js";
|
|
|
12
12
|
import "../../../voice/stt/index.js";
|
|
13
13
|
import { listSttProvidersForApi } from "../../../voice/stt/list-providers.js";
|
|
14
14
|
import "../../../voice/tts/index.js";
|
|
15
|
-
import { listLocalVoiceModelStatuses, removeLocalVoiceModel, startLocalVoiceModelInstall } from "../../../voice/local/model-manager.js";
|
|
16
15
|
import { createGatewayRouteLogger } from "../lib/route-logger.js";
|
|
16
|
+
import { listLocalVoiceModelStatuses, removeLocalVoiceModel, startLocalVoiceModelInstall } from "../../../voice/local/model-manager.js";
|
|
17
17
|
import { listTtsProvidersForApi } from "../../../voice/tts/list-providers.js";
|
|
18
18
|
//#region src/gateway/hono/routes/voice.ts
|
|
19
19
|
init_providers();
|
|
@@ -7,10 +7,10 @@ import { messagesToClientHistory } from "../../../session/client-history.js";
|
|
|
7
7
|
import "../../../workflows/domain/index.js";
|
|
8
8
|
import { resolveWorkflowRunArtifactsDir } from "../../../workflows/store/paths.js";
|
|
9
9
|
import { WorkflowDraftService } from "../../../workflows/draft/workflow-draft-service.js";
|
|
10
|
-
import { WorkflowDraftConflictError, WorkflowDraftStore } from "../../../workflows/authoring/workflow-draft-store.js";
|
|
11
|
-
import "../../../workflows/authoring/index.js";
|
|
12
10
|
import "../../../workflows/draft/index.js";
|
|
13
11
|
import { ProjectWorkflowPresetRepository } from "../../../workflows/project-presets/project-workflow-preset-repository.js";
|
|
12
|
+
import { WorkflowDraftConflictError, WorkflowDraftStore } from "../../../workflows/authoring/workflow-draft-store.js";
|
|
13
|
+
import "../../../workflows/authoring/index.js";
|
|
14
14
|
import { basename, join } from "node:path";
|
|
15
15
|
import { readFile, stat } from "node:fs/promises";
|
|
16
16
|
//#region src/gateway/hono/routes/workflows.ts
|
|
@@ -50,7 +50,7 @@ declare class BucketRegistry {
|
|
|
50
50
|
* config read.
|
|
51
51
|
*/
|
|
52
52
|
authFailure(cfg: ResolvedAuthRateLimitConfig): FailureLimiter;
|
|
53
|
-
/**
|
|
53
|
+
/** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
|
|
54
54
|
strictApi(): RateLimiter;
|
|
55
55
|
/** Interactive chat actions — 180 req / 60 s per client IP. */
|
|
56
56
|
chatApi(): RateLimiter;
|
|
@@ -75,10 +75,10 @@ var BucketRegistry = class {
|
|
|
75
75
|
}
|
|
76
76
|
return this.authFailureLimiter;
|
|
77
77
|
}
|
|
78
|
-
/**
|
|
78
|
+
/** Authenticated admin / mutation endpoints — 150 req / 60 s per client IP. */
|
|
79
79
|
strictApi() {
|
|
80
80
|
if (!this.strictApiLimiter) this.strictApiLimiter = new RateLimiter({
|
|
81
|
-
maxRequests:
|
|
81
|
+
maxRequests: 150,
|
|
82
82
|
windowMs: 6e4
|
|
83
83
|
});
|
|
84
84
|
return this.strictApiLimiter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
4
3
|
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
4
|
+
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
5
5
|
import { init_providers } from "../../providers/index.js";
|
|
6
6
|
import { disposeAllSessionMcpRuntimes } from "../../agent/mcp/bundle-mcp-runtime.js";
|
|
7
7
|
import { reloadImageGenerationProviders } from "../../agent/image/generation/provider-registry.js";
|
|
@@ -9,14 +9,14 @@ import { closeXopcDatabase, openXopcDatabase } from "../storage/sqlite/connectio
|
|
|
9
9
|
import "../storage/sqlite/index.js";
|
|
10
10
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
11
11
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
12
|
-
import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
|
|
13
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
14
12
|
import { init_paths, resolveAgentDir, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
13
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
15
14
|
import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
|
|
16
15
|
import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
|
|
17
16
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, init_channel_catalog_service } from "../channels/catalog/channel-catalog-service.js";
|
|
18
17
|
import { loadConfig, saveConfig } from "../config/loader.js";
|
|
19
|
-
import {
|
|
18
|
+
import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
|
|
19
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
20
20
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
21
21
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
22
22
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
@@ -50,18 +50,18 @@ import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
|
50
50
|
import { ChannelManager } from "../channels/manager.js";
|
|
51
51
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
52
52
|
import "../config/index.js";
|
|
53
|
-
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
54
|
-
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
55
|
-
import "../knowledge/index.js";
|
|
56
|
-
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
57
|
-
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
58
|
-
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
59
53
|
import { DiscussionService } from "../discussions/service.js";
|
|
60
54
|
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
61
55
|
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
62
56
|
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
63
57
|
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
64
58
|
import "../discussions/index.js";
|
|
59
|
+
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
60
|
+
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
61
|
+
import "../knowledge/index.js";
|
|
62
|
+
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
63
|
+
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
64
|
+
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
65
65
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
66
66
|
import "../endpoint-tools/index.js";
|
|
67
67
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
@@ -116,7 +116,7 @@ import { GatewayAgentRunner } from "./service/agent-runner.js";
|
|
|
116
116
|
import { RealtimeRuntime } from "../realtime/runtime.js";
|
|
117
117
|
import { GatewayReadiness } from "./startup-readiness.js";
|
|
118
118
|
import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
119
|
-
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults
|
|
119
|
+
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
120
120
|
import crypto from "crypto";
|
|
121
121
|
//#region src/gateway/service.ts
|
|
122
122
|
init_agent_scope();
|
|
@@ -793,7 +793,6 @@ var GatewayService = class {
|
|
|
793
793
|
this.proactiveWorker.start();
|
|
794
794
|
this.proactiveTemporalWorker.start();
|
|
795
795
|
this.proactiveInboxWorker.start();
|
|
796
|
-
prepareConfiguredLocalVoiceModel(this.config);
|
|
797
796
|
this.startupTrace = createGatewayStartupTrace();
|
|
798
797
|
this.readiness.markStarting(this.startTime);
|
|
799
798
|
const trace = this.startupTrace;
|
|
@@ -1268,7 +1267,6 @@ var GatewayService = class {
|
|
|
1268
1267
|
error: saved.error ?? "Failed to save voice language"
|
|
1269
1268
|
};
|
|
1270
1269
|
}
|
|
1271
|
-
prepareConfiguredLocalVoiceModel(this.config);
|
|
1272
1270
|
return {
|
|
1273
1271
|
applied: changed,
|
|
1274
1272
|
language,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Config } from '../config/schema.js';
|
|
2
|
+
import type { CatalogSource } from '../providers/model-catalog-store.js';
|
|
3
|
+
type CloudCapability = 'vision' | 'image-generation' | 'stt' | 'tts';
|
|
4
|
+
export interface XopcCloudCapabilitySelection {
|
|
5
|
+
vision: string;
|
|
6
|
+
imageGeneration: string;
|
|
7
|
+
stt: string;
|
|
8
|
+
tts: string;
|
|
9
|
+
ttsVoice: string;
|
|
10
|
+
}
|
|
11
|
+
export type PrepareXopcCloudCapabilitySetupResult = {
|
|
12
|
+
ok: true;
|
|
13
|
+
config: Config;
|
|
14
|
+
selection: XopcCloudCapabilitySelection;
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
error: string;
|
|
18
|
+
missing: CloudCapability[];
|
|
19
|
+
};
|
|
20
|
+
export type ApplyXopcCloudCapabilitySetupResult = {
|
|
21
|
+
configured: true;
|
|
22
|
+
selection: XopcCloudCapabilitySelection;
|
|
23
|
+
} | {
|
|
24
|
+
configured: false;
|
|
25
|
+
error: string;
|
|
26
|
+
missing?: CloudCapability[];
|
|
27
|
+
};
|
|
28
|
+
export declare function selectXopcCloudCapabilities(source: CatalogSource): {
|
|
29
|
+
selection?: XopcCloudCapabilitySelection;
|
|
30
|
+
missing: CloudCapability[];
|
|
31
|
+
};
|
|
32
|
+
/** Build one atomic config update for every managed XOPC Cloud media capability. */
|
|
33
|
+
export declare function prepareXopcCloudCapabilitySetup(config: Config, source: CatalogSource): PrepareXopcCloudCapabilitySetupResult;
|
|
34
|
+
export declare function applyXopcCloudCapabilitySetup(service: {
|
|
35
|
+
currentConfig: Config;
|
|
36
|
+
saveConfig(config: Config): Promise<{
|
|
37
|
+
saved: boolean;
|
|
38
|
+
error?: string;
|
|
39
|
+
}>;
|
|
40
|
+
}): Promise<ApplyXopcCloudCapabilitySetupResult>;
|
|
41
|
+
export {};
|