@songsid/agend 2.4.0-beta.6 → 2.4.0-beta.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/dist/agent-cli-instructions.md +2 -0
- package/dist/app-message-origin.d.ts +2 -0
- package/dist/app-message-origin.js +3 -0
- package/dist/app-message-origin.js.map +1 -0
- package/dist/auth-api.js +3 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/antigravity.d.ts +9 -2
- package/dist/backend/antigravity.js +24 -6
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/cli-env-probe.js +1 -1
- package/dist/backend/cli-env-probe.js.map +1 -1
- package/dist/backend-availability.d.ts +22 -0
- package/dist/backend-availability.js +71 -2
- package/dist/backend-availability.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/telegram.d.ts +2 -0
- package/dist/channel/adapters/telegram.js +3 -0
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/cli-capability.d.ts +3 -0
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-registry-check.js +1 -1
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +1 -0
- package/dist/cli-spec-antigravity.d.ts +1 -0
- package/dist/cli-spec-antigravity.js +3 -1
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -1
- package/dist/connect/control.d.ts +20 -0
- package/dist/connect/control.js +236 -0
- package/dist/connect/control.js.map +1 -0
- package/dist/connect/install.d.ts +13 -0
- package/dist/connect/install.js +12 -0
- package/dist/connect/install.js.map +1 -0
- package/dist/connect/protocol.d.ts +38 -0
- package/dist/connect/protocol.js +36 -0
- package/dist/connect/protocol.js.map +1 -0
- package/dist/connect/service.d.ts +19 -0
- package/dist/connect/service.js +79 -0
- package/dist/connect/service.js.map +1 -0
- package/dist/connect/stdio-entry.d.ts +1 -0
- package/dist/connect/stdio-entry.js +6 -0
- package/dist/connect/stdio-entry.js.map +1 -0
- package/dist/connect/stdio.d.ts +5 -0
- package/dist/connect/stdio.js +39 -0
- package/dist/connect/stdio.js.map +1 -0
- package/dist/daemon.d.ts +13 -0
- package/dist/daemon.js +66 -1
- package/dist/daemon.js.map +1 -1
- package/dist/dispatcher-liveness.d.ts +51 -1
- package/dist/dispatcher-liveness.js +92 -2
- package/dist/dispatcher-liveness.js.map +1 -1
- package/dist/fleet-manager.d.ts +67 -1
- package/dist/fleet-manager.js +307 -27
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.js +4 -2
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -0
- package/dist/general-knowledge/skills/hub/SKILL.md +6 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +15 -1
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +2 -0
- package/dist/hub/catalog.d.ts +6 -4
- package/dist/hub/catalog.js +14 -7
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/group-policy/admin-impact.d.ts +32 -3
- package/dist/hub/group-policy/admin-impact.js +14 -2
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.d.ts +1 -1
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/model.d.ts +23 -0
- package/dist/hub/group-policy/model.js +3 -3
- package/dist/hub/group-policy/model.js.map +1 -1
- package/dist/hub/group-policy/store.js +3 -3
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/team-subjects.d.ts +1 -1
- package/dist/hub/group-policy/team-subjects.js +1 -1
- package/dist/hub/group-policy/team-subjects.js.map +1 -1
- package/dist/hub/http/compose.js +73 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.js +3 -0
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +1 -0
- package/dist/hub/join/service.d.ts +1 -1
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/mcp/auth-schema.d.ts +7 -0
- package/dist/hub/mcp/auth-schema.js +31 -0
- package/dist/hub/mcp/auth-schema.js.map +1 -0
- package/dist/hub/mcp/auth.d.ts +86 -0
- package/dist/hub/mcp/auth.js +364 -0
- package/dist/hub/mcp/auth.js.map +1 -0
- package/dist/hub/personal/owner-host.d.ts +64 -0
- package/dist/hub/personal/owner-host.js +190 -0
- package/dist/hub/personal/owner-host.js.map +1 -0
- package/dist/hub/personal/schema.d.ts +2 -0
- package/dist/hub/personal/schema.js +48 -0
- package/dist/hub/personal/schema.js.map +1 -0
- package/dist/hub/personal/types.d.ts +42 -0
- package/dist/hub/personal/types.js +2 -0
- package/dist/hub/personal/types.js.map +1 -0
- package/dist/hub/policy.js +2 -0
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/quota.js +3 -1
- package/dist/hub/quota.js.map +1 -1
- package/dist/hub/roles/admin-control.d.ts +29 -0
- package/dist/hub/roles/admin-control.js +134 -0
- package/dist/hub/roles/admin-control.js.map +1 -0
- package/dist/hub/roles/admin-types.d.ts +49 -0
- package/dist/hub/roles/admin-types.js +2 -0
- package/dist/hub/roles/admin-types.js.map +1 -0
- package/dist/hub/roles/change.js +4 -0
- package/dist/hub/roles/change.js.map +1 -1
- package/dist/hub/roles/convert.js +1 -1
- package/dist/hub/roles/convert.js.map +1 -1
- package/dist/hub/roles/delegation.js +4 -0
- package/dist/hub/roles/delegation.js.map +1 -1
- package/dist/hub/roles/evaluate.d.ts +2 -1
- package/dist/hub/roles/evaluate.js +14 -0
- package/dist/hub/roles/evaluate.js.map +1 -1
- package/dist/hub/roles/model.d.ts +23 -0
- package/dist/hub/roles/model.js +7 -2
- package/dist/hub/roles/model.js.map +1 -1
- package/dist/hub/roles/resource-effects.d.ts +16 -0
- package/dist/hub/roles/resource-effects.js +62 -0
- package/dist/hub/roles/resource-effects.js.map +1 -0
- package/dist/hub/roles/writer.d.ts +6 -1
- package/dist/hub/roles/writer.js +10 -2
- package/dist/hub/roles/writer.js.map +1 -1
- package/dist/hub/rooms/agents.js +5 -2
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms.d.ts +1 -1
- package/dist/hub/rooms.js +12 -8
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/sessions.js +20 -2
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/sharing.js +2 -2
- package/dist/hub/sharing.js.map +1 -1
- package/dist/hub/types.d.ts +15 -3
- package/dist/human-delivery-receipts.js +8 -0
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instructions.js +3 -0
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +53 -0
- package/dist/locale.js.map +1 -1
- package/dist/native-model-catalog.d.ts +15 -0
- package/dist/native-model-catalog.js +43 -3
- package/dist/native-model-catalog.js.map +1 -1
- package/dist/runtime-build-info.js +1 -0
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/runtime-cli.js +31 -5
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +5 -0
- package/dist/runtime-client-store.js +28 -0
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +4 -0
- package/dist/runtime-client.js +33 -10
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-coordinator.d.ts +4 -2
- package/dist/runtime-coordinator.js +28 -6
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-install.d.ts +3 -0
- package/dist/runtime-install.js +7 -1
- package/dist/runtime-install.js.map +1 -1
- package/dist/runtime-personal-answer.d.ts +26 -0
- package/dist/runtime-personal-answer.js +116 -0
- package/dist/runtime-personal-answer.js.map +1 -0
- package/dist/runtime-personal-preflight.d.ts +5 -0
- package/dist/runtime-personal-preflight.js +57 -0
- package/dist/runtime-personal-preflight.js.map +1 -0
- package/dist/runtime-personal-profile.d.ts +36 -0
- package/dist/runtime-personal-profile.js +70 -0
- package/dist/runtime-personal-profile.js.map +1 -0
- package/dist/runtime-personal-protocol.d.ts +7 -0
- package/dist/runtime-personal-protocol.js +11 -0
- package/dist/runtime-personal-protocol.js.map +1 -0
- package/dist/runtime-personal-stage.d.ts +36 -0
- package/dist/runtime-personal-stage.js +163 -0
- package/dist/runtime-personal-stage.js.map +1 -0
- package/dist/runtime-protocol.d.ts +2 -0
- package/dist/settings-api.js +5 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/tool-progress.d.ts +9 -0
- package/dist/tool-progress.js +141 -32
- package/dist/tool-progress.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +2 -2
- package/dist/turn-reply-guard.js +3 -3
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/ui/chat-store.js +39 -2
- package/dist/ui/fleet-office-skin.js +1 -1
- package/dist/ui/hub-client.js +14 -0
- package/dist/ui/hub-quick-pairing.js +7 -2
- package/dist/ui/hub-roles-strings.js +15 -0
- package/dist/ui/hub-roles.js +48 -0
- package/dist/ui/hub-switcher.js +2 -2
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/model-picker.js +4 -1
- package/dist/ui/panel-hub.js +15 -9
- package/dist/ui/panel-settings.js +4 -4
- package/dist/ui/settings-catalog.js +22 -0
- package/dist/ui/settings-connector-strings.js +23 -0
- package/dist/ui/settings-connector.js +39 -0
- package/dist/ui/settings-hub-setup.js +2 -1
- package/dist/ui/settings-strings.js +2 -0
- package/dist/ui/shared/app-shell.js +24 -10
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app-themes.js +2 -2
- package/dist/ui/shared/app.css +223 -145
- package/dist/ui/shared/chat-thread.js +3 -3
- package/dist/ui/shared/chat-work-bar.css +9 -1
- package/dist/ui/shared/connector-prompt.d.ts +2 -0
- package/dist/ui/shared/connector-prompt.js +10 -0
- package/dist/ui/shared/hub-chat.css +1 -1
- package/dist/ui/shared/hub-owner.css +1 -1
- package/dist/ui/shared/hub-roles.css +27 -0
- package/dist/ui/shared/hub.css +16 -3
- package/dist/ui/shared/image-lightbox.js +35 -10
- package/dist/ui/shared/image-zoom.js +61 -9
- package/dist/ui/shared/instance-nav.js +35 -6
- package/dist/ui/shared/settings-connector.css +7 -0
- package/dist/ui/shared/theme.js +52 -0
- package/dist/ui/shared/tokens.css +27 -10
- package/dist/ui/shared/usage-dialog.js +67 -12
- package/dist/ui/shared/view-strings.js +14 -0
- package/dist/web-api.d.ts +4 -0
- package/dist/web-api.js +39 -23
- package/dist/web-api.js.map +1 -1
- package/dist/web-icons.js +3 -3
- package/dist/web-icons.js.map +1 -1
- package/dist/web-theme.js +2 -2
- package/dist/windows-cli-worker.d.ts +7 -0
- package/dist/windows-cli-worker.js +80 -14
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +9 -1
- package/dist/windows-cli.js +43 -13
- package/dist/windows-cli.js.map +1 -1
- package/package.json +1 -1
package/dist/fleet-manager.js
CHANGED
|
@@ -106,7 +106,7 @@ import { getEffectiveInstanceDefaults, loadFleetConfig, loadRawFleetConfig, load
|
|
|
106
106
|
import { EventLog } from "./event-log.js";
|
|
107
107
|
import { binaryProbe } from "./binary-probe.js";
|
|
108
108
|
import { deletePlannedTopic, planInstanceTopicDelete, topicDestination, topicMustStay } from "./instance-topic-delete.js";
|
|
109
|
-
import { AVAILABILITY_STALE_MS, BackendAvailabilityStore,
|
|
109
|
+
import { AVAILABILITY_STALE_MS, BackendAvailabilityStore, structuredSignInReady, hostAvailabilityProbes, findExecutableIn, resolveBackendBinary } from "./backend-availability.js";
|
|
110
110
|
import { classifySqliteOpenError } from "./sqlite-open-errors.js";
|
|
111
111
|
import { OutboxOpenError } from "./outbox-open-error.js";
|
|
112
112
|
import { AdapterWorld } from "./adapter-world.js";
|
|
@@ -135,7 +135,7 @@ import { routeToolCall } from "./channel/tool-router.js";
|
|
|
135
135
|
import { Scheduler } from "./scheduler/index.js";
|
|
136
136
|
import { boardActivity, boardCardLimit, boardToolAction } from "./task-board-tool.js";
|
|
137
137
|
import { TaskBoardWaker, namesCard } from "./task-board-waker.js";
|
|
138
|
-
import { DispatcherLiveness, LIVENESS_STARTUP_GRACE_MS, livenessSettings } from "./dispatcher-liveness.js";
|
|
138
|
+
import { DispatcherLiveness, LIVENESS_STARTUP_GRACE_MS, livenessSettings, questionNotices, turnQuestion } from "./dispatcher-liveness.js";
|
|
139
139
|
import { TaskBoardError, waitsForPerson, wrapUpGap } from "./scheduler/task-board.js";
|
|
140
140
|
import { escapeTelegramHtml, scheduleClock, scheduleRetryLabel } from "./scheduler/retry-label.js";
|
|
141
141
|
import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
|
|
@@ -229,7 +229,7 @@ import { RuntimeWindowsBridge } from "./runtime-windows-bridge.js";
|
|
|
229
229
|
import { FleetWindowsRuntime } from "./fleet-windows-runtime.js";
|
|
230
230
|
import { NativeMcpSessions } from "./native-mcp.js";
|
|
231
231
|
import { nativeProviderMcpSupported } from "./windows-cli-providers.js";
|
|
232
|
-
import { cachedNativeModelCatalog } from "./native-model-catalog.js";
|
|
232
|
+
import { cachedNativeModelCatalog, refreshNativeModelCatalogAfterSignIn } from "./native-model-catalog.js";
|
|
233
233
|
import { shapeWebModelCatalog } from "./web-model-groups.js";
|
|
234
234
|
import { isWindowsInstance, isNativePaneInstance, isNativeExecInstance, WINDOWS_CONFIG_REFUSED, nativeCredentialProfile } from "./native-instance-registry.js";
|
|
235
235
|
import { createNativeWindowsInstance, updateNativeWindowsInstance } from "./native-instance-api.js";
|
|
@@ -693,6 +693,13 @@ const NONCE_RETIRE_BUDGET_MS = 5_000;
|
|
|
693
693
|
* so nothing re-probed and `/model` kept serving a list up to 24h old.
|
|
694
694
|
*/
|
|
695
695
|
const CLI_ENV_FRESH_MS = 60 * 60 * 1000;
|
|
696
|
+
/**
|
|
697
|
+
* How long a menu that opens on an empty model list waits for its one discovery, and how long an attempt that
|
|
698
|
+
* found nothing (a CLI not signed in, offline) is not repeated by the next open. Shorter than CLI_ENV_PROBE_DEADLINE_MS: a
|
|
699
|
+
* slower probe finishes behind the menu and the page reads again (the `models` event).
|
|
700
|
+
*/
|
|
701
|
+
const MODEL_OPEN_PROBE_WAIT_MS = 12_000;
|
|
702
|
+
const MODEL_OPEN_PROBE_COOLDOWN_MS = 60_000;
|
|
696
703
|
/**
|
|
697
704
|
* Upper bound on a live probe driven by `/model`.
|
|
698
705
|
*
|
|
@@ -3137,6 +3144,8 @@ export class FleetManager {
|
|
|
3137
3144
|
livenessGone = new Map();
|
|
3138
3145
|
/** #3647: when each instance last showed working (after the startup grace): activity for "quiet". */
|
|
3139
3146
|
lastWorkingAt = new Map();
|
|
3147
|
+
/** M-3239: the instances whose progress is read from their transcript (see cacheInstanceExecutionState). */
|
|
3148
|
+
livenessTurnEvidence = new Set();
|
|
3140
3149
|
dispatcherLiveness = null;
|
|
3141
3150
|
/** Adapters whose last slash command registration failed and General was told (#1131). */
|
|
3142
3151
|
slashRegistrationFailed = new Set();
|
|
@@ -3891,6 +3900,7 @@ export class FleetManager {
|
|
|
3891
3900
|
settingsRuntimeRevision = 0;
|
|
3892
3901
|
settingsConfirmation = null;
|
|
3893
3902
|
settingsControl = null;
|
|
3903
|
+
ownerAppControl = null;
|
|
3894
3904
|
settingsJobSettlements = new Map();
|
|
3895
3905
|
classicSettingsOwners = new WeakMap();
|
|
3896
3906
|
queueSettingsOperation(job, resources, execution, run) {
|
|
@@ -5145,6 +5155,45 @@ export class FleetManager {
|
|
|
5145
5155
|
throw err;
|
|
5146
5156
|
}
|
|
5147
5157
|
}
|
|
5158
|
+
/** A person's local app gets a private, read/chat-only surface, never an instance's tool permissions. */
|
|
5159
|
+
async startOwnerAppControl() {
|
|
5160
|
+
if (this.shuttingDown || this.ownerAppControl)
|
|
5161
|
+
return;
|
|
5162
|
+
const [{ OwnerAppControl }, { createOwnerAppService }] = await Promise.all([import("./connect/control.js"), import("./connect/service.js")]);
|
|
5163
|
+
if (this.shuttingDown || this.ownerAppControl)
|
|
5164
|
+
return;
|
|
5165
|
+
const service = createOwnerAppService({
|
|
5166
|
+
current: () => !this.shuttingDown && !!this.fleetConfig,
|
|
5167
|
+
agents: () => Object.entries(this.fleetConfig?.instances ?? {}).map(([name, config]) => ({ name,
|
|
5168
|
+
display_name: config.display_name, backend: config.backend ?? "claude-code", status: this.getInstanceStatus(name) })),
|
|
5169
|
+
identity: name => this.fleetConfig?.instances[name],
|
|
5170
|
+
history: this.webChatHistory,
|
|
5171
|
+
board: () => this.scheduler?.db.board ?? null,
|
|
5172
|
+
deliver: async (name, text, messageId, current) => {
|
|
5173
|
+
if (!current())
|
|
5174
|
+
return false;
|
|
5175
|
+
const config = this.fleetConfig.instances[name];
|
|
5176
|
+
const adapter = this.getAdapterForInstance(name);
|
|
5177
|
+
const result = await this.deliverHumanToInstance(name, { type: "fleet_inbound", targetSession: name, content: text,
|
|
5178
|
+
meta: { chat_id: String(this.getGroupIdForInstance(name) ?? ""), thread_id: String(config.topic_id ?? ""),
|
|
5179
|
+
message_id: messageId, user: "Local app", user_id: "local-connector", source: "app", adapter_id: adapter?.id,
|
|
5180
|
+
ts: new Date().toISOString() } }, undefined, text, { stillCurrent: current, authorityCurrent: () => !this.shuttingDown && this.fleetConfig?.instances[name] === config });
|
|
5181
|
+
// No web-verified origin or human receipt authority is manufactured for an external app.
|
|
5182
|
+
if (result !== false)
|
|
5183
|
+
this.emitSseEvent("message", { instance: name, sender: "Local app", role: "user", text, messageId, ts: new Date().toISOString() });
|
|
5184
|
+
return result;
|
|
5185
|
+
},
|
|
5186
|
+
});
|
|
5187
|
+
const control = this.ownerAppControl = new OwnerAppControl(this.dataDir, service);
|
|
5188
|
+
try {
|
|
5189
|
+
await control.listen();
|
|
5190
|
+
}
|
|
5191
|
+
catch (error) {
|
|
5192
|
+
if (this.ownerAppControl === control)
|
|
5193
|
+
this.ownerAppControl = null;
|
|
5194
|
+
throw error;
|
|
5195
|
+
}
|
|
5196
|
+
}
|
|
5148
5197
|
get webToken() { return readWebToken(this.dataDir); }
|
|
5149
5198
|
/**
|
|
5150
5199
|
* Server-side web sessions (see web-session.ts). Created with the token, not per
|
|
@@ -5768,6 +5817,39 @@ export class FleetManager {
|
|
|
5768
5817
|
claimedAt: Math.max(ms(board.lastChangeAt(c.uuid)), ms(c.startedAt)), updatedAt: ms(c.updatedAt),
|
|
5769
5818
|
}));
|
|
5770
5819
|
}
|
|
5820
|
+
/**
|
|
5821
|
+
* M-3239: a tool call or an answer in the agent's transcript. Unlike the pane's spinner it counts from the fleet's start
|
|
5822
|
+
* (the boot shows working; a transcript line is real work, and the monitor starts at the transcript's end).
|
|
5823
|
+
*/
|
|
5824
|
+
noteTurnActivity(name, at) {
|
|
5825
|
+
if (!Number.isFinite(at) || at > Date.now() + 60_000 || at < this.startedAt)
|
|
5826
|
+
return;
|
|
5827
|
+
if (at > (this.lastWorkingAt.get(name) ?? 0))
|
|
5828
|
+
this.lastWorkingAt.set(name, at);
|
|
5829
|
+
}
|
|
5830
|
+
/**
|
|
5831
|
+
* M-3239: an agent ended a turn without messaging anyone. If its final text asks a question and it holds a card
|
|
5832
|
+
* another agent handed it, that dispatcher is told, quoting the question — otherwise the question sits on the agent's
|
|
5833
|
+
* own screen and the card stalls (a beta.7 rehearsal waited 1.5 h on one).
|
|
5834
|
+
*/
|
|
5835
|
+
onTurnEndedQuietly(name, startedAt, text) {
|
|
5836
|
+
if (this.shuttingDown || this.isPlannedRestart() || !livenessSettings(this.fleetConfig).enabled)
|
|
5837
|
+
return;
|
|
5838
|
+
const question = turnQuestion(text);
|
|
5839
|
+
if (!question)
|
|
5840
|
+
return;
|
|
5841
|
+
const outbox = this.deliveryOutbox;
|
|
5842
|
+
if (!outbox?.isOpen)
|
|
5843
|
+
return;
|
|
5844
|
+
const sent = outbox.latestSentAt(name);
|
|
5845
|
+
if (sent !== null && sent >= startedAt)
|
|
5846
|
+
return; // it did tell someone during the turn
|
|
5847
|
+
const isAgent = (d) => (this.fleetConfig?.instances?.[d] != null || this.isClassicInstance(d)) && !taskBoardOffIn(this.fleetConfig, d);
|
|
5848
|
+
for (const n of questionNotices(this.livenessCards(), name, question, startedAt, isAgent)) {
|
|
5849
|
+
this.admitTaskBoardNotice(n.dispatcher, n.message, n.key);
|
|
5850
|
+
this.logger.info({ assignee: name, dispatcher: n.dispatcher }, "Dispatcher told: assignee ended its turn on a question it sent no one");
|
|
5851
|
+
}
|
|
5852
|
+
}
|
|
5771
5853
|
/** #3647: what the fleet knows about an assignee now; null when it is not an instance here. */
|
|
5772
5854
|
livenessFacts(name) {
|
|
5773
5855
|
if (this.fleetConfig?.instances?.[name] == null)
|
|
@@ -5797,6 +5879,9 @@ export class FleetManager {
|
|
|
5797
5879
|
usageHold: this.daemons.get(name)?.usageHold?.() ?? null,
|
|
5798
5880
|
execution: exec ? { state: exec.state, since: exec.stateChangedAt } : null,
|
|
5799
5881
|
lastWorkingAt: this.lastWorkingAt.get(name) ?? null,
|
|
5882
|
+
turnEvidence: this.livenessTurnEvidence.has(name),
|
|
5883
|
+
// M-3239 (Fable F1): a restart forgets the transcript's progress; its quiet clock starts no earlier than the fleet.
|
|
5884
|
+
quietFloor: this.livenessTurnEvidence.has(name) ? this.startedAt : null,
|
|
5800
5885
|
prompt: p.state === "awaiting_input" && p.interaction?.since ? { since: p.interaction.since } : null,
|
|
5801
5886
|
waitingOn,
|
|
5802
5887
|
// Asked only when it could be quiet (one indexed read per idle assignee).
|
|
@@ -7473,8 +7558,16 @@ export class FleetManager {
|
|
|
7473
7558
|
// asks "is anyone still reporting", which only the receiver can date.
|
|
7474
7559
|
receivedAt: now,
|
|
7475
7560
|
});
|
|
7476
|
-
// #3647: activity, for "quiet" — not the boot itself (every agent shows working while it starts).
|
|
7477
|
-
|
|
7561
|
+
// #3647: activity, for "quiet" — not the boot itself (every agent shows working while it starts). M-3239: an agent
|
|
7562
|
+
// whose transcript tells its turns (Claude, Codex) shows progress by its tool calls and answers, not by its pane's
|
|
7563
|
+
// spinner — Claude compacting its context on its own, idle, held off a stalled card's notice.
|
|
7564
|
+
if (msg.turnEvidence === true)
|
|
7565
|
+
this.livenessTurnEvidence.add(name);
|
|
7566
|
+
else if (msg.turnEvidence === false)
|
|
7567
|
+
this.livenessTurnEvidence.delete(name);
|
|
7568
|
+
if (typeof msg.turnActivityAt === "number")
|
|
7569
|
+
this.noteTurnActivity(name, msg.turnActivityAt);
|
|
7570
|
+
if (state === "working" && !this.livenessTurnEvidence.has(name) && now - this.startedAt >= LIVENESS_STARTUP_GRACE_MS)
|
|
7478
7571
|
this.lastWorkingAt.set(name, now);
|
|
7479
7572
|
// The dashboard's "working" line and its Stop button follow the edges, not the heartbeat.
|
|
7480
7573
|
if (previous?.state !== state)
|
|
@@ -13507,6 +13600,14 @@ export class FleetManager {
|
|
|
13507
13600
|
waiter(msg);
|
|
13508
13601
|
}
|
|
13509
13602
|
}
|
|
13603
|
+
else if (msg.type === "turn_activity") {
|
|
13604
|
+
if (typeof msg.at === "number")
|
|
13605
|
+
this.noteTurnActivity(name, msg.at);
|
|
13606
|
+
}
|
|
13607
|
+
else if (msg.type === "turn_ended") {
|
|
13608
|
+
if (typeof msg.startedAt === "number" && typeof msg.text === "string")
|
|
13609
|
+
this.onTurnEndedQuietly(name, msg.startedAt, msg.text);
|
|
13610
|
+
}
|
|
13510
13611
|
else if (msg.type === "instance_state" || msg.type === "instance_state_response") {
|
|
13511
13612
|
this.cacheInstanceExecutionState(name, msg);
|
|
13512
13613
|
if (msg.type === "instance_state_response") {
|
|
@@ -14048,7 +14149,27 @@ export class FleetManager {
|
|
|
14048
14149
|
}
|
|
14049
14150
|
return true;
|
|
14050
14151
|
}
|
|
14051
|
-
/**
|
|
14152
|
+
/**
|
|
14153
|
+
* Who a Telegram update that was too old to inject would have gone to live (handleInboundMessageCore), or null when live
|
|
14154
|
+
* delivery would not have taken it — then it is not "missed". A topic of the fleet group: its instance (an unbound topic
|
|
14155
|
+
* only gets the bind prompt live, so nobody). The fleet group's root: general ("" when none is configured). Any other chat
|
|
14156
|
+
* is a ClassicBot candidate: its registered room — in a group only when the message @mentions the bot — and otherwise
|
|
14157
|
+
* nobody (live, an unregistered chat is ignored, and an @mention there only gets the no-agent reply).
|
|
14158
|
+
*/
|
|
14159
|
+
missedOfflineInstance(ev, stub) {
|
|
14160
|
+
const threadId = this.inboundRouteThreadId(stub);
|
|
14161
|
+
if (threadId)
|
|
14162
|
+
return this.resolveInboundTarget(stub, threadId)?.name ?? null;
|
|
14163
|
+
if (ev.chatId !== String(this.getChannelConfig(ev.adapterId)?.group_id ?? "")) {
|
|
14164
|
+
const room = this.classicChannels?.getInstanceByChannel(ev.chatId, ev.adapterId);
|
|
14165
|
+
if (!room)
|
|
14166
|
+
return null;
|
|
14167
|
+
const isPrivateChat = !ev.chatId.startsWith("-");
|
|
14168
|
+
return isPrivateChat || ev.mentionsBot ? room : null;
|
|
14169
|
+
}
|
|
14170
|
+
return Object.entries(this.fleetConfig?.instances ?? {}).find(([name, cfg]) => cfg.general_topic && this.getInstanceAdapterId(name) === ev.adapterId)?.[0] ?? "";
|
|
14171
|
+
}
|
|
14172
|
+
/** File a Telegram update that was too old to inject, where live delivery would have taken it; Needs you lists it until Acknowledge. */
|
|
14052
14173
|
recordMissedOffline(ev) {
|
|
14053
14174
|
if (!this.missedOfflineStore)
|
|
14054
14175
|
this.missedOfflineStore = new MissedOfflineStore(this.dataDir);
|
|
@@ -14057,11 +14178,10 @@ export class FleetManager {
|
|
|
14057
14178
|
messageId: ev.messageId, userId: ev.userId, username: ev.username, text: ev.preview,
|
|
14058
14179
|
timestamp: ev.timestamp, isBotMessage: false,
|
|
14059
14180
|
};
|
|
14060
|
-
const
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
instance = Object.entries(this.fleetConfig?.instances ?? {}).find(([name, cfg]) => cfg.general_topic && this.getInstanceAdapterId(name) === ev.adapterId)?.[0] ?? "";
|
|
14181
|
+
const instance = this.missedOfflineInstance(ev, stub);
|
|
14182
|
+
if (instance === null) {
|
|
14183
|
+
this.logger.debug({ adapterId: ev.adapterId, updateId: ev.updateId, chatId: ev.chatId, threadId: ev.threadId }, "Telegram message from while AgEnD was offline is not for this fleet — not filed");
|
|
14184
|
+
return;
|
|
14065
14185
|
}
|
|
14066
14186
|
const place = [ev.chatTitle, ev.threadId ? `#${ev.threadId}` : ""].filter(Boolean).join(" · ") || ev.chatId;
|
|
14067
14187
|
this.missedOfflineStore.add({
|
|
@@ -21021,6 +21141,9 @@ export class FleetManager {
|
|
|
21021
21141
|
return { current: catalog.current_model, options: catalog.models.map(m => ({ id: m.id, label: m.label })), actions: ["refresh"] };
|
|
21022
21142
|
}
|
|
21023
21143
|
const backend = this.backendNameForInstance(instance);
|
|
21144
|
+
// Opened on an empty list, the menu waits for one bounded discovery ("loading") instead of showing nothing.
|
|
21145
|
+
if (!more)
|
|
21146
|
+
await this.ensureModelCatalog(backend, instance);
|
|
21024
21147
|
const env = this.webModelEnv(backend, instance);
|
|
21025
21148
|
const current = this.resolveInstanceModel(instance).model;
|
|
21026
21149
|
const models = more ? this.modelCatalogFor(backend, instance) : env?.models ?? [];
|
|
@@ -21090,7 +21213,11 @@ export class FleetManager {
|
|
|
21090
21213
|
const refusal = this.backendCommandRefusal(instance);
|
|
21091
21214
|
if (refusal)
|
|
21092
21215
|
return { error: refusal };
|
|
21093
|
-
// The cached model lists
|
|
21216
|
+
// The cached model lists, as the web's /model; an empty one is discovered once, bounded (moving to a CLI
|
|
21217
|
+
// never signed in at startup, or probed before it was installed, must not offer an empty list).
|
|
21218
|
+
const wanted = backendArgs(args)[0];
|
|
21219
|
+
if (wanted && KNOWN_BACKENDS.includes(wanted))
|
|
21220
|
+
await this.ensureModelCatalog(wanted, instance);
|
|
21094
21221
|
const step = await backendStep({ ...this.backendCommandDeps(instance, { live: false }), models: async (backend) => this.modelCatalogFor(backend, instance) }, instance, backendArgs(args));
|
|
21095
21222
|
if (step.kind === "refuse")
|
|
21096
21223
|
return step.noop ? { text: step.text } : { error: step.text };
|
|
@@ -22052,7 +22179,7 @@ export class FleetManager {
|
|
|
22052
22179
|
* so claiming every retained checkpoint is "completed" would be false. */
|
|
22053
22180
|
composeRetiredBubbleText(entry) {
|
|
22054
22181
|
const elapsed = FleetManager.formatProgressElapsed(Date.now() - (entry.startedAt ?? Date.now()));
|
|
22055
|
-
return
|
|
22182
|
+
return `${t("progress.trace_title", elapsed)}\n${entry.toolProgress}`;
|
|
22056
22183
|
}
|
|
22057
22184
|
/**
|
|
22058
22185
|
* Make a tool summary safe to paste into a channel message.
|
|
@@ -22494,6 +22621,7 @@ export class FleetManager {
|
|
|
22494
22621
|
// #2072: a sign-in just finished — the pickers learn it now, not at the next pass.
|
|
22495
22622
|
if (!profile)
|
|
22496
22623
|
void this.backendAvailability.refresh([backend], { force: true });
|
|
22624
|
+
this.modelsAfterSignIn(backend, profile ?? null); // Chat /login and the dashboard's terminal sign-in
|
|
22497
22625
|
return this.recoverBackendInstances(backend, undefined, profile ?? null);
|
|
22498
22626
|
},
|
|
22499
22627
|
claimWindow: backend => this.loginWindow.tryClaim("web", backend),
|
|
@@ -22529,7 +22657,7 @@ export class FleetManager {
|
|
|
22529
22657
|
reported: (id, profile, backend) => this.machineAccounts.profileState(id, profile, backend),
|
|
22530
22658
|
reportedDefault: (id, backend) => this.machineAccounts.reportedDefault(id, backend),
|
|
22531
22659
|
readiness: (id, backend, named) => this.machineAccounts.readiness(id, backend, named),
|
|
22532
|
-
actor: owner =>
|
|
22660
|
+
actor: owner => this.machineSignInActor(owner),
|
|
22533
22661
|
changed: (event, owner) => {
|
|
22534
22662
|
// Safe fields only: the computer, the CLI, the profile name (none for Antigravity's default login), a phase and a fixed reason. Never a URL, a code, output or an e-mail address.
|
|
22535
22663
|
this.logger.info({ machine: event.machine, backend: event.backend, ...(event.profile ? { profile: event.profile } : {}), phase: event.phase, ...(event.reason ? { reason: event.reason } : {}), by: owner.label }, "Computer account sign-in from Settings → Accounts");
|
|
@@ -22537,11 +22665,44 @@ export class FleetManager {
|
|
|
22537
22665
|
// Only the computer's OWN login (no profile) is remembered here: a named account's sign-in is reported by its Runtime's inventory, which it sends before the sign-in ends.
|
|
22538
22666
|
if (event.phase === "done" && event.profile === undefined)
|
|
22539
22667
|
this.machineAccounts.noteDefaultLogin(event.machine, event.backend, true);
|
|
22668
|
+
// That computer's Runtime lists models in its own inventory (never a host probe): pages read it again now,
|
|
22669
|
+
// and the Runtime is asked once, for the admin who finished the sign-in, to list them as this account.
|
|
22670
|
+
if (event.phase === "done") {
|
|
22671
|
+
this.announceModels(event.backend);
|
|
22672
|
+
void this.nativeModelsAfterSignIn(event, owner);
|
|
22673
|
+
}
|
|
22540
22674
|
broadcastSseEvent(this.sseClients, "backend_login", {}, err => this.logger.debug({ err }, "backend_login event failed"));
|
|
22541
22675
|
this.needsYou?.poke();
|
|
22542
22676
|
},
|
|
22543
22677
|
});
|
|
22544
22678
|
}
|
|
22679
|
+
/**
|
|
22680
|
+
* A paired computer's sign-in ended — ask its Runtime once (`models.refresh`, as the admin who finished the
|
|
22681
|
+
* sign-in) for the list as this account, so the next read of its agents' and the create dialog's list has it without the
|
|
22682
|
+
* Refresh button. Once per sign-in; never on a read (M-2239 P1-2). A Runtime without the capability, a refused account or any
|
|
22683
|
+
* failure is skipped quietly: the sign-in is done either way.
|
|
22684
|
+
*/
|
|
22685
|
+
/** The name a paired computer's audit log records for the admin session that signed in on it (`admin:<handle>`); null refuses. */
|
|
22686
|
+
machineSignInActor(owner) {
|
|
22687
|
+
const handle = owner.handle;
|
|
22688
|
+
return typeof handle === "string" && /^[a-f0-9]{16}$/.test(handle) ? `admin:${handle}` : null;
|
|
22689
|
+
}
|
|
22690
|
+
async nativeModelsAfterSignIn(event, owner) {
|
|
22691
|
+
try {
|
|
22692
|
+
const actor = this.machineSignInActor(owner);
|
|
22693
|
+
if (!actor || this.shuttingDown || !this.browserSignInOwnerCurrent(owner))
|
|
22694
|
+
return;
|
|
22695
|
+
const refreshed = await refreshNativeModelCatalogAfterSignIn(this, {
|
|
22696
|
+
backend: event.backend, machineId: event.machine, ...(event.profile ? { profile: event.profile } : {}), actor,
|
|
22697
|
+
stillAdmin: () => !this.shuttingDown && this.browserSignInOwnerCurrent(owner),
|
|
22698
|
+
});
|
|
22699
|
+
if (refreshed)
|
|
22700
|
+
this.announceModels(event.backend);
|
|
22701
|
+
}
|
|
22702
|
+
catch (err) {
|
|
22703
|
+
this.logger.debug({ backend: event.backend, err }, "Model refresh after a computer's sign-in skipped");
|
|
22704
|
+
}
|
|
22705
|
+
}
|
|
22545
22706
|
machineAccountsInstance = null;
|
|
22546
22707
|
/** #3190 Part 3c: a paired computer's accounts in Settings → Accounts (machine-accounts.ts). */
|
|
22547
22708
|
get machineAccounts() {
|
|
@@ -22590,6 +22751,7 @@ export class FleetManager {
|
|
|
22590
22751
|
broadcastSseEvent(this.sseClients, "backend_login", {}, err => this.logger.debug({ err }, "backend_login event failed"));
|
|
22591
22752
|
if (event.phase === "done") {
|
|
22592
22753
|
this.forgetSignInIdentities(); // a sign-in may be a different account now
|
|
22754
|
+
this.modelsAfterSignIn(event.backend, null); // The list read before this sign-in (a signed-out CLI answers none) is not this account's
|
|
22593
22755
|
this.keepAliveAfterSignIn(event.backend, null); // its file changed, whoever is watching: a "needs sign-in" left from before is no longer the answer
|
|
22594
22756
|
this.usageAfterSignIn(); // the usage read before this sign-in is not this account's
|
|
22595
22757
|
}
|
|
@@ -22645,6 +22807,7 @@ export class FleetManager {
|
|
|
22645
22807
|
broadcastSseEvent(this.sseClients, "backend_login", {}, err => this.logger.debug({ err }, "backend_login event failed"));
|
|
22646
22808
|
if (event.phase === "done") {
|
|
22647
22809
|
this.forgetSignInIdentities(); // a sign-in may be a different account now
|
|
22810
|
+
this.modelsAfterSignIn(event.backend, event.profile);
|
|
22648
22811
|
this.keepAliveAfterSignIn(event.backend, event.profile);
|
|
22649
22812
|
this.usageAfterSignIn();
|
|
22650
22813
|
}
|
|
@@ -23367,7 +23530,7 @@ export class FleetManager {
|
|
|
23367
23530
|
if (!structuredSignInSupported(backend) || !STRUCTURED_PROFILE_BACKENDS.has(backend))
|
|
23368
23531
|
return false;
|
|
23369
23532
|
const row = this.backendAvailabilityRows().find(r => r.backend === backend);
|
|
23370
|
-
return !!row && row.state !== "not_installed" && row.state !== "too_old" &&
|
|
23533
|
+
return !!row && row.state !== "not_installed" && row.state !== "too_old" && structuredSignInReady(row, hostFacts(backend, "structuredSignIn")?.minVersion);
|
|
23371
23534
|
}
|
|
23372
23535
|
backendSignInTargets() {
|
|
23373
23536
|
const out = [];
|
|
@@ -23378,10 +23541,11 @@ export class FleetManager {
|
|
|
23378
23541
|
// whether it is over, and then it is not signed in (never the other way: the file can't vouch for a login).
|
|
23379
23542
|
const ended = row.state === "usable" && this.claudeSignInEnded(row.backend, null);
|
|
23380
23543
|
// A CLI the dashboard drives with the structured sign-in (registry: `host.structuredSignIn`) although chat's /login and the browser terminal decline it (Antigravity: `agy acp --login`, agy
|
|
23381
|
-
// >= its `minVersion`) is signed in from Settings → Accounts. A CLI that is older, or whose version is not
|
|
23544
|
+
// >= its `minVersion`, or — AGEND-274, only while the version is unknown — its file holds the command's `marker`) is signed in from Settings → Accounts. A CLI that is older, or whose version is not
|
|
23545
|
+
// known and whose file was not seen to hold the marker, keeps "Sign in on the host" (told to update only when the version is known to be older).
|
|
23382
23546
|
const structured = hostFacts(row.backend, "structuredSignIn");
|
|
23383
23547
|
const viaStructured = !!structured && flow?.remoteLogin === "unsupported" && row.state !== "not_installed";
|
|
23384
|
-
const structuredSignIn = viaStructured &&
|
|
23548
|
+
const structuredSignIn = viaStructured && structuredSignInReady(row, structured.minVersion);
|
|
23385
23549
|
// Told to update only when the version is KNOWN to be older: a version that was not read yet is not "too old".
|
|
23386
23550
|
const structuredUpdate = viaStructured && !structuredSignIn && typeof row.version === "string" && /\d/.test(row.version);
|
|
23387
23551
|
out.push({
|
|
@@ -25855,6 +26019,8 @@ export class FleetManager {
|
|
|
25855
26019
|
/** Preserve the existing cache merge rules for worker probes. */
|
|
25856
26020
|
persistCliEnvProbeResult(backend, probed, profile = null) {
|
|
25857
26021
|
const env = { backend, probedAt: Date.now(), ...probed };
|
|
26022
|
+
const listed = (e) => (e?.models ?? []).map(m => m.id).join("\0");
|
|
26023
|
+
const before = listed(this.readCliEnv(backend, profile));
|
|
25858
26024
|
// An empty result must never overwrite a catalog we already have. Some
|
|
25859
26025
|
// probes hit the network (`agy models` fetches, 5s cap), so a slow moment
|
|
25860
26026
|
// returns [] — and writing that would blank the list for the whole 24h
|
|
@@ -25885,6 +26051,8 @@ export class FleetManager {
|
|
|
25885
26051
|
const path = this.cliEnvPath(backend, profile);
|
|
25886
26052
|
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
25887
26053
|
writeFileSync(path, JSON.stringify(env, null, 2));
|
|
26054
|
+
if (listed(env) !== before)
|
|
26055
|
+
this.announceModels(backend); // An open /model or Settings page reads the new list
|
|
25888
26056
|
return env;
|
|
25889
26057
|
}
|
|
25890
26058
|
/** Background-probe every distinct backend in use at startup (non-blocking). */
|
|
@@ -25906,6 +26074,105 @@ export class FleetManager {
|
|
|
25906
26074
|
void this.probeBackendBounded(b);
|
|
25907
26075
|
this.probeChangedCliEnvs(null);
|
|
25908
26076
|
}
|
|
26077
|
+
/**
|
|
26078
|
+
* Whether a named account's catalog can be discovered without publishing another account's models under its name
|
|
26079
|
+
* (#3526 / D7). A CLI whose profile is a variable the probe inherits (codex, kiro, claude) is. A CLI told its account by an
|
|
26080
|
+
* argument (agy, `launch-argument`) is too, since AGEND-278: the probe is run with the account's own folder
|
|
26081
|
+
* (backend/antigravity.ts `listModels`), and it answers nothing for a folder with no sign-in. Never a profile on a
|
|
26082
|
+
* backend that has no credential home at all.
|
|
26083
|
+
*/
|
|
26084
|
+
modelDiscoverable(backend, binding) {
|
|
26085
|
+
return !binding.profile || !!credentialHomeSpec(backend);
|
|
26086
|
+
}
|
|
26087
|
+
/** One model discovery for a binding — the scoped (own config) or the shared per-backend/profile cache — or null when fenced. */
|
|
26088
|
+
discoverModels(backend, name, binding = this.webModelBinding(backend, name), opts = {}) {
|
|
26089
|
+
if (!binding || !this.modelDiscoverable(backend, binding))
|
|
26090
|
+
return null;
|
|
26091
|
+
// A scoped read resolves its binding again (publication and current checks included), so it is handed the selection the
|
|
26092
|
+
// binding came from: without it the agent's saved/default account would be probed and populated instead.
|
|
26093
|
+
return binding.scoped
|
|
26094
|
+
? this.refreshModelCatalogFor(backend, name, opts.selection, opts.afterSignIn ? { afterSignIn: true } : {})
|
|
26095
|
+
: this.probeBackendBounded(backend, { profile: binding.profile, ...(opts.refreshVendorCatalog ? { refreshVendorCatalog: true } : {}) });
|
|
26096
|
+
}
|
|
26097
|
+
/** The `models` stream event: a backend's model list changed — an open page reads it again (no details, as `backend_login`). */
|
|
26098
|
+
announceModels(backend) {
|
|
26099
|
+
try {
|
|
26100
|
+
broadcastSseEvent(this.sseClients, "models", { backend }, err => this.logger.debug({ err }, "models event failed"));
|
|
26101
|
+
}
|
|
26102
|
+
catch { /* best effort */ }
|
|
26103
|
+
}
|
|
26104
|
+
modelOpenProbes = new Map();
|
|
26105
|
+
/**
|
|
26106
|
+
* The list a menu opens on. Cached and fresh: nothing to do. Empty (never discovered: the CLI was signed out
|
|
26107
|
+
* at startup, or the agent just moved to this CLI): one bounded discovery that the caller waits for — so `/model` and
|
|
26108
|
+
* Settings show "loading" instead of an empty list. Stale: the list stands and is refreshed behind it. Both join a
|
|
26109
|
+
* discovery already running, and an attempt that found nothing is not repeated for MODEL_OPEN_PROBE_COOLDOWN_MS.
|
|
26110
|
+
* Never throws; a Windows Runtime's catalog is its inventory's and is not a host probe.
|
|
26111
|
+
*/
|
|
26112
|
+
async ensureModelCatalog(backend, instance, selection) {
|
|
26113
|
+
try {
|
|
26114
|
+
const binding = this.webModelBinding(backend, instance, selection);
|
|
26115
|
+
if (!binding || this.shuttingDown)
|
|
26116
|
+
return;
|
|
26117
|
+
const env = this.webModelEnv(backend, instance, selection);
|
|
26118
|
+
const empty = !env?.models?.length;
|
|
26119
|
+
if (!empty && !this.cliEnvNeedsRefresh(env))
|
|
26120
|
+
return;
|
|
26121
|
+
this.modelOpenProbes ??= new Map();
|
|
26122
|
+
const last = this.modelOpenProbes.get(binding.key);
|
|
26123
|
+
if (last !== undefined && Date.now() - last < MODEL_OPEN_PROBE_COOLDOWN_MS)
|
|
26124
|
+
return;
|
|
26125
|
+
const work = this.discoverModels(backend, instance, binding, { selection });
|
|
26126
|
+
if (!work)
|
|
26127
|
+
return;
|
|
26128
|
+
const done = work.catch(err => { this.logger.debug({ backend, instance, err }, "Model discovery on open failed"); }).then(() => {
|
|
26129
|
+
const after = this.webModelEnv(backend, instance, selection);
|
|
26130
|
+
if (!after?.models?.length || this.cliEnvNeedsRefresh(after))
|
|
26131
|
+
this.modelOpenProbes.set(binding.key, Date.now());
|
|
26132
|
+
else
|
|
26133
|
+
this.modelOpenProbes.delete(binding.key);
|
|
26134
|
+
});
|
|
26135
|
+
if (!empty)
|
|
26136
|
+
return;
|
|
26137
|
+
let timer;
|
|
26138
|
+
await Promise.race([done, new Promise(resolve => { timer = setTimeout(resolve, MODEL_OPEN_PROBE_WAIT_MS); timer.unref?.(); })]);
|
|
26139
|
+
if (timer)
|
|
26140
|
+
clearTimeout(timer);
|
|
26141
|
+
}
|
|
26142
|
+
catch (err) {
|
|
26143
|
+
this.logger.debug({ backend, instance, err }, "Model discovery on open failed");
|
|
26144
|
+
}
|
|
26145
|
+
}
|
|
26146
|
+
/**
|
|
26147
|
+
* A sign-in just ended, so the CLI can now answer `models` as this account — whatever started the sign-in
|
|
26148
|
+
* (Settings → Accounts, a named account, chat `/login`, the dashboard's terminal). The account's list is read again now,
|
|
26149
|
+
* not at the next startup or by hand. The default account: the backend's shared cache. A named account: its own store
|
|
26150
|
+
* (claude's profile catalog), or each agent's scoped one (the other CLIs, agy included: its probe runs with the account's folder).
|
|
26151
|
+
* A provider-bound agent does not depend on the sign-in. Background; each page is told when the list changed.
|
|
26152
|
+
*/
|
|
26153
|
+
modelsAfterSignIn(backend, profile) {
|
|
26154
|
+
if (this.shuttingDown || !KNOWN_BACKENDS.includes(backend) || backend === "mock")
|
|
26155
|
+
return;
|
|
26156
|
+
(this.modelOpenProbes ??= new Map()).clear(); // a cooldown from before the sign-in said "nothing to find": it no longer does
|
|
26157
|
+
const settle = (work) => {
|
|
26158
|
+
void work?.catch(err => this.logger.debug({ backend, profile, err }, "Model discovery after sign-in failed"));
|
|
26159
|
+
};
|
|
26160
|
+
if (profile === null) {
|
|
26161
|
+
settle(this.discoverModels(backend, null, undefined, { refreshVendorCatalog: true }));
|
|
26162
|
+
return;
|
|
26163
|
+
}
|
|
26164
|
+
if (backend === "claude-code") {
|
|
26165
|
+
settle(this.probeBackendBounded(backend, { profile, refreshVendorCatalog: true }));
|
|
26166
|
+
return;
|
|
26167
|
+
}
|
|
26168
|
+
for (const name of this.configuredBackendInstanceNames()) {
|
|
26169
|
+
if (this.backendNameOf(name) !== backend || this.credentialProfileOf(name, backend) !== profile)
|
|
26170
|
+
continue;
|
|
26171
|
+
const binding = this.webModelBinding(backend, name);
|
|
26172
|
+
if (binding?.scoped)
|
|
26173
|
+
settle(this.discoverModels(backend, name, binding, { afterSignIn: true }));
|
|
26174
|
+
}
|
|
26175
|
+
}
|
|
25909
26176
|
/** Maintain discovery after committed config changes; a model-field read remains passive. */
|
|
25910
26177
|
probeChangedCliEnvs(previous) {
|
|
25911
26178
|
const signature = (fleet, name) => {
|
|
@@ -25920,11 +26187,7 @@ export class FleetManager {
|
|
|
25920
26187
|
continue;
|
|
25921
26188
|
const backend = this.backendNameForInstance(name);
|
|
25922
26189
|
const binding = this.webModelBinding(backend, name);
|
|
25923
|
-
|
|
25924
|
-
// never publish the ambient account's models under that profile (#3526 / D7). (AGEND-119: agy now HAS
|
|
25925
|
-
// named accounts, but `agy models` is not run with the account's folder, so its answer would still be the
|
|
25926
|
-
// default account's: only a CLI whose profile is a variable the probe inherits is discovered under one.)
|
|
25927
|
-
if (!binding || (binding.profile && (!credentialHomeSpec(backend) || credentialHomeSpec(backend).kind === "launch-argument")))
|
|
26190
|
+
if (!binding || !this.modelDiscoverable(backend, binding))
|
|
25928
26191
|
continue;
|
|
25929
26192
|
// A description/defaults save can retire a scoped answer's full binding even
|
|
25930
26193
|
// though its account signature is unchanged. Keep the conservative fence and
|
|
@@ -25932,10 +26195,8 @@ export class FleetManager {
|
|
|
25932
26195
|
if (previous && signature(previous, name) === signature(this.fleetConfig, name)
|
|
25933
26196
|
&& (!binding.scoped || this.webModelEnv(backend, name) || this.webModelRefreshes.has(binding.key)))
|
|
25934
26197
|
continue;
|
|
25935
|
-
const work = binding
|
|
25936
|
-
|
|
25937
|
-
: this.probeBackendBounded(backend, { profile: binding.profile });
|
|
25938
|
-
void work.catch(err => this.logger.debug({ backend, name, err }, "Background model discovery failed"));
|
|
26198
|
+
const work = this.discoverModels(backend, name, binding);
|
|
26199
|
+
void work?.catch(err => this.logger.debug({ backend, name, err }, "Background model discovery failed"));
|
|
25939
26200
|
}
|
|
25940
26201
|
}
|
|
25941
26202
|
/** Best-effort model list for `/model`: cached CLI env first, else live probe. Never throws. */
|
|
@@ -27149,11 +27410,22 @@ export class FleetManager {
|
|
|
27149
27410
|
return shapeWebModelCatalog(backend, env?.models ?? [], env?.apiModels ?? []);
|
|
27150
27411
|
}
|
|
27151
27412
|
/** Explicit, bounded vendor rediscovery. Never publish an answer under a different account/config/instance. */
|
|
27152
|
-
async refreshModelCatalogFor(backend, instance, selection) {
|
|
27413
|
+
async refreshModelCatalogFor(backend, instance, selection, opts = {}) {
|
|
27153
27414
|
const binding = this.webModelBinding(backend, instance, selection);
|
|
27154
27415
|
if (!binding || this.shuttingDown)
|
|
27155
27416
|
return { models: [], refreshed: false };
|
|
27156
27417
|
const pending = this.webModelRefreshes.get(binding.key);
|
|
27418
|
+
if (pending && opts.afterSignIn) {
|
|
27419
|
+
// A sign-in changes the credentials, not the binding key, so a flight started before it is answering as the signed-out
|
|
27420
|
+
// account. Join it for admission (the worker limit), then read once more as the signed-in one; sign-ins that land on the
|
|
27421
|
+
// same flight meet in that one read (the second finds the first's flight).
|
|
27422
|
+
return pending.catch(() => null).then(() => {
|
|
27423
|
+
const next = this.webModelBinding(backend, instance, selection);
|
|
27424
|
+
if (next?.key !== binding.key)
|
|
27425
|
+
return { models: [], refreshed: false };
|
|
27426
|
+
return this.refreshModelCatalogFor(backend, instance, selection);
|
|
27427
|
+
});
|
|
27428
|
+
}
|
|
27157
27429
|
if (pending)
|
|
27158
27430
|
return pending;
|
|
27159
27431
|
const epoch = this.cliEnvProbeEpoch;
|
|
@@ -27171,7 +27443,11 @@ export class FleetManager {
|
|
|
27171
27443
|
return { models: this.modelCatalogFor(backend, instance, selection), refreshed: false };
|
|
27172
27444
|
if (this.webModelCatalogs.size >= 64)
|
|
27173
27445
|
this.webModelCatalogs.delete(this.webModelCatalogs.keys().next().value);
|
|
27446
|
+
const listed = (models) => models.map(m => m.id).join("\0");
|
|
27447
|
+
const before = listed(this.webModelEnv(backend, instance, selection)?.models ?? []);
|
|
27174
27448
|
this.webModelCatalogs.set(binding.key, { ...result, backend, probedAt: Date.now() });
|
|
27449
|
+
if (listed(result.models) !== before)
|
|
27450
|
+
this.announceModels(backend);
|
|
27175
27451
|
return { models: this.modelCatalogFor(backend, instance, selection), refreshed: true };
|
|
27176
27452
|
}).finally(() => { if (this.webModelRefreshes.get(binding.key) === work)
|
|
27177
27453
|
this.webModelRefreshes.delete(binding.key); });
|
|
@@ -28002,6 +28278,9 @@ export class FleetManager {
|
|
|
28002
28278
|
const settingsControl = this.settingsControl;
|
|
28003
28279
|
this.settingsControl = null;
|
|
28004
28280
|
const settingsControlStopped = settingsControl?.close();
|
|
28281
|
+
const ownerAppControl = this.ownerAppControl;
|
|
28282
|
+
this.ownerAppControl = null;
|
|
28283
|
+
const ownerAppStopped = ownerAppControl?.close();
|
|
28005
28284
|
this.publicLinkAutoOpen?.stop();
|
|
28006
28285
|
const publicStopped = this.publicWebLink?.close("fleet shutdown");
|
|
28007
28286
|
this.webRemoteAccessState?.close(); // #3008: an unsaved switch gets its last write
|
|
@@ -28068,6 +28347,7 @@ export class FleetManager {
|
|
|
28068
28347
|
await hubStopped;
|
|
28069
28348
|
await needsStopped;
|
|
28070
28349
|
await settingsControlStopped;
|
|
28350
|
+
await ownerAppStopped;
|
|
28071
28351
|
await cacheStopped;
|
|
28072
28352
|
await quotaNoticesStopped;
|
|
28073
28353
|
this.quotaNotices = null;
|