@songsid/agend 2.4.0-beta.31 → 2.4.0-beta.34

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.
Files changed (91) hide show
  1. package/dist/build-provenance.json +1 -1
  2. package/dist/channel/mcp-tools.js +1 -1
  3. package/dist/channel/mcp-tools.js.map +1 -1
  4. package/dist/daemon.d.ts +9 -1
  5. package/dist/daemon.js +104 -25
  6. package/dist/daemon.js.map +1 -1
  7. package/dist/fleet-context.d.ts +2 -0
  8. package/dist/fleet-manager.d.ts +16 -0
  9. package/dist/fleet-manager.js +92 -9
  10. package/dist/fleet-manager.js.map +1 -1
  11. package/dist/general-knowledge/skills/concepts/SKILL.md +21 -2
  12. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +9 -4
  13. package/dist/general-knowledge/skills/hub/SKILL.md +16 -4
  14. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +2 -0
  15. package/dist/hub/client.js +23 -7
  16. package/dist/hub/client.js.map +1 -1
  17. package/dist/hub/compose/member.d.ts +11 -0
  18. package/dist/hub/compose/member.js +17 -5
  19. package/dist/hub/compose/member.js.map +1 -1
  20. package/dist/hub/compose/server.js +2 -1
  21. package/dist/hub/compose/server.js.map +1 -1
  22. package/dist/hub/group-policy/resources.d.ts +1 -1
  23. package/dist/hub/http/compose.d.ts +2 -0
  24. package/dist/hub/http/compose.js +45 -6
  25. package/dist/hub/http/compose.js.map +1 -1
  26. package/dist/hub/member/room-ask.d.ts +1 -0
  27. package/dist/hub/member/room-ask.js +11 -4
  28. package/dist/hub/member/room-ask.js.map +1 -1
  29. package/dist/hub/member-journal.d.ts +2 -0
  30. package/dist/hub/member-journal.js +5 -0
  31. package/dist/hub/member-journal.js.map +1 -1
  32. package/dist/hub/member-reconciliation.d.ts +2 -0
  33. package/dist/hub/member-reconciliation.js +3 -1
  34. package/dist/hub/member-reconciliation.js.map +1 -1
  35. package/dist/hub/protocol.d.ts +15 -8
  36. package/dist/hub/protocol.js +15 -3
  37. package/dist/hub/protocol.js.map +1 -1
  38. package/dist/hub/receipt-reason.d.ts +6 -0
  39. package/dist/hub/receipt-reason.js +12 -0
  40. package/dist/hub/receipt-reason.js.map +1 -0
  41. package/dist/hub/representative.d.ts +6 -0
  42. package/dist/hub/representative.js +21 -4
  43. package/dist/hub/representative.js.map +1 -1
  44. package/dist/hub/rooms/direct-view.js +2 -0
  45. package/dist/hub/rooms/direct-view.js.map +1 -1
  46. package/dist/hub/rooms/types.d.ts +2 -0
  47. package/dist/hub/rooms.d.ts +12 -0
  48. package/dist/hub/rooms.js +14 -3
  49. package/dist/hub/rooms.js.map +1 -1
  50. package/dist/hub/server.js +9 -2
  51. package/dist/hub/server.js.map +1 -1
  52. package/dist/hub/settings-member-address-decision.js +1 -1
  53. package/dist/hub/settings-member-address-decision.js.map +1 -1
  54. package/dist/hub/settings-web-address-decision.js +2 -2
  55. package/dist/hub/settings-web-address-decision.js.map +1 -1
  56. package/dist/hub-reply-route.d.ts +36 -0
  57. package/dist/hub-reply-route.js +67 -0
  58. package/dist/hub-reply-route.js.map +1 -0
  59. package/dist/hub-report-target.d.ts +4 -0
  60. package/dist/instance-lifecycle.d.ts +2 -0
  61. package/dist/instance-lifecycle.js +4 -0
  62. package/dist/instance-lifecycle.js.map +1 -1
  63. package/dist/locale.js +2 -2
  64. package/dist/locale.js.map +1 -1
  65. package/dist/outbound-handlers.d.ts +2 -0
  66. package/dist/outbound-handlers.js +22 -7
  67. package/dist/outbound-handlers.js.map +1 -1
  68. package/dist/outbound-schemas.d.ts +1 -0
  69. package/dist/outbound-schemas.js +1 -0
  70. package/dist/outbound-schemas.js.map +1 -1
  71. package/dist/topic-commands.js +6 -4
  72. package/dist/topic-commands.js.map +1 -1
  73. package/dist/turn-reply-guard.d.ts +3 -1
  74. package/dist/turn-reply-guard.js +7 -3
  75. package/dist/turn-reply-guard.js.map +1 -1
  76. package/dist/ui/hub-assistant-admin.js +10 -3
  77. package/dist/ui/hub-assistant-usage-strings.js +8 -0
  78. package/dist/ui/hub-chat-store.js +9 -6
  79. package/dist/ui/hub-chat-strings.js +4 -2
  80. package/dist/ui/hub-owner-strings.js +2 -2
  81. package/dist/ui/hub-room-composer.js +9 -2
  82. package/dist/ui/hub-room-strings.js +4 -4
  83. package/dist/ui/hub-room-thread.js +45 -11
  84. package/dist/ui/panel-chat.js +18 -5
  85. package/dist/ui/panel-hub.js +3 -3
  86. package/dist/ui/report-columns.js +137 -0
  87. package/dist/ui/shared/app.css +28 -2
  88. package/dist/ui/shared/chat-msg-actions.js +1 -1
  89. package/dist/ui/shared/chat-thread.js +1 -1
  90. package/dist/ui/shared/hub-owner.css +12 -0
  91. package/package.json +1 -1
@@ -215,6 +215,8 @@ export interface FleetContext {
215
215
  cancelLoginSession?(): Promise<string>;
216
216
  /** Human-readable effective model for an instance (resolves inherited defaults). */
217
217
  modelDisplayForInstance?(name: string): string;
218
+ /** M-3943: the account an agent signs in with — a profile name, "default", "invalid", or null when its backend has none. */
219
+ credentialProfileLabel?(name: string, backend?: string): string | null;
218
220
  /** How this instance's backend takes a reasoning-effort setting, if at all. */
219
221
  effortStrategyFor?(name: string): "runtime" | "restart" | "unsupported";
220
222
  /** Configured effort for an instance: per-instance, else fleet default, else none. */
@@ -843,6 +843,15 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
843
843
  hubFleetUpdates(): import("./hub/member/updates.js").HubMemberUpdates | null;
844
844
  /** `ownClaim` is this caller's launch, so that launch does not look busy to itself. The Hub queue passes its claim; the local card passes its own. */
845
845
  private hubUpdateIdle;
846
+ /**
847
+ * M-3960: a paused instance that is doing no work, for both idle checks (the Hub-requested update and Update when idle).
848
+ * A pause persisted across a restart starts no daemon at all ("Persisted paused instance — skipping startup"): before,
849
+ * that read as an unknown process, counted as busy and held every idle update until it expired. A live daemon is
850
+ * asleep only once its process has stopped. A wake on its way is checked first, by wakeOnItsWay().
851
+ */
852
+ private pausedAndAsleep;
853
+ /** M-3960: a wake of `name` is under way: its lifecycle flight, or the wake coordinator's admission. Busy for both idle checks. */
854
+ private wakeOnItsWay;
846
855
  private hubUpdateCanInstall;
847
856
  private launchHubUpdate;
848
857
  /**
@@ -1038,6 +1047,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1038
1047
  private hubSettledOutsideTurn;
1039
1048
  /** M-3660: the member side's "this question is no longer being answered" reader (null: no member service attached). */
1040
1049
  private notifyHubQuestionEnded;
1050
+ private hubQuestionDelivered;
1041
1051
  private hubQuestionEnded;
1042
1052
  private hubQuestionSettled;
1043
1053
  hubContactRestricted(agent: string): boolean;
@@ -4933,6 +4943,12 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
4933
4943
  /** #3715: update_instance_config's ClassicBot room account switch — the room's Settings save (#3691), from a tool. */
4934
4944
  switchClassicRoomProfile(name: string, backendOptions: unknown): Promise<ClassicProfileSwitch>;
4935
4945
  credentialProfileOf(name: string, backend: string): string | null;
4946
+ /**
4947
+ * M-3943: the account an agent signs in with, as /status, the web status table and list_instances show it — a profile
4948
+ * name, "default" for the backend's shared login, "invalid" for a ClassicBot room whose setting cannot launch, or
4949
+ * null when the backend has no profiles. A Windows agent's profile is the one kept on its paired Runtime computer.
4950
+ */
4951
+ credentialProfileLabel(name: string, backend?: string): string | null;
4936
4952
  /**
4937
4953
  * #1699: the claude config dir an instance's CLI uses — its credential profile's, else exactly as before
4938
4954
  * (CLAUDE_CONFIG_DIR or ~/.claude).
@@ -288,7 +288,7 @@ import { windowsCliEnabled, closeWindowsBridge, retireWindowsBridgeForRequestCon
288
288
  import { nativeCliVersionState } from "./runtime-pane-native.js";
289
289
  import { localWindowsCliEnabled, remoteRuntimeEnabled, setConfiguredRuntimeSwitches, maxAgentsPerMachine } from "./runtime-switches.js";
290
290
  import { RuntimeInstallService } from "./runtime-install.js";
291
- import { RUNTIME_CREDENTIAL_CAPABILITY, validCredentialProfileName } from "./runtime-credential-profiles.js";
291
+ import { RUNTIME_CREDENTIAL_CAPABILITY, isCredentialProfileCli, validCredentialProfileName } from "./runtime-credential-profiles.js";
292
292
  import { RuntimeCoordinator } from "./runtime-coordinator.js";
293
293
  import { runtimeUpdateAttention } from "./runtime-update-attention.js";
294
294
  import { RuntimeWindowsBridge } from "./runtime-windows-bridge.js";
@@ -3347,10 +3347,14 @@ export class FleetManager {
3347
3347
  const worker = this.queueWorkers.get(name);
3348
3348
  if (worker?.busy || worker?.inFlight)
3349
3349
  return false;
3350
+ // M-3960 (Prism #4634): a wake on its way is busy whatever the status reads; a cold wake clears the pause marker
3351
+ // before its daemon exists, so the status reads stopped for that window.
3352
+ if (this.wakeOnItsWay(name))
3353
+ return false;
3350
3354
  const process = this.getInstanceStatus(name);
3351
3355
  if (process === "stopped" || process === "crashed")
3352
3356
  continue;
3353
- if (process === "paused" && ["stopped", "crashed"].includes(this.daemons.get(name)?.getProcessStatus?.() ?? "unknown"))
3357
+ if (process === "paused" && this.pausedAndAsleep(name))
3354
3358
  continue;
3355
3359
  if (process !== "running" || this.getInstanceExecutionState(name) !== "idle")
3356
3360
  return false;
@@ -3359,6 +3363,22 @@ export class FleetManager {
3359
3363
  }
3360
3364
  return true;
3361
3365
  }
3366
+ /**
3367
+ * M-3960: a paused instance that is doing no work, for both idle checks (the Hub-requested update and Update when idle).
3368
+ * A pause persisted across a restart starts no daemon at all ("Persisted paused instance — skipping startup"): before,
3369
+ * that read as an unknown process, counted as busy and held every idle update until it expired. A live daemon is
3370
+ * asleep only once its process has stopped. A wake on its way is checked first, by wakeOnItsWay().
3371
+ */
3372
+ pausedAndAsleep(name) {
3373
+ const daemon = this.daemons.get(name);
3374
+ if (!daemon)
3375
+ return true;
3376
+ return ["stopped", "crashed"].includes(daemon.getProcessStatus?.() ?? "unknown");
3377
+ }
3378
+ /** M-3960: a wake of `name` is under way: its lifecycle flight, or the wake coordinator's admission. Busy for both idle checks. */
3379
+ wakeOnItsWay(name) {
3380
+ return this.lifecycle.wakeInFlight(name) || this.wakeCoordinator?.isWaking(name) === true;
3381
+ }
3362
3382
  async hubUpdateCanInstall() {
3363
3383
  const found = await npmForRunningInstall();
3364
3384
  if ("reason" in found)
@@ -4200,6 +4220,7 @@ export class FleetManager {
4200
4220
  attachReports: (handler, failed) => { this.hubReports = handler; this.hubDeliveryFailed = failed; },
4201
4221
  attachPrivateQuestions: read => { this.hubPrivateQuestions = read; },
4202
4222
  attachQuestionEnded: ended => { this.hubQuestionEnded = ended; },
4223
+ attachQuestionDelivered: delivered => { this.hubQuestionDelivered = delivered; },
4203
4224
  attachQuestionSettled: read => { this.hubQuestionSettled = read; },
4204
4225
  attachReacts: handler => { this.hubReacts = handler; },
4205
4226
  },
@@ -4776,6 +4797,8 @@ export class FleetManager {
4776
4797
  if (msg.unknown !== true && (cid || msg.correlationId === null))
4777
4798
  this.hubQuestionTurnState(agent, cid, msg.contactLimit !== false);
4778
4799
  }
4800
+ else if (cid && msg.type === "hub_question_delivered")
4801
+ this.hubQuestionDelivered?.(agent, cid);
4779
4802
  else if (cid && msg.type === "hub_question_input")
4780
4803
  this.hubQuestionInput(agent, cid, msg.contactLimit !== false);
4781
4804
  else if (cid && msg.type === "hub_question_turn_ended")
@@ -4799,6 +4822,7 @@ export class FleetManager {
4799
4822
  this.logger?.warn({ err }, "Hub unanswered completion receipt held");
4800
4823
  }
4801
4824
  }
4825
+ hubQuestionDelivered = null;
4802
4826
  hubQuestionEnded = null;
4803
4827
  hubQuestionSettled = null;
4804
4828
  hubContactRestricted(agent) { return this.contactWindows().restricted(agent, this.hubSettledOutsideTurn()); }
@@ -4875,7 +4899,10 @@ export class FleetManager {
4875
4899
  // M-3660: the share's opt-out travels with the question; its daemon's hub_question_input then opens no window.
4876
4900
  if (input.contactLimit === false)
4877
4901
  ipcMeta.hub_contact_limit = "off";
4878
- const result = await this.deliverToInstance(input.agent, { type: "fleet_inbound", targetSession: input.agent, content: this.screenHubText(input.text), meta: ipcMeta, ...(scoped ? { request_context_input_id: scoped.inputId } : {}) }, { isCrossInstance: true, stillCurrent: input.stillCurrent, beforeInput: async () => {
4902
+ const replyInputId = input.acceptedHubRequest ? randomUUID() : undefined;
4903
+ let registeredDaemon;
4904
+ const screenedText = this.screenHubText(input.text);
4905
+ const result = await this.deliverToInstance(input.agent, { ...(replyInputId ? { hub_reply_input_id: replyInputId } : {}), type: "fleet_inbound", targetSession: input.agent, content: screenedText, meta: ipcMeta, ...(scoped ? { request_context_input_id: scoped.inputId } : {}) }, { isCrossInstance: true, stillCurrent: input.stillCurrent, beforeInput: async () => {
4879
4906
  const classic = this.isClassicInstance(input.agent);
4880
4907
  // A busy Classic room must finish its public turn first; never force a private question into that turn's queue.
4881
4908
  const idle = () => this.waitForInstanceIdle(input.agent, 0, this.lastDeliveryAt.get(input.agent) ?? 0, () => !input.stillCurrent());
@@ -4898,8 +4925,20 @@ export class FleetManager {
4898
4925
  // M-3660: the window covers only the turn that answers the question. The agent's daemon (Classic rooms' too)
4899
4926
  // writes it only into an idle pane, as a turn of its own, and says so just before the write (hub_question_input),
4900
4927
  // so a question waiting behind another turn — or never written — opens nothing.
4928
+ if (!input.stillCurrent())
4929
+ return false;
4930
+ if (replyInputId && input.acceptedHubRequest) {
4931
+ const daemon = this.daemons.get(input.agent);
4932
+ if (typeof daemon?.registerHubReplyInput !== "function")
4933
+ return false;
4934
+ registeredDaemon = daemon;
4935
+ daemon.registerHubReplyInput(replyInputId, input.acceptedHubRequest, input.correlationId, screenedText, this.screenHubText(input.replyQuestionBeginning ?? ""));
4936
+ }
4901
4937
  return input.stillCurrent();
4902
- } });
4938
+ } }).catch(error => { if (replyInputId)
4939
+ registeredDaemon?.releaseHubReplyInput(replyInputId); throw error; });
4940
+ if (result === false && replyInputId)
4941
+ registeredDaemon?.releaseHubReplyInput(replyInputId);
4903
4942
  return result !== false;
4904
4943
  }
4905
4944
  async deliverHubRoomNotification(input) {
@@ -5024,7 +5063,12 @@ export class FleetManager {
5024
5063
  const result = this.hubReports?.(input) ?? null;
5025
5064
  if (!result)
5026
5065
  return null;
5066
+ const daemon = this.daemons.get(input.caller);
5067
+ const callerCurrent = () => typeof input.callerCurrent === "function" && input.callerCurrent();
5068
+ const settle = callerCurrent() ? daemon?.captureHubReplyCompletion?.(input.correlationId) : null;
5027
5069
  return result.then(outcome => {
5070
+ if (this.daemons.get(input.caller) === daemon && callerCurrent())
5071
+ settle?.(outcome);
5028
5072
  // M-3660: an accepted answer inside its own running answer turn does not lift it: the turn's end does.
5029
5073
  if (outcome.ok && this.hubAnswerTurnKnownNone(input.caller, input.correlationId)) {
5030
5074
  try {
@@ -5035,11 +5079,18 @@ export class FleetManager {
5035
5079
  }
5036
5080
  }
5037
5081
  return outcome;
5038
- });
5082
+ }, error => { if (this.daemons.get(input.caller) === daemon)
5083
+ settle?.({ ok: false, message: "Hub outcome unconfirmed" }); throw error; });
5039
5084
  }
5040
5085
  /** M-3127 OutboundContext: an agent's `react` on a Hub room question (its correlation id as message_id); null: not one. */
5041
5086
  hubReact(input) {
5042
- return this.hubReacts?.(input) ?? null;
5087
+ const result = this.hubReacts?.(input) ?? null;
5088
+ if (!result)
5089
+ return null;
5090
+ const daemon = this.daemons.get(input.caller), callerCurrent = () => typeof input.callerCurrent === "function" && input.callerCurrent(), settle = callerCurrent() ? daemon?.captureHubReplyCompletion?.(input.correlationId, false) : null;
5091
+ return result.then(outcome => { if (this.daemons.get(input.caller) === daemon && callerCurrent())
5092
+ settle?.(outcome); return outcome; }, error => { if (this.daemons.get(input.caller) === daemon)
5093
+ settle?.({ ok: false, message: "Hub acknowledgement unconfirmed" }); throw error; });
5043
5094
  }
5044
5095
  hubReacts = null;
5045
5096
  /** The member side's pane-failure hook for a Hub-issued correlation id (else null). */
@@ -12783,7 +12834,7 @@ export class FleetManager {
12783
12834
  const after = identity();
12784
12835
  if (!owned() || after.incarnation !== before.incarnation || after.workGeneration === before.workGeneration)
12785
12836
  throw Error("Fresh request work identity did not rotate");
12786
- }, snapshot => requestHumanReplyTarget(box, snapshot, () => owned() && daemon.requestContextTurnCurrent(snapshot), root => this.requestContextNativeAdmissionCurrent(root)), (id, recovery) => {
12837
+ }, snapshot => requestHumanReplyTarget(box, snapshot, () => owned() && daemon.requestContextTurnCurrent(snapshot), root => this.requestContextNativeAdmissionCurrent(root)) ?? (owned() && daemon.requestContextTurnCurrent(snapshot) ? daemon.hubReplyTarget?.(snapshot) ?? null : null), (id, recovery) => {
12787
12838
  const publication = this.requestContextBoot?.publication;
12788
12839
  if (!publication)
12789
12840
  return;
@@ -18562,7 +18613,7 @@ export class FleetManager {
18562
18613
  if (this.instanceIpcClients.get(name) === ipc && typeof msg.generation === "string" && typeof msg.turn === "string")
18563
18614
  void this.hubRoomOwed?.turnEnded(name, msg.generation, msg.turn).catch(err => this.logger.warn({ err }, "Hub room completion notice held"));
18564
18615
  }
18565
- else if (msg.type === "hub_question_input" || msg.type === "hub_question_turn_ended" || msg.type === "hub_question_turn_state") {
18616
+ else if (msg.type === "hub_question_input" || msg.type === "hub_question_turn_ended" || msg.type === "hub_question_turn_state" || msg.type === "hub_question_delivered") {
18566
18617
  // M-3660: only the instance's current daemon speaks for its pane's turns.
18567
18618
  if (this.instanceIpcClients.get(name) === ipc)
18568
18619
  this.hubTurnSignal(name, msg);
@@ -24856,6 +24907,34 @@ export class FleetManager {
24856
24907
  return null;
24857
24908
  return profileName(this.classicChannels.getCredentialProfileByInstance(name, this.fleetConfig?.defaults));
24858
24909
  }
24910
+ /**
24911
+ * M-3943: the account an agent signs in with, as /status, the web status table and list_instances show it — a profile
24912
+ * name, "default" for the backend's shared login, "invalid" for a ClassicBot room whose setting cannot launch, or
24913
+ * null when the backend has no profiles. A Windows agent's profile is the one kept on its paired Runtime computer.
24914
+ */
24915
+ credentialProfileLabel(name, backend = this.backendNameOf(name)) {
24916
+ const cfg = this.fleetConfig?.instances?.[name];
24917
+ if (isWindowsInstance(cfg)) {
24918
+ if (!isCredentialProfileCli(cfg?.backend ?? backend))
24919
+ return null;
24920
+ try {
24921
+ return nativeCredentialProfile(cfg) ?? "default";
24922
+ }
24923
+ catch {
24924
+ return "invalid";
24925
+ }
24926
+ }
24927
+ if (!credentialHomeSpec(backend))
24928
+ return null;
24929
+ const profile = this.credentialProfileOf(name, backend);
24930
+ if (profile)
24931
+ return profile;
24932
+ if (!cfg && !this.daemons.get(name)?.getConfigSnapshot?.()
24933
+ && this.classicChannels?.getBackendByInstance(name, this.fleetConfig?.defaults?.backend) === backend
24934
+ && this.classicChannels.getCredentialProfileByInstance(name, this.fleetConfig?.defaults).state === "invalid")
24935
+ return "invalid";
24936
+ return "default";
24937
+ }
24859
24938
  /**
24860
24939
  * #1699: the claude config dir an instance's CLI uses — its credential profile's, else exactly as before
24861
24940
  * (CLAUDE_CONFIG_DIR or ~/.claude).
@@ -37170,10 +37249,14 @@ export class FleetManager {
37170
37249
  out.push(this.shownInstanceName(name));
37171
37250
  continue;
37172
37251
  }
37252
+ if (this.wakeOnItsWay(name)) {
37253
+ out.push(this.shownInstanceName(name));
37254
+ continue;
37255
+ } // M-3960: before any status skip
37173
37256
  const process = this.getInstanceStatus(name);
37174
37257
  if (process === "stopped" || process === "crashed")
37175
37258
  continue;
37176
- if (process === "paused" && ["stopped", "crashed"].includes(this.daemons.get(name)?.getProcessStatus?.() ?? "unknown"))
37259
+ if (process === "paused" && this.pausedAndAsleep(name))
37177
37260
  continue;
37178
37261
  if (process !== "running" || this.getInstanceExecutionState(name) !== "idle" || this.getInstanceInteraction(name)?.phase === "waiting") {
37179
37262
  out.push(this.shownInstanceName(name));