@xopcai/xopc 0.0.260 → 0.0.263
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/icons/icon-128.png +0 -0
- package/dist/browser-ext/icons/icon-16.png +0 -0
- package/dist/browser-ext/icons/icon-32.png +0 -0
- package/dist/browser-ext/icons/icon-48.png +0 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/apple-touch-icon.png +0 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DQXGuDU1.js → agent-avatar-dicebear-CGfZj39N.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B-adIdqU.js → agent-defaults-settings-panel-BEfQ37Md.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-tEnV2m4V.js → agents-D04Sobl9.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DpPFwi9Y.js → app-management-settings-panel-BPHAGj40.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CMZNnWrt.js → appearance-settings-1c8VsdQr.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CjUC3jZ3.js → apps-page-CRuJkEs4.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CDO9Z4tl.js → archive-plugin-BO0zh3JH.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B0OLG7F4.js → attachment-load-hM6hZczY.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DkRGPgbA.js → automations-page-DQFZUB4m.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DToID01H.js → automations-workspace-B4Rm1r01.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-C9cQvqON.js → binary-plugins-BycS7-SL.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CuhEms-L.js → block-editor-BKWv_VZ-.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D4ylF3c0.js → browser-automations-page-CH1MCd_B.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BIYTKzLB.js → browser-settings-page-C6fxxddT.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DLaPx1nq.js → capabilities-settings-panel-CO33biQC.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-jIVF8Nin.js → channels-settings-B9SXtr0p.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BIdsO11x.js → chat-terminal-dock-CdajkVWX.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CIslIJFt.js → connectors-page-Dv9Gc04W.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-Dgkeyu7p.js → cron-expression-IQ7L7Yfo.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-De7tAQEZ.js → date-picker-_8L4XYi4.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BzPt6TdE.js → dependency-picker-DqKQ7zii.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BPOx0awZ.js → desktop-pet-B5Hj8onM.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CLo3YMLt.js → desktop-pet-settings-Cx9eOnxz.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DDEyLbVr.js → extension-debug-page-C0E8G0L3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D1NUZpPd.js → extension-page-DwU54hPO.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BJhuMrU_.js → extension-settings-page-CoHiKnkT.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-v2JeDF9-.js → gateway-settings-D9eRbAgP.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-1W8w4lhI.js → heartbeat-settings-Bo6VHm0J.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BSKKIfeQ.js → home-page-E1AzAvyw.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BKCWDzbV.css → index-CRJrO4GI.css} +1 -1
- package/dist/gateway/static/root/assets/{index-BXdV0Oia.js → index-pmcvQ5pq.js} +47 -47
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-COT94SO3.js → keyboard-shortcuts-settings-Nzl7HzsR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DUs-vc7c.js → local-app-workbench-page-yIMJ_WdU.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-C6rKhNyX.js → local-apps-page-DRQoDm9I.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-D_qfxg72.js → logs-page-Cdpl_Ccj.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DSH7NnVw.js → management-settings-U81XMIVy.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Cf6kUNl_.js → media-plugins-D9ajlmEo.js} +1 -1
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-CILSkJVm.js → mobile-pairing-wizard-DFAUuhB5.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-p09JcANK.js → note-detail-panel-Cx0UW1ml.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-CFNvIB8t.js → notes-page-CqWid6rN.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-BE7aDmYf.js → page-tabs-CXo5GsOJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-C9TdeSFT.js → preview-open-alternatives-Ct078fbo.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CM2vs8CY.js → project-detail-page-DloclfjI.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DA-zzY8B.js → projects-page-DPbVBxEl.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub--sgDiADe.js → remote-access-hub-BkFDpVBV.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DkshrVpk.js → runtime-tools-settings-panel-DPIpVABf.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-tLOl1ZAH.js → schema-form-B_1CsQnV.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-C_TdKlUD.js → sessions-page-Cu-O03Ah.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3b1Fj9k.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Dxkw4v4H.js → settings-form-section-DpAFw7dA.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Bqk8W4z_.js → settings-page-KGC3Nc4j.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DWd6faoE.js → setup-status-panel-DUnPvWv4.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-j2tIceho.js → share-preview-page-Bz49xVj2.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-oDcCqSFK.js → shares-settings-BdnefOpB.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CwBaDY-N.js → skill-reload-api-CArff6hI.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CTmhlyZc.js → skills-page-CqASoG63.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DOvugRyA.js → skills-page.utils-DpNBvHVa.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BnYP6VIv.js → system-settings-panel-CjYfWbkg.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-A2JXlr_r.js → task-detail-page-1ciKj-G2.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BmDqq1-x.js → tunnel-api-BeTjaQ30.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BzsVGQQM.js → use-autosave-DMeAoaFH.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CkO83New.js → user-model-page-CqF2Sz0B.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BjOEAtzw.js → voice-api-key-field-BpCCTqEw.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CrtXygYb.js → work-discovery-overlay-CHKBgPVw.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Darl4tuN.js → workflow-run-setup-panel-C7a3xXM2.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BTdeeQSn.js → workflows-page-B-qyam4R.js} +1 -1
- package/dist/gateway/static/root/favicon-16x16.png +0 -0
- package/dist/gateway/static/root/favicon-32x32.png +0 -0
- package/dist/gateway/static/root/favicon.ico +0 -0
- package/dist/gateway/static/root/favicon.png +0 -0
- package/dist/gateway/static/root/favicon.svg +1 -1
- package/dist/gateway/static/root/index.html +8 -8
- package/dist/gateway/static/root/logo-dark.svg +1 -1
- package/dist/gateway/static/root/logo.svg +1 -1
- package/dist/gateway/static/root/pwa-192x192.png +0 -0
- package/dist/gateway/static/root/pwa-512x512.png +0 -0
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/prepare-image-for-model.d.ts +13 -0
- package/dist/src/agent/image/prepare-image-for-model.js +55 -0
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +7 -5
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.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/tools/media-read-tool.js +3 -3
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/service/automation-service.js +21 -8
- 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/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/media.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +18 -0
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service.js +14 -7
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/media/store.js +11 -2
- 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/voice/realtime/agentEngine.js +71 -17
- package/dist/src/voice/realtime/conversation-context.d.ts +2 -0
- package/dist/src/voice/realtime/conversation-context.js +13 -4
- package/dist/src/voice/realtime/persona-context.d.ts +19 -0
- package/dist/src/voice/realtime/persona-context.js +126 -0
- package/dist/src/voice/realtime/runtime.d.ts +1 -0
- package/dist/src/voice/realtime/runtime.js +16 -0
- package/dist/src/voice/realtime/speakable-segmenter.d.ts +4 -1
- package/dist/src/voice/realtime/speakable-segmenter.js +11 -3
- package/dist/src/work-discovery/service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cpf80P_r.js +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const MODEL_IMAGE_MAX_BYTES: number;
|
|
2
|
+
export declare const MODEL_IMAGE_SOURCE_MAX_BYTES: number;
|
|
3
|
+
export type PreparedModelImage = {
|
|
4
|
+
buffer: Buffer;
|
|
5
|
+
mimeType: string;
|
|
6
|
+
optimized: boolean;
|
|
7
|
+
originalBytes: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Keep small images byte-for-byte. Oversized images are converted to a bounded
|
|
11
|
+
* WebP derivative for model input; the original media-store object is untouched.
|
|
12
|
+
*/
|
|
13
|
+
export declare function prepareImageForModel(buffer: Buffer, mimeType: string, maxBytes?: number): Promise<PreparedModelImage>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/agent/image/prepare-image-for-model.ts
|
|
2
|
+
const MODEL_IMAGE_MAX_BYTES = 2 * 1024 * 1024;
|
|
3
|
+
const MODEL_IMAGE_SOURCE_MAX_BYTES = 32 * 1024 * 1024;
|
|
4
|
+
const INITIAL_MAX_DIMENSION = 2048;
|
|
5
|
+
const MIN_MAX_DIMENSION = 512;
|
|
6
|
+
const INITIAL_QUALITY = 84;
|
|
7
|
+
const MIN_QUALITY = 40;
|
|
8
|
+
const MAX_OPTIMIZATION_ATTEMPTS = 6;
|
|
9
|
+
function formatMiB(bytes) {
|
|
10
|
+
return `${(bytes / (1024 * 1024)).toFixed(2)} MiB`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Keep small images byte-for-byte. Oversized images are converted to a bounded
|
|
14
|
+
* WebP derivative for model input; the original media-store object is untouched.
|
|
15
|
+
*/
|
|
16
|
+
async function prepareImageForModel(buffer, mimeType, maxBytes = MODEL_IMAGE_MAX_BYTES) {
|
|
17
|
+
if (buffer.byteLength <= maxBytes) return {
|
|
18
|
+
buffer,
|
|
19
|
+
mimeType,
|
|
20
|
+
optimized: false,
|
|
21
|
+
originalBytes: buffer.byteLength
|
|
22
|
+
};
|
|
23
|
+
let maxDimension = INITIAL_MAX_DIMENSION;
|
|
24
|
+
let quality = INITIAL_QUALITY;
|
|
25
|
+
let smallest;
|
|
26
|
+
const { default: sharp } = await import("sharp");
|
|
27
|
+
for (let attempt = 0; attempt < MAX_OPTIMIZATION_ATTEMPTS; attempt += 1) {
|
|
28
|
+
const candidate = await sharp(buffer, {
|
|
29
|
+
animated: false,
|
|
30
|
+
failOn: "error",
|
|
31
|
+
limitInputPixels: 1e8
|
|
32
|
+
}).rotate().resize({
|
|
33
|
+
width: maxDimension,
|
|
34
|
+
height: maxDimension,
|
|
35
|
+
fit: "inside",
|
|
36
|
+
withoutEnlargement: true
|
|
37
|
+
}).webp({
|
|
38
|
+
quality,
|
|
39
|
+
effort: 4
|
|
40
|
+
}).toBuffer();
|
|
41
|
+
if (!smallest || candidate.byteLength < smallest.byteLength) smallest = candidate;
|
|
42
|
+
if (candidate.byteLength <= maxBytes) return {
|
|
43
|
+
buffer: candidate,
|
|
44
|
+
mimeType: "image/webp",
|
|
45
|
+
optimized: true,
|
|
46
|
+
originalBytes: buffer.byteLength
|
|
47
|
+
};
|
|
48
|
+
const sizeRatio = Math.sqrt(maxBytes / candidate.byteLength);
|
|
49
|
+
maxDimension = Math.max(MIN_MAX_DIMENSION, Math.floor(maxDimension * Math.min(.85, sizeRatio * .95)));
|
|
50
|
+
quality = Math.max(MIN_QUALITY, quality - 9);
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Image could not be optimized below ${formatMiB(maxBytes)} (original ${formatMiB(buffer.byteLength)}, smallest ${formatMiB(smallest?.byteLength ?? buffer.byteLength)})`);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { MODEL_IMAGE_MAX_BYTES, MODEL_IMAGE_SOURCE_MAX_BYTES, prepareImageForModel };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "../../config/schema.js";
|
|
2
2
|
import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
|
|
3
|
-
import { getDefaultModelSync, getModelsByProvider, init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
4
3
|
import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
|
|
4
|
+
import { getDefaultModelSync, getModelsByProvider, init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
5
5
|
import { resolveAgentModelFallbackValues, resolveAgentModelPrimaryValue } from "../../config/model-input.js";
|
|
6
6
|
import { buildCapabilityPlansForConfig } from "../../capabilities/readiness/from-config.js";
|
|
7
7
|
import "../../capabilities/readiness/index.js";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { stripRuntimeUserMessageEnvelope } from "../../../packages/gateway-contract/src/user-message-display.js";
|
|
2
2
|
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
3
|
+
import { mimeTypeFromMediaPath } from "../../media/store.js";
|
|
3
4
|
import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
4
|
-
import {
|
|
5
|
+
import { readMediaReference } from "../../media/media-reference.js";
|
|
5
6
|
import { isImageInboundAttachment } from "../../channels/attachments/attachment-classifiers.js";
|
|
6
7
|
import "../../channels/attachments/inbound-persist.js";
|
|
7
8
|
import { expandAtFileMentionsInPlainText } from "../context/expand-at-file-mentions.js";
|
|
8
9
|
import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
|
|
9
10
|
import { resolveInboundImageContentParts } from "../image/inbound-image-handling.js";
|
|
11
|
+
import { MODEL_IMAGE_MAX_BYTES, MODEL_IMAGE_SOURCE_MAX_BYTES, prepareImageForModel } from "../image/prepare-image-for-model.js";
|
|
10
12
|
//#region src/agent/inbound/attachment-pipeline.ts
|
|
11
|
-
const VISION_INLINE_MAX_BYTES = 2 * 1024 * 1024;
|
|
12
13
|
function textBlocksFromContent(content) {
|
|
13
14
|
if (typeof content === "string") return content.trim() ? [content] : [];
|
|
14
15
|
if (!Array.isArray(content)) return [];
|
|
@@ -48,10 +49,11 @@ function assertTranscriptUserMessage(message) {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
async function readImageBase64FromRef(ref) {
|
|
51
|
-
const loaded = await
|
|
52
|
+
const loaded = await readMediaReference(ref.uri, MODEL_IMAGE_SOURCE_MAX_BYTES);
|
|
53
|
+
const prepared = await prepareImageForModel(loaded.buffer, ref.mimeType || mimeTypeFromMediaPath(loaded.path), MODEL_IMAGE_MAX_BYTES);
|
|
52
54
|
return {
|
|
53
|
-
data:
|
|
54
|
-
mimeType:
|
|
55
|
+
data: prepared.buffer.toString("base64"),
|
|
56
|
+
mimeType: prepared.mimeType
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
function appendMediaAttachedLines(textParts, media) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_write_file_atomic, writeTextAtomic } from "../../../infra/write-file-atomic.js";
|
|
2
1
|
import { init_paths, resolveMcpOAuthPath } from "../../../config/paths.js";
|
|
2
|
+
import { init_write_file_atomic, writeTextAtomic } from "../../../infra/write-file-atomic.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { readFile, rm } from "node:fs/promises";
|
|
5
5
|
//#region src/agent/mcp/oauth/mcp-oauth-store.ts
|
|
@@ -2,10 +2,10 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
|
|
4
4
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
5
|
-
import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
|
|
6
|
-
import { init_providers, resolveModel } from "../providers/index.js";
|
|
7
5
|
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
6
|
+
import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
|
|
8
7
|
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
8
|
+
import { init_providers, resolveModel } from "../providers/index.js";
|
|
9
9
|
import { extractTextContent } from "./context/workspace.js";
|
|
10
10
|
import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
|
|
11
11
|
import { getProjectForSession } from "../projects/workspace.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_workspace_defaults, resolveDefaultAgentWorkspaceDir } from "../../config/workspace-defaults.js";
|
|
4
|
-
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
5
4
|
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
5
|
+
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
6
6
|
import { getExecutionEnvironmentForSession } from "../../execution-environments/subject.js";
|
|
7
7
|
import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../session/session-workspace.js";
|
|
8
8
|
import { getProjectForSession } from "../../projects/workspace.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
1
|
import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
|
|
2
|
+
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
//#region src/agent/skills/hub-lock.ts
|
|
5
5
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { TaskRunRepository } from "../../tasks/task-run-repository.js";
|
|
4
|
-
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
|
|
5
4
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
6
|
-
import { getApiKey, init_providers, resolveModel } from "../../providers/index.js";
|
|
7
|
-
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
8
5
|
import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
|
|
6
|
+
import { getApiKey, init_providers, resolveModel } from "../../providers/index.js";
|
|
9
7
|
import { TaskRepository } from "../../tasks/task-repository.js";
|
|
10
8
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
11
9
|
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
10
|
+
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
12
11
|
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
12
|
+
import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
|
|
13
13
|
//#region src/agent/tasks/task-judge-service.ts
|
|
14
14
|
init_schema();
|
|
15
15
|
init_providers();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { mimeTypeFromMediaPath } from "../../media/store.js";
|
|
1
|
+
import { MEDIA_MAX_BYTES, mimeTypeFromMediaPath } from "../../media/store.js";
|
|
2
2
|
import { readMediaReference } from "../../media/media-reference.js";
|
|
3
3
|
import { Type } from "@sinclair/typebox";
|
|
4
4
|
//#region src/agent/tools/media-read-tool.ts
|
|
5
|
-
const DEFAULT_MAX_BYTES =
|
|
6
|
-
const HARD_MAX_BYTES =
|
|
5
|
+
const DEFAULT_MAX_BYTES = MEDIA_MAX_BYTES;
|
|
6
|
+
const HARD_MAX_BYTES = MEDIA_MAX_BYTES;
|
|
7
7
|
const ReadMediaSchema = Type.Object({
|
|
8
8
|
uri: Type.String({ description: "The media:// URI from an xopc-media-uri line in the user message." }),
|
|
9
9
|
maxBytes: Type.Optional(Type.Number({ description: "Maximum bytes to read, capped at 5 MiB." }))
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
4
3
|
import { getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
5
4
|
import { createExtensionAwareStreamFn } from "../providers/extension-stream-bridge.js";
|
|
6
5
|
import { isLocalModelBaseUrl, resolveModelCallApiKey, resolveModelCallOptions } from "../providers/model-call.js";
|
|
6
|
+
import { getAssistantMessageErrorReason, stripCodeFences } from "../providers/model-response.js";
|
|
7
7
|
//#region src/ai-assist/text-assist.ts
|
|
8
8
|
init_providers();
|
|
9
9
|
init_logger();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
4
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
|
|
6
|
-
import {
|
|
5
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
7
6
|
import { getOAuthProviderDefinition, init_registry } from "./oauth/registry.js";
|
|
7
|
+
import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
|
|
8
8
|
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
9
9
|
import { dirname, join } from "path";
|
|
10
10
|
import { mkdir, readFile, readdir, rm } from "fs/promises";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { generatePKCE, init_pkce } from "./pkce.js";
|
|
3
2
|
import { init_resolution, resolveConnectedPlatformEndpoint } from "../../platform/resolution.js";
|
|
3
|
+
import { generatePKCE, init_pkce } from "./pkce.js";
|
|
4
4
|
import { hostname } from "node:os";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
import http from "node:http";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
1
|
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
2
|
+
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
5
5
|
//#region src/auth/profiles/store.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
2
3
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
3
|
-
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
4
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
|
-
import {
|
|
5
|
+
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
//#region src/auth/sync-provider-auth.ts
|
|
8
8
|
/**
|
|
@@ -16,6 +16,12 @@ const MISSED_RUN_STAGGER_MS = 5e3;
|
|
|
16
16
|
const RUN_HEARTBEAT_INTERVAL_MS = 1e4;
|
|
17
17
|
const RUN_LEASE_DURATION_MS = 3e4;
|
|
18
18
|
const RETRY_BASE_DELAY_MS = 1e3;
|
|
19
|
+
var AutomationDeadlineExceededError = class extends Error {
|
|
20
|
+
constructor() {
|
|
21
|
+
super("Automation deadline exceeded while calling the completion webhook");
|
|
22
|
+
this.name = "AutomationDeadlineExceededError";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
19
25
|
var AutomationAlreadyRunningError = class extends Error {
|
|
20
26
|
constructor(automationId, runningRunId) {
|
|
21
27
|
super(`Automation is already running: ${automationId}`);
|
|
@@ -411,7 +417,7 @@ var AutomationService = class {
|
|
|
411
417
|
}
|
|
412
418
|
} catch (err) {
|
|
413
419
|
error = err instanceof Error ? err.message : String(err);
|
|
414
|
-
const deadlineExceeded = run.deadlineAtMs !== void 0 && Date.now() >= run.deadlineAtMs;
|
|
420
|
+
const deadlineExceeded = err instanceof AutomationDeadlineExceededError || run.deadlineAtMs !== void 0 && Date.now() >= run.deadlineAtMs;
|
|
415
421
|
status = controller.signal.aborted ? "cancelled" : deadlineExceeded ? "timeout" : "failed";
|
|
416
422
|
this.appendRunEvent(run, activePhase === "completion_hook" ? "completion_hook.failed" : "action.failed", `Automation run ${status}`, { error });
|
|
417
423
|
run = {
|
|
@@ -593,13 +599,20 @@ var AutomationService = class {
|
|
|
593
599
|
}
|
|
594
600
|
async postCompletionWebhook(url, run, signal) {
|
|
595
601
|
const remainingMs = run.deadlineAtMs === void 0 ? 3e4 : Math.max(1, run.deadlineAtMs - Date.now());
|
|
596
|
-
const
|
|
597
|
-
const
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
602
|
+
const deadlineSignal = AbortSignal.timeout(remainingMs);
|
|
603
|
+
const requestSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
604
|
+
let response;
|
|
605
|
+
try {
|
|
606
|
+
response = await fetch(url, {
|
|
607
|
+
method: "POST",
|
|
608
|
+
headers: { "content-type": "application/json" },
|
|
609
|
+
body: JSON.stringify({ run }),
|
|
610
|
+
signal: requestSignal
|
|
611
|
+
});
|
|
612
|
+
} catch (err) {
|
|
613
|
+
if (!signal.aborted && deadlineSignal.aborted) throw new AutomationDeadlineExceededError();
|
|
614
|
+
throw err;
|
|
615
|
+
}
|
|
603
616
|
if (!response.ok) {
|
|
604
617
|
const text = await response.text().catch(() => "");
|
|
605
618
|
throw new Error(`Automation webhook failed: HTTP ${response.status}${text ? ` ${text.slice(0, 200)}` : ""}`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PACKAGE_VERSION, init_package_version } from "../../package-version.js";
|
|
2
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
|
-
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
5
4
|
import { init_paths, resolveBinDir } from "../../config/paths.js";
|
|
5
|
+
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
6
6
|
import { assertCacheDir } from "../cache-dir-policy.js";
|
|
7
7
|
import { resolvePackageRoot } from "../../infra/update-check.js";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
|
|
2
|
-
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "../../../../providers/env-keys.js";
|
|
3
2
|
import { init_loader, loadConfig } from "../../../../config/loader.js";
|
|
3
|
+
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "../../../../providers/env-keys.js";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
//#region src/cli/commands/doctor/checks/provider-auth.ts
|
|
6
6
|
init_loader();
|
|
@@ -3,9 +3,9 @@ import { init_loader, loadConfig } from "../../config/loader.js";
|
|
|
3
3
|
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
4
4
|
import { getContextWithOpts } from "../context.js";
|
|
5
5
|
import { getExtensionLockfileManager } from "../../extensions/lockfile.js";
|
|
6
|
+
import { fetchRegistry, findExtension, getExtensionMarketplaceStoreBaseUrl, listExtensions, searchExtensions } from "../../extensions/marketplace.js";
|
|
6
7
|
import { installFromLocal, installFromNpm, peekExtensionManifestFromStoreZip } from "../../extensions/install.js";
|
|
7
8
|
import { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionStoreZip } from "../../extensions/install-transaction.js";
|
|
8
|
-
import { fetchRegistry, findExtension, getExtensionMarketplaceStoreBaseUrl, listExtensions, searchExtensions } from "../../extensions/marketplace.js";
|
|
9
9
|
import { colors } from "../utils/colors.js";
|
|
10
10
|
import { validateExtensionPackageDirectory } from "./extension-pack.js";
|
|
11
11
|
import { join, resolve } from "node:path";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { init_paths, resolveConfigPath } from "../../../config/paths.js";
|
|
2
2
|
import { loadConfig } from "../../../config/loader.js";
|
|
3
3
|
import "../../../config/index.js";
|
|
4
|
-
import { resolveGatewayService } from "../../../daemon/service.js";
|
|
5
4
|
import { isRestartEnabled } from "../../../config/commands.flags.js";
|
|
5
|
+
import { resolveGatewayService } from "../../../daemon/service.js";
|
|
6
6
|
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "../../../infra/restart.js";
|
|
7
7
|
import { findVerifiedGatewayListenerPidsOnPortSync, formatGatewayPidList, signalVerifiedGatewayPidSync } from "../../../infra/gateway-processes.js";
|
|
8
8
|
import { runServiceRestart, runServiceStop } from "./lifecycle-core.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
2
|
-
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
2
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
|
+
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
4
4
|
import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
|
|
5
5
|
import { formatExamples, register } from "../registry.js";
|
|
6
6
|
import { getContextWithOpts } from "../context.js";
|
|
@@ -4,8 +4,8 @@ import { saveConfig } from "../../config/loader.js";
|
|
|
4
4
|
import { resolveGatewayLocalClientHost } from "../../config/gateway-bind.js";
|
|
5
5
|
import { formatExamples, register } from "../registry.js";
|
|
6
6
|
import "../../config/index.js";
|
|
7
|
-
import { colors } from "../utils/colors.js";
|
|
8
7
|
import { provisionEagerRuntimes } from "../../runtime-tools/bootstrap.js";
|
|
8
|
+
import { colors } from "../utils/colors.js";
|
|
9
9
|
import { initWorkspace } from "../utils/init-workspace.js";
|
|
10
10
|
import { setupModel } from "./onboard/model.js";
|
|
11
11
|
import { getChannelConfigurators } from "./onboard/channels/registry.js";
|
package/dist/src/config/index.js
CHANGED
|
@@ -2,15 +2,15 @@ import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXop
|
|
|
2
2
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
3
3
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
4
4
|
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
5
|
-
import {
|
|
5
|
+
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
6
6
|
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
7
7
|
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
8
8
|
import { resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
9
|
+
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
9
10
|
import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMcpOAuthPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
10
|
-
import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
|
|
11
11
|
import { init_loader, loadConfig, saveConfig } from "./loader.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
13
|
+
import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
|
|
14
14
|
import { canonicalizeConfiguredMcpServer, isKnownCliMcpTypeAlias, normalizeConfiguredMcpServers, resolveXopcMcpTransportAlias } from "./mcp-config-normalize.js";
|
|
15
15
|
import { formatThinkingLevels, listThinkingLevels, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, thinkLevelToNumber } from "../agent/transcript/thinking-types.js";
|
|
16
16
|
import { getWorkspacePath } from "./workspace-path-helpers.js";
|
|
@@ -2,10 +2,10 @@ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
4
|
import { ConfigSchema, init_schema } from "./schema.js";
|
|
5
|
-
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
6
5
|
import { init_paths, resolveConfigPath } from "./paths.js";
|
|
7
|
-
import {
|
|
6
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
8
7
|
import { assertChannelPluginConfigs, init_validate_channel_configs } from "./validate-channel-configs.js";
|
|
8
|
+
import { init_resolution, setActivePlatformDiscovery } from "../platform/resolution.js";
|
|
9
9
|
import { dirname } from "path";
|
|
10
10
|
import { existsSync, mkdirSync, promises, readFileSync } from "fs";
|
|
11
11
|
import { config } from "dotenv";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
|
|
3
2
|
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
3
|
+
import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
|
|
4
4
|
import { existsSync, readFileSync } from "fs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/config/models-json.ts
|
|
@@ -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_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
3
|
import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
|
|
4
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
7
|
import { mkdir, readFile } from "fs/promises";
|
|
@@ -4,8 +4,8 @@ import { init_paths, resolveBundledExtensionsDir, resolveExtensionsDir } from ".
|
|
|
4
4
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
5
|
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
6
6
|
import { getExtensionLockfileManager } from "./lockfile.js";
|
|
7
|
-
import { installExtensionFromStoreZip, installFromNpm } from "./install.js";
|
|
8
7
|
import { findExtension } from "./marketplace.js";
|
|
8
|
+
import { installExtensionFromStoreZip, installFromNpm } from "./install.js";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
11
11
|
import semver from "semver";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
|
-
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
3
2
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
3
|
+
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
4
4
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
5
5
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
6
6
|
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 { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
4
3
|
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
|
+
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.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 { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, 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";
|
|
4
5
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
5
6
|
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";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getAllModels, getAvailableModels, init_providers } from "../../../providers/index.js";
|
|
2
2
|
import { ActivationPlanner } from "../../../extensions/activation-planner.js";
|
|
3
3
|
import { mergeActivationContext } from "../../../extensions/activation-context.js";
|
|
4
|
-
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
5
4
|
import { buildWhenContextSnapshot } from "../../../extensions/when-context.js";
|
|
5
|
+
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
6
6
|
import { createOAuthAsyncHandler } from "../oauth-async.js";
|
|
7
7
|
import { createOAuthHandler } from "../oauth.js";
|
|
8
8
|
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
@@ -15,13 +15,13 @@ import { getConnectorDefinition, listConnectorCatalog } from "../../../connector
|
|
|
15
15
|
import { recordConnectorHealthUsage } from "../../../connectors/usage.js";
|
|
16
16
|
import { getConnectorInstance, getInstalledConnectorDefinition, listConnectorInstances } from "../../../connectors/instances.js";
|
|
17
17
|
import { installConnector, installConnectorDefinition, uninstallConnector, updateConnectorConfig } from "../../../connectors/install.js";
|
|
18
|
+
import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
|
|
18
19
|
import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
19
20
|
import { startConnectorAuthorization } from "../../../connectors/auth-provider-registry.js";
|
|
20
21
|
import { composioLogoResponse } from "../../../connectors/composio-logo.js";
|
|
21
22
|
import { inspectManagedComposioStatus } from "../../../connectors/composio-managed-client.js";
|
|
22
23
|
import { appendComposioTriggerEvent, listComposioTriggerEvents } from "../../../connectors/composio-triggers.js";
|
|
23
24
|
import { ingestLocalFolderSource } from "../../../connectors/connected-source-ingestion.js";
|
|
24
|
-
import { ConfigPersistenceError, persistConfigMutation } from "../../../config/config-mutation.js";
|
|
25
25
|
import { previewConnectorDefinition, testConnectorInstance } from "../../../connectors/health.js";
|
|
26
26
|
import { listUnderstandingSourceGrants, revokeUnderstandingSourceGrant } from "../../../user-context/sources/repository.js";
|
|
27
27
|
import { setConnectorEnabled } from "../../../connectors/lifecycle.js";
|
|
@@ -73,7 +73,7 @@ function registerMediaRoutes(authenticated, deps) {
|
|
|
73
73
|
const { buffer, path } = await readMediaReference((await resolveScopedMediaReference(deps.service, uriRaw.trim(), {
|
|
74
74
|
sessionKey,
|
|
75
75
|
taskId
|
|
76
|
-
})).uri);
|
|
76
|
+
})).uri, MAX_WEBCHAT_ATTACHMENT_FILE_BYTES);
|
|
77
77
|
const contentType = mimeTypeFromMediaPath(path);
|
|
78
78
|
const range = parseByteRange(c.req.header("Range"), buffer.byteLength);
|
|
79
79
|
const commonHeaders = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
2
1
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
2
|
+
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.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";
|
|
@@ -21,6 +21,7 @@ import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
|
21
21
|
import { createGatewayRouteLogger } from "../lib/route-logger.js";
|
|
22
22
|
import { listLocalVoiceModelStatuses, removeLocalVoiceModel, startLocalVoiceModelInstall } from "../../../voice/local/model-manager.js";
|
|
23
23
|
import { listTtsProvidersForApi } from "../../../voice/tts/list-providers.js";
|
|
24
|
+
import { z } from "zod";
|
|
24
25
|
//#region src/gateway/hono/routes/voice.ts
|
|
25
26
|
init_providers();
|
|
26
27
|
const log = createGatewayRouteLogger("Voice");
|
|
@@ -33,6 +34,10 @@ function readVoiceApiKeyFromConfigFileOnly(cfg, kind, providerId) {
|
|
|
33
34
|
const REFINE_TIMEOUT_MS = 15e3;
|
|
34
35
|
const MAX_AUDIO_BYTES = 25 * 1024 * 1024;
|
|
35
36
|
const MAX_SPEECH_TEXT_LENGTH = 1200;
|
|
37
|
+
const cancelVoiceSessionSchema = z.strictObject({
|
|
38
|
+
sessionId: z.uuid(),
|
|
39
|
+
ticket: z.string().min(32).max(512)
|
|
40
|
+
});
|
|
36
41
|
function speechMimeType(format) {
|
|
37
42
|
if (format === "opus" || format === "ogg") return "audio/ogg";
|
|
38
43
|
if (format === "mp3" || format === "mpeg") return "audio/mpeg";
|
|
@@ -240,6 +245,19 @@ function registerVoiceRoutes(authenticated, deps) {
|
|
|
240
245
|
}, 503);
|
|
241
246
|
}
|
|
242
247
|
});
|
|
248
|
+
authenticated.post("/api/voice/realtime/sessions/cancel", strictRateLimitMiddleware, async (c) => {
|
|
249
|
+
const parsed = cancelVoiceSessionSchema.safeParse(await c.req.json().catch(() => null));
|
|
250
|
+
if (!parsed.success) return c.json({
|
|
251
|
+
ok: false,
|
|
252
|
+
error: {
|
|
253
|
+
code: "INVALID_REQUEST",
|
|
254
|
+
message: "Invalid realtime voice cancellation request"
|
|
255
|
+
}
|
|
256
|
+
}, 400);
|
|
257
|
+
const principal = getGatewayPrincipal(c);
|
|
258
|
+
service.voiceRealtime.cancelSession(parsed.data.sessionId, parsed.data.ticket, principal.principalId);
|
|
259
|
+
return c.json({ ok: true });
|
|
260
|
+
});
|
|
243
261
|
authenticated.post("/api/voice/language", strictRateLimitMiddleware, async (c) => {
|
|
244
262
|
let body = {};
|
|
245
263
|
try {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
4
3
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
4
|
+
import { getModelRegistry } from "../../providers/model-registry.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";
|
|
8
8
|
import "../../agent/mcp/bundle-mcp-tools.js";
|
|
9
9
|
import { ConfigHotReloader } from "../../config/reload.js";
|
|
10
10
|
import "../../config/index.js";
|
|
11
|
-
import { computeBundledExtensionExtensionsPatch } from "../../extensions/bundled-extension-activation.js";
|
|
12
11
|
import { sanitizeTunnelConfig } from "../../tunnel/tunnel-config.js";
|
|
12
|
+
import { computeBundledExtensionExtensionsPatch } from "../../extensions/bundled-extension-activation.js";
|
|
13
13
|
//#region src/gateway/service/config-coordinator.ts
|
|
14
14
|
init_providers();
|
|
15
15
|
init_logger();
|