@getpaseo/plugin 0.13.0-beta.1 → 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.
- package/dist/client/contracts.d.ts +38 -12
- package/dist/client/file.d.ts +0 -11
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.js +1 -0
- package/dist/client/react-native.d.ts +2 -0
- package/dist/client/tab.d.ts +6 -0
- package/dist/client/tab.js +9 -0
- package/dist/server/acp-internal/connection.js +54 -10
- package/package.json +5 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PluginText } from "../text.js";
|
|
2
2
|
import type { ComponentType } from "react";
|
|
3
3
|
import type { PaseoApi } from "@getpaseo/client";
|
|
4
|
-
import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
|
|
4
|
+
import type { AgentTimelineItem, JsonValue } from "@getpaseo/protocol/agent-types";
|
|
5
5
|
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
6
|
-
import type { PluginFile
|
|
6
|
+
import type { PluginFile } from "./file.js";
|
|
7
7
|
import type { PluginRpcContract } from "../rpc.js";
|
|
8
8
|
import type { PluginButtonRegistration, PluginHeaderButtonContribution, PluginComposerPillContribution } from "./buttons.js";
|
|
9
9
|
import type { PluginTheme, PluginWorkspaceSnapshot, PluginAgentSnapshot, PluginThemeContribution, PluginAttachmentSourceContribution, PluginTimelineTransformResult, PluginCleanup } from "../contracts.js";
|
|
@@ -86,21 +86,41 @@ interface PluginWorkspacePanelBase<Text extends PluginText = string> {
|
|
|
86
86
|
icon: PluginIcon;
|
|
87
87
|
locations?: readonly PluginPanelLocation[];
|
|
88
88
|
}
|
|
89
|
-
export interface
|
|
90
|
-
|
|
89
|
+
export interface PluginTab {
|
|
90
|
+
/** Shows the tab's unsaved dot and asks before closing. */
|
|
91
|
+
setModified(modified: boolean): void;
|
|
92
|
+
/** Opaque persisted JSON. Undefined until written; the panel validates it. */
|
|
93
|
+
readonly state: unknown;
|
|
94
|
+
setState(state: JsonValue): void;
|
|
95
|
+
}
|
|
96
|
+
export interface PluginPanelProps<Params> extends PluginNavigableHostProps {
|
|
91
97
|
workspaceId: string;
|
|
98
|
+
readonly params: Readonly<Params>;
|
|
99
|
+
revision: number;
|
|
100
|
+
tab: PluginTab;
|
|
101
|
+
}
|
|
102
|
+
export interface PluginWorkspacePanelParams {
|
|
103
|
+
}
|
|
104
|
+
export interface PluginAgentPanelParams {
|
|
105
|
+
readonly agentId: string;
|
|
106
|
+
}
|
|
107
|
+
export interface PluginFilePanelParams {
|
|
108
|
+
readonly path: string;
|
|
109
|
+
readonly lineStart?: number;
|
|
110
|
+
readonly lineEnd?: number;
|
|
111
|
+
}
|
|
112
|
+
export interface PluginWorkspacePanelProps extends PluginPanelProps<PluginWorkspacePanelParams> {
|
|
113
|
+
/** @deprecated Use the panel registration to select the context. */
|
|
114
|
+
context: "workspace";
|
|
92
115
|
}
|
|
93
|
-
export interface PluginAgentPanelProps extends
|
|
116
|
+
export interface PluginAgentPanelProps extends PluginPanelProps<PluginAgentPanelParams> {
|
|
117
|
+
/** @deprecated Use the panel registration to select the context. */
|
|
94
118
|
context: "agent";
|
|
95
|
-
|
|
119
|
+
/** @deprecated Read `params.agentId`. */
|
|
96
120
|
agentId: string;
|
|
97
121
|
}
|
|
98
|
-
export interface PluginFilePanelProps extends
|
|
99
|
-
workspaceId: string;
|
|
100
|
-
/** The file itself. The panel decides how to read it, show it, and save it. */
|
|
122
|
+
export interface PluginFilePanelProps extends PluginPanelProps<PluginFilePanelParams> {
|
|
101
123
|
file: PluginFile;
|
|
102
|
-
tab: PluginFileTab;
|
|
103
|
-
location: PluginFileLocation;
|
|
104
124
|
}
|
|
105
125
|
export interface PluginFilePanelContribution<Text extends PluginText = string> {
|
|
106
126
|
id: string;
|
|
@@ -134,6 +154,7 @@ export interface PluginClientContext extends PluginCommandCapabilities, PluginCl
|
|
|
134
154
|
addScreen(contribution: PluginScreenContribution<PluginText>): PluginCleanup;
|
|
135
155
|
addSidebarHeaderItem(contribution: PluginSidebarItemContribution<PluginText>): PluginCleanup;
|
|
136
156
|
addSidebarFooterItem(contribution: PluginSidebarItemContribution<PluginText>): PluginCleanup;
|
|
157
|
+
addAgentPanel(contribution: PluginAgentPanelContribution<PluginText>): PluginCleanup;
|
|
137
158
|
addWorkspacePanel(contribution: PluginWorkspacePanelContribution<PluginText>): PluginCleanup;
|
|
138
159
|
addCommandCenterItem(contribution: PluginCommandCenterItemContribution<PluginText>): PluginCleanup;
|
|
139
160
|
addSlashCommand(contribution: PluginClientSlashCommandContribution<PluginText>): PluginCleanup;
|
|
@@ -148,12 +169,17 @@ export interface PluginClientContext extends PluginCommandCapabilities, PluginCl
|
|
|
148
169
|
}
|
|
149
170
|
export type PluginClientContribution = (client: PluginClientContext) => PluginCleanup;
|
|
150
171
|
export type PluginWorkspacePanelContribution<Text extends PluginText = string> = (PluginWorkspacePanelBase<Text> & {
|
|
151
|
-
context
|
|
172
|
+
/** @deprecated Omit context. */
|
|
173
|
+
context?: "workspace";
|
|
152
174
|
Component: ComponentType<PluginWorkspacePanelProps>;
|
|
153
175
|
}) | (PluginWorkspacePanelBase<Text> & {
|
|
176
|
+
/** @deprecated Register with `addAgentPanel`. */
|
|
154
177
|
context: "agent";
|
|
155
178
|
Component: ComponentType<PluginAgentPanelProps>;
|
|
156
179
|
});
|
|
180
|
+
export interface PluginAgentPanelContribution<Text extends PluginText = string> extends PluginWorkspacePanelBase<Text> {
|
|
181
|
+
Component: ComponentType<PluginAgentPanelProps>;
|
|
182
|
+
}
|
|
157
183
|
export interface PluginSettingsScreenContribution<Text extends PluginText = string> {
|
|
158
184
|
id: string;
|
|
159
185
|
title: Text;
|
package/dist/client/file.d.ts
CHANGED
|
@@ -43,17 +43,6 @@ export type PluginFileEvent = {
|
|
|
43
43
|
} | {
|
|
44
44
|
type: "deleted";
|
|
45
45
|
};
|
|
46
|
-
/** What the panel reports back to its tab. */
|
|
47
|
-
export interface PluginFileTab {
|
|
48
|
-
/** Shows the tab's unsaved dot and asks before the tab closes. */
|
|
49
|
-
setModified(modified: boolean): void;
|
|
50
|
-
}
|
|
51
|
-
/** The line a link or search result opened the file at. `revision` bumps on every new target. */
|
|
52
|
-
export interface PluginFileLocation {
|
|
53
|
-
lineStart?: number;
|
|
54
|
-
lineEnd?: number;
|
|
55
|
-
revision: number;
|
|
56
|
-
}
|
|
57
46
|
/** The file changed on disk since the handle last read or wrote it. */
|
|
58
47
|
export declare class PluginFileConflictError extends Error {
|
|
59
48
|
constructor(message?: string);
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type { PluginHostProps, PluginFilePanelContribution, PluginFilePanelProps, PluginSurfaceProps, PluginScreenProps, PluginPopoverProps, PluginScreenParams, PluginOpenScreenInput, PluginScreenLocation, PluginSidebarItemProps, PluginSidebarItemContribution, PluginIcon, PluginPanelLocation, PluginOpenPanelOptions, PluginWorkspacePanelProps, PluginAgentPanelProps, PluginClientOpenPanelOptions, PluginClientContext, PluginClientContribution, PluginWorkspacePanelContribution, PluginSettingsScreenContribution, PluginSurfaceContribution, PluginScreenContribution, PluginScreenTitle, PluginSidebarContribution, PluginTimelineTransformerContribution, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginCommandCapabilities, PluginGlobalCommandContext, PluginWorkspaceCommandContext, PluginAgentCommandContext, PluginCommandCenterItemContribution, PluginClientSlashCommandContribution, SettingsState, } from "./contracts.js";
|
|
1
|
+
export type { PluginHostProps, PluginTab, PluginPanelProps, PluginWorkspacePanelParams, PluginAgentPanelParams, PluginFilePanelParams, PluginAgentPanelContribution, PluginFilePanelContribution, PluginFilePanelProps, PluginSurfaceProps, PluginScreenProps, PluginPopoverProps, PluginScreenParams, PluginOpenScreenInput, PluginScreenLocation, PluginSidebarItemProps, PluginSidebarItemContribution, PluginIcon, PluginPanelLocation, PluginOpenPanelOptions, PluginWorkspacePanelProps, PluginAgentPanelProps, PluginClientOpenPanelOptions, PluginClientContext, PluginClientContribution, PluginWorkspacePanelContribution, PluginSettingsScreenContribution, PluginSurfaceContribution, PluginScreenContribution, PluginScreenTitle, PluginSidebarContribution, PluginTimelineTransformerContribution, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginCommandCapabilities, PluginGlobalCommandContext, PluginWorkspaceCommandContext, PluginAgentCommandContext, PluginCommandCenterItemContribution, PluginClientSlashCommandContribution, SettingsState, } from "./contracts.js";
|
|
2
2
|
export type { PluginButton, PluginButtonBehavior, PluginButtonContentProps, PluginButtonContext, PluginButtonIcon, PluginButtonIconProps, PluginButtonMenuEntry, PluginButtonRegistration, PluginComposerPillContribution, PluginHeaderButtonContribution, } from "./buttons.js";
|
|
3
3
|
export type { PluginIconProps, PluginSerializableIcon, PluginSvgIcon } from "../icons.js";
|
|
4
|
-
export type { PluginFile, PluginFileBytesState, PluginFileEvent,
|
|
4
|
+
export type { PluginFile, PluginFileBytesState, PluginFileEvent, PluginFileTextState, PluginFileUrlState, PluginFileWriteOptions, } from "./file.js";
|
|
5
5
|
export { PluginFileConflictError, PluginFileDeletedError, useFileBytes, useFileText, useFileUrl, } from "./file.js";
|
|
6
6
|
export { usePaseo } from "./paseo-context.js";
|
|
7
7
|
export { useAgent, useWorkspace } from "./client-state.js";
|
|
@@ -25,4 +25,5 @@ export declare function openExternalUrl(url: string): Promise<void>;
|
|
|
25
25
|
export { defineTranslations, useTranslation } from "./translations.js";
|
|
26
26
|
export type { PluginI18n } from "./translations.js";
|
|
27
27
|
export type { PluginText, PluginMessage, PluginTranslations } from "../text.js";
|
|
28
|
+
export { useTabState } from "./tab.js";
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/client/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { usePaseo } from "./paseo-context.js";
|
|
|
3
3
|
export { useAgent, useWorkspace } from "./client-state.js";
|
|
4
4
|
export { useRpc } from "./rpc-context.js";
|
|
5
5
|
export { defineTranslations, useTranslation } from "./translations.js";
|
|
6
|
+
export { useTabState } from "./tab.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -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
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JsonValue } from "@getpaseo/protocol/agent-types";
|
|
2
|
+
import type { ZodType } from "zod";
|
|
3
|
+
import type { PluginTab } from "./contracts.js";
|
|
4
|
+
/** Validates the panel's persisted state, using the default for missing or invalid values. */
|
|
5
|
+
export declare function useTabState<T extends JsonValue>(tab: PluginTab, schema: ZodType<T>, defaultState: T): [T, (next: T) => void];
|
|
6
|
+
//# sourceMappingURL=tab.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
/** Validates the panel's persisted state, using the default for missing or invalid values. */
|
|
3
|
+
export function useTabState(tab, schema, defaultState) {
|
|
4
|
+
const parsed = useMemo(() => schema.safeParse(tab.state), [schema, tab.state]);
|
|
5
|
+
const writeState = tab.setState;
|
|
6
|
+
const setState = useCallback((next) => writeState(next), [writeState]);
|
|
7
|
+
return [parsed.success ? parsed.data : defaultState, setState];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=tab.js.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
|
|
323
|
-
*
|
|
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
|
-
|
|
381
|
-
|
|
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
|
|
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
|
|
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
|
|
76
|
-
"@getpaseo/protocol": "0.13.0
|
|
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
|
|
87
|
-
"@getpaseo/protocol": "0.13.0
|
|
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"
|