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

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.
@@ -1037,6 +1037,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
1037
1037
  /** M-3660: a settled question lifts its window only outside its own running answer turn; inside it, the turn's end does. */
1038
1038
  private hubSettledOutsideTurn;
1039
1039
  /** M-3660: the member side's "this question is no longer being answered" reader (null: no member service attached). */
1040
+ private notifyHubQuestionEnded;
1041
+ private hubQuestionEnded;
1040
1042
  private hubQuestionSettled;
1041
1043
  hubContactRestricted(agent: string): boolean;
1042
1044
  hubContactQuestion(agent: string): string | null;
@@ -4199,6 +4199,7 @@ export class FleetManager {
4199
4199
  scratchDir: agent => isSafeInstanceDirName(agent) ? join(this.dataDir, "workspaces", agent, "hub-files") : null },
4200
4200
  attachReports: (handler, failed) => { this.hubReports = handler; this.hubDeliveryFailed = failed; },
4201
4201
  attachPrivateQuestions: read => { this.hubPrivateQuestions = read; },
4202
+ attachQuestionEnded: ended => { this.hubQuestionEnded = ended; },
4202
4203
  attachQuestionSettled: read => { this.hubQuestionSettled = read; },
4203
4204
  attachReacts: handler => { this.hubReacts = handler; },
4204
4205
  },
@@ -4741,6 +4742,7 @@ export class FleetManager {
4741
4742
  hubQuestionTurnEnded(agent, correlationId) {
4742
4743
  if (this.hubAnswerTurns.get(agent) === correlationId)
4743
4744
  this.hubAnswerTurns.set(agent, null);
4745
+ this.notifyHubQuestionEnded(agent, correlationId);
4744
4746
  try {
4745
4747
  this.contactWindows().answered(agent, correlationId);
4746
4748
  }
@@ -4762,8 +4764,10 @@ export class FleetManager {
4762
4764
  }
4763
4765
  if (correlationId)
4764
4766
  this.hubQuestionInput(agent, correlationId, contactLimit);
4765
- else
4767
+ else {
4766
4768
  this.hubAnswerTurns.set(agent, null);
4769
+ this.notifyHubQuestionEnded(agent, null);
4770
+ }
4767
4771
  }
4768
4772
  /** M-3660: a daemon's Hub turn signal (from its current connection). "unknown" (an unreadable turn record) changes nothing. */
4769
4773
  hubTurnSignal(agent, msg) {
@@ -4787,6 +4791,15 @@ export class FleetManager {
4787
4791
  return settled ? (agent, correlationId) => this.hubAnswerTurnKnownNone(agent, correlationId) && settled(agent, correlationId) : undefined;
4788
4792
  }
4789
4793
  /** M-3660: the member side's "this question is no longer being answered" reader (null: no member service attached). */
4794
+ notifyHubQuestionEnded(agent, correlationId) {
4795
+ try {
4796
+ this.hubQuestionEnded?.(agent, correlationId);
4797
+ }
4798
+ catch (err) {
4799
+ this.logger?.warn({ err }, "Hub unanswered completion receipt held");
4800
+ }
4801
+ }
4802
+ hubQuestionEnded = null;
4790
4803
  hubQuestionSettled = null;
4791
4804
  hubContactRestricted(agent) { return this.contactWindows().restricted(agent, this.hubSettledOutsideTurn()); }
4792
4805
  hubContactQuestion(agent) { return this.contactWindows().restrictingQuestion(agent, this.hubSettledOutsideTurn()); }
@@ -11674,6 +11687,7 @@ export class FleetManager {
11674
11687
  return;
11675
11688
  this.cancelIdleButtonRetirement(name);
11676
11689
  this.instanceProcessStatus.set(name, status);
11690
+ this.notifyHubQuestionEnded(name, null);
11677
11691
  // Never display the last ready prompt as current execution state after its
11678
11692
  // owning CLI process has exited.
11679
11693
  if (this.instanceStateCache.delete(name))
@@ -18535,7 +18549,8 @@ export class FleetManager {
18535
18549
  this.refuseTypedIpc(name, msg, typed.message);
18536
18550
  }
18537
18551
  else if (msg.type === "instance_process_state") {
18538
- this.cacheInstanceProcessStatus(name, msg.status);
18552
+ if (this.instanceIpcClients.get(name) === ipc)
18553
+ this.cacheInstanceProcessStatus(name, msg.status);
18539
18554
  }
18540
18555
  else if (msg.type === "instance_activity") {
18541
18556
  this.cacheInstanceActivity(name, msg.activity);
@@ -28095,6 +28110,7 @@ export class FleetManager {
28095
28110
  if (!daemon)
28096
28111
  return false;
28097
28112
  const deliveryEpoch = this.cancelPendingDeliveries(instanceName);
28113
+ this.notifyHubQuestionEnded(instanceName, null);
28098
28114
  daemon.clearPendingDeliveries?.(deliveryEpoch);
28099
28115
  daemon.sendEscape().catch(e => this.logger.warn({ err: e, instanceName }, "sendEscape failed"));
28100
28116
  this.lastInboundMsg.delete(instanceName);