@0xmaxma/claude-gateway 1.8.9 → 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/tools/image/module.ts +6 -1
- package/mcp/tools/telegram/receiver-server.ts +15 -8
- package/mcp/tools/telegram/reply-attachment.ts +81 -0
- package/mcp/tools/video/module.ts +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,6 +119,9 @@ claude-gateway service install # systemd *user* unit — no sudo
|
|
|
119
119
|
claude-gateway service install --print # just show what it would install
|
|
120
120
|
claude-gateway service status
|
|
121
121
|
claude-gateway service uninstall # asks first — this stops a running gateway
|
|
122
|
+
claude-gateway service start # start the installed service (found even if inactive)
|
|
123
|
+
claude-gateway service restart
|
|
124
|
+
claude-gateway service stop
|
|
122
125
|
```
|
|
123
126
|
|
|
124
127
|
Install and uninstall both prompt before acting; pass `--yes` in scripts (without it, a
|
|
@@ -126,11 +129,13 @@ non-interactive run is refused rather than left hanging). Always stop the gatewa
|
|
|
126
129
|
`service uninstall` or `systemctl --user stop claude-gateway.service` — a bare `kill <pid>` bypasses
|
|
127
130
|
systemd's own stop tracking, so `Restart=always` brings it right back regardless of exit code.
|
|
128
131
|
|
|
129
|
-
`install`
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
`install`, `start` and `restart` — the commands meant to leave a running gateway behind — share one
|
|
133
|
+
exit-code contract with three outcomes: `0` fully healthy, `1` the action itself failed (or a
|
|
134
|
+
validation/confirmation gate refused, so nothing was written), `2` the action succeeded but
|
|
135
|
+
`/health` never answered within the poll window. A script that only checks the exit code — not the
|
|
136
|
+
JSON result on stdout — can still tell "didn't happen" apart from "happened, health unconfirmed"
|
|
137
|
+
this way. `start` on an already-running service is no exception: it still probes `/health` and can
|
|
138
|
+
still exit `2`, because "the process manager calls it active" is not "the gateway answers".
|
|
134
139
|
|
|
135
140
|
`install` also refuses (rather than just warning) if a `claude-gateway.service` unit already
|
|
136
141
|
exists and is enabled or active at *system* scope (e.g. one written by provisioning outside this
|
|
@@ -194,6 +199,11 @@ claude-gateway gateway stop
|
|
|
194
199
|
claude-gateway gateway logs # tail the gateway's own log (works even when it is dead)
|
|
195
200
|
```
|
|
196
201
|
|
|
202
|
+
`gateway restart`/`stop` only drive whatever manager is currently reported *active*. To start an
|
|
203
|
+
installed service that is currently stopped — or to act on a specific `--manager`/`--scope`
|
|
204
|
+
regardless of what else might be running — use `service start`/`stop`/`restart` instead; they
|
|
205
|
+
discover the installed unit from disk the same way `service status`/`uninstall` do.
|
|
206
|
+
|
|
197
207
|
Managing PM2 directly still works too:
|
|
198
208
|
|
|
199
209
|
```bash
|
|
@@ -904,6 +914,10 @@ claude-gateway gateway start # run the gateway in the foreground
|
|
|
904
914
|
claude-gateway gateway status # is it running? which manager owns it?
|
|
905
915
|
claude-gateway gateway logs --follow # stream the gateway log (reads files, needs no server)
|
|
906
916
|
claude-gateway service install # run it as a systemd-user (or --manager pm2) service
|
|
917
|
+
claude-gateway service start|stop|restart # drive the installed service (found even if inactive)
|
|
918
|
+
claude-gateway app list # installed Docker-compose apps and their status
|
|
919
|
+
claude-gateway app install agent-note # install from the community registry
|
|
920
|
+
claude-gateway app start|stop|restart <name>
|
|
907
921
|
claude-gateway update check # newer claude-gateway published?
|
|
908
922
|
claude-gateway claude update # update Claude Code via its own updater
|
|
909
923
|
claude-gateway doctor # check config / key / connectivity
|
|
@@ -1040,6 +1054,19 @@ curl -X POST http://localhost:10850/api/v1/apps/install \
|
|
|
1040
1054
|
curl http://localhost:10850/api/v1/apps/jobs/<jobId> -H "X-Api-Key: <key>" | jq .status
|
|
1041
1055
|
```
|
|
1042
1056
|
|
|
1057
|
+
**Or use the CLI**, which wraps the same endpoints (see [CLI.md](./CLI.md) for the full reference):
|
|
1058
|
+
|
|
1059
|
+
```bash
|
|
1060
|
+
claude-gateway app install agent-note --env-file ./agent-note.env --wait # follow the job to completion
|
|
1061
|
+
claude-gateway app list # installed apps + status
|
|
1062
|
+
claude-gateway app stop agent-note
|
|
1063
|
+
claude-gateway app uninstall agent-note --yes
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
`--env-file` reads `KEY=VALUE` lines from a dotenv file. Prefer it over `--env` for anything secret:
|
|
1067
|
+
a value passed on the command line is readable by every local user in `/proc/<pid>/cmdline` while the
|
|
1068
|
+
install runs, and is written to your shell history. `--env` wins if both set the same variable.
|
|
1069
|
+
|
|
1043
1070
|
**App is then live at** `/app/getpod-manager/<portName>/`.
|
|
1044
1071
|
|
|
1045
1072
|
Apps can also be installed from a GitHub URL (`github_url` + `commit`) or a local path (`local_path`) for development. Updates use a **blue-green swap with automatic rollback** — the old containers stay intact until the new version passes its healthcheck.
|
package/dist/agent/runner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { AgentConfig, CustomConnectorEntry, GatewayConfig, Logger, ModelConfig, ApiAttachment, ImageParams } from '../types';
|
|
2
|
+
import { AgentConfig, CustomConnectorEntry, GatewayConfig, Logger, ModelConfig, ApiAttachment, ImageParams, VideoParams } from '../types';
|
|
3
3
|
import { SessionProcess } from '../session/process';
|
|
4
4
|
import { type SkillRegistry } from '../skills';
|
|
5
5
|
import { type ApiStreamCallbacks, type TurnSink } from './turn-stream';
|
|
@@ -195,6 +195,14 @@ export declare class AgentRunner extends EventEmitter {
|
|
|
195
195
|
* options are present.
|
|
196
196
|
*/
|
|
197
197
|
private static buildImageParamsNote;
|
|
198
|
+
/**
|
|
199
|
+
* Render composer-selected video options as a directive the agent reads and
|
|
200
|
+
* forwards to the generate_video MCP tool. Mirrors buildImageParamsNote. Returns
|
|
201
|
+
* '' when no usable options are present. Without this the agent gets no composer
|
|
202
|
+
* context for video and invents duration/aspect (a phantom 10s cap, an 8+8 scene
|
|
203
|
+
* split, or a landscape clip when 9:16 was picked).
|
|
204
|
+
*/
|
|
205
|
+
private static buildVideoParamsNote;
|
|
198
206
|
/**
|
|
199
207
|
* The durable slice of the composer image options — everything except
|
|
200
208
|
* `image_refs`, which is a per-turn explicit selection (#73) and must never be
|
|
@@ -211,7 +219,9 @@ export declare class AgentRunner extends EventEmitter {
|
|
|
211
219
|
* session path; refs that were never staged (catalog refs, artifact:<id>)
|
|
212
220
|
* pass through untouched. (#74)
|
|
213
221
|
*/
|
|
222
|
+
private static buildRefRemap;
|
|
214
223
|
static remapImageParamsRefs(p: ImageParams | undefined, stagedPaths: readonly string[] | undefined, promotedPaths: readonly string[] | undefined): ImageParams | undefined;
|
|
224
|
+
static remapVideoParamsRefs(p: VideoParams | undefined, stagedPaths: readonly string[] | undefined, promotedPaths: readonly string[] | undefined): VideoParams | undefined;
|
|
215
225
|
private static buildChannelXml;
|
|
216
226
|
/**
|
|
217
227
|
* Await a SessionProcess's in-flight crash-triggered auto-restart
|
|
@@ -514,6 +524,7 @@ export declare class AgentRunner extends EventEmitter {
|
|
|
514
524
|
model?: string;
|
|
515
525
|
skipUserMessage?: boolean;
|
|
516
526
|
imageParams?: ImageParams;
|
|
527
|
+
videoParams?: VideoParams;
|
|
517
528
|
}): Promise<{
|
|
518
529
|
text: string;
|
|
519
530
|
attachments: ApiAttachment[];
|
|
@@ -533,6 +544,7 @@ export declare class AgentRunner extends EventEmitter {
|
|
|
533
544
|
model?: string;
|
|
534
545
|
skipUserMessage?: boolean;
|
|
535
546
|
imageParams?: ImageParams;
|
|
547
|
+
videoParams?: VideoParams;
|
|
536
548
|
requestId?: string;
|
|
537
549
|
}): Promise<() => void>;
|
|
538
550
|
/**
|
|
@@ -619,6 +631,7 @@ export declare class AgentRunner extends EventEmitter {
|
|
|
619
631
|
getAllSessionMeta(): Promise<Map<string, {
|
|
620
632
|
name: string;
|
|
621
633
|
imageConfig?: ImageParams;
|
|
634
|
+
videoConfig?: VideoParams;
|
|
622
635
|
model?: string;
|
|
623
636
|
}>>;
|
|
624
637
|
listSessionsForChat(chatId: string, channel: ChatChannel): Promise<import('../types').SessionIndex>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAOtC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,EAAW,WAAW,EAAe,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAOtC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,EAAW,WAAW,EAAe,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGhK,OAAO,EAAE,cAAc,EAA8E,MAAM,oBAAoB,CAAC;AAQhI,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAKvF,OAAO,EAML,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG7F,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,KAAK,EAAiB,WAAW,EAAoB,MAAM,kBAAkB,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,C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,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC;IAc/G,OAAO,CAAC,+BAA+B;IAsBjC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAiB7F,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAW5I,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxE;;;;;;;OAOG;IACG,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,EAAE,kBAAkB,EAC7B,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9C,OAAO,CAAC,MAAM,IAAI,CAAC;IA2JtB,OAAO,CAAC,iBAAiB;IA2CzB;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;;;OAMG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAoBnC"}
|
package/dist/agent/runner.js
CHANGED
|
@@ -1219,6 +1219,54 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
1219
1219
|
`Do NOT open or Read the referenced files first — the image model receives the actual files; ` +
|
|
1220
1220
|
`reading them wastes minutes and can push the request past its timeout. Go straight to generate_image.\n`);
|
|
1221
1221
|
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Render composer-selected video options as a directive the agent reads and
|
|
1224
|
+
* forwards to the generate_video MCP tool. Mirrors buildImageParamsNote. Returns
|
|
1225
|
+
* '' when no usable options are present. Without this the agent gets no composer
|
|
1226
|
+
* context for video and invents duration/aspect (a phantom 10s cap, an 8+8 scene
|
|
1227
|
+
* split, or a landscape clip when 9:16 was picked).
|
|
1228
|
+
*/
|
|
1229
|
+
static buildVideoParamsNote(p) {
|
|
1230
|
+
const attrs = [
|
|
1231
|
+
p.model ? `model="${AgentRunner.escapeXmlAttr(p.model)}"` : '',
|
|
1232
|
+
p.resolution ? `resolution="${AgentRunner.escapeXmlAttr(p.resolution)}"` : '',
|
|
1233
|
+
p.aspect_ratio ? `aspect_ratio="${AgentRunner.escapeXmlAttr(p.aspect_ratio)}"` : '',
|
|
1234
|
+
typeof p.duration === 'number' ? `duration="${p.duration}"` : '',
|
|
1235
|
+
p.image_ref ? `image_ref="${AgentRunner.escapeXmlAttr(p.image_ref)}"` : '',
|
|
1236
|
+
].filter(Boolean);
|
|
1237
|
+
if (!attrs.length)
|
|
1238
|
+
return '';
|
|
1239
|
+
// The generate_video schema lets the agent pick model/duration itself; when the
|
|
1240
|
+
// composer selection isn't made authoritative the agent falls back to
|
|
1241
|
+
// action="list" and self-selects, or invents a duration cap and splits the clip
|
|
1242
|
+
// into multiple scenes. Nail every field down.
|
|
1243
|
+
const modelNote = p.model
|
|
1244
|
+
? `The user explicitly SELECTED model="${AgentRunner.escapeXmlAttr(p.model)}" in the composer. ` +
|
|
1245
|
+
`Call generate_video with that exact model — do NOT call action="list" to second-guess an ` +
|
|
1246
|
+
`explicit selection or substitute a different model.\n`
|
|
1247
|
+
: '';
|
|
1248
|
+
const durationNote = typeof p.duration === 'number'
|
|
1249
|
+
? `duration=${p.duration} is a valid length for the selected model — pass it verbatim as the "duration" ` +
|
|
1250
|
+
`argument. Do NOT invent a maximum, do NOT clamp it to a smaller value, and do NOT split the request ` +
|
|
1251
|
+
`into multiple shorter scenes/clips. Generate exactly ONE clip of this duration.\n`
|
|
1252
|
+
: '';
|
|
1253
|
+
const aspectNote = p.aspect_ratio
|
|
1254
|
+
? `Pass aspect_ratio="${AgentRunner.escapeXmlAttr(p.aspect_ratio)}" verbatim — do NOT change the orientation.\n`
|
|
1255
|
+
: '';
|
|
1256
|
+
const refNote = p.image_ref
|
|
1257
|
+
? `The user selected a source image for image-to-video. Pass image_ref="${AgentRunner.escapeXmlAttr(p.image_ref)}" ` +
|
|
1258
|
+
`as the "image" argument of generate_video (the source frame's own aspect then wins). ` +
|
|
1259
|
+
`Do NOT call list_refs to second-guess it, and do NOT open or Read the file first.\n`
|
|
1260
|
+
: '';
|
|
1261
|
+
return (`<video-params ${attrs.join(' ')} />\n` +
|
|
1262
|
+
`The user selected the video-generation options above in the composer. When the request involves ` +
|
|
1263
|
+
`creating a video, call the generate_video tool (action="generate") using these exact values, then ` +
|
|
1264
|
+
`deliver the returned video with your reply tool.\n` +
|
|
1265
|
+
modelNote +
|
|
1266
|
+
durationNote +
|
|
1267
|
+
aspectNote +
|
|
1268
|
+
refNote);
|
|
1269
|
+
}
|
|
1222
1270
|
/**
|
|
1223
1271
|
* The durable slice of the composer image options — everything except
|
|
1224
1272
|
* `image_refs`, which is a per-turn explicit selection (#73) and must never be
|
|
@@ -1238,16 +1286,26 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
1238
1286
|
* session path; refs that were never staged (catalog refs, artifact:<id>)
|
|
1239
1287
|
* pass through untouched. (#74)
|
|
1240
1288
|
*/
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1289
|
+
// Build the staging→promoted path map: promoteUiUploads moves a turn's
|
|
1290
|
+
// ui-upload files into per-session storage, so any ref built from a staging
|
|
1291
|
+
// path must follow the file to its new location (#74). Empty map = nothing
|
|
1292
|
+
// moved (or no uploads), so callers leave their refs untouched.
|
|
1293
|
+
static buildRefRemap(stagedPaths, promotedPaths) {
|
|
1244
1294
|
const map = new Map();
|
|
1295
|
+
if (!stagedPaths?.length || !promotedPaths?.length)
|
|
1296
|
+
return map;
|
|
1245
1297
|
for (let i = 0; i < Math.min(stagedPaths.length, promotedPaths.length); i++) {
|
|
1246
1298
|
const from = stagedPaths[i];
|
|
1247
1299
|
const to = promotedPaths[i];
|
|
1248
1300
|
if (from !== to)
|
|
1249
1301
|
map.set(from, to);
|
|
1250
1302
|
}
|
|
1303
|
+
return map;
|
|
1304
|
+
}
|
|
1305
|
+
static remapImageParamsRefs(p, stagedPaths, promotedPaths) {
|
|
1306
|
+
if (!p)
|
|
1307
|
+
return p;
|
|
1308
|
+
const map = AgentRunner.buildRefRemap(stagedPaths, promotedPaths);
|
|
1251
1309
|
if (!map.size)
|
|
1252
1310
|
return p;
|
|
1253
1311
|
const remap = (r) => map.get(r) ?? r;
|
|
@@ -1257,6 +1315,17 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
1257
1315
|
...(p.image_refs?.length ? { image_refs: p.image_refs.map(remap) } : {}),
|
|
1258
1316
|
};
|
|
1259
1317
|
}
|
|
1318
|
+
// Video analogue of remapImageParamsRefs. The composer's image-to-video
|
|
1319
|
+
// source frame (VideoParams.image_ref) is built from a staging path; without
|
|
1320
|
+
// this remap the raw ref dangles after promoteUiUploads moves the file, and
|
|
1321
|
+
// generate_video fails share_ref_not_found. artifact:/catalog refs aren't in
|
|
1322
|
+
// the map, so they pass through untouched.
|
|
1323
|
+
static remapVideoParamsRefs(p, stagedPaths, promotedPaths) {
|
|
1324
|
+
if (!p?.image_ref)
|
|
1325
|
+
return p;
|
|
1326
|
+
const to = AgentRunner.buildRefRemap(stagedPaths, promotedPaths).get(p.image_ref);
|
|
1327
|
+
return to ? { ...p, image_ref: to } : p;
|
|
1328
|
+
}
|
|
1260
1329
|
static buildChannelXml(params) {
|
|
1261
1330
|
const meta = params.meta ?? {};
|
|
1262
1331
|
const optionalAttrs = [
|
|
@@ -1280,6 +1349,10 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
1280
1349
|
if (meta['replied_message_id']) {
|
|
1281
1350
|
const repliedAttrs = [
|
|
1282
1351
|
'replied_image_path',
|
|
1352
|
+
'replied_attachment_file_id',
|
|
1353
|
+
'replied_attachment_kind',
|
|
1354
|
+
'replied_attachment_mime',
|
|
1355
|
+
'replied_attachment_name',
|
|
1283
1356
|
]
|
|
1284
1357
|
.filter(k => meta[k])
|
|
1285
1358
|
.map(k => ` ${k}="${meta[k].replace(/"/g, '"')}"`)
|
|
@@ -3090,6 +3163,8 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
3090
3163
|
// Refs built from staging paths must follow the files to their promoted
|
|
3091
3164
|
// location — see remapImageParamsRefs (#74).
|
|
3092
3165
|
const imageParams = AgentRunner.remapImageParamsRefs(opts.imageParams, opts.mediaFiles, finalMediaFiles);
|
|
3166
|
+
// The image-to-video source frame follows the same staging→promoted move.
|
|
3167
|
+
const videoParams = AgentRunner.remapVideoParamsRefs(opts.videoParams, opts.mediaFiles, finalMediaFiles);
|
|
3093
3168
|
// Resolve media files to absolute paths for file-path based image passing
|
|
3094
3169
|
// (same pattern as Telegram — Claude Code reads files via Read tool instead of base64 inline)
|
|
3095
3170
|
const imagePaths = finalMediaFiles?.length ? this.resolveMediaPaths(finalMediaFiles) : [];
|
|
@@ -3145,6 +3220,7 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
3145
3220
|
// Build channel XML with image_path attribute (like Telegram) for first image
|
|
3146
3221
|
const imageAttr = effectiveImagePaths.length ? ` image_path="${AgentRunner.escapeXmlAttr(effectiveImagePaths[0])}"` : '';
|
|
3147
3222
|
const imageParamsNote = imageParams ? AgentRunner.buildImageParamsNote(imageParams) : '';
|
|
3223
|
+
const videoParamsNote = videoParams ? AgentRunner.buildVideoParamsNote(videoParams) : '';
|
|
3148
3224
|
// Persist the composer image options to session meta so the web can restore the
|
|
3149
3225
|
// selection on reload (SessionMeta.imageConfig). Only when the send carries them
|
|
3150
3226
|
// (the web sends image_params on first-set/change), so this holds the latest.
|
|
@@ -3156,10 +3232,17 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
3156
3232
|
.updateSessionMeta(this.agentConfig.id, chatId, sessionId, { imageConfig: durableImageConfig }, 'api')
|
|
3157
3233
|
.catch(() => { });
|
|
3158
3234
|
}
|
|
3235
|
+
// Persist composer video options the same way (SessionMeta.videoConfig).
|
|
3236
|
+
if (videoParams) {
|
|
3237
|
+
this.sessionStore
|
|
3238
|
+
.updateSessionMeta(this.agentConfig.id, chatId, sessionId, { videoConfig: videoParams }, 'api')
|
|
3239
|
+
.catch(() => { });
|
|
3240
|
+
}
|
|
3159
3241
|
const channelXml = `<channel source="api" chat_id="${chatId}" session_id="${sessionId}" ts="${new Date().toISOString()}"${imageAttr}>\n` +
|
|
3160
3242
|
`${message}\n\n` +
|
|
3161
3243
|
`${systemNote}` +
|
|
3162
3244
|
`${imageParamsNote}` +
|
|
3245
|
+
`${videoParamsNote}` +
|
|
3163
3246
|
`</channel>` +
|
|
3164
3247
|
(skillInvocation ? `\n${(0, skills_1.formatSkillContext)(skillInvocation)}` : '');
|
|
3165
3248
|
return new Promise((resolve, reject) => {
|
|
@@ -3362,6 +3445,8 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
3362
3445
|
// Refs built from staging paths must follow the files to their promoted
|
|
3363
3446
|
// location — see remapImageParamsRefs (#74).
|
|
3364
3447
|
const imageParamsStream = AgentRunner.remapImageParamsRefs(opts.imageParams, opts.mediaFiles, finalMediaFilesStream);
|
|
3448
|
+
// The image-to-video source frame follows the same staging→promoted move.
|
|
3449
|
+
const videoParamsStream = AgentRunner.remapVideoParamsRefs(opts.videoParams, opts.mediaFiles, finalMediaFilesStream);
|
|
3365
3450
|
// Resolve media files to absolute paths for file-path based image passing
|
|
3366
3451
|
const imagePathsStream = finalMediaFilesStream?.length ? this.resolveMediaPaths(finalMediaFilesStream) : [];
|
|
3367
3452
|
if (!opts.skipUserMessage) {
|
|
@@ -3625,6 +3710,7 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
3625
3710
|
// Build channel XML with image_path attribute (like Telegram) for first image
|
|
3626
3711
|
const imageAttrStream = effectiveImagePathsStream.length ? ` image_path="${AgentRunner.escapeXmlAttr(effectiveImagePathsStream[0])}"` : '';
|
|
3627
3712
|
const imageParamsNoteStream = imageParamsStream ? AgentRunner.buildImageParamsNote(imageParamsStream) : '';
|
|
3713
|
+
const videoParamsNoteStream = videoParamsStream ? AgentRunner.buildVideoParamsNote(videoParamsStream) : '';
|
|
3628
3714
|
// Persist composer image config to session meta (SessionMeta.imageConfig) so the
|
|
3629
3715
|
// web restores the selection on reload. This is the streaming path the web uses.
|
|
3630
3716
|
// image_refs are per-turn and deliberately excluded (#73).
|
|
@@ -3637,10 +3723,17 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
3637
3723
|
.updateSessionMeta(this.agentConfig.id, chatId, sessionId, { imageConfig: durableImageConfigStream }, 'api')
|
|
3638
3724
|
.catch(() => { });
|
|
3639
3725
|
}
|
|
3726
|
+
// Persist composer video options the same way (SessionMeta.videoConfig).
|
|
3727
|
+
if (videoParamsStream) {
|
|
3728
|
+
this.sessionStore
|
|
3729
|
+
.updateSessionMeta(this.agentConfig.id, chatId, sessionId, { videoConfig: videoParamsStream }, 'api')
|
|
3730
|
+
.catch(() => { });
|
|
3731
|
+
}
|
|
3640
3732
|
const channelXml = `<channel source="api" chat_id="${chatId}" session_id="${sessionId}" ts="${new Date().toISOString()}"${imageAttrStream}>\n` +
|
|
3641
3733
|
`${message}\n\n` +
|
|
3642
3734
|
systemNote +
|
|
3643
3735
|
imageParamsNoteStream +
|
|
3736
|
+
videoParamsNoteStream +
|
|
3644
3737
|
`</channel>` +
|
|
3645
3738
|
(skillInvocationStream ? `\n${(0, skills_1.formatSkillContext)(skillInvocationStream)}` : '');
|
|
3646
3739
|
session.setProcessing(true);
|