@songsid/agend 2.4.0-beta.15 → 2.4.0-beta.17
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/accounts-profiles.d.ts +1 -1
- package/dist/accounts-view.d.ts +3 -0
- package/dist/accounts-view.js.map +1 -1
- package/dist/auth-api.js +6 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.d.ts +15 -1
- package/dist/backend/claude-code.js +64 -8
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/kiro.js +6 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +8 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-command.d.ts +4 -2
- package/dist/backend-command.js +3 -0
- package/dist/backend-command.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +1 -0
- package/dist/browser-backend-signins.js +3 -1
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/classic-channel-manager.d.ts +1 -0
- package/dist/classic-channel-manager.js +4 -1
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/claude-credential-change.d.ts +22 -0
- package/dist/claude-credential-change.js +47 -0
- package/dist/claude-credential-change.js.map +1 -0
- package/dist/claude-credential-launch.d.ts +63 -0
- package/dist/claude-credential-launch.js +315 -0
- package/dist/claude-credential-launch.js.map +1 -0
- package/dist/claude-credential-runner.d.ts +1 -0
- package/dist/claude-credential-runner.js +56 -0
- package/dist/claude-credential-runner.js.map +1 -0
- package/dist/claude-credential-vault.d.ts +57 -0
- package/dist/claude-credential-vault.js +277 -0
- package/dist/claude-credential-vault.js.map +1 -0
- package/dist/claude-request-observation.d.ts +7 -0
- package/dist/claude-request-observation.js +26 -0
- package/dist/claude-request-observation.js.map +1 -0
- package/dist/claude-setup-token-transport.d.ts +9 -0
- package/dist/claude-setup-token-transport.js +82 -0
- package/dist/claude-setup-token-transport.js.map +1 -0
- package/dist/claude-setup-token.d.ts +51 -0
- package/dist/claude-setup-token.js +83 -0
- package/dist/claude-setup-token.js.map +1 -0
- package/dist/cli-audited.js +15 -12
- package/dist/cli-audited.js.map +1 -1
- package/dist/command-report.d.ts +11 -0
- package/dist/command-report.js +2 -0
- package/dist/command-report.js.map +1 -0
- package/dist/config-validator.js +9 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.js +65 -3
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +1 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +53 -2
- package/dist/fleet-manager.js +511 -22
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +25 -6
- package/dist/host-monitoring-config.d.ts +15 -0
- package/dist/host-monitoring-config.js +36 -0
- package/dist/host-monitoring-config.js.map +1 -0
- package/dist/host-monitoring-history-files.d.ts +2 -0
- package/dist/host-monitoring-history-files.js +16 -0
- package/dist/host-monitoring-history-files.js.map +1 -0
- package/dist/host-monitoring-history-policy.d.ts +55 -0
- package/dist/host-monitoring-history-policy.js +93 -0
- package/dist/host-monitoring-history-policy.js.map +1 -0
- package/dist/host-monitoring-history-store.d.ts +52 -0
- package/dist/host-monitoring-history-store.js +176 -0
- package/dist/host-monitoring-history-store.js.map +1 -0
- package/dist/host-monitoring-history-worker.d.ts +1 -0
- package/dist/host-monitoring-history-worker.js +50 -0
- package/dist/host-monitoring-history-worker.js.map +1 -0
- package/dist/host-monitoring-history.d.ts +71 -0
- package/dist/host-monitoring-history.js +265 -0
- package/dist/host-monitoring-history.js.map +1 -0
- package/dist/host-monitoring-platform.d.ts +73 -0
- package/dist/host-monitoring-platform.js +273 -0
- package/dist/host-monitoring-platform.js.map +1 -0
- package/dist/host-monitoring-runtime.d.ts +34 -0
- package/dist/host-monitoring-runtime.js +80 -0
- package/dist/host-monitoring-runtime.js.map +1 -0
- package/dist/host-monitoring-settings-store.d.ts +5 -0
- package/dist/host-monitoring-settings-store.js +49 -0
- package/dist/host-monitoring-settings-store.js.map +1 -0
- package/dist/host-monitoring.d.ts +106 -0
- package/dist/host-monitoring.js +157 -0
- package/dist/host-monitoring.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/instance-config-impact.js +1 -1
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instructions.js +1 -0
- package/dist/instructions.js.map +1 -1
- package/dist/locale.d.ts +2 -0
- package/dist/locale.js +13 -1
- package/dist/locale.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/profile-signins.d.ts +1 -0
- package/dist/profile-signins.js +3 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/public-web-gateway.js +6 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +21 -2
- package/dist/public-web-link.js +22 -2
- package/dist/public-web-link.js.map +1 -1
- package/dist/runtime-cli-install.js +17 -16
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/settings-api.d.ts +15 -0
- package/dist/settings-api.js +154 -8
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +1 -0
- package/dist/settings-baseline.js +5 -4
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.js +10 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.d.ts +2 -0
- package/dist/settings-effect.js +15 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/topic-commands.d.ts +7 -1
- package/dist/topic-commands.js +98 -88
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.d.ts +1 -0
- package/dist/transcript-monitor.js +18 -0
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/ui/accounts-view.js +16 -8
- package/dist/ui/backend-signin.js +3 -1
- package/dist/ui/chat-commands.js +2 -0
- package/dist/ui/chat-popout-transport.js +49 -19
- package/dist/ui/chat-popout.js +15 -1
- package/dist/ui/chat-store.js +1 -1
- package/dist/ui/claude-credentials.js +123 -0
- package/dist/ui/claude-setup-token.js +36 -0
- package/dist/ui/contact-auth-client.js +7 -2
- package/dist/ui/contact-auth-strings.js +45 -14
- package/dist/ui/contact-authorizations.js +47 -26
- package/dist/ui/contact-needs.js +4 -4
- package/dist/ui/fleet-canvas.js +3 -2
- package/dist/ui/fleet-office-card.js +414 -41
- package/dist/ui/fleet-office-dialogue.js +3 -3
- package/dist/ui/fleet-office-pack.d.ts +67 -1
- package/dist/ui/fleet-office-pack.js +412 -18
- package/dist/ui/fleet-office-play.js +401 -3
- package/dist/ui/fleet-office-skin.js +133 -21
- package/dist/ui/fleet-office-store.js +41 -0
- package/dist/ui/fleet-office-zones.js +34 -9
- package/dist/ui/fleet-office.js +513 -62
- package/dist/ui/host-health-model.js +42 -0
- package/dist/ui/host-health.js +74 -0
- package/dist/ui/office-share-page.js +5 -1
- package/dist/ui/panel-chat.js +146 -46
- package/dist/ui/panel-fleet.js +24 -11
- package/dist/ui/panel-hub.js +5 -1
- package/dist/ui/panel-settings.js +5 -4
- package/dist/ui/preview-popout.js +134 -0
- package/dist/ui/reply-file-preview.js +1 -1
- package/dist/ui/search-dialog.js +8 -1
- package/dist/ui/settings-capabilities.js +2 -0
- package/dist/ui/settings-host-monitoring.js +69 -0
- package/dist/ui/settings-registry.js +4 -1
- package/dist/ui/settings-shared.js +3 -2
- package/dist/ui/shared/accounts.css +8 -4
- package/dist/ui/shared/agent-sheet.js +5 -2
- package/dist/ui/shared/app-route.js +1 -1
- package/dist/ui/shared/app.css +248 -27
- package/dist/ui/shared/app.js +8 -1
- package/dist/ui/shared/chat-strings.js +10 -4
- package/dist/ui/shared/chat-thread.js +42 -10
- package/dist/ui/shared/info-tip.js +64 -0
- package/dist/ui/shared/instance-nav.js +47 -5
- package/dist/ui/shared/jump-idle.js +36 -0
- package/dist/ui/shared/office-dialogue.css +12 -0
- package/dist/ui/shared/preview-panel.js +44 -18
- package/dist/ui/shared/preview-popout.css +11 -0
- package/dist/ui/shared/theme.js +15 -1
- package/dist/ui/shared/ui-menu.js +17 -11
- package/dist/ui/shared/usage-dialog.js +9 -34
- package/dist/ui/shared/view-strings.js +2 -0
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +1 -1
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/providers.d.ts +1 -0
- package/dist/usage/providers.js +14 -1
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.js +5 -2
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +6 -1
- package/dist/web-api.js +83 -9
- package/dist/web-api.js.map +1 -1
- package/dist/web-chat-history.d.ts +7 -1
- package/dist/web-chat-history.js +19 -3
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-claude-credentials.d.ts +31 -0
- package/dist/web-claude-credentials.js +138 -0
- package/dist/web-claude-credentials.js.map +1 -0
- package/dist/web-commands.d.ts +5 -2
- package/dist/web-commands.js +4 -2
- package/dist/web-commands.js.map +1 -1
- package/dist/web-office-skins.d.ts +7 -2
- package/dist/web-office-skins.js +42 -16
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-session.d.ts +20 -1
- package/dist/web-session.js +27 -0
- package/dist/web-session.js.map +1 -1
- package/dist/web-shell-routes.d.ts +1 -1
- package/dist/web-shell-routes.js +1 -1
- package/dist/web-shell-routes.js.map +1 -1
- package/dist/web-terminal.d.ts +4 -0
- package/dist/web-terminal.js +16 -1
- package/dist/web-terminal.js.map +1 -1
- package/package.json +1 -1
package/dist/settings-api.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HOST_MONITORING_PAGE_AVAILABLE, monitoringConfig, parseMonitoringSettings } from "./host-monitoring-config.js";
|
|
1
2
|
import { hubPageSharingSettings, parseHubPageSharing } from "./hub-page-sharing-settings.js";
|
|
2
3
|
import { handleHubWebInitHttp } from "./hub/init/web-http.js";
|
|
3
4
|
import { connectInstallInfo } from "./connect/install.js";
|
|
@@ -66,6 +67,7 @@ import yaml from "js-yaml";
|
|
|
66
67
|
import { parseDocument } from "yaml";
|
|
67
68
|
import { isDeepStrictEqual } from "node:util";
|
|
68
69
|
import { classicProfile, normalizeBackendOptions } from "./classic-bindings.js";
|
|
70
|
+
import { modelNameCarried } from "./backend-command.js";
|
|
69
71
|
import { channelWithDefaults } from "./config.js";
|
|
70
72
|
import { KNOWN_BACKENDS, validateFleetConfig, validateClassicBotConfig } from "./config-validator.js";
|
|
71
73
|
import { clearPausedMarker } from "./pause-marker.js";
|
|
@@ -242,19 +244,19 @@ function spliceChangedLines(original, base, edited) {
|
|
|
242
244
|
* edit wins, and nothing is restarted for it); the room is restarted only by this operation's own receipt, never over
|
|
243
245
|
* a runtime someone else has stopped or started meanwhile.
|
|
244
246
|
*/
|
|
245
|
-
async function rollBackClassicProfile(ctx, key, instanceName, paths, undo, op, cause) {
|
|
247
|
+
async function rollBackClassicProfile(ctx, key, instanceName, paths, undo, op, cause, choice = "account", fields = "backend_options", next = "new account") {
|
|
246
248
|
const failed = `The room's restart failed (${cause})`;
|
|
247
249
|
try {
|
|
248
250
|
const retained = undoSettingsPaths(classicPath(ctx), readClassic(ctx), undo);
|
|
249
251
|
if (retained.conflicts) {
|
|
250
252
|
ctx.logger.warn({ key, instanceName }, "update_instance_config: classicBot.yaml changed meanwhile; the newer account is kept");
|
|
251
|
-
return `${failed}. Its
|
|
253
|
+
return `${failed}. Its ${choice} was not put back: classicBot.yaml was changed again meanwhile, and that newer change is kept. Check the room.`;
|
|
252
254
|
}
|
|
253
255
|
writeClassicLeaves(ctx, retained.value, paths);
|
|
254
256
|
}
|
|
255
257
|
catch (rollbackErr) {
|
|
256
258
|
ctx.logger.error({ err: rollbackErr, key }, "update_instance_config: failed to roll back classicBot.yaml");
|
|
257
|
-
return `${failed}, and classicBot.yaml could not be put back (${rollbackErr.message}). The room's
|
|
259
|
+
return `${failed}, and classicBot.yaml could not be put back (${rollbackErr.message}). The room's ${fields} may still name the ${next}. Check the room.`;
|
|
258
260
|
}
|
|
259
261
|
let recovery;
|
|
260
262
|
try {
|
|
@@ -262,11 +264,90 @@ async function rollBackClassicProfile(ctx, key, instanceName, paths, undo, op, c
|
|
|
262
264
|
}
|
|
263
265
|
catch (recoveryErr) {
|
|
264
266
|
ctx.logger.error({ err: recoveryErr, instanceName }, "update_instance_config: failed to restore the classic room after rollback");
|
|
265
|
-
return `${failed}. Its
|
|
267
|
+
return `${failed}. Its ${choice} was put back in classicBot.yaml, but starting the room on it failed too (${recoveryErr.message}). Check the room.`;
|
|
266
268
|
}
|
|
267
|
-
return recovery === "restarted" ? `${failed}, so its
|
|
268
|
-
: recovery === "not-running" ? `${failed}. Its
|
|
269
|
-
: `${failed}. Its
|
|
269
|
+
return recovery === "restarted" ? `${failed}, so its ${choice} was put back and the room was started on it again.`
|
|
270
|
+
: recovery === "not-running" ? `${failed}. Its ${choice} was put back in classicBot.yaml; the room was not running.`
|
|
271
|
+
: `${failed}. Its ${choice} was put back in classicBot.yaml. The room was not restarted: it was stopped or started by something else meanwhile.`;
|
|
272
|
+
}
|
|
273
|
+
/** A confirmed room /backend uses Settings' leaf writer, account gate, undo and owned restart. */
|
|
274
|
+
export async function switchClassicRoomBackend(ctx, target, plan, from, current) {
|
|
275
|
+
if (!current())
|
|
276
|
+
return { ok: false, error: "The room changed. Open /backend again." };
|
|
277
|
+
if (!KNOWN_BACKENDS.includes(plan.backend) || plan.backend === "mock"
|
|
278
|
+
|| (plan.model !== null && !modelNameCarried(plan.backend, plan.model))
|
|
279
|
+
|| (plan.effort !== null && !/^(low|medium|high|xhigh|max)$/.test(plan.effort))) {
|
|
280
|
+
return { ok: false, error: "Invalid backend, model or effort" };
|
|
281
|
+
}
|
|
282
|
+
const record = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
283
|
+
let classic;
|
|
284
|
+
try {
|
|
285
|
+
classic = readClassic(ctx);
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
return { ok: false, error: error.message };
|
|
289
|
+
}
|
|
290
|
+
if (!record(classic.channels))
|
|
291
|
+
return { ok: false, error: "ClassicBot room not found" };
|
|
292
|
+
const entries = Object.entries(classic.channels).filter(([key, room]) => {
|
|
293
|
+
if (!record(room) || (room.instanceName !== undefined && room.instanceName !== target.instanceName))
|
|
294
|
+
return false;
|
|
295
|
+
const separator = key.lastIndexOf("#");
|
|
296
|
+
const channelId = room.channelId ?? (separator < 0 ? key : key.slice(0, separator));
|
|
297
|
+
const adapterId = room.adapterId ?? (separator < 0 ? undefined : key.slice(separator + 1));
|
|
298
|
+
return channelId === target.channelId && (adapterId === undefined || adapterId === target.adapterId);
|
|
299
|
+
});
|
|
300
|
+
if (entries.length !== 1)
|
|
301
|
+
return { ok: false, error: "ClassicBot room not found or ambiguous" };
|
|
302
|
+
const [key, value] = entries[0], room = value;
|
|
303
|
+
const defaults = record(classic.defaults) ? classic.defaults : {};
|
|
304
|
+
const backend = String(room.backend ?? defaults.backend ?? ctx.fleetConfig?.defaults?.backend ?? "claude-code");
|
|
305
|
+
if (backend !== from)
|
|
306
|
+
return { ok: false, error: "The room's backend changed. Open /backend again." };
|
|
307
|
+
const previous = structuredClone(classic), merged = { ...room, backend: plan.backend };
|
|
308
|
+
for (const field of ["model", "effort"]) {
|
|
309
|
+
if (plan[field] === null)
|
|
310
|
+
delete merged[field];
|
|
311
|
+
else
|
|
312
|
+
merged[field] = plan[field];
|
|
313
|
+
}
|
|
314
|
+
// Keep every backend's saved options; equal profile names on different CLIs are different accounts.
|
|
315
|
+
const binding = classicProfile(normalizeBackendOptions(merged.backend_options).options, ctx.fleetConfig?.defaults?.backend_options, plan.backend);
|
|
316
|
+
if (binding.state === "invalid")
|
|
317
|
+
return { ok: false, error: `Invalid credential_profile: ${binding.reason}` };
|
|
318
|
+
if (binding.state === "profile") {
|
|
319
|
+
const login = signedOutCredentialProfile(ctx.dataDir, plan.backend, binding.name);
|
|
320
|
+
if (login)
|
|
321
|
+
return { ok: false, error: `The ${plan.backend} account "${binding.name}" is not signed in.\n${login.loginCommand}` };
|
|
322
|
+
}
|
|
323
|
+
classic.channels[key] = merged;
|
|
324
|
+
const before = new Set(validateClassicBotConfig(previous).errors.map(issueKey));
|
|
325
|
+
const introduced = validateClassicBotConfig(classic).errors.filter(issue => !before.has(issueKey(issue)));
|
|
326
|
+
if (introduced.length)
|
|
327
|
+
return { ok: false, error: `Rejected: ${introduced.map(issue => `${issue.path}: ${issue.message}`).join("; ")}` };
|
|
328
|
+
if (!ctx.beginClassicSettingsRestart)
|
|
329
|
+
return { ok: false, error: "This fleet cannot restart a ClassicBot room here" };
|
|
330
|
+
if (!current())
|
|
331
|
+
return { ok: false, error: "The room changed. Open /backend again." };
|
|
332
|
+
const fields = ["backend", "model", "effort"], paths = fields.map(field => ["channels", key, field]);
|
|
333
|
+
const op = ctx.beginClassicSettingsRestart(target.instanceName, fields);
|
|
334
|
+
try {
|
|
335
|
+
writeClassicLeaves(ctx, classic, paths);
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
op.close();
|
|
339
|
+
return { ok: false, error: "Failed to write classicBot.yaml" };
|
|
340
|
+
}
|
|
341
|
+
const undo = settingsUndo(classicPath(ctx), previous, classic, paths);
|
|
342
|
+
try {
|
|
343
|
+
await op.restart();
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
op.close();
|
|
347
|
+
return { ok: false, error: await rollBackClassicProfile(ctx, key, target.instanceName, paths, undo, op, error.message, "backend choice", "backend/model/effort", "new settings") };
|
|
348
|
+
}
|
|
349
|
+
op.close();
|
|
350
|
+
return { ok: true };
|
|
270
351
|
}
|
|
271
352
|
/**
|
|
272
353
|
* #3715 (M-2961): `update_instance_config` on a ClassicBot room may change its AI account and nothing else —
|
|
@@ -585,6 +666,8 @@ export function handleSettingsRequest(req, res, url, ctx) {
|
|
|
585
666
|
if (method === "GET" && path === "/api/settings/schema") {
|
|
586
667
|
json(res, 200, {
|
|
587
668
|
...buildSettingsImpactSchema(),
|
|
669
|
+
host_monitoring: ctx.hostMonitoringAvailable?.() === true,
|
|
670
|
+
host_monitoring_page: HOST_MONITORING_PAGE_AVAILABLE,
|
|
588
671
|
reply_triggers_default: DEFAULT_REPLY_TRIGGERS,
|
|
589
672
|
// Non-null means a restart cannot clear the fleet row, so the page shows
|
|
590
673
|
// the mismatch instead of offering a button that can never succeed.
|
|
@@ -603,7 +686,7 @@ export function handleSettingsRequest(req, res, url, ctx) {
|
|
|
603
686
|
return true;
|
|
604
687
|
}
|
|
605
688
|
if (method === "GET" && path === "/api/settings/fleet") {
|
|
606
|
-
json(res, 200, redactInlineSecrets(ctx.fleetConfig ?? {}));
|
|
689
|
+
json(res, 200, redactInlineSecrets(ctx.fleetConfig ? { ...ctx.fleetConfig, monitoring: ctx.hostMonitoringSettings?.() ?? ctx.fleetConfig.monitoring } : {}));
|
|
607
690
|
return true;
|
|
608
691
|
}
|
|
609
692
|
if (method === "GET" && path === "/api/settings/fleet/raw") {
|
|
@@ -1933,6 +2016,62 @@ export function handleSettingsRequest(req, res, url, ctx) {
|
|
|
1933
2016
|
json(res, 405, { error: "method_not_allowed" });
|
|
1934
2017
|
return true;
|
|
1935
2018
|
}
|
|
2019
|
+
// M-3454: settings are inert until the collector slice is connected. False
|
|
2020
|
+
// values are always written, including the untouched companion preference.
|
|
2021
|
+
if (method === "PUT" && path === "/api/settings/fleet/monitoring") {
|
|
2022
|
+
if (linkNonAdmin(req, url, ctx)) {
|
|
2023
|
+
json(res, 403, { error: "admin_required" });
|
|
2024
|
+
return true;
|
|
2025
|
+
}
|
|
2026
|
+
if (!cfg) {
|
|
2027
|
+
json(res, 503, { error: "fleet not loaded" });
|
|
2028
|
+
return true;
|
|
2029
|
+
}
|
|
2030
|
+
void readBody(req, 4096).then(buf => {
|
|
2031
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
2032
|
+
return;
|
|
2033
|
+
let body;
|
|
2034
|
+
try {
|
|
2035
|
+
body = JSON.parse(buf.toString("utf8"));
|
|
2036
|
+
}
|
|
2037
|
+
catch {
|
|
2038
|
+
return json(res, 400, { error: "invalid JSON" });
|
|
2039
|
+
}
|
|
2040
|
+
const parsed = parseMonitoringSettings(body);
|
|
2041
|
+
if ("error" in parsed)
|
|
2042
|
+
return json(res, 400, { error: parsed.error });
|
|
2043
|
+
const monitoring = { ...monitoringConfig(cfg.monitoring), ...parsed.patch };
|
|
2044
|
+
if (monitoring.enabled && ctx.hostMonitoringAvailable?.() !== true)
|
|
2045
|
+
return json(res, 409, { error: "monitoring_unavailable" });
|
|
2046
|
+
const before = validateFleet(cfg), after = validateFleet({ ...cfg, monitoring });
|
|
2047
|
+
if (rejectIfWorse(res, before, after))
|
|
2048
|
+
return;
|
|
2049
|
+
const previous = { value: cfg.monitoring, had: Object.hasOwn(cfg, "monitoring") };
|
|
2050
|
+
try {
|
|
2051
|
+
settingsWrite(req, () => {
|
|
2052
|
+
if (ctx.saveHostMonitoringSettings)
|
|
2053
|
+
ctx.saveHostMonitoringSettings(parsed.patch);
|
|
2054
|
+
else {
|
|
2055
|
+
if (Object.hasOwn(parsed.patch, 'wsl_drive'))
|
|
2056
|
+
throw Error('monitoring_sidecar_unavailable');
|
|
2057
|
+
cfg.monitoring = monitoringConfig(monitoring);
|
|
2058
|
+
ctx.saveFleetConfig(Object.entries(cfg.monitoring).map(([key, value]) => ({ path: ['monitoring', key], value })));
|
|
2059
|
+
}
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
catch (error) {
|
|
2063
|
+
if (previous.had)
|
|
2064
|
+
cfg.monitoring = previous.value;
|
|
2065
|
+
else
|
|
2066
|
+
delete cfg.monitoring;
|
|
2067
|
+
ctx.logger.warn({ error }, "settings: monitoring save refused");
|
|
2068
|
+
return json(res, 500, { error: "monitoring_save_failed" });
|
|
2069
|
+
}
|
|
2070
|
+
json(res, 200, { ok: true, monitoring: ctx.hostMonitoringSettings?.() ?? monitoringConfig(monitoring) });
|
|
2071
|
+
}).catch(() => { if (!res.headersSent)
|
|
2072
|
+
json(res, 400, { error: "bad request" }); });
|
|
2073
|
+
return true;
|
|
2074
|
+
}
|
|
1936
2075
|
// ── M-2255: Settings → Runtime's switches — "Use this PC's Windows CLIs" (runtimes.windows_cli) and "Allow other
|
|
1937
2076
|
// Windows computers to pair" (runtimes.remote_runtime). Off by default; the environment overrides them (said here).
|
|
1938
2077
|
// M-3278: over the public link too, for its admin session. Switching one on is confirmed by a General admin (settings-change.ts); off applies at once.
|
|
@@ -2583,6 +2722,7 @@ export function handleSettingsRequest(req, res, url, ctx) {
|
|
|
2583
2722
|
const allowed = new Set([
|
|
2584
2723
|
"backend",
|
|
2585
2724
|
"model",
|
|
2725
|
+
"effort",
|
|
2586
2726
|
"auto_pause_after",
|
|
2587
2727
|
"collab",
|
|
2588
2728
|
"reply_triggers",
|
|
@@ -2602,6 +2742,10 @@ export function handleSettingsRequest(req, res, url, ctx) {
|
|
|
2602
2742
|
}
|
|
2603
2743
|
if (body.model !== undefined && body.model !== null && typeof body.model !== "string")
|
|
2604
2744
|
return json(res, 400, { error: "model must be a string" });
|
|
2745
|
+
if (body.effort !== undefined && body.effort !== null
|
|
2746
|
+
&& (typeof body.effort !== "string" || !/^(low|medium|high|xhigh|max)$/.test(body.effort))) {
|
|
2747
|
+
return json(res, 400, { error: "effort must be low, medium, high, xhigh, or max" });
|
|
2748
|
+
}
|
|
2605
2749
|
if (body.auto_pause_after !== undefined && body.auto_pause_after !== null
|
|
2606
2750
|
&& (typeof body.auto_pause_after !== "number" || !Number.isFinite(body.auto_pause_after) || body.auto_pause_after < 0)) {
|
|
2607
2751
|
return json(res, 400, { error: "auto_pause_after must be a non-negative finite number" });
|
|
@@ -2657,6 +2801,8 @@ export function handleSettingsRequest(req, res, url, ctx) {
|
|
|
2657
2801
|
const merged = { ...current, ...body };
|
|
2658
2802
|
if (body.model === null || body.model === "")
|
|
2659
2803
|
delete merged.model;
|
|
2804
|
+
if (body.effort === null)
|
|
2805
|
+
delete merged.effort;
|
|
2660
2806
|
if (body.auto_pause_after === null)
|
|
2661
2807
|
delete merged.auto_pause_after;
|
|
2662
2808
|
if (body.tool_progress === null)
|