@songsid/agend 2.4.0-beta.20 → 2.4.0-beta.22
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 +1 -1
- package/dist/backend/claude-carry.d.ts +11 -0
- package/dist/backend/claude-carry.js +88 -6
- package/dist/backend/claude-carry.js.map +1 -1
- package/dist/backend/claude-code.js +3 -0
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/cache-ledger.d.ts +23 -21
- package/dist/cache-ledger.js +70 -6
- package/dist/cache-ledger.js.map +1 -1
- package/dist/cache-prices.d.ts +8 -6
- package/dist/cache-prices.js +12 -5
- package/dist/cache-prices.js.map +1 -1
- package/dist/cache-service.d.ts +9 -5
- package/dist/cache-service.js +202 -50
- package/dist/cache-service.js.map +1 -1
- package/dist/channel/mcp-tools.js +6 -4
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/cli-audited.js +2 -1
- package/dist/cli-audited.js.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/contact-auth-policy.js +1 -1
- package/dist/contact-auth-policy.js.map +1 -1
- package/dist/contact-auth-service.js +8 -2
- package/dist/contact-auth-service.js.map +1 -1
- package/dist/contact-auth-store.d.ts +3 -0
- package/dist/contact-auth-store.js +34 -8
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/contact-auth-types.d.ts +3 -2
- package/dist/contact-auth-types.js.map +1 -1
- package/dist/contact-change-proposals.d.ts +47 -0
- package/dist/contact-change-proposals.js +132 -0
- package/dist/contact-change-proposals.js.map +1 -0
- package/dist/daemon.d.ts +31 -0
- package/dist/daemon.js +149 -2
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +10 -0
- package/dist/delivery-outbox.js +21 -0
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +65 -1
- package/dist/fleet-manager.js +338 -20
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +45 -5
- package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
- package/dist/hub/agent-pictures-model.d.ts +275 -0
- package/dist/hub/agent-pictures-model.js +103 -0
- package/dist/hub/agent-pictures-model.js.map +1 -0
- package/dist/hub/agent-pictures.d.ts +64 -0
- package/dist/hub/agent-pictures.js +255 -0
- package/dist/hub/agent-pictures.js.map +1 -0
- package/dist/hub/client.d.ts +4 -0
- package/dist/hub/client.js +23 -2
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +14 -3
- package/dist/hub/compose/member.js +46 -10
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +6 -5
- package/dist/hub/compose/server.js +7 -3
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/direct-posts-model.d.ts +1 -0
- package/dist/hub/direct-posts-model.js +2 -0
- package/dist/hub/direct-posts-model.js.map +1 -0
- package/dist/hub/direct-posts.d.ts +36 -0
- package/dist/hub/direct-posts.js +145 -0
- package/dist/hub/direct-posts.js.map +1 -0
- package/dist/hub/http/compose.d.ts +5 -0
- package/dist/hub/http/compose.js +158 -20
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +9 -1
- package/dist/hub/http/core.js +21 -1
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/http/deps.d.ts +1 -0
- package/dist/hub/http/schema.js +7 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/init/text.js +1 -1
- package/dist/hub/join/service.d.ts +2 -0
- package/dist/hub/join/service.js +7 -3
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/member/agent-pictures.d.ts +76 -0
- package/dist/hub/member/agent-pictures.js +196 -0
- package/dist/hub/member/agent-pictures.js.map +1 -0
- package/dist/hub/member/direct-rooms.d.ts +9 -0
- package/dist/hub/member/direct-rooms.js +14 -0
- package/dist/hub/member/direct-rooms.js.map +1 -0
- package/dist/hub/member/room-ask.d.ts +22 -1
- package/dist/hub/member/room-ask.js +99 -5
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-asker-store.d.ts +48 -0
- package/dist/hub/member/room-asker-store.js +181 -0
- package/dist/hub/member/room-asker-store.js.map +1 -0
- package/dist/hub/member/room-post.d.ts +11 -10
- package/dist/hub/member/room-post.js +51 -7
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/policy.d.ts +11 -2
- package/dist/hub/policy.js +60 -7
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/protocol.d.ts +254 -1
- package/dist/hub/protocol.js +20 -8
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/representative.d.ts +38 -0
- package/dist/hub/representative.js +140 -12
- package/dist/hub/representative.js.map +1 -1
- package/dist/hub/room-asker-identity-model.d.ts +53 -0
- package/dist/hub/room-asker-identity-model.js +14 -0
- package/dist/hub/room-asker-identity-model.js.map +1 -0
- package/dist/hub/room-asker-identity.d.ts +22 -0
- package/dist/hub/room-asker-identity.js +43 -0
- package/dist/hub/room-asker-identity.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +2 -0
- package/dist/hub/rooms/agents.js +30 -3
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/asker-identity.d.ts +21 -0
- package/dist/hub/rooms/asker-identity.js +86 -0
- package/dist/hub/rooms/asker-identity.js.map +1 -0
- package/dist/hub/rooms/direct-view.d.ts +3 -2
- package/dist/hub/rooms/direct-view.js +23 -8
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/office.d.ts +27 -0
- package/dist/hub/rooms/office.js +12 -2
- package/dist/hub/rooms/office.js.map +1 -1
- package/dist/hub/rooms/service.d.ts +38 -1
- package/dist/hub/rooms/service.js +56 -3
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +5 -2
- package/dist/hub/rooms.d.ts +9 -0
- package/dist/hub/rooms.js +97 -26
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +24 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/session-directory-transition.d.ts +1 -0
- package/dist/hub/session-directory-transition.js +15 -9
- package/dist/hub/session-directory-transition.js.map +1 -1
- package/dist/hub/session-limits.d.ts +58 -0
- package/dist/hub/session-limits.js +121 -0
- package/dist/hub/session-limits.js.map +1 -0
- package/dist/hub/sessions.d.ts +1 -1
- package/dist/hub/sessions.js +13 -7
- package/dist/hub/sessions.js.map +1 -1
- package/dist/hub/settings-directory-decision.js +1 -1
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/types.d.ts +9 -2
- package/dist/hub-character-plan.d.ts +47 -0
- package/dist/hub-character-plan.js +70 -0
- package/dist/hub-character-plan.js.map +1 -0
- package/dist/hub-contact-windows.d.ts +13 -1
- package/dist/hub-contact-windows.js +35 -2
- package/dist/hub-contact-windows.js.map +1 -1
- package/dist/hub-picture-reduce.d.ts +34 -0
- package/dist/hub-picture-reduce.js +101 -0
- package/dist/hub-picture-reduce.js.map +1 -0
- package/dist/hub-picture-worker.d.ts +1 -0
- package/dist/hub-picture-worker.js +19 -0
- package/dist/hub-picture-worker.js.map +1 -0
- package/dist/hub-report-target.d.ts +6 -0
- package/dist/hub-report-target.js +6 -0
- package/dist/hub-report-target.js.map +1 -1
- package/dist/locale.js +357 -265
- package/dist/locale.js.map +1 -1
- package/dist/ls-rows.d.ts +2 -0
- package/dist/ls-rows.js.map +1 -1
- package/dist/needs-you.d.ts +6 -0
- package/dist/needs-you.js +3 -1
- package/dist/needs-you.js.map +1 -1
- package/dist/outbound-handlers.d.ts +8 -0
- package/dist/outbound-handlers.js +53 -6
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +2 -0
- package/dist/outbound-schemas.js +6 -4
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/runtime-cli-install.js +4 -4
- package/dist/runtime-cli-install.js.map +1 -1
- package/dist/task-board-tool.d.ts +17 -0
- package/dist/task-board-tool.js +58 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/tips.js +3 -3
- package/dist/tool-permissions.js +2 -2
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/agent-export-strings.js +1 -1
- package/dist/ui/agent-page-strings.js +5 -5
- package/dist/ui/contact-auth-client.js +2 -2
- package/dist/ui/contact-tool-groups.js +1 -1
- package/dist/ui/fleet-cache.js +5 -5
- package/dist/ui/fleet-canvas.js +3 -2
- package/dist/ui/fleet-office-card.js +46 -7
- package/dist/ui/fleet-office-dialogue.d.ts +6 -3
- package/dist/ui/fleet-office-dialogue.js +13 -3
- package/dist/ui/fleet-office-layout.js +15 -15
- package/dist/ui/fleet-office-model.js +3 -2
- package/dist/ui/fleet-office-overview.js +1 -1
- package/dist/ui/fleet-office-pack.d.ts +17 -7
- package/dist/ui/fleet-office-pack.js +106 -38
- package/dist/ui/fleet-office-play.js +11 -4
- package/dist/ui/fleet-office-skin.js +41 -11
- package/dist/ui/fleet-office-store.js +10 -1
- package/dist/ui/fleet-office-talk.js +423 -0
- package/dist/ui/fleet-office-view.js +58 -17
- package/dist/ui/fleet-office-zones.js +20 -12
- package/dist/ui/fleet-office.js +250 -65
- package/dist/ui/fleet-org.js +3 -3
- package/dist/ui/fleet-task-common.js +3 -3
- package/dist/ui/fleet-task-sort.js +88 -0
- package/dist/ui/fleet-task-view.js +38 -9
- package/dist/ui/fleet-tasks.js +47 -15
- package/dist/ui/fleet-usage.js +6 -6
- package/dist/ui/hub-admin-overview.js +1 -1
- package/dist/ui/hub-chat-store.js +4 -3
- package/dist/ui/hub-chat-strings.js +3 -1
- package/dist/ui/hub-client.js +3 -0
- package/dist/ui/hub-my-agents-strings.js +2 -2
- package/dist/ui/hub-my-agents.js +3 -0
- package/dist/ui/hub-room-composer.js +24 -4
- package/dist/ui/hub-room-members.js +7 -3
- package/dist/ui/hub-room-office.js +71 -2
- package/dist/ui/hub-room-presence.js +14 -0
- package/dist/ui/hub-room-strings.js +18 -2
- package/dist/ui/hub-room-thread.js +82 -13
- package/dist/ui/hub-room-working.js +37 -0
- package/dist/ui/hub-session-limits.js +79 -0
- package/dist/ui/panel-fleet.js +5 -5
- package/dist/ui/panel-hub.js +41 -6
- package/dist/ui/panel-log.js +3 -3
- package/dist/ui/panel-needs.js +28 -2
- package/dist/ui/panel-runtimes.js +2 -2
- package/dist/ui/runtime-cli-install.js +1 -1
- package/dist/ui/runtime-update-status.js +1 -1
- package/dist/ui/settings-access-strings.js +1 -1
- package/dist/ui/settings-hub-setup-strings.js +1 -1
- package/dist/ui/settings-layout.js +2 -2
- package/dist/ui/settings-named-test.js +16 -16
- package/dist/ui/settings-public-session-strings.js +2 -2
- package/dist/ui/settings-revoke-strings.js +1 -1
- package/dist/ui/settings-shared-strings.js +2 -2
- package/dist/ui/settings-strings.js +40 -40
- package/dist/ui/shared/app-shell.js +1 -1
- package/dist/ui/shared/app.css +106 -6
- package/dist/ui/shared/chat-strings.js +9 -9
- package/dist/ui/shared/hub-owner.css +5 -0
- package/dist/ui/shared/hub-rooms-u2.css +3 -0
- package/dist/ui/shared/instance-nav.js +36 -2
- package/dist/ui/shared/office-dialogue.css +110 -0
- package/dist/ui/shared/task-board.css +103 -7
- package/dist/ui/shared/view-strings.js +27 -9
- package/dist/web-api.d.ts +5 -0
- package/dist/web-api.js +29 -0
- package/dist/web-api.js.map +1 -1
- package/dist/web-office-skins.d.ts +8 -2
- package/dist/web-office-skins.js +33 -14
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-office-store.js +5 -3
- package/dist/web-office-store.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { managedClaudeBinding } from "./claude-credential-launch.js";
|
|
2
2
|
import { HUB_REPORT_TARGET } from "./hub-report-target.js";
|
|
3
|
+
import { atomicWriteFileSync } from "./atomic-write.js";
|
|
3
4
|
import { RoomConversationGeneration, roomContextInputMarker } from "./hub-room-conversation.js";
|
|
4
5
|
import { checkpointGrokDelivery } from "./grok-delivery-proof.js";
|
|
5
6
|
import { nativePaneToolRefusal } from "./native-pane-tools.js";
|
|
@@ -1141,6 +1142,33 @@ const FLEET_RESPONSE_TYPES = new Set([
|
|
|
1141
1142
|
"fleet_schedule_response", "fleet_outbound_response", "fleet_decision_response", "fleet_task_response",
|
|
1142
1143
|
"fleet_display_name_response", "fleet_description_response", "fleet_persona_emoji_response", "fleet_web_theme_response",
|
|
1143
1144
|
]);
|
|
1145
|
+
/** null: no record (no turn). "unknown": a record that cannot be read or makes no sense — a turn may be running. */
|
|
1146
|
+
function readHubAnswerTurn(file) {
|
|
1147
|
+
let text;
|
|
1148
|
+
try {
|
|
1149
|
+
text = readFileSync(file, "utf8");
|
|
1150
|
+
}
|
|
1151
|
+
catch (err) {
|
|
1152
|
+
return err.code === "ENOENT" ? null : "unknown";
|
|
1153
|
+
}
|
|
1154
|
+
try {
|
|
1155
|
+
const r = JSON.parse(text);
|
|
1156
|
+
if (!r || typeof r.correlationId !== "string" || !/^hub-[A-Za-z0-9-]+$/.test(r.correlationId))
|
|
1157
|
+
return "unknown";
|
|
1158
|
+
return { correlationId: r.correlationId, contactLimit: r.contactLimit !== false, sawWorking: true, restored: true };
|
|
1159
|
+
}
|
|
1160
|
+
catch {
|
|
1161
|
+
return "unknown";
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* M-3660: a question from the Hub (a representative or room ask) that the agent answers with report_result to agend-hub.
|
|
1166
|
+
* It trusts the meta: only the fleet writes fleet_inbound, and from_instance "agend-hub" is its reserved sender — an
|
|
1167
|
+
* agent's send_to_instance is stamped with the agent's own name.
|
|
1168
|
+
*/
|
|
1169
|
+
export function isHubQuestionMeta(meta) {
|
|
1170
|
+
return meta.from_instance === HUB_REPORT_TARGET && meta.request_kind === "query" && /^hub-[A-Za-z0-9-]+$/.test(meta.correlation_id ?? "");
|
|
1171
|
+
}
|
|
1144
1172
|
export class Daemon extends EventEmitter {
|
|
1145
1173
|
name;
|
|
1146
1174
|
config;
|
|
@@ -3278,6 +3306,7 @@ export class Daemon extends EventEmitter {
|
|
|
3278
3306
|
}
|
|
3279
3307
|
// Batch response for prune path
|
|
3280
3308
|
this.ipcServer?.send(socket, { type: "query_sessions_response", sessions });
|
|
3309
|
+
this.ipcServer?.send(socket, this.hubAnswerTurnStateMessage()); // M-3660: a fresh connection learns the current turn
|
|
3281
3310
|
}
|
|
3282
3311
|
else
|
|
3283
3312
|
this.handleFleetMessage(msg, reply => { this.ipcServer?.send(socket, reply); });
|
|
@@ -3386,6 +3415,7 @@ export class Daemon extends EventEmitter {
|
|
|
3386
3415
|
if (nativeDisposition)
|
|
3387
3416
|
this.isNewSession = nativeDisposition === "fresh";
|
|
3388
3417
|
this.resetRoomConversation(nativeDisposition === "reattached");
|
|
3418
|
+
this.settleHubAnswerTurnAtLaunch(nativeDisposition === "reattached");
|
|
3389
3419
|
// #1209: conditional continuation for the turn interrupted by the last
|
|
3390
3420
|
// restart, if the gates allow. Detached; the gate
|
|
3391
3421
|
// consumes its one-shot marker first and never throws into boot.
|
|
@@ -6323,6 +6353,7 @@ export class Daemon extends EventEmitter {
|
|
|
6323
6353
|
}
|
|
6324
6354
|
if (msg.type === "query_sessions") {
|
|
6325
6355
|
send({ type: "query_sessions_response", sessions: [] });
|
|
6356
|
+
send(this.hubAnswerTurnStateMessage()); // M-3660
|
|
6326
6357
|
}
|
|
6327
6358
|
else if (msg.type === "fleet_inbound") {
|
|
6328
6359
|
const meta = msg.meta;
|
|
@@ -7310,6 +7341,99 @@ export class Daemon extends EventEmitter {
|
|
|
7310
7341
|
hubRoomTurnBoot = randomUUID();
|
|
7311
7342
|
hubRoomTurnSequence = 0;
|
|
7312
7343
|
turnEndTimer = null;
|
|
7344
|
+
/**
|
|
7345
|
+
* M-3660: the Hub question this pane is answering as a turn of its own — from just before its write until the idle edge
|
|
7346
|
+
* after that turn's work (or the next write into the idle pane). The fleet keeps the agent's contact window for exactly
|
|
7347
|
+
* this turn: hub_question_input opens it, hub_question_turn_ended closes it.
|
|
7348
|
+
*/
|
|
7349
|
+
// It is kept on disk too (hub-answer-turn.json): a daemon restarted mid-turn takes it up again, so deliveries keep
|
|
7350
|
+
// waiting behind it and its end is still announced; the fleet is told the current state again on every (re)connect.
|
|
7351
|
+
hubAnswerTurnState;
|
|
7352
|
+
/** Prism #4420 P2-2: the turn record exists but cannot be read — a turn may be running; fail closed until an idle edge. */
|
|
7353
|
+
hubAnswerTurnUnknown = false;
|
|
7354
|
+
get hubAnswerTurn() {
|
|
7355
|
+
if (this.hubAnswerTurnState === undefined) {
|
|
7356
|
+
const file = this.hubAnswerTurnFile(), read = file ? readHubAnswerTurn(file) : null;
|
|
7357
|
+
this.hubAnswerTurnUnknown = read === "unknown";
|
|
7358
|
+
this.hubAnswerTurnState = read === "unknown" ? null : read;
|
|
7359
|
+
}
|
|
7360
|
+
return this.hubAnswerTurnState;
|
|
7361
|
+
}
|
|
7362
|
+
/** M-3660: a turn is running, or may be (an unreadable record): nothing is handed into it. */
|
|
7363
|
+
hubAnswerTurnMayRun() { return this.hubAnswerTurn !== null || this.hubAnswerTurnUnknown; }
|
|
7364
|
+
/** The unknown is resolved (an idle edge, a write into the idle pane): no turn runs; the fleet is told "none". */
|
|
7365
|
+
resolveUnknownHubAnswerTurn() {
|
|
7366
|
+
if (!this.hubAnswerTurnUnknown)
|
|
7367
|
+
return;
|
|
7368
|
+
this.hubAnswerTurnUnknown = false;
|
|
7369
|
+
const file = this.hubAnswerTurnFile();
|
|
7370
|
+
try {
|
|
7371
|
+
if (file)
|
|
7372
|
+
rmSync(file, { force: true });
|
|
7373
|
+
}
|
|
7374
|
+
catch (err) {
|
|
7375
|
+
this.logger.warn({ err }, "Unreadable Hub answer turn record could not be removed");
|
|
7376
|
+
}
|
|
7377
|
+
this.broadcastFleetMessage({ type: "hub_question_turn_state", correlationId: null });
|
|
7378
|
+
}
|
|
7379
|
+
hubAnswerTurnFile() { return typeof this.instanceDir === "string" ? join(this.instanceDir, "hub-answer-turn.json") : null; }
|
|
7380
|
+
/** A turn's end is always kept in memory; a record that cannot be removed is read as a restored turn later (fail closed). */
|
|
7381
|
+
setHubAnswerTurn(turn) {
|
|
7382
|
+
this.hubAnswerTurnState = turn;
|
|
7383
|
+
const file = this.hubAnswerTurnFile();
|
|
7384
|
+
if (!file)
|
|
7385
|
+
return;
|
|
7386
|
+
try {
|
|
7387
|
+
if (turn)
|
|
7388
|
+
atomicWriteFileSync(file, JSON.stringify({ correlationId: turn.correlationId, contactLimit: turn.contactLimit }), { mode: 0o600 });
|
|
7389
|
+
else
|
|
7390
|
+
rmSync(file, { force: true });
|
|
7391
|
+
}
|
|
7392
|
+
catch (err) {
|
|
7393
|
+
// Prism #4420 P2-2: a turn that cannot be recorded is not begun — its question is not written (the caller throws).
|
|
7394
|
+
if (turn) {
|
|
7395
|
+
this.hubAnswerTurnState = null;
|
|
7396
|
+
throw err;
|
|
7397
|
+
}
|
|
7398
|
+
this.logger.warn({ err }, "Hub answer turn end could not be saved; a restart reads it as a turn that ends at its first idle edge");
|
|
7399
|
+
}
|
|
7400
|
+
}
|
|
7401
|
+
hubAnswerTurnBegins(correlationId, contactLimit = true) {
|
|
7402
|
+
if (correlationId !== undefined && this.hubAnswerTurn?.correlationId === correlationId)
|
|
7403
|
+
return; // a retried write
|
|
7404
|
+
this.resolveUnknownHubAnswerTurn(); // written into the idle pane: whatever might have run is over
|
|
7405
|
+
this.endHubAnswerTurn();
|
|
7406
|
+
if (correlationId === undefined)
|
|
7407
|
+
return;
|
|
7408
|
+
// Throws when the turn cannot be recorded: the question is then not written, and its delivery fails (reported).
|
|
7409
|
+
this.setHubAnswerTurn({ correlationId, contactLimit, sawWorking: false, restored: false });
|
|
7410
|
+
this.broadcastFleetMessage({ type: "hub_question_input", correlationId, contactLimit });
|
|
7411
|
+
}
|
|
7412
|
+
endHubAnswerTurn() {
|
|
7413
|
+
const turn = this.hubAnswerTurn;
|
|
7414
|
+
if (!turn)
|
|
7415
|
+
return;
|
|
7416
|
+
this.setHubAnswerTurn(null);
|
|
7417
|
+
this.broadcastFleetMessage({ type: "hub_question_turn_ended", correlationId: turn.correlationId });
|
|
7418
|
+
}
|
|
7419
|
+
/**
|
|
7420
|
+
* Lumen #4420 R2-A: a turn taken up from the record outlives nothing but the pane it ran in. A launch that starts a new
|
|
7421
|
+
* CLI (every launch but a native reattach) ends it, and an unreadable record resolves to "none", at once.
|
|
7422
|
+
*/
|
|
7423
|
+
settleHubAnswerTurnAtLaunch(reattached) {
|
|
7424
|
+
if (reattached)
|
|
7425
|
+
return;
|
|
7426
|
+
if (this.hubAnswerTurn?.restored)
|
|
7427
|
+
this.endHubAnswerTurn();
|
|
7428
|
+
this.resolveUnknownHubAnswerTurn();
|
|
7429
|
+
}
|
|
7430
|
+
/** M-3660: the current Hub answer turn, told to a fleet connection when it (re)connects (a signal may have been lost). */
|
|
7431
|
+
hubAnswerTurnStateMessage() {
|
|
7432
|
+
const turn = this.hubAnswerTurn;
|
|
7433
|
+
if (!turn && this.hubAnswerTurnUnknown)
|
|
7434
|
+
return { type: "hub_question_turn_state", correlationId: null, unknown: true };
|
|
7435
|
+
return { type: "hub_question_turn_state", correlationId: turn?.correlationId ?? null, ...(turn ? { contactLimit: turn.contactLimit } : {}) };
|
|
7436
|
+
}
|
|
7313
7437
|
/** M-3239: Claude's and Codex's transcripts tell each tool call and answer; their pane's spinner alone is not a turn. */
|
|
7314
7438
|
turnEvidence() {
|
|
7315
7439
|
const bin = this.backend?.binaryName;
|
|
@@ -7336,9 +7460,17 @@ export class Daemon extends EventEmitter {
|
|
|
7336
7460
|
if (state === "working") {
|
|
7337
7461
|
this.turnWatch.begin(Date.now());
|
|
7338
7462
|
this.hubRoomTurnActivityStart ??= this.hubRoomTranscriptActivity;
|
|
7463
|
+
{
|
|
7464
|
+
const hubTurn = this.hubAnswerTurn;
|
|
7465
|
+
if (hubTurn)
|
|
7466
|
+
hubTurn.sawWorking = true;
|
|
7467
|
+
}
|
|
7339
7468
|
}
|
|
7340
7469
|
return;
|
|
7341
7470
|
}
|
|
7471
|
+
// Lumen #4420 R2-A: a turn taken up from the record ends on the first idle state, at once (no settle wait, no work proof).
|
|
7472
|
+
if (this.hubAnswerTurn?.restored)
|
|
7473
|
+
this.endHubAnswerTurn();
|
|
7342
7474
|
if (this.turnEndTimer)
|
|
7343
7475
|
return;
|
|
7344
7476
|
const roomGeneration = this.roomConversationState ? this.roomConversationGeneration() : null, roomInputEpoch = this.hubRoomInputEpoch;
|
|
@@ -7349,6 +7481,14 @@ export class Daemon extends EventEmitter {
|
|
|
7349
7481
|
const bin = this.backend?.binaryName, needsTranscript = bin === "claude" || bin === "codex";
|
|
7350
7482
|
const realWork = !needsTranscript || this.hubRoomTurnActivityStart !== null && this.hubRoomTranscriptActivity > this.hubRoomTurnActivityStart;
|
|
7351
7483
|
this.hubRoomTurnActivityStart = null;
|
|
7484
|
+
// M-3660: the Hub answer turn ends only on real work (a compaction spinner is not its end: realWork needs a fresh
|
|
7485
|
+
// working edge AND transcript activity since it, so a flicker leaves the turn running until real work then idle) —
|
|
7486
|
+
// or, taken up again after a daemon restart, on the first idle edge.
|
|
7487
|
+
const hubTurn = this.hubAnswerTurn;
|
|
7488
|
+
if (hubTurn?.sawWorking && (realWork || hubTurn.restored))
|
|
7489
|
+
this.endHubAnswerTurn();
|
|
7490
|
+
else if (!hubTurn)
|
|
7491
|
+
this.resolveUnknownHubAnswerTurn(); // an unreadable record: the pane is idle now, nothing runs
|
|
7352
7492
|
if (turn && realWork && roomGeneration && roomGeneration === this.roomConversationGeneration() && roomInputEpoch === this.hubRoomInputEpoch)
|
|
7353
7493
|
this.broadcastFleetMessage({ type: "hub_room_turn_ended", generation: roomGeneration, turn: `${this.hubRoomTurnBoot}:${++this.hubRoomTurnSequence}` });
|
|
7354
7494
|
if (!turn || turn.messaged || !turn.text.trim() || !this.turnEvidence())
|
|
@@ -9033,6 +9173,7 @@ export class Daemon extends EventEmitter {
|
|
|
9033
9173
|
sent = await this.deliverMessage(pasted, status, {
|
|
9034
9174
|
deliveryEpoch,
|
|
9035
9175
|
submissionId: meta.message_id,
|
|
9176
|
+
...(isHubQuestionMeta(meta) ? { hubQuestion: meta.correlation_id, hubContactLimit: meta.hub_contact_limit !== "off" } : {}),
|
|
9036
9177
|
...(meta.hub_room_context_generation ? { roomContextGeneration: meta.hub_room_context_generation } : {}),
|
|
9037
9178
|
...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
|
|
9038
9179
|
verdict,
|
|
@@ -9166,7 +9307,10 @@ export class Daemon extends EventEmitter {
|
|
|
9166
9307
|
// normal Enter input has steering/interrupt semantics in several other CLIs.
|
|
9167
9308
|
let readiness = "ready";
|
|
9168
9309
|
const gateWindowId = windowId;
|
|
9169
|
-
|
|
9310
|
+
// M-3660: a Hub question is never handed into a running turn (Claude would merge it into that turn's work), and while
|
|
9311
|
+
// a Hub answer turn runs, nothing else is handed into it: each waits for the idle pane and becomes a turn of its own.
|
|
9312
|
+
const exclusiveTurn = opts?.hubQuestion !== undefined || this.hubAnswerTurnMayRun();
|
|
9313
|
+
const handOffEligible = !exclusiveTurn && !!(supportsQueuedInput || opts?.steer || composerQueue);
|
|
9170
9314
|
const handOffAdmissible = async () => (await this.probeBlockingDialog()).state === "clear"
|
|
9171
9315
|
&& await this.hasPositiveDeliveryInput(true)
|
|
9172
9316
|
&& ((!opts?.steer && !composerQueue) || (this.launchTakesSteer() && await this.steerComposerAdmits(false, opts?.steer === true)));
|
|
@@ -9347,7 +9491,10 @@ export class Daemon extends EventEmitter {
|
|
|
9347
9491
|
return stale();
|
|
9348
9492
|
if (residue !== "clear")
|
|
9349
9493
|
return this.failDelivery(verdict, status, "input-residue", residue);
|
|
9350
|
-
const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId,
|
|
9494
|
+
const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId,
|
|
9495
|
+
// M-3660: written into an idle pane, so whatever Hub answer turn ran is over; a Hub question begins its own.
|
|
9496
|
+
() => { if (!handingOffToNativeQueue)
|
|
9497
|
+
this.hubAnswerTurnBegins(opts?.hubQuestion, opts?.hubContactLimit !== false); opts?.beforePaneWrite?.(); }, opts?.lookBeforePaneWrite, opts?.humanMeta);
|
|
9351
9498
|
// #1690: still under the lock — whatever waits on it next must already see what this write started.
|
|
9352
9499
|
if (verdict.paneWriteStarted)
|
|
9353
9500
|
opts?.onPaneWritten?.();
|