@genesislcap/ai-assistant 15.80.0 → 15.82.0

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.
@@ -4937,9 +4937,10 @@ var AgentSession = class {
4937
4937
  /**
4938
4938
  * The name routing is locked to, flow lock first. A flow in progress outranks the user's
4939
4939
  * sticky pick for the duration of the flow; neither being set means automatic routing.
4940
+ * `pin`, when given, stands in for the sticky pick: one message routed its own way.
4940
4941
  */
4941
- getLockedName() {
4942
- return this.flowOwner ?? this.pinned;
4942
+ getLockedName(pin = this.pinned) {
4943
+ return this.flowOwner ?? pin;
4943
4944
  }
4944
4945
  /** Set the sticky user pin. `null` returns to automatic routing. */
4945
4946
  setPinned(name) {
@@ -9615,7 +9616,8 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
9615
9616
  })
9616
9617
  );
9617
9618
  const routingInput = delegated.delegate ? frameDelegatedContent(input, delegated.delegateFraming) : input;
9618
- const pinned = this.resolvePinnedAgent();
9619
+ const pin = options?.agent;
9620
+ const pinned = this.resolvePinnedAgent(pin);
9619
9621
  if (!pinned) this.dispatchEvent(new CustomEvent("orchestrating-start"));
9620
9622
  let routed;
9621
9623
  if (pinned) {
@@ -9633,7 +9635,7 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
9633
9635
  let lastResult;
9634
9636
  while (true) {
9635
9637
  if (this.cancelled) break;
9636
- await this.installAgent(currentAgent);
9638
+ await this.installAgent(currentAgent, pin);
9637
9639
  if (this.cancelled) break;
9638
9640
  let result;
9639
9641
  if (isHandoff) {
@@ -9769,9 +9771,13 @@ var OrchestratingDriver = class _OrchestratingDriver extends BaseDriverDecorator
9769
9771
  }
9770
9772
  return winner ? { ...winner, agentName, basis: "reachable-max" } : void 0;
9771
9773
  }
9772
- async installAgent(agent) {
9774
+ /**
9775
+ * `pin` stands in for the user-pin when given, as for
9776
+ * {@link OrchestratingDriver.resolvePinnedAgent}.
9777
+ */
9778
+ async installAgent(agent, pin) {
9773
9779
  const { previousAgent } = await this.agentSession.activate(agent);
9774
- const isTerminal = isFallback(agent) || this.agentSession.getPinned() !== null || this.agentSession.getFlowOwner() !== null || !!(agent.onActivate || agent.onDeactivate);
9780
+ const isTerminal = isFallback(agent) || (pin === void 0 ? this.agentSession.getPinned() : pin) !== null || this.agentSession.getFlowOwner() !== null || !!(agent.onActivate || agent.onDeactivate);
9775
9781
  let agentToApply = agent;
9776
9782
  if (!isTerminal) {
9777
9783
  const declaredTools = agent.toolDefinitions;
@@ -10012,9 +10018,11 @@ ${recentMessages}` : ""}`;
10012
10018
  *
10013
10019
  * Logs and returns `undefined` if a name no longer matches the agents array
10014
10020
  * — protects against stale state after an agents-array reassignment.
10021
+ *
10022
+ * `pin` stands in for the user-pin when given — `SendMessageOptions.agent`.
10015
10023
  */
10016
- resolvePinnedAgent() {
10017
- const name = this.agentSession.getLockedName();
10024
+ resolvePinnedAgent(pin) {
10025
+ const name = this.agentSession.getLockedName(pin);
10018
10026
  if (name === null) return void 0;
10019
10027
  const match = this.agents.find((a) => a.name === name);
10020
10028
  if (!match) {