@caupulican/pi-adaptative 0.80.11 → 0.80.13

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.
@@ -73,6 +73,8 @@ export class AgentSession {
73
73
  _queuedExtensionCommands = [];
74
74
  /** Messages queued to be included with the next user prompt as context ("asides"). */
75
75
  _pendingNextTurnMessages = [];
76
+ /** Serializes prompt() submissions made while streaming so queued steering/follow-ups keep user-typed FIFO order. */
77
+ _streamingPromptSubmissionTail = Promise.resolve();
76
78
  // Compaction state
77
79
  _compactionAbortController = undefined;
78
80
  _autoCompactionAbortController = undefined;
@@ -836,6 +838,14 @@ export class AgentSession {
836
838
  * @throws Error if no model selected or no API key available (when not streaming)
837
839
  */
838
840
  async prompt(text, options) {
841
+ if (this.isStreaming && options?.streamingBehavior) {
842
+ const run = this._streamingPromptSubmissionTail.then(() => this._promptUnserialized(text, options), () => this._promptUnserialized(text, options));
843
+ this._streamingPromptSubmissionTail = run.catch(() => { });
844
+ return run;
845
+ }
846
+ return this._promptUnserialized(text, options);
847
+ }
848
+ async _promptUnserialized(text, options) {
839
849
  const expandPromptTemplates = options?.expandPromptTemplates ?? true;
840
850
  const processSlashCommands = options?.processSlashCommands ?? expandPromptTemplates;
841
851
  const preflightResult = options?.preflightResult;