@0xmaxma/claude-gateway 1.8.6 → 1.8.8
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 +159 -4
- package/dist/agent/dreaming/config.d.ts +3 -1
- package/dist/agent/dreaming/config.d.ts.map +1 -1
- package/dist/agent/dreaming/config.js +14 -3
- package/dist/agent/dreaming/config.js.map +1 -1
- package/dist/agent/dreaming/index.d.ts +2 -0
- package/dist/agent/dreaming/index.d.ts.map +1 -1
- package/dist/agent/dreaming/index.js +1 -1
- package/dist/agent/dreaming/index.js.map +1 -1
- package/dist/agent/knowledge/config.d.ts +3 -1
- package/dist/agent/knowledge/config.d.ts.map +1 -1
- package/dist/agent/knowledge/config.js +13 -3
- package/dist/agent/knowledge/config.js.map +1 -1
- package/dist/agent/runner.d.ts +66 -1
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +165 -12
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/skill-learning/config.d.ts +3 -1
- package/dist/agent/skill-learning/config.d.ts.map +1 -1
- package/dist/agent/skill-learning/config.js +13 -3
- package/dist/agent/skill-learning/config.js.map +1 -1
- package/dist/agent/skill-learning/index.d.ts +2 -0
- package/dist/agent/skill-learning/index.d.ts.map +1 -1
- package/dist/agent/skill-learning/index.js +1 -1
- package/dist/agent/skill-learning/index.js.map +1 -1
- package/dist/api/connectors-router.d.ts +50 -0
- package/dist/api/connectors-router.d.ts.map +1 -0
- package/dist/api/connectors-router.js +650 -0
- package/dist/api/connectors-router.js.map +1 -0
- package/dist/api/gateway-router.d.ts +4 -0
- package/dist/api/gateway-router.d.ts.map +1 -1
- package/dist/api/gateway-router.js +26 -0
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/api/oauth-connectors-router.d.ts +43 -0
- package/dist/api/oauth-connectors-router.d.ts.map +1 -0
- package/dist/api/oauth-connectors-router.js +384 -0
- package/dist/api/oauth-connectors-router.js.map +1 -0
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +101 -9
- package/dist/api/router.js.map +1 -1
- package/dist/apps/agent-manager.d.ts +6 -2
- package/dist/apps/agent-manager.d.ts.map +1 -1
- package/dist/apps/agent-manager.js +14 -17
- package/dist/apps/agent-manager.js.map +1 -1
- package/dist/apps/installer.d.ts +3 -1
- package/dist/apps/installer.d.ts.map +1 -1
- package/dist/apps/installer.js +8 -2
- package/dist/apps/installer.js.map +1 -1
- package/dist/cli/commands/service.d.ts +34 -4
- package/dist/cli/commands/service.d.ts.map +1 -1
- package/dist/cli/commands/service.js +552 -96
- package/dist/cli/commands/service.js.map +1 -1
- package/dist/config/bootstrap.d.ts.map +1 -1
- package/dist/config/bootstrap.js +4 -1
- package/dist/config/bootstrap.js.map +1 -1
- package/dist/config/config-write-lock.d.ts +45 -0
- package/dist/config/config-write-lock.d.ts.map +1 -0
- package/dist/config/config-write-lock.js +164 -0
- package/dist/config/config-write-lock.js.map +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +36 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/migrator.d.ts.map +1 -1
- package/dist/config/migrator.js +12 -1
- package/dist/config/migrator.js.map +1 -1
- package/dist/config/watcher.d.ts.map +1 -1
- package/dist/config/watcher.js +29 -0
- package/dist/config/watcher.js.map +1 -1
- package/dist/connectors/custom-connectors-store.d.ts +54 -0
- package/dist/connectors/custom-connectors-store.d.ts.map +1 -0
- package/dist/connectors/custom-connectors-store.js +204 -0
- package/dist/connectors/custom-connectors-store.js.map +1 -0
- package/dist/connectors/custom.d.ts +69 -0
- package/dist/connectors/custom.d.ts.map +1 -0
- package/dist/connectors/custom.js +158 -0
- package/dist/connectors/custom.js.map +1 -0
- package/dist/connectors/mcp-oauth.d.ts +152 -0
- package/dist/connectors/mcp-oauth.d.ts.map +1 -0
- package/dist/connectors/mcp-oauth.js +522 -0
- package/dist/connectors/mcp-oauth.js.map +1 -0
- package/dist/connectors/oauth-refresh-sweep.d.ts +71 -0
- package/dist/connectors/oauth-refresh-sweep.d.ts.map +1 -0
- package/dist/connectors/oauth-refresh-sweep.js +337 -0
- package/dist/connectors/oauth-refresh-sweep.js.map +1 -0
- package/dist/connectors/pending-oauth-store.d.ts +39 -0
- package/dist/connectors/pending-oauth-store.d.ts.map +1 -0
- package/dist/connectors/pending-oauth-store.js +50 -0
- package/dist/connectors/pending-oauth-store.js.map +1 -0
- package/dist/connectors/resolve.d.ts +52 -0
- package/dist/connectors/resolve.d.ts.map +1 -0
- package/dist/connectors/resolve.js +176 -0
- package/dist/connectors/resolve.js.map +1 -0
- package/dist/connectors/token-env.d.ts +93 -0
- package/dist/connectors/token-env.d.ts.map +1 -0
- package/dist/connectors/token-env.js +323 -0
- package/dist/connectors/token-env.js.map +1 -0
- package/dist/connectors/types.d.ts +126 -0
- package/dist/connectors/types.d.ts.map +1 -0
- package/dist/connectors/types.js +13 -0
- package/dist/connectors/types.js.map +1 -0
- package/dist/index.js +37 -4
- package/dist/index.js.map +1 -1
- package/dist/session/process.d.ts +23 -0
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +97 -4
- package/dist/session/process.js.map +1 -1
- package/dist/types.d.ts +46 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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,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,W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
|
|
42
42
|
const http = __importStar(require("http"));
|
|
43
43
|
const os = __importStar(require("os"));
|
|
44
44
|
const path = __importStar(require("path"));
|
|
45
|
+
const config_write_lock_1 = require("../config/config-write-lock");
|
|
45
46
|
const logger_1 = require("../logger");
|
|
46
47
|
const process_1 = require("../session/process");
|
|
47
48
|
const store_1 = require("../session/store");
|
|
@@ -55,6 +56,7 @@ const skills_1 = require("../skills");
|
|
|
55
56
|
const builtin_commands_1 = require("./builtin-commands");
|
|
56
57
|
const model_catalog_1 = require("./model-catalog");
|
|
57
58
|
const safe_mode_1 = require("./safe-mode");
|
|
59
|
+
const config_1 = require("./skill-learning/config");
|
|
58
60
|
const turn_stream_1 = require("./turn-stream");
|
|
59
61
|
const recovery_executor_1 = require("./recovery-executor");
|
|
60
62
|
const recovery_policy_1 = require("./recovery-policy");
|
|
@@ -67,6 +69,7 @@ const db_1 = require("../history/db");
|
|
|
67
69
|
const media_store_1 = require("../history/media-store");
|
|
68
70
|
const cleanup_1 = require("../history/cleanup");
|
|
69
71
|
const knowledge_1 = require("./knowledge");
|
|
72
|
+
const resolve_1 = require("../connectors/resolve");
|
|
70
73
|
const DEFAULT_IDLE_TIMEOUT_MINUTES = 30;
|
|
71
74
|
const DEFAULT_MAX_CONCURRENT = 20;
|
|
72
75
|
const ANTHROPIC_SOCKET_ERROR = 'socket connection was closed unexpectedly';
|
|
@@ -908,17 +911,22 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
908
911
|
}
|
|
909
912
|
/**
|
|
910
913
|
* Persist the current model to config.json using atomic write (tmp + rename).
|
|
914
|
+
*
|
|
915
|
+
* Runs under the process-wide config write lock: the read and the rename below are
|
|
916
|
+
* synchronous and so cannot interleave with each other, but without the lock they
|
|
917
|
+
* can still land between an async writer's read and its own rename — dropping this
|
|
918
|
+
* model change, or being dropped by it. See config/config-write-lock.ts.
|
|
911
919
|
*/
|
|
912
920
|
persistModelToConfig(newModel) {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
agent
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
}
|
|
921
|
+
return (0, config_write_lock_1.withConfigWriteLock)(this.configPath, () => {
|
|
922
|
+
const raw = fs.readFileSync(this.configPath, 'utf-8');
|
|
923
|
+
const config = JSON.parse(raw);
|
|
924
|
+
const agent = config.agents?.find((a) => a.id === this.agentConfig.id);
|
|
925
|
+
if (agent) {
|
|
926
|
+
agent.claude.model = newModel;
|
|
927
|
+
(0, config_write_lock_1.writeConfigAtomicSync)(this.configPath, config);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
922
930
|
}
|
|
923
931
|
static escapeXmlAttr(value) {
|
|
924
932
|
return value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
|
@@ -1173,12 +1181,23 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
1173
1181
|
const refs = (p.image_refs ?? []).filter((r) => typeof r === 'string' && r.trim().length > 0);
|
|
1174
1182
|
if (!attrs.length && !refs.length)
|
|
1175
1183
|
return '';
|
|
1184
|
+
// Make the model authoritative, mirroring the explicit-selection wording used
|
|
1185
|
+
// for reference images below. The composer dropdown is the user's explicit
|
|
1186
|
+
// choice, but the generate_image schema lets the agent pick its own model; when
|
|
1187
|
+
// the model isn't nailed down the agent falls back to action="list" and
|
|
1188
|
+
// self-selects a different one (the composer selection is then silently ignored).
|
|
1189
|
+
const modelNote = p.model
|
|
1190
|
+
? `The user explicitly SELECTED model="${AgentRunner.escapeXmlAttr(p.model)}" in the composer. ` +
|
|
1191
|
+
`Call generate_image with that exact model — do NOT call action="list" to second-guess an ` +
|
|
1192
|
+
`explicit selection or substitute a different model.\n`
|
|
1193
|
+
: '';
|
|
1176
1194
|
if (!refs.length) {
|
|
1177
1195
|
return (`<image-params ${attrs.join(' ')} />\n` +
|
|
1178
1196
|
`The user selected the image-generation options above in the composer. When the request ` +
|
|
1179
1197
|
`involves creating or editing an image, call the generate_image tool (action="generate") ` +
|
|
1180
1198
|
`using these values (pass image_ref as the "image" argument for image-to-image), then ` +
|
|
1181
|
-
`deliver the returned image with your reply tool.\n`
|
|
1199
|
+
`deliver the returned image with your reply tool.\n` +
|
|
1200
|
+
modelNote);
|
|
1182
1201
|
}
|
|
1183
1202
|
// Explicitly selected reference images (#73). Rendered as nested elements so a
|
|
1184
1203
|
// ref containing separators (commas, quotes) stays unambiguous.
|
|
@@ -1193,6 +1212,7 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
1193
1212
|
`The user selected the image-generation options above in the composer. When the request ` +
|
|
1194
1213
|
`involves creating or editing an image, call the generate_image tool (action="generate") ` +
|
|
1195
1214
|
`using these values, then deliver the returned image with your reply tool.\n` +
|
|
1215
|
+
modelNote +
|
|
1196
1216
|
`The user explicitly SELECTED the reference image(s) listed above in the composer, in this order. ` +
|
|
1197
1217
|
`${passInstruction} Do NOT reinterpret which images they are, do NOT call list_refs to ` +
|
|
1198
1218
|
`second-guess an explicit selection, and do not drop any of them. ` +
|
|
@@ -2452,11 +2472,17 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
2452
2472
|
async restartOrDefer(opts) {
|
|
2453
2473
|
const skipBusy = opts?.skipBusy ?? false;
|
|
2454
2474
|
const deferIdle = opts?.deferIdle ?? false;
|
|
2475
|
+
const filter = opts?.filter;
|
|
2455
2476
|
let immediate = 0;
|
|
2456
2477
|
let deferred = 0;
|
|
2457
2478
|
let skipped = 0;
|
|
2458
2479
|
const toStopNow = [];
|
|
2459
2480
|
for (const [id, proc] of this.sessions) {
|
|
2481
|
+
// Not counted as `skipped`: that reports sessions this call declined to
|
|
2482
|
+
// restart even though they needed one (the skipBusy case). A session the
|
|
2483
|
+
// change does not reach at all was never a candidate.
|
|
2484
|
+
if (filter && !filter(proc))
|
|
2485
|
+
continue;
|
|
2460
2486
|
if (proc.isProcessing) {
|
|
2461
2487
|
if (skipBusy) {
|
|
2462
2488
|
skipped++;
|
|
@@ -2509,6 +2535,86 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
2509
2535
|
this.logger.info('restartOrDefer: sessions restarted', { immediate, deferred, skipped });
|
|
2510
2536
|
return { immediate, deferred, skipped };
|
|
2511
2537
|
}
|
|
2538
|
+
/**
|
|
2539
|
+
* Called after a connector's secret or definition changes: a connector was
|
|
2540
|
+
* connected, an external control plane pushed a fresh access_token for one it
|
|
2541
|
+
* owns (POST /oauth/receive), the background refresh sweep in
|
|
2542
|
+
* oauth-refresh-sweep.ts (invoked from gateway-router.ts's 60s interval)
|
|
2543
|
+
* rotated one, or a connector was deleted / had its refresh given up on.
|
|
2544
|
+
*
|
|
2545
|
+
* Restarts exactly the sessions whose own mcp-config no longer matches what
|
|
2546
|
+
* `connectorId` resolves to for this agent — see
|
|
2547
|
+
* SessionProcess.connectorConfigChanged, which owns that comparison. The
|
|
2548
|
+
* stdio MCP subprocess reads its env once at spawn (see writeMcpConfig), so
|
|
2549
|
+
* there is no way to hot-patch a running child; a session that IS affected
|
|
2550
|
+
* genuinely needs a respawn, and one that isn't must not be disrupted.
|
|
2551
|
+
*
|
|
2552
|
+
* `overlay` is merged over this runner's view of `gateway.customConnectors` —
|
|
2553
|
+
* and adopted into it, so the sessions restarted below respawn from the new
|
|
2554
|
+
* state rather than the one the watcher has not delivered yet (see the inline
|
|
2555
|
+
* note). Callers that have just written a connector entry need it:
|
|
2556
|
+
* config.json's watcher propagates asynchronously, so a route that creates a
|
|
2557
|
+
* connector and immediately asks what it resolves to would otherwise be
|
|
2558
|
+
* answered from a config snapshot taken before its own write. A `null` value
|
|
2559
|
+
* expresses the other half of that write — the entry was REMOVED — which a
|
|
2560
|
+
* merge alone cannot say. Deleting a connector whose owner is `'none'` has no
|
|
2561
|
+
* secrets to clear, so without it the stale snapshot still resolves the entry
|
|
2562
|
+
* to the identical fingerprint, nothing looks changed, and every live session
|
|
2563
|
+
* keeps the deleted MCP server connected and callable while the API reports it
|
|
2564
|
+
* gone.
|
|
2565
|
+
*
|
|
2566
|
+
* Deliberately takes no "the caller already decided" escape hatch. The delete
|
|
2567
|
+
* and give-up paths needed one while this asked whether the connector still
|
|
2568
|
+
* resolves — after `deleteSecrets` it never does, so the answer was always no
|
|
2569
|
+
* and the restart silently did nothing. Per-session comparison answers those
|
|
2570
|
+
* paths correctly on its own: resolving to nothing IS the change.
|
|
2571
|
+
*/
|
|
2572
|
+
async restartSessionsUsingConnector(connectorId, opts) {
|
|
2573
|
+
const overlay = opts?.overlay;
|
|
2574
|
+
const customConnectors = {
|
|
2575
|
+
...this.gatewayConfig?.gateway?.customConnectors,
|
|
2576
|
+
...overlay,
|
|
2577
|
+
};
|
|
2578
|
+
for (const [id, entry] of Object.entries(overlay ?? {})) {
|
|
2579
|
+
if (entry === null)
|
|
2580
|
+
delete customConnectors[id];
|
|
2581
|
+
}
|
|
2582
|
+
// Adopted into the config object, not just used for the comparison below.
|
|
2583
|
+
//
|
|
2584
|
+
// The overlay's whole purpose is that this runner's view of config.json is
|
|
2585
|
+
// older than the write the caller just made — and the sessions this method
|
|
2586
|
+
// restarts respawn from that same view: SessionProcess.writeMcpConfig reads
|
|
2587
|
+
// `gatewayConfig.gateway.customConnectors` at spawn (this is the very object
|
|
2588
|
+
// it was handed — see the constructor call above), so a session stopped
|
|
2589
|
+
// because a connector changed came back up with the pre-change connector
|
|
2590
|
+
// set. The watcher's 500ms debounce means that is the normal case, not a
|
|
2591
|
+
// narrow race: connect a connector and the agent respawns still without the
|
|
2592
|
+
// tool, delete one and it respawns still holding it.
|
|
2593
|
+
//
|
|
2594
|
+
// And it does not self-correct. The fresh spawn records the STALE resolution
|
|
2595
|
+
// as its fingerprint, so when the watcher finally lands nothing compares it
|
|
2596
|
+
// again — this method is the only caller of connectorConfigChanged, and it
|
|
2597
|
+
// has already run. The wrong config sticks until something unrelated
|
|
2598
|
+
// restarts the session.
|
|
2599
|
+
//
|
|
2600
|
+
// Mutating the config object is exactly what index.ts's `changes` handler
|
|
2601
|
+
// does to this same long-lived object on every reload, so this is the
|
|
2602
|
+
// established way to publish a config change to running runners rather than
|
|
2603
|
+
// a new mechanism. Idempotent across runners: they share the object, and
|
|
2604
|
+
// every one of them merges the same overlay onto it.
|
|
2605
|
+
if (overlay) {
|
|
2606
|
+
this.gatewayConfig.gateway.customConnectors =
|
|
2607
|
+
customConnectors;
|
|
2608
|
+
}
|
|
2609
|
+
const resolved = (0, resolve_1.resolveEnabledConnectors)(this.agentConfig, customConnectors, this.gatewayConfig?.gateway?.connectorsDefaultEnabled ?? true);
|
|
2610
|
+
const target = resolved[connectorId];
|
|
2611
|
+
const { immediate, deferred } = await this.restartOrDefer({
|
|
2612
|
+
skipBusy: false,
|
|
2613
|
+
deferIdle: true,
|
|
2614
|
+
filter: (proc) => proc.connectorConfigChanged(connectorId, target),
|
|
2615
|
+
});
|
|
2616
|
+
return { restarted: immediate + deferred > 0 };
|
|
2617
|
+
}
|
|
2512
2618
|
/**
|
|
2513
2619
|
* Format a timestamp as a human-readable age string (e.g. "5m ago", "2h ago").
|
|
2514
2620
|
*/
|
|
@@ -2703,6 +2809,7 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
2703
2809
|
}
|
|
2704
2810
|
async start() {
|
|
2705
2811
|
this.stopping = false;
|
|
2812
|
+
await this.sweepStaleSessionDirs();
|
|
2706
2813
|
await this.startCallbackServer();
|
|
2707
2814
|
if (this.agentConfig.telegram?.botToken) {
|
|
2708
2815
|
this.receiver = new receiver_1.TelegramReceiver(this.agentConfig, this.callbackPort, this.gatewayConfig.gateway.logDir);
|
|
@@ -2721,6 +2828,45 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
2721
2828
|
this._startCleanupScheduler();
|
|
2722
2829
|
this.logger.info('AgentRunner started', { agentId: this.agentConfig.id });
|
|
2723
2830
|
}
|
|
2831
|
+
/**
|
|
2832
|
+
* Remove any `.sessions/<id>/` directory not backed by a currently-live
|
|
2833
|
+
* `SessionProcess` — leftovers from a hard kill (SIGKILL, crash, host
|
|
2834
|
+
* reboot) that `SessionProcess.stop()`'s own cleanup never got to run for.
|
|
2835
|
+
* Each holds a `mcp-config.json` with fully-substituted secrets (channel
|
|
2836
|
+
* bot tokens, GATEWAY_API_KEY) that must not accumulate unbounded (#460).
|
|
2837
|
+
*
|
|
2838
|
+
* Called once per runner instance at the top of `start()`, before any of
|
|
2839
|
+
* this agent's own sessions exist yet, so `this.sessions` is normally
|
|
2840
|
+
* empty here — but the liveness check is real, not just a formality: skip
|
|
2841
|
+
* anything present in `this.sessions` regardless, rather than assuming
|
|
2842
|
+
* "start() always runs on an empty pool" and deleting unconditionally.
|
|
2843
|
+
*
|
|
2844
|
+
* Async (fsPromises) rather than sync fs calls: a first upgrade to this fix
|
|
2845
|
+
* can face a real backlog of leftovers accumulated before it existed, and
|
|
2846
|
+
* synchronous readdir/rm would block the event loop — and every other
|
|
2847
|
+
* agent's start() sharing this process — for the duration.
|
|
2848
|
+
*/
|
|
2849
|
+
async sweepStaleSessionDirs() {
|
|
2850
|
+
const sessionsRoot = path.join(this.agentConfig.workspace, '.sessions');
|
|
2851
|
+
let entries;
|
|
2852
|
+
try {
|
|
2853
|
+
entries = await fsPromises.readdir(sessionsRoot, { withFileTypes: true });
|
|
2854
|
+
}
|
|
2855
|
+
catch {
|
|
2856
|
+
return; // no .sessions directory yet — nothing to sweep
|
|
2857
|
+
}
|
|
2858
|
+
const liveSessionIds = new Set(Array.from(this.sessions.values(), (s) => s.sessionId));
|
|
2859
|
+
for (const entry of entries) {
|
|
2860
|
+
if (!entry.isDirectory() || liveSessionIds.has(entry.name))
|
|
2861
|
+
continue;
|
|
2862
|
+
try {
|
|
2863
|
+
await fsPromises.rm(path.join(sessionsRoot, entry.name), { recursive: true, force: true });
|
|
2864
|
+
}
|
|
2865
|
+
catch {
|
|
2866
|
+
/* best-effort cleanup — a stubborn leftover isn't worth failing boot over */
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2724
2870
|
updateAgentConfig(newConfig) {
|
|
2725
2871
|
this.agentConfig = newConfig;
|
|
2726
2872
|
// Restart LineReplyManager if the LINE config changed so the live instance
|
|
@@ -2862,7 +3008,14 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
2862
3008
|
const gw = this.gatewayConfig.gateway;
|
|
2863
3009
|
const retentionDays = (0, cleanup_1.resolveRetentionDays)(this.agentConfig.history?.retentionDays, gw.history?.retentionDays);
|
|
2864
3010
|
const cleanupHour = gw.history?.cleanupHour ?? 0;
|
|
2865
|
-
|
|
3011
|
+
// Each precedence level is validated in turn — an invalid-but-present
|
|
3012
|
+
// cleanupTimezone does not count as "set" and falls through to gw.timezone
|
|
3013
|
+
// rather than jumping straight to UTC (issue #462 review).
|
|
3014
|
+
const cleanupTimezone = (0, config_1.isValidTimezone)(gw.history?.cleanupTimezone)
|
|
3015
|
+
? gw.history.cleanupTimezone
|
|
3016
|
+
: (0, config_1.isValidTimezone)(gw.timezone)
|
|
3017
|
+
? gw.timezone
|
|
3018
|
+
: 'UTC';
|
|
2866
3019
|
const agentMediaRoot = media_store_1.MediaStore.agentMediaRoot(this.agentsBaseDir, this.agentConfig.id);
|
|
2867
3020
|
const logPath = path.join(this.agentDir, 'cleanup.log');
|
|
2868
3021
|
this.cancelCleanup = (0, cleanup_1.scheduleCleanup)({
|
|
@@ -3896,7 +4049,7 @@ class AgentRunner extends events_1.EventEmitter {
|
|
|
3896
4049
|
// are validated by the upstream provider, not the local config list.
|
|
3897
4050
|
this.agentConfig.claude.model = newModel;
|
|
3898
4051
|
try {
|
|
3899
|
-
this.persistModelToConfig(newModel);
|
|
4052
|
+
await this.persistModelToConfig(newModel);
|
|
3900
4053
|
}
|
|
3901
4054
|
catch (err) {
|
|
3902
4055
|
this.logger.error('Failed to persist model to config', { error: err.message });
|