@getpaseo/plugin 0.13.0-beta.1 → 0.13.0-beta.2

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,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, PluginFileLocation, PluginFileTab } from "./file.js";
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 PluginWorkspacePanelProps extends PluginNavigableHostProps {
90
- context: "workspace";
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 PluginNavigableHostProps {
116
+ export interface PluginAgentPanelProps extends PluginPanelProps<PluginAgentPanelParams> {
117
+ /** @deprecated Use the panel registration to select the context. */
94
118
  context: "agent";
95
- workspaceId: string;
119
+ /** @deprecated Read `params.agentId`. */
96
120
  agentId: string;
97
121
  }
98
- export interface PluginFilePanelProps extends PluginNavigableHostProps {
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: "workspace";
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;
@@ -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);
@@ -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, PluginFileLocation, PluginFileTab, PluginFileTextState, PluginFileUrlState, PluginFileWriteOptions, } from "./file.js";
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
@@ -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
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/plugin",
3
- "version": "0.13.0-beta.1",
3
+ "version": "0.13.0-beta.2",
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.1",
76
- "@getpaseo/protocol": "0.13.0-beta.1",
75
+ "@getpaseo/client": "0.13.0-beta.2",
76
+ "@getpaseo/protocol": "0.13.0-beta.2",
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.1",
87
- "@getpaseo/protocol": "0.13.0-beta.1",
86
+ "@getpaseo/client": "0.13.0-beta.2",
87
+ "@getpaseo/protocol": "0.13.0-beta.2",
88
88
  "react": ">=19.1.0 <20",
89
89
  "react-native": ">=0.81.5",
90
90
  "zod": "^4.4.3"