@songsid/agend 2.4.0-alpha.1 → 2.4.0-alpha.2
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 +1 -1
- package/README.zh-TW.md +1 -1
- package/dist/agent-whats-new.js +2 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.js +3 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.js +4 -0
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/types.d.ts +6 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +1 -1
- package/dist/backend-availability.js +28 -1
- package/dist/backend-availability.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +7 -1
- package/dist/browser-backend-signins.js +8 -4
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/config-validator.js +47 -7
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.d.ts +3 -0
- package/dist/daemon.js +4 -0
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +33 -4
- package/dist/fleet-manager.js +143 -61
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -0
- package/dist/hub/audit/index.js +12 -5
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/catalog.d.ts +6 -0
- package/dist/hub/catalog.js +14 -4
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.js +2 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +2 -0
- package/dist/hub/compose/member.js +11 -2
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.js +2 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/enrolment-code.d.ts +126 -0
- package/dist/hub/enrolment-code.js +266 -0
- package/dist/hub/enrolment-code.js.map +1 -0
- package/dist/hub/group-policy/admin-impact.js +4 -2
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.js +6 -6
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +16 -2
- package/dist/hub/group-policy/authorization.js +69 -5
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.js +3 -3
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +40 -1
- package/dist/hub/group-policy/resources.js +51 -13
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +6 -0
- package/dist/hub/group-policy/store.js +49 -4
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/http/compose.js +30 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/init/text.js +2 -2
- package/dist/hub/init/text.js.map +1 -1
- package/dist/hub/init/web.d.ts +7 -0
- package/dist/hub/init/web.js +6 -1
- package/dist/hub/init/web.js.map +1 -1
- package/dist/hub/join/local.d.ts +27 -0
- package/dist/hub/join/local.js +70 -5
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/join/receipt.d.ts +1 -0
- package/dist/hub/join/receipt.js +1 -1
- package/dist/hub/join/receipt.js.map +1 -1
- package/dist/hub/join/service.d.ts +92 -6
- package/dist/hub/join/service.js +199 -28
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/join/store.d.ts +2 -1
- package/dist/hub/join/store.js +7 -7
- package/dist/hub/join/store.js.map +1 -1
- package/dist/hub/member/exposure-api.d.ts +2 -0
- package/dist/hub/member/exposure-api.js +3 -2
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +4 -0
- package/dist/hub/member/exposures.js +12 -2
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/pairing-notices.js +8 -6
- package/dist/hub/member/pairing-notices.js.map +1 -1
- package/dist/hub/pairing-notices.d.ts +5 -2
- package/dist/hub/pairing-notices.js +38 -13
- package/dist/hub/pairing-notices.js.map +1 -1
- package/dist/hub/pairing.d.ts +7 -2
- package/dist/hub/protocol.d.ts +47 -0
- package/dist/hub/protocol.js +3 -1
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/server.js +15 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/types.d.ts +12 -4
- package/dist/hub-pairing-summary.js +1 -1
- package/dist/hub-pairing-summary.js.map +1 -1
- package/dist/instance-config-impact.js +4 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.js +4 -0
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +6 -2
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +62 -6
- package/dist/log-service.js +135 -28
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps-agy-grok.d.ts +74 -0
- package/dist/log-steps-agy-grok.js +440 -0
- package/dist/log-steps-agy-grok.js.map +1 -0
- package/dist/log-steps.d.ts +62 -3
- package/dist/log-steps.js +188 -22
- package/dist/log-steps.js.map +1 -1
- package/dist/log-transcript-paths.d.ts +29 -0
- package/dist/log-transcript-paths.js +109 -0
- package/dist/log-transcript-paths.js.map +1 -0
- package/dist/login-controller.d.ts +17 -3
- package/dist/login-controller.js +57 -5
- package/dist/login-controller.js.map +1 -1
- package/dist/login-window-lock.d.ts +20 -8
- package/dist/login-window-lock.js +35 -16
- package/dist/login-window-lock.js.map +1 -1
- package/dist/outbound-handlers.d.ts +14 -0
- package/dist/outbound-handlers.js +49 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/profile-signins.d.ts +2 -0
- package/dist/profile-signins.js +1 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/settings-api.d.ts +34 -0
- package/dist/settings-api.js +184 -6
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +38 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +14 -0
- package/dist/settings-effect.js.map +1 -1
- package/dist/tool-progress.d.ts +7 -0
- package/dist/tool-progress.js +21 -9
- package/dist/tool-progress.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/ui/accounts-view.js +14 -4
- package/dist/ui/agent-details-settings.js +2 -2
- package/dist/ui/agent-page-strings.js +2 -2
- package/dist/ui/backend-signin.js +47 -14
- package/dist/ui/chat-activity-groups.js +225 -0
- package/dist/ui/chat-activity.js +355 -0
- package/dist/ui/chat-popout-header.js +35 -0
- package/dist/ui/chat-popout-transport.js +80 -0
- package/dist/ui/chat-popout.js +63 -0
- package/dist/ui/chat-quote.js +3 -1
- package/dist/ui/chat-store.js +45 -4
- package/dist/ui/chat-workspace-gestures.js +177 -0
- package/dist/ui/chat-workspace-navigation.js +34 -10
- package/dist/ui/chat-workspace.js +96 -32
- package/dist/ui/host-install.js +2 -2
- package/dist/ui/hub-agent-copy.js +7 -7
- package/dist/ui/hub-chat-strings.js +3 -3
- package/dist/ui/hub-client.js +77 -17
- package/dist/ui/hub-company-join-strings.js +12 -10
- package/dist/ui/hub-company-join.js +52 -39
- package/dist/ui/hub-confirm-place.js +44 -0
- package/dist/ui/hub-directory-editor-strings.js +3 -3
- package/dist/ui/hub-directory-notice-strings.js +1 -1
- package/dist/ui/hub-enrolment-code-strings.js +44 -0
- package/dist/ui/hub-enrolment-code.js +159 -0
- package/dist/ui/hub-group-search.js +82 -0
- package/dist/ui/hub-group-strings.js +8 -8
- package/dist/ui/hub-join-approval.js +31 -0
- package/dist/ui/hub-join-code-input.js +66 -0
- package/dist/ui/hub-join-queue.js +62 -0
- package/dist/ui/hub-join-steps.js +231 -0
- package/dist/ui/hub-joincode-flow-strings.js +22 -0
- package/dist/ui/hub-owner-strings.js +9 -9
- package/dist/ui/hub-pairing-progress-strings.js +1 -1
- package/dist/ui/hub-quick-pairing.js +8 -4
- package/dist/ui/hub-quick-strings.js +11 -11
- package/dist/ui/hub-share-refused.js +17 -0
- package/dist/ui/hub-strings.js +61 -61
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/hub-welcome.js +26 -5
- package/dist/ui/image-annotate.js +283 -0
- package/dist/ui/image-lightbox.js +26 -6
- package/dist/ui/log-row.js +327 -0
- package/dist/ui/panel-chat.js +151 -12
- package/dist/ui/panel-details.js +14 -6
- package/dist/ui/panel-hub.js +42 -13
- package/dist/ui/panel-log.js +9 -154
- package/dist/ui/panel-settings.js +48 -11
- package/dist/ui/search-dialog.js +1 -0
- package/dist/ui/settings-access-overview.js +1 -1
- package/dist/ui/settings-hub-browser-certificate.js +3 -3
- package/dist/ui/settings-hub-company-join.js +41 -30
- package/dist/ui/settings-hub-connection.js +8 -5
- package/dist/ui/settings-hub-membership.js +3 -3
- package/dist/ui/settings-hub-section.js +1 -1
- package/dist/ui/settings-hub-setup-strings.js +6 -6
- package/dist/ui/settings-hub-setup.js +44 -6
- package/dist/ui/settings-hub.js +35 -10
- package/dist/ui/settings-layout.js +6 -4
- package/dist/ui/settings-public-session-strings.js +37 -0
- package/dist/ui/settings-registry.js +4 -0
- package/dist/ui/settings-strings.js +2 -2
- package/dist/ui/shared/app-shell.js +16 -10
- package/dist/ui/shared/app.css +195 -30
- package/dist/ui/shared/app.js +8 -1
- package/dist/ui/shared/chat-render.js +11 -2
- package/dist/ui/shared/chat-thread.js +20 -3
- package/dist/ui/shared/chat-work-bar.css +7 -0
- package/dist/ui/shared/chat-workspace-model.js +39 -9
- package/dist/ui/shared/hub-owner.css +8 -0
- package/dist/ui/shared/identity-color.js +9 -3
- package/dist/ui/shared/image-annotate.css +45 -0
- package/dist/ui/shared/instance-nav.js +59 -22
- package/dist/ui/shared/pane-geometry.js +29 -0
- package/dist/ui/shared/signin.js +2 -2
- package/dist/ui/shared/tokens.css +14 -0
- package/dist/ui/shared/ui-menu.js +22 -7
- package/dist/ui/signin.html +1 -1
- package/dist/ui/structured-signin.js +11 -4
- package/dist/web-api.d.ts +1 -0
- package/dist/web-api.js +34 -4
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +9 -3
- package/dist/web-backend-login.js +7 -4
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-history.d.ts +11 -0
- package/dist/web-chat-history.js +9 -1
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-guest-access.js +2 -2
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-session.d.ts +31 -3
- package/dist/web-session.js +25 -4
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +8 -2
- package/dist/web-settings-patch.js +22 -10
- package/dist/web-settings-patch.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* "One login/install window per runtime at a time" reservation (AGEND-203).
|
|
3
|
+
*
|
|
4
|
+
* It used to be one window for the whole fleet, so a Claude Code sign-in nobody had finished refused a Grok sign-in. Each backend's credentials are
|
|
5
|
+
* its own: two backends' windows never write the same files, so they no longer wait for each other. What stays exclusive:
|
|
6
|
+
* - a backend: sign-in, install, keep-alive, sign-out and Remove of ONE backend's accounts (default and named alike — they share its store and its CLI);
|
|
7
|
+
* - an install: at most one at a time on the host (one installer window, one handoff).
|
|
8
|
+
* Callers that keep a single session of their own (the chat/terminal controller, the installer) say so themselves.
|
|
3
9
|
*
|
|
4
10
|
* Web login and the install `/login` runs all share this lock. The
|
|
5
11
|
* claim is SYNCHRONOUS and must be taken before the caller's first await
|
|
@@ -18,44 +24,57 @@
|
|
|
18
24
|
*/
|
|
19
25
|
import { t } from "./locale.js";
|
|
20
26
|
export class LoginWindowLock {
|
|
21
|
-
|
|
27
|
+
owners = new Map();
|
|
22
28
|
seq = 0;
|
|
23
29
|
closed = false;
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
/** The window held on `backend`, if any. */
|
|
31
|
+
heldFor(backend) { return this.owners.get(backend) ?? null; }
|
|
32
|
+
/** Every window held now (one per backend at most). */
|
|
33
|
+
get held() { return [...this.owners.values()]; }
|
|
34
|
+
get isHeld() { return this.owners.size > 0; }
|
|
26
35
|
get isClosed() { return this.closed; }
|
|
27
|
-
/** Take the window now, or null when it is held or the lock is closed. Never awaits. */
|
|
36
|
+
/** Take the backend's window now, or null when it is held (or an install is, for an install), or the lock is closed. Never awaits. */
|
|
28
37
|
tryClaim(kind, backend) {
|
|
29
|
-
if (this.closed || this.
|
|
38
|
+
if (this.closed || this.owners.has(backend))
|
|
39
|
+
return null;
|
|
40
|
+
if (kind === "install" && [...this.owners.values()].some(o => o.kind === "install"))
|
|
30
41
|
return null;
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
const claim = { id: ++this.seq, kind, backend };
|
|
43
|
+
this.owners.set(backend, claim);
|
|
44
|
+
return claim;
|
|
33
45
|
}
|
|
34
|
-
/** True while `claim` is the live owner and the lock is open — the condition for continuing after an await. */
|
|
46
|
+
/** True while `claim` is the live owner of its backend's window and the lock is open — the condition for continuing after an await. */
|
|
35
47
|
isCurrent(claim) {
|
|
36
|
-
return !!claim && this.
|
|
48
|
+
return !!claim && this.owners.get(claim.backend) === claim && !this.closed;
|
|
37
49
|
}
|
|
38
50
|
/** Release only if `claim` is the current owner. Returns whether it was. */
|
|
39
51
|
release(claim) {
|
|
40
|
-
if (!claim || this.
|
|
52
|
+
if (!claim || this.owners.get(claim.backend) !== claim)
|
|
41
53
|
return false;
|
|
42
|
-
this.
|
|
54
|
+
this.owners.delete(claim.backend);
|
|
43
55
|
return true;
|
|
44
56
|
}
|
|
45
57
|
/** Fleet shutdown: invalidate whatever is held (its continuation will see !isCurrent) and refuse new claims. */
|
|
46
58
|
close() {
|
|
47
59
|
this.closed = true;
|
|
48
|
-
this.
|
|
60
|
+
this.owners.clear();
|
|
49
61
|
}
|
|
50
62
|
/** In-process restart: accept claims again. */
|
|
51
63
|
reopen() {
|
|
52
64
|
this.closed = false;
|
|
53
65
|
}
|
|
54
|
-
/** The
|
|
55
|
-
|
|
66
|
+
/** The window a claim for `backend` is refused by: its own holder, else the install in progress (an install claim only). */
|
|
67
|
+
holderFor(backend) {
|
|
68
|
+
return this.owners.get(backend) ?? [...this.owners.values()].find(w => w.kind === "install") ?? null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The user-facing reason a window for `backend` cannot open right now. An install claim that was refused because ANOTHER backend's install runs has no
|
|
72
|
+
* window of its own on `backend`: the answer names the install.
|
|
73
|
+
*/
|
|
74
|
+
busyMessage(backend) {
|
|
56
75
|
if (this.closed)
|
|
57
76
|
return t("login.web_shutting_down");
|
|
58
|
-
const o = this.
|
|
77
|
+
const o = (backend !== undefined ? this.owners.get(backend) : undefined) ?? [...this.owners.values()].find(w => w.kind === "install") ?? [...this.owners.values()][0];
|
|
59
78
|
if (!o)
|
|
60
79
|
return t("login.no_session");
|
|
61
80
|
return o.kind === "install" ? t("install.busy") : t("login.busy", o.backend);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-window-lock.js","sourceRoot":"","sources":["../src/login-window-lock.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"login-window-lock.js","sourceRoot":"","sources":["../src/login-window-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAehC,MAAM,OAAO,eAAe;IACT,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;IACtD,GAAG,GAAG,CAAC,CAAC;IACR,MAAM,GAAG,KAAK,CAAC;IAEvB,4CAA4C;IAC5C,OAAO,CAAC,OAAe,IAA6B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;IAC9F,uDAAuD;IACvD,IAAI,IAAI,KAAyB,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IACpE,IAAI,MAAM,KAAc,OAAO,IAAI,CAAC,MAAM,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|
|
58
|
+
/** #3715: a ClassicBot room's account (backend_options.<cli>.credential_profile), written and relaunched as Settings does. */
|
|
59
|
+
switchClassicRoomProfile?(name: string, backendOptions: unknown): Promise<{
|
|
60
|
+
ok: true;
|
|
61
|
+
channel: string;
|
|
62
|
+
backend: string;
|
|
63
|
+
profile: string | null;
|
|
64
|
+
changed: boolean;
|
|
65
|
+
} | {
|
|
66
|
+
ok: false;
|
|
67
|
+
error: string;
|
|
68
|
+
loginCommand?: string;
|
|
69
|
+
}>;
|
|
70
|
+
/** The profile an instance was launched on (a ClassicBot room: its running daemon's), null for the shared login. */
|
|
71
|
+
credentialProfileOf?(name: string, backend: string): string | null;
|
|
58
72
|
restartSingleInstance(name: string, opts?: {
|
|
59
73
|
freshStart?: boolean;
|
|
60
74
|
explicit?: boolean;
|
|
@@ -1293,6 +1293,13 @@ const updateInstanceConfig = async (ctx, rawArgs, respond, meta) => {
|
|
|
1293
1293
|
respond(null, WINDOWS_TOOL_SET_REFUSED);
|
|
1294
1294
|
return;
|
|
1295
1295
|
}
|
|
1296
|
+
// #3715 (M-2961): a ClassicBot room takes its AI account and nothing else. The raw keys decide (the schema strips
|
|
1297
|
+
// unknown ones), so an unsupported field is refused rather than dropped.
|
|
1298
|
+
if (typeof target === "string" && !(instances && Object.hasOwn(instances, target))
|
|
1299
|
+
&& (ctx.classicChannels?.getAll() ?? []).some(channel => channel.instanceName === target)) {
|
|
1300
|
+
await updateClassicRoomProfile(ctx, target, rawArgs?.config, respond);
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1296
1303
|
const v = validateArgs(UpdateInstanceConfigArgs, rawArgs, "update_instance_config");
|
|
1297
1304
|
if (!v.ok) {
|
|
1298
1305
|
respond(null, v.error);
|
|
@@ -1321,6 +1328,47 @@ const updateInstanceConfig = async (ctx, rawArgs, respond, meta) => {
|
|
|
1321
1328
|
}
|
|
1322
1329
|
applyInstanceConfigPatch(ctx, v.data.name, v.data.config, respond);
|
|
1323
1330
|
};
|
|
1331
|
+
/** Today's refusal (#3715 keeps it word for word for every key but a room's account). */
|
|
1332
|
+
const CLASSIC_CONFIG_REFUSED = "This is a ClassicBot instance (managed in classicBot.yaml). Use set_display_name or set_description to configure it.";
|
|
1333
|
+
/**
|
|
1334
|
+
* #3715: update_instance_config on a ClassicBot room. Only `config.backend_options.<backend>.credential_profile`; the
|
|
1335
|
+
* write and relaunch are the room's Settings save (switchClassicRoomProfile). The answer names the profile the room was
|
|
1336
|
+
* relaunched on, read back from its running daemon — not the one asked for.
|
|
1337
|
+
*/
|
|
1338
|
+
async function updateClassicRoomProfile(ctx, name, rawConfig, respond) {
|
|
1339
|
+
const config = rawConfig && typeof rawConfig === "object" && !Array.isArray(rawConfig) ? rawConfig : {};
|
|
1340
|
+
const fields = Object.keys(config).filter(key => config[key] !== undefined);
|
|
1341
|
+
if (fields.length !== 1 || fields[0] !== "backend_options" || !ctx.switchClassicRoomProfile) {
|
|
1342
|
+
respond(null, CLASSIC_CONFIG_REFUSED);
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
let result;
|
|
1346
|
+
try {
|
|
1347
|
+
result = await ctx.switchClassicRoomProfile(name, config.backend_options);
|
|
1348
|
+
}
|
|
1349
|
+
catch (err) {
|
|
1350
|
+
respond(null, `Failed to switch the room's account: ${err.message}`);
|
|
1351
|
+
return;
|
|
1352
|
+
}
|
|
1353
|
+
if (!result.ok) {
|
|
1354
|
+
respond(null, result.loginCommand ? `${result.error}:\n ${result.loginCommand}` : result.error);
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
const running = targetState(ctx, name) === "running";
|
|
1358
|
+
const launched = running ? (ctx.credentialProfileOf?.(name, result.backend) ?? null) : undefined;
|
|
1359
|
+
respond({
|
|
1360
|
+
success: true,
|
|
1361
|
+
name,
|
|
1362
|
+
classic_room: result.channel,
|
|
1363
|
+
backend: result.backend,
|
|
1364
|
+
credential_profile: result.profile ?? "default",
|
|
1365
|
+
changed: result.changed,
|
|
1366
|
+
restarted: result.changed && running,
|
|
1367
|
+
...(running
|
|
1368
|
+
? { launched_profile: launched ?? "default", ...(launched !== result.profile ? { warning: `The room is running on "${launched ?? "default"}", not "${result.profile ?? "default"}".` } : {}) }
|
|
1369
|
+
: { note: `The room is ${targetState(ctx, name)}; it starts on this account next time.` }),
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1324
1372
|
/**
|
|
1325
1373
|
* update_instance_config's write: one validated config write, rolled back whole on a refusal, then one relaunch when
|
|
1326
1374
|
* the backend (fresh, #1217), a credential profile or backend_options changed. Answers through `respond` like the tool.
|
|
@@ -1336,7 +1384,7 @@ export function applyInstanceConfigPatch(ctx, name, patch, respond) {
|
|
|
1336
1384
|
const isClassic = (ctx.classicChannels?.getAll() ?? [])
|
|
1337
1385
|
.some(channel => channel.instanceName === name);
|
|
1338
1386
|
respond(null, isClassic
|
|
1339
|
-
?
|
|
1387
|
+
? CLASSIC_CONFIG_REFUSED
|
|
1340
1388
|
: `Instance '${name}' not found in fleet config`);
|
|
1341
1389
|
return;
|
|
1342
1390
|
}
|