@getpaseo/plugin 0.13.0-beta.2 → 0.13.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.
@@ -1,3 +1,5 @@
1
1
  /** @deprecated Import Paseo UI from @getpaseo/plugin/client/ui. */
2
2
  export * from "./ui.js";
3
+ /** @deprecated Render StreamedText from @getpaseo/plugin/client/ui. Removed after 2027-04-20 with this entry. */
4
+ export declare function useRevealedText(text: string, phase: "streaming" | "complete"): string;
3
5
  //# sourceMappingURL=react-native.d.ts.map
@@ -319,10 +319,16 @@ class AcpRuntime {
319
319
  /**
320
320
  * Fallback ids for streamed chunks that carry no `messageId`, one per
321
321
  * chunk kind. Consecutive chunks of a kind continue the same timeline
322
- * item; a chunk of the other kind, a tool call, a plan, a user message,
323
- * or a turn boundary ends it (#4699).
322
+ * item; a chunk of another kind, a tool call, a plan, or a turn boundary
323
+ * ends it (#4699).
324
324
  */
325
325
  this.fallbackChunkIds = new Map();
326
+ /**
327
+ * Active while a persisted session loads. ACP agents replay the loaded
328
+ * session's updates before session/load resolves; the value follows the
329
+ * open request's history contract.
330
+ */
331
+ this.replayWindow = null;
326
332
  this.closing = false;
327
333
  this.processFailed = false;
328
334
  this.configTransaction = false;
@@ -377,13 +383,22 @@ class AcpRuntime {
377
383
  };
378
384
  let response;
379
385
  if (nativeSessionId) {
380
- response = await this.call(this.connection.loadSession({
381
- sessionId: nativeSessionId,
382
- cwd: input.config.cwd,
383
- mcpServers,
384
- _meta: metadata,
385
- }));
386
+ // ACP agents replay the loaded session's updates before session/load resolves,
387
+ // so the native id must be registered first for them to pass the session filter.
386
388
  this.nativeSessionId = nativeSessionId;
389
+ this.replayWindow = input.history === "replay" ? "replay" : "skip";
390
+ try {
391
+ response = await this.call(this.connection.loadSession({
392
+ sessionId: nativeSessionId,
393
+ cwd: input.config.cwd,
394
+ mcpServers,
395
+ _meta: metadata,
396
+ }));
397
+ await this.drainNotifications();
398
+ }
399
+ finally {
400
+ this.replayWindow = null;
401
+ }
387
402
  }
388
403
  else {
389
404
  const newSession = await this.call(this.connection.newSession({
@@ -732,6 +747,13 @@ class AcpRuntime {
732
747
  sessionUpdate(notification) {
733
748
  if (notification.sessionId !== this.nativeSessionId)
734
749
  return;
750
+ if (this.replayWindow === "skip")
751
+ return;
752
+ if (this.replayWindow === "replay" &&
753
+ notification.update.sessionUpdate === "user_message_chunk") {
754
+ this.reduceUserMessageChunk(notification.update);
755
+ return;
756
+ }
735
757
  this.reduceUpdate(notification.update);
736
758
  }
737
759
  reduceUpdate(update) {
@@ -742,11 +764,12 @@ class AcpRuntime {
742
764
  this.fallbackChunkIds.clear();
743
765
  return;
744
766
  }
745
- // A chunk of one kind ends the other kind's item, whatever its content
746
- // or id: reasoning, then text, then reasoning again are three items.
767
+ // A chunk of one kind ends every other kind's open item, whatever its
768
+ // content or id: reasoning, then text, then reasoning again are three items.
747
769
  this.fallbackChunkIds.delete(update.sessionUpdate === "agent_message_chunk"
748
770
  ? "agent_thought_chunk"
749
771
  : "agent_message_chunk");
772
+ this.fallbackChunkIds.delete("user_message_chunk");
750
773
  if (update.content.type !== "text")
751
774
  return;
752
775
  const id = this.resolveChunkId(update.sessionUpdate, update.messageId);
@@ -776,6 +799,27 @@ class AcpRuntime {
776
799
  this.fallbackChunkIds.clear();
777
800
  this.reduceStateUpdate(update);
778
801
  }
802
+ // Historical user messages arrive only as replayed chunks; a live prompt
803
+ // already echoes its own user message when it is admitted.
804
+ reduceUserMessageChunk(update) {
805
+ this.fallbackChunkIds.delete("agent_message_chunk");
806
+ this.fallbackChunkIds.delete("agent_thought_chunk");
807
+ if (update.content.type !== "text")
808
+ return;
809
+ const id = this.resolveChunkId("user_message_chunk", update.messageId);
810
+ const text = `${this.messages.get(id) ?? ""}${update.content.text}`;
811
+ this.messages.set(id, text);
812
+ this.emit({
813
+ type: "timeline.item",
814
+ sessionId: this.options.boundarySessionId,
815
+ item: {
816
+ type: "user_message",
817
+ id,
818
+ text,
819
+ ...(update.messageId ? { messageId: update.messageId } : {}),
820
+ },
821
+ });
822
+ }
779
823
  resolveChunkId(kind, messageId) {
780
824
  if (messageId) {
781
825
  this.fallbackChunkIds.delete(kind);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/plugin",
3
- "version": "0.13.0-beta.2",
3
+ "version": "0.13.0",
4
4
  "description": "Paseo plugin SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -72,8 +72,8 @@
72
72
  "use-sync-external-store": "^1.6.0"
73
73
  },
74
74
  "devDependencies": {
75
- "@getpaseo/client": "0.13.0-beta.2",
76
- "@getpaseo/protocol": "0.13.0-beta.2",
75
+ "@getpaseo/client": "0.13.0",
76
+ "@getpaseo/protocol": "0.13.0",
77
77
  "@types/node": "^20.9.0",
78
78
  "@types/react": "~19.2.0",
79
79
  "react": "19.2.3",
@@ -83,8 +83,8 @@
83
83
  "zod": "^4.4.3"
84
84
  },
85
85
  "peerDependencies": {
86
- "@getpaseo/client": "0.13.0-beta.2",
87
- "@getpaseo/protocol": "0.13.0-beta.2",
86
+ "@getpaseo/client": "0.13.0",
87
+ "@getpaseo/protocol": "0.13.0",
88
88
  "react": ">=19.1.0 <20",
89
89
  "react-native": ">=0.81.5",
90
90
  "zod": "^4.4.3"