@0xmaxma/claude-gateway 1.8.8 → 1.8.10
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 +32 -5
- package/dist/agent/runner.d.ts +14 -1
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +96 -3
- package/dist/agent/runner.js.map +1 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +37 -3
- package/dist/api/router.js.map +1 -1
- package/dist/api/share-router.d.ts.map +1 -1
- package/dist/api/share-router.js +24 -0
- package/dist/api/share-router.js.map +1 -1
- package/dist/cli/args.d.ts +34 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +55 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/app.d.ts +28 -0
- package/dist/cli/commands/app.d.ts.map +1 -0
- package/dist/cli/commands/app.js +411 -0
- package/dist/cli/commands/app.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +77 -16
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/service.d.ts.map +1 -1
- package/dist/cli/commands/service.js +373 -56
- package/dist/cli/commands/service.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +1 -17
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/http-client.d.ts +8 -0
- package/dist/cli/http-client.d.ts.map +1 -1
- package/dist/cli/http-client.js +5 -2
- package/dist/cli/http-client.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +16 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/prompt.d.ts +17 -2
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +33 -2
- package/dist/cli/prompt.js.map +1 -1
- package/dist/config/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +15 -4
- package/dist/config/loader.js.map +1 -1
- package/dist/config/watcher.d.ts.map +1 -1
- package/dist/config/watcher.js +12 -0
- package/dist/config/watcher.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/session/store.d.ts +3 -2
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js +1 -1
- package/dist/session/store.js.map +1 -1
- package/dist/share/session-video-catalog.d.ts +19 -0
- package/dist/share/session-video-catalog.d.ts.map +1 -0
- package/dist/share/session-video-catalog.js +119 -0
- package/dist/share/session-video-catalog.js.map +1 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/mcp/instructions.ts +14 -1
- package/mcp/server.ts +11 -5
- package/mcp/tools/image/module.ts +8 -71
- package/mcp/tools/shared/media.ts +76 -0
- package/mcp/tools/telegram/receiver-server.ts +15 -8
- package/mcp/tools/telegram/reply-attachment.ts +81 -0
- package/mcp/tools/video/module.ts +681 -0
- package/package.json +1 -1
package/dist/api/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/api/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,QAAQ,EAAE,MAAM,SAAS,CAAC;AAOpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAe,WAAW,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/api/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,QAAQ,EAAE,MAAM,SAAS,CAAC;AAOpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAe,WAAW,EAAe,MAAM,UAAU,CAAC;AAmDtF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAExD;AAMD,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEtD;AAuED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CA4CjD;AAoID,wBAAgB,eAAe,CAC7B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,EAAE,GACrB,MAAM,CAwwGR"}
|
package/dist/api/router.js
CHANGED
|
@@ -429,7 +429,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
|
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
431
|
const body = req.body;
|
|
432
|
-
const { message, chat_id, session_id, stream, timeout_ms, media_files, model: requestModel, store_user_message, image_params } = body;
|
|
432
|
+
const { message, chat_id, session_id, stream, timeout_ms, media_files, model: requestModel, store_user_message, image_params, video_params } = body;
|
|
433
433
|
if (message !== undefined && typeof message !== 'string') {
|
|
434
434
|
res.status(400).json({ error: 'message must be a string if provided' });
|
|
435
435
|
return;
|
|
@@ -526,6 +526,39 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
|
|
|
526
526
|
if (Object.keys(out).length)
|
|
527
527
|
validatedImageParams = out;
|
|
528
528
|
}
|
|
529
|
+
// Validate optional video_params — mirrors image_params. Surfaced to the agent
|
|
530
|
+
// so it calls generate_video with the composer-selected model/duration/
|
|
531
|
+
// resolution/aspect_ratio instead of inventing them.
|
|
532
|
+
let validatedVideoParams;
|
|
533
|
+
if (video_params !== undefined) {
|
|
534
|
+
if (typeof video_params !== 'object' || video_params === null || Array.isArray(video_params)) {
|
|
535
|
+
res.status(400).json({ error: 'video_params must be an object if provided' });
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const vp = video_params;
|
|
539
|
+
const vStrFields = ['model', 'resolution', 'aspect_ratio', 'image_ref'];
|
|
540
|
+
const vOut = {};
|
|
541
|
+
for (const f of vStrFields) {
|
|
542
|
+
const v = vp[f];
|
|
543
|
+
if (v !== undefined) {
|
|
544
|
+
if (typeof v !== 'string') {
|
|
545
|
+
res.status(400).json({ error: `video_params.${f} must be a string` });
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
if (v.trim())
|
|
549
|
+
vOut[f] = v.trim();
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (vp.duration !== undefined) {
|
|
553
|
+
if (typeof vp.duration !== 'number' || !Number.isFinite(vp.duration) || vp.duration < 1) {
|
|
554
|
+
res.status(400).json({ error: 'video_params.duration must be a positive number' });
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
vOut.duration = Math.floor(vp.duration);
|
|
558
|
+
}
|
|
559
|
+
if (Object.keys(vOut).length)
|
|
560
|
+
validatedVideoParams = vOut;
|
|
561
|
+
}
|
|
529
562
|
// Allow message OR media_files. Image-only sends pass an empty text
|
|
530
563
|
// alongside the image_path attribute on channelXml so Claude can Read the file.
|
|
531
564
|
const trimmedMessage = typeof message === 'string' ? message.trim() : '';
|
|
@@ -602,7 +635,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
|
|
|
602
635
|
openSseStream(res);
|
|
603
636
|
const agentCfg = agentConfigs.get(agentId);
|
|
604
637
|
const allowTools = agentCfg.allow_tools ?? !!apiKey.allow_tools;
|
|
605
|
-
onClientDisconnect = await runner.sendApiMessageStream(sessionId, chatIdStr, trimmedMessage, sseCallbacks, { timeoutMs, allowTools, mediaFiles: validatedMediaFiles, model: modelStr, skipUserMessage, imageParams: validatedImageParams, requestId });
|
|
638
|
+
onClientDisconnect = await runner.sendApiMessageStream(sessionId, chatIdStr, trimmedMessage, sseCallbacks, { timeoutMs, allowTools, mediaFiles: validatedMediaFiles, model: modelStr, skipUserMessage, imageParams: validatedImageParams, videoParams: validatedVideoParams, requestId });
|
|
606
639
|
// Client disconnect — detaches this connection's sink. The turn keeps
|
|
607
640
|
// running and keeps buffering, so the client can resume it on a new
|
|
608
641
|
// connection via GET …/sessions/:sessionId/stream?after_seq= (#421).
|
|
@@ -646,6 +679,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
|
|
|
646
679
|
model: modelStr,
|
|
647
680
|
skipUserMessage,
|
|
648
681
|
imageParams: validatedImageParams,
|
|
682
|
+
videoParams: validatedVideoParams,
|
|
649
683
|
}));
|
|
650
684
|
}
|
|
651
685
|
const syncResult = {
|
|
@@ -790,7 +824,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
|
|
|
790
824
|
description: cfg?.description ?? '',
|
|
791
825
|
sessions: sessions.map((s) => {
|
|
792
826
|
const meta = metaMap.get(s.sessionId);
|
|
793
|
-
return { ...s, sessionName: meta?.name ?? null, imageConfig: meta?.imageConfig ?? null, model: meta?.model ?? null };
|
|
827
|
+
return { ...s, sessionName: meta?.name ?? null, imageConfig: meta?.imageConfig ?? null, videoConfig: meta?.videoConfig ?? null, model: meta?.model ?? null };
|
|
794
828
|
}),
|
|
795
829
|
};
|
|
796
830
|
}));
|