@camerontaylor/paseo-plugin 0.12.0-fork.1 → 0.13.0-fork.1

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,6 +1,7 @@
1
+ import type { PluginText } from "./text.js";
1
2
  import { z } from "zod";
2
3
  import type { PluginAttachmentSourceContribution } from "./contracts.js";
3
- export declare function defineAttachmentSource<Definition extends PluginAttachmentSourceContribution>(definition: Definition): Definition;
4
+ export declare function defineAttachmentSource<Definition extends PluginAttachmentSourceContribution<PluginText>>(definition: Definition): Definition;
4
5
  export declare const PluginAttachmentItemSchema: z.ZodObject<{
5
6
  id: z.ZodString;
6
7
  identifier: z.ZodString;
@@ -1,5 +1,7 @@
1
+ import type { PluginText } from "../text.js";
1
2
  import type { ComponentType } from "react";
2
- import type { PluginHostProps } from "./contracts.js";
3
+ import type { PluginIconProps } from "../icons.js";
4
+ import type { PluginHostProps, PluginIcon } from "./contracts.js";
3
5
  export type PluginButtonContext = {
4
6
  context: "workspace";
5
7
  workspaceId: string;
@@ -8,57 +10,54 @@ export type PluginButtonContext = {
8
10
  workspaceId: string;
9
11
  agentId: string;
10
12
  };
11
- export type PluginButtonIconProps = PluginHostProps & PluginButtonContext & {
12
- size: number;
13
- color: string;
14
- };
13
+ export type PluginButtonIconProps = PluginHostProps & PluginButtonContext & PluginIconProps;
15
14
  export type PluginButtonContentProps = PluginHostProps & PluginButtonContext & {
16
15
  close(): void;
17
16
  };
18
- export type PluginButtonIcon = string | ComponentType<PluginButtonIconProps>;
19
- export type PluginButtonBehavior = {
17
+ export type PluginButtonIcon = PluginIcon<PluginButtonIconProps>;
18
+ export type PluginButtonBehavior<Text extends PluginText = string> = {
20
19
  kind: "action";
21
20
  onPress(): void | Promise<void>;
22
21
  } | {
23
22
  kind: "menu";
24
- items: readonly PluginButtonMenuEntry[];
23
+ items: readonly PluginButtonMenuEntry<Text>[];
25
24
  } | {
26
25
  kind: "popover";
27
26
  Content: ComponentType<PluginButtonContentProps>;
28
27
  };
29
- export type PluginButtonMenuEntry = {
28
+ export type PluginButtonMenuEntry<Text extends PluginText = string> = {
30
29
  kind: "separator";
31
30
  id: string;
32
31
  } | {
33
32
  kind: "item";
34
33
  id: string;
35
- title: string;
34
+ title: Text;
36
35
  icon?: PluginButtonIcon;
37
36
  visible?: boolean;
38
37
  disabled?: boolean;
39
- behavior: PluginButtonBehavior;
38
+ behavior: PluginButtonBehavior<Text>;
40
39
  };
41
- export interface PluginButton {
42
- title: string;
40
+ export interface PluginButton<Text extends PluginText = string> {
41
+ title: Text;
43
42
  icon: PluginButtonIcon;
44
43
  /** Omit for an icon-only header button. Composer pills use title when omitted. */
45
- label?: string;
44
+ label?: Text;
46
45
  visible?: boolean;
47
46
  disabled?: boolean;
48
- behavior: PluginButtonBehavior;
47
+ behavior: PluginButtonBehavior<Text>;
49
48
  }
50
- export interface PluginButtonRegistration {
49
+ export interface PluginButtonRegistration<Text extends PluginText = string> {
51
50
  /** Updates presentation in place. Supply a complete behavior to replace it. */
52
- update(patch: Partial<PluginButton>): void;
51
+ update(patch: Partial<PluginButton<Text>>): void;
53
52
  /** Idempotent. Updates after removal do nothing. */
54
53
  remove(): void;
55
54
  }
56
- export interface PluginHeaderButtonContribution {
55
+ export interface PluginHeaderButtonContribution<Text extends PluginText = string> {
57
56
  id: string;
58
57
  workspaceId: string;
59
- button: PluginButton;
58
+ button: PluginButton<Text>;
60
59
  }
61
- export interface PluginComposerPillContribution extends PluginHeaderButtonContribution {
60
+ export interface PluginComposerPillContribution<Text extends PluginText = string> extends PluginHeaderButtonContribution<Text> {
62
61
  agentId: string;
63
62
  }
64
63
  //# sourceMappingURL=buttons.d.ts.map
@@ -1,10 +1,13 @@
1
+ import type { PluginText } from "../text.js";
1
2
  import type { ComponentType } from "react";
2
3
  import type { PaseoApi } from "@camerontaylor/paseo-client";
3
- import type { AgentTimelineItem } from "@camerontaylor/paseo-protocol/agent-types";
4
+ import type { AgentTimelineItem, JsonValue } from "@camerontaylor/paseo-protocol/agent-types";
4
5
  import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
6
+ import type { PluginFile } from "./file.js";
5
7
  import type { PluginRpcContract } from "../rpc.js";
6
8
  import type { PluginButtonRegistration, PluginHeaderButtonContribution, PluginComposerPillContribution } from "./buttons.js";
7
9
  import type { PluginTheme, PluginWorkspaceSnapshot, PluginAgentSnapshot, PluginThemeContribution, PluginAttachmentSourceContribution, PluginTimelineTransformResult, PluginCleanup } from "../contracts.js";
10
+ import type { PluginIconProps, PluginSerializableIcon } from "../icons.js";
8
11
  export interface PluginHostProps {
9
12
  theme: PluginTheme;
10
13
  host: {
@@ -62,36 +65,74 @@ export interface PluginSidebarItemProps extends PluginHostProps {
62
65
  /** Anchored to the item on wide layouts; a bottom sheet on compact layouts. */
63
66
  openPopover(Content: ComponentType<PluginPopoverProps>): void;
64
67
  }
65
- export interface PluginSidebarItemContribution {
68
+ export interface PluginSidebarItemContribution<Text extends PluginText = string> {
66
69
  id: string;
67
70
  /** Settings row label, accessibility label, and default label for SidebarRow. */
68
- title: string;
71
+ title: Text;
69
72
  Component: ComponentType<PluginSidebarItemProps>;
70
73
  }
71
- export interface PluginIconProps {
72
- name: string;
73
- size?: number;
74
- color?: string;
75
- }
74
+ /**
75
+ * A Lucide icon name, inline SVG markup, or a component. Components receive the surface's size
76
+ * and color; buttons widen the props with their host and target context.
77
+ */
78
+ export type PluginIcon<Props extends PluginIconProps = PluginIconProps> = PluginSerializableIcon | ComponentType<Props>;
76
79
  export type PluginPanelLocation = "workspace" | "explorer";
77
80
  export interface PluginOpenPanelOptions {
78
81
  location?: PluginPanelLocation;
79
82
  }
80
- interface PluginWorkspacePanelBase {
83
+ interface PluginWorkspacePanelBase<Text extends PluginText = string> {
81
84
  id: string;
82
- title: string;
83
- icon: string;
85
+ title: Text;
86
+ icon: PluginIcon;
84
87
  locations?: readonly PluginPanelLocation[];
85
88
  }
86
- export interface PluginWorkspacePanelProps extends PluginNavigableHostProps {
87
- 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 {
88
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";
89
115
  }
90
- export interface PluginAgentPanelProps extends PluginNavigableHostProps {
116
+ export interface PluginAgentPanelProps extends PluginPanelProps<PluginAgentPanelParams> {
117
+ /** @deprecated Use the panel registration to select the context. */
91
118
  context: "agent";
92
- workspaceId: string;
119
+ /** @deprecated Read `params.agentId`. */
93
120
  agentId: string;
94
121
  }
122
+ export interface PluginFilePanelProps extends PluginPanelProps<PluginFilePanelParams> {
123
+ file: PluginFile;
124
+ }
125
+ export interface PluginFilePanelContribution<Text extends PluginText = string> {
126
+ id: string;
127
+ title: Text;
128
+ icon: PluginIcon;
129
+ /** Extensions without the dot, case-insensitive, and exact filenames. */
130
+ files: {
131
+ extensions: readonly string[];
132
+ filenames?: readonly string[];
133
+ };
134
+ Component: ComponentType<PluginFilePanelProps>;
135
+ }
95
136
  export interface PluginClientOpenPanelOptions extends PluginOpenPanelOptions {
96
137
  workspaceId: string;
97
138
  agentId?: string;
@@ -100,48 +141,56 @@ interface PluginClientContextAliases {
100
141
  /** @deprecated Use `addScreen`. */
101
142
  addSurface(id: string, Component: ComponentType<PluginSurfaceProps>): PluginCleanup;
102
143
  /** @deprecated Use `addSidebarHeaderItem`. */
103
- addSidebarItem(contribution: PluginSidebarContribution): PluginCleanup;
144
+ addSidebarItem(contribution: PluginSidebarContribution<PluginText>): PluginCleanup;
104
145
  }
105
146
  export interface PluginClientContext extends PluginCommandCapabilities, PluginClientContextAliases {
147
+ readonly i18n: import("./translations.js").PluginI18n;
106
148
  /** Play a base64-encoded audio file on this client; resolves when playback ends. */
107
149
  playAudio(source: {
108
150
  base64: string;
109
151
  mimeType: string;
110
152
  }): Promise<void>;
111
- addSettingsScreen(contribution: PluginSettingsScreenContribution): PluginCleanup;
112
- addScreen(contribution: PluginScreenContribution): PluginCleanup;
113
- addSidebarHeaderItem(contribution: PluginSidebarItemContribution): PluginCleanup;
114
- addSidebarFooterItem(contribution: PluginSidebarItemContribution): PluginCleanup;
115
- addWorkspacePanel(contribution: PluginWorkspacePanelContribution): PluginCleanup;
116
- addCommandCenterItem(contribution: PluginCommandCenterItemContribution): PluginCleanup;
117
- addSlashCommand(contribution: PluginClientSlashCommandContribution): PluginCleanup;
118
- addHeaderButton(contribution: PluginHeaderButtonContribution): PluginButtonRegistration;
119
- addComposerPill(contribution: PluginComposerPillContribution): PluginButtonRegistration;
120
- addAttachmentSource(contribution: PluginAttachmentSourceContribution): PluginCleanup;
121
- addTheme(contribution: PluginThemeContribution): PluginCleanup;
153
+ addSettingsScreen(contribution: PluginSettingsScreenContribution<PluginText>): PluginCleanup;
154
+ addScreen(contribution: PluginScreenContribution<PluginText>): PluginCleanup;
155
+ addSidebarHeaderItem(contribution: PluginSidebarItemContribution<PluginText>): PluginCleanup;
156
+ addSidebarFooterItem(contribution: PluginSidebarItemContribution<PluginText>): PluginCleanup;
157
+ addAgentPanel(contribution: PluginAgentPanelContribution<PluginText>): PluginCleanup;
158
+ addWorkspacePanel(contribution: PluginWorkspacePanelContribution<PluginText>): PluginCleanup;
159
+ addCommandCenterItem(contribution: PluginCommandCenterItemContribution<PluginText>): PluginCleanup;
160
+ addSlashCommand(contribution: PluginClientSlashCommandContribution<PluginText>): PluginCleanup;
161
+ addHeaderButton(contribution: PluginHeaderButtonContribution<PluginText>): PluginButtonRegistration<PluginText>;
162
+ addComposerPill(contribution: PluginComposerPillContribution<PluginText>): PluginButtonRegistration<PluginText>;
163
+ addAttachmentSource(contribution: PluginAttachmentSourceContribution<PluginText>): PluginCleanup;
164
+ addTheme(contribution: PluginThemeContribution<PluginText>): PluginCleanup;
165
+ addFilePanel(contribution: PluginFilePanelContribution<PluginText>): PluginCleanup;
122
166
  addTimelineTransformer<ItemType extends AgentTimelineItem["type"]>(contribution: PluginTimelineTransformerContribution<ItemType>): PluginCleanup;
123
167
  addTimelineRenderer<Schema extends ZodType>(contribution: PluginTimelineRendererContribution<Schema>): PluginCleanup;
124
168
  openPanel(id: string, options: PluginClientOpenPanelOptions): void;
125
169
  }
126
170
  export type PluginClientContribution = (client: PluginClientContext) => PluginCleanup;
127
- export type PluginWorkspacePanelContribution = (PluginWorkspacePanelBase & {
128
- context: "workspace";
171
+ export type PluginWorkspacePanelContribution<Text extends PluginText = string> = (PluginWorkspacePanelBase<Text> & {
172
+ /** @deprecated Omit context. */
173
+ context?: "workspace";
129
174
  Component: ComponentType<PluginWorkspacePanelProps>;
130
- }) | (PluginWorkspacePanelBase & {
175
+ }) | (PluginWorkspacePanelBase<Text> & {
176
+ /** @deprecated Register with `addAgentPanel`. */
131
177
  context: "agent";
132
178
  Component: ComponentType<PluginAgentPanelProps>;
133
179
  });
134
- export interface PluginSettingsScreenContribution {
180
+ export interface PluginAgentPanelContribution<Text extends PluginText = string> extends PluginWorkspacePanelBase<Text> {
181
+ Component: ComponentType<PluginAgentPanelProps>;
182
+ }
183
+ export interface PluginSettingsScreenContribution<Text extends PluginText = string> {
135
184
  id: string;
136
- title: string;
137
- icon: string;
185
+ title: Text;
186
+ icon: PluginIcon;
138
187
  Component: ComponentType<PluginSurfaceProps>;
139
188
  }
140
189
  /** The screen header's title: fixed, or derived from the params the screen was opened with. */
141
- export type PluginScreenTitle = string | ((params: PluginScreenParams) => string);
142
- export interface PluginScreenContribution {
190
+ export type PluginScreenTitle<Text extends PluginText = string> = Text | ((params: PluginScreenParams) => Text);
191
+ export interface PluginScreenContribution<Text extends PluginText = string> {
143
192
  id: string;
144
- title: PluginScreenTitle;
193
+ title: PluginScreenTitle<Text>;
145
194
  Component: ComponentType<PluginScreenProps>;
146
195
  }
147
196
  export interface PluginSurfaceContribution {
@@ -149,10 +198,10 @@ export interface PluginSurfaceContribution {
149
198
  Component: ComponentType<PluginSurfaceProps>;
150
199
  }
151
200
  /** @deprecated Use `PluginSidebarItemContribution` with `addSidebarHeaderItem`. */
152
- export interface PluginSidebarContribution {
201
+ export interface PluginSidebarContribution<Text extends PluginText = string> {
153
202
  id: string;
154
- title: string;
155
- icon: string;
203
+ title: Text;
204
+ icon: PluginIcon;
156
205
  surface: string;
157
206
  }
158
207
  export type PluginTimelineTransformerContribution<ItemType extends AgentTimelineItem["type"] = AgentTimelineItem["type"]> = ItemType extends AgentTimelineItem["type"] ? {
@@ -205,33 +254,33 @@ export interface PluginAgentCommandContext extends PluginCommandCapabilities {
205
254
  agent: PluginAgentSnapshot;
206
255
  openPanel(id: string, options?: PluginOpenPanelOptions): void;
207
256
  }
208
- interface PluginCommandCenterItemBase {
257
+ interface PluginCommandCenterItemBase<Text extends PluginText = string> {
209
258
  id: string;
210
- title: string;
211
- icon: string;
259
+ title: Text;
260
+ icon: PluginIcon;
212
261
  keywords?: readonly string[];
213
262
  }
214
- export type PluginCommandCenterItemContribution = (PluginCommandCenterItemBase & {
263
+ export type PluginCommandCenterItemContribution<Text extends PluginText = string> = (PluginCommandCenterItemBase<Text> & {
215
264
  context: "global";
216
265
  onSelect(context: PluginGlobalCommandContext): void | Promise<void>;
217
- }) | (PluginCommandCenterItemBase & {
266
+ }) | (PluginCommandCenterItemBase<Text> & {
218
267
  context: "workspace";
219
268
  onSelect(context: PluginWorkspaceCommandContext): void | Promise<void>;
220
- }) | (PluginCommandCenterItemBase & {
269
+ }) | (PluginCommandCenterItemBase<Text> & {
221
270
  context: "agent";
222
271
  onSelect(context: PluginAgentCommandContext): void | Promise<void>;
223
272
  });
224
- interface PluginClientSlashCommandBase {
273
+ interface PluginClientSlashCommandBase<Text extends PluginText = string> {
225
274
  name: string;
226
- description: string;
227
- argumentHint: string;
275
+ description: Text;
276
+ argumentHint: Text;
228
277
  }
229
- export type PluginClientSlashCommandContribution = (PluginClientSlashCommandBase & {
278
+ export type PluginClientSlashCommandContribution<Text extends PluginText = string> = (PluginClientSlashCommandBase<Text> & {
230
279
  context: "workspace";
231
280
  onSubmit(context: PluginWorkspaceCommandContext & {
232
281
  args: string;
233
282
  }): void | Promise<void>;
234
- }) | (PluginClientSlashCommandBase & {
283
+ }) | (PluginClientSlashCommandBase<Text> & {
235
284
  context: "agent";
236
285
  onSubmit(context: PluginAgentCommandContext & {
237
286
  args: string;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * The file a file panel shows. Stable for the life of the tab's target. The stat fields hold the
3
+ * latest version Paseo knows; read them while rendering. Changing them does not re-render the
4
+ * panel: `watch`, or a re-render from the read hooks, is how a panel learns they changed.
5
+ */
6
+ export interface PluginFile {
7
+ /** Absolute path on the host. */
8
+ readonly path: string;
9
+ readonly name: string;
10
+ /** Lowercase, without the dot; empty when the name has none. */
11
+ readonly extension: string;
12
+ readonly size: number;
13
+ readonly modifiedAt: string;
14
+ readonly mimeType: string;
15
+ /** Reads the file as UTF-8. A byte order mark is dropped here and written back by `writeText`. */
16
+ readText(): Promise<string>;
17
+ readBytes(): Promise<Uint8Array>;
18
+ /**
19
+ * A local URL of the file's current bytes, for `DocumentFrame` and images. Paseo owns it: it stays
20
+ * valid until a URL of a newer version resolves or the tab closes.
21
+ */
22
+ url(): Promise<string>;
23
+ /**
24
+ * Writes the file if it has not changed since this handle last read or wrote it. Otherwise
25
+ * rejects with `PluginFileConflictError`; `force: true` writes anyway. Rejects with
26
+ * `PluginFileDeletedError` when the file is gone.
27
+ */
28
+ writeText(text: string, options?: PluginFileWriteOptions): Promise<void>;
29
+ writeBytes(bytes: Uint8Array, options?: PluginFileWriteOptions): Promise<void>;
30
+ /**
31
+ * Calls `listener` when the file changes on disk or is deleted. This handle's own writes do not
32
+ * notify. A deletion is reported once a read confirms it; the panel stays mounted. Returns the
33
+ * unsubscribe function.
34
+ */
35
+ watch(listener: (event: PluginFileEvent) => void): () => void;
36
+ }
37
+ export interface PluginFileWriteOptions {
38
+ force?: boolean;
39
+ }
40
+ /** What happened to the file on disk. Switch on `type`; later versions may add fields. */
41
+ export type PluginFileEvent = {
42
+ type: "changed";
43
+ } | {
44
+ type: "deleted";
45
+ };
46
+ /** The file changed on disk since the handle last read or wrote it. */
47
+ export declare class PluginFileConflictError extends Error {
48
+ constructor(message?: string);
49
+ }
50
+ /** The file was deleted on disk. */
51
+ export declare class PluginFileDeletedError extends Error {
52
+ constructor(message?: string);
53
+ }
54
+ export type PluginFileTextState = {
55
+ status: "loading";
56
+ } | {
57
+ status: "ready";
58
+ text: string;
59
+ } | {
60
+ status: "error";
61
+ error: Error;
62
+ };
63
+ export type PluginFileBytesState = {
64
+ status: "loading";
65
+ } | {
66
+ status: "ready";
67
+ bytes: Uint8Array;
68
+ } | {
69
+ status: "error";
70
+ error: Error;
71
+ };
72
+ export type PluginFileUrlState = {
73
+ status: "loading";
74
+ } | {
75
+ status: "ready";
76
+ url: string;
77
+ } | {
78
+ status: "error";
79
+ error: Error;
80
+ };
81
+ /**
82
+ * The file's text, re-read when it changes on disk. Keeps the current text during a re-read. A
83
+ * deleted file is an error holding a `PluginFileDeletedError`.
84
+ */
85
+ export declare function useFileText(file: PluginFile): PluginFileTextState;
86
+ /**
87
+ * The file's bytes, re-read when it changes on disk. Keeps the current bytes during a re-read. A
88
+ * deleted file is an error holding a `PluginFileDeletedError`.
89
+ */
90
+ export declare function useFileBytes(file: PluginFile): PluginFileBytesState;
91
+ /**
92
+ * A local URL of the file, replaced when it changes on disk. A deleted file is an error holding a
93
+ * `PluginFileDeletedError`.
94
+ */
95
+ export declare function useFileUrl(file: PluginFile): PluginFileUrlState;
96
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1,87 @@
1
+ import { useEffect, useState } from "react";
2
+ /** The file changed on disk since the handle last read or wrote it. */
3
+ export class PluginFileConflictError extends Error {
4
+ constructor(message = "The file changed on disk.") {
5
+ super(message);
6
+ this.name = "PluginFileConflictError";
7
+ }
8
+ }
9
+ /** The file was deleted on disk. */
10
+ export class PluginFileDeletedError extends Error {
11
+ constructor(message = "The file was deleted.") {
12
+ super(message);
13
+ this.name = "PluginFileDeletedError";
14
+ }
15
+ }
16
+ /**
17
+ * The file's text, re-read when it changes on disk. Keeps the current text during a re-read. A
18
+ * deleted file is an error holding a `PluginFileDeletedError`.
19
+ */
20
+ export function useFileText(file) {
21
+ const state = useFileRead(file, "text");
22
+ return state.status === "ready" ? { status: "ready", text: state.value } : state;
23
+ }
24
+ /**
25
+ * The file's bytes, re-read when it changes on disk. Keeps the current bytes during a re-read. A
26
+ * deleted file is an error holding a `PluginFileDeletedError`.
27
+ */
28
+ export function useFileBytes(file) {
29
+ const state = useFileRead(file, "bytes");
30
+ return state.status === "ready" ? { status: "ready", bytes: state.value } : state;
31
+ }
32
+ /**
33
+ * A local URL of the file, replaced when it changes on disk. A deleted file is an error holding a
34
+ * `PluginFileDeletedError`.
35
+ */
36
+ export function useFileUrl(file) {
37
+ const state = useFileRead(file, "url");
38
+ return state.status === "ready" ? { status: "ready", url: state.value } : state;
39
+ }
40
+ function useFileRead(file, read) {
41
+ const [state, setState] = useState(() => ({ file, read, state: { status: "loading" } }));
42
+ useEffect(() => {
43
+ let generation = 0;
44
+ let active = true;
45
+ const load = async () => {
46
+ const current = ++generation;
47
+ let next;
48
+ try {
49
+ next = { status: "ready", value: await readFile(file, read) };
50
+ }
51
+ catch (error) {
52
+ next = { status: "error", error: asError(error) };
53
+ }
54
+ if (active && current === generation)
55
+ setState({ file, read, state: next });
56
+ };
57
+ void load();
58
+ const unwatch = file.watch((event) => {
59
+ if (event.type === "changed") {
60
+ void load();
61
+ return;
62
+ }
63
+ generation += 1;
64
+ setState({
65
+ file,
66
+ read,
67
+ state: { status: "error", error: new PluginFileDeletedError() },
68
+ });
69
+ });
70
+ return () => {
71
+ active = false;
72
+ unwatch();
73
+ };
74
+ }, [file, read]);
75
+ return state.file === file && state.read === read ? state.state : { status: "loading" };
76
+ }
77
+ function readFile(file, read) {
78
+ if (read === "text")
79
+ return file.readText();
80
+ if (read === "bytes")
81
+ return file.readBytes();
82
+ return file.url();
83
+ }
84
+ function asError(error) {
85
+ return error instanceof Error ? error : new Error(String(error));
86
+ }
87
+ //# sourceMappingURL=file.js.map
@@ -1,10 +1,11 @@
1
+ import type { PluginText } from "../text.js";
1
2
  export { PluginClientStateProvider, type PluginClientStateSource } from "./client-state.js";
2
3
  export { usePluginRuntimeContextBridge, type PluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
3
4
  import type { PluginAttachmentSourceContribution } from "../contracts.js";
4
5
  import { PluginRpcProvider } from "./rpc-context.js";
5
6
  import { PaseoApiProvider } from "./paseo-context.js";
6
7
  import { callPluginRpc } from "../rpc.js";
7
- export declare function searchPluginAttachments(source: PluginAttachmentSourceContribution, invoke: (method: string, input: unknown) => Promise<unknown>, query: string): Promise<{
8
+ export declare function searchPluginAttachments(source: PluginAttachmentSourceContribution<PluginText>, invoke: (method: string, input: unknown) => Promise<unknown>, query: string): Promise<{
8
9
  items: {
9
10
  id: string;
10
11
  identifier: string;
@@ -16,4 +17,6 @@ export declare function searchPluginAttachments(source: PluginAttachmentSourceCo
16
17
  }[];
17
18
  }>;
18
19
  export { callPluginRpc, PaseoApiProvider, PluginRpcProvider };
20
+ export { PluginTranslationRuntime, PluginTranslationProvider, usePluginTranslationRuntime, requirePluginText, isPluginMessage, } from "./translations.js";
21
+ export type { PluginLocaleSource } from "./translations.js";
19
22
  //# sourceMappingURL=host.d.ts.map
@@ -9,4 +9,5 @@ export async function searchPluginAttachments(source, invoke, query) {
9
9
  return PluginAttachmentSearchPayloadSchema.parseAsync(output);
10
10
  }
11
11
  export { callPluginRpc, PaseoApiProvider, PluginRpcProvider };
12
+ export { PluginTranslationRuntime, PluginTranslationProvider, usePluginTranslationRuntime, requirePluginText, isPluginMessage, } from "./translations.js";
12
13
  //# sourceMappingURL=host.js.map
@@ -1,5 +1,8 @@
1
- export type { PluginHostProps, PluginSurfaceProps, PluginScreenProps, PluginPopoverProps, PluginScreenParams, PluginOpenScreenInput, PluginScreenLocation, PluginSidebarItemProps, PluginSidebarItemContribution, PluginIconProps, 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
+ export type { PluginIconProps, PluginSerializableIcon, PluginSvgIcon } from "../icons.js";
4
+ export type { PluginFile, PluginFileBytesState, PluginFileEvent, PluginFileTextState, PluginFileUrlState, PluginFileWriteOptions, } from "./file.js";
5
+ export { PluginFileConflictError, PluginFileDeletedError, useFileBytes, useFileText, useFileUrl, } from "./file.js";
3
6
  export { usePaseo } from "./paseo-context.js";
4
7
  export { useAgent, useWorkspace } from "./client-state.js";
5
8
  export { useRpc } from "./rpc-context.js";
@@ -19,4 +22,8 @@ export declare function useHosts(): readonly PluginHostSummary[];
19
22
  export declare function getPaseoClient(serverId: string): import("@camerontaylor/paseo-client").PaseoApi;
20
23
  /** Open an absolute HTTP(S) URL using the client platform’s external opener. */
21
24
  export declare function openExternalUrl(url: string): Promise<void>;
25
+ export { defineTranslations, useTranslation } from "./translations.js";
26
+ export type { PluginI18n } from "./translations.js";
27
+ export type { PluginText, PluginMessage, PluginTranslations } from "../text.js";
28
+ export { useTabState } from "./tab.js";
22
29
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,7 @@
1
+ export { PluginFileConflictError, PluginFileDeletedError, useFileBytes, useFileText, useFileUrl, } from "./file.js";
1
2
  export { usePaseo } from "./paseo-context.js";
2
3
  export { useAgent, useWorkspace } from "./client-state.js";
3
4
  export { useRpc } from "./rpc-context.js";
5
+ export { defineTranslations, useTranslation } from "./translations.js";
6
+ export { useTabState } from "./tab.js";
4
7
  //# sourceMappingURL=index.js.map
@@ -1,46 +1,5 @@
1
- import type { ComponentType, FunctionComponent, ReactNode, ForwardRefExoticComponent, RefAttributes, ReactElement, Ref } from "react";
2
- import type { StyleProp, ViewStyle, ScrollView as NativeScrollView, ScrollViewProps, FlatList as NativeFlatList, FlatListProps, TextInput as NativeTextInput, TextInputProps } from "react-native";
3
- import type { PluginIconProps } from "./contracts.js";
4
- export interface ModalProps {
5
- title: string;
6
- icon?: ReactNode;
7
- open: boolean;
8
- onOpenChange(open: boolean): void;
9
- children: ReactNode;
10
- }
11
- export interface ModalContentProps {
12
- children: ReactNode;
13
- /** Paint the full body below the header. */
14
- style?: StyleProp<ViewStyle>;
15
- /** Overrides the default 24px padding and 16px gap. Safe-area clearance stays host-owned. */
16
- contentContainerStyle?: StyleProp<ViewStyle>;
17
- /** Default true. Set false for a bounded body with your own ScrollView or FlatList. */
18
- scrollable?: boolean;
19
- }
20
- export interface ModalComponent extends FunctionComponent<ModalProps> {
21
- Content: ComponentType<ModalContentProps>;
22
- }
23
- export type ToastVariant = "default" | "info" | "success" | "warning" | "error";
24
- export interface ToastOptions {
25
- variant?: ToastVariant;
26
- durationMs?: number;
27
- }
28
- export interface ToastApi {
29
- show(message: string, options?: ToastOptions): void;
30
- error(message: string): void;
31
- }
32
- export declare const Icon: ComponentType<PluginIconProps>;
33
- export declare const Modal: ModalComponent;
34
- export declare function useToast(): ToastApi;
1
+ /** @deprecated Import Paseo UI from @getpaseo/plugin/client/ui. */
2
+ export * from "./ui.js";
3
+ /** @deprecated Render StreamedText from @getpaseo/plugin/client/ui. Removed after 2027-04-20 with this entry. */
35
4
  export declare function useRevealedText(text: string, phase: "streaming" | "complete"): string;
36
- export type { PluginIconProps } from "./contracts.js";
37
- /** React Native scrolling with the host's sheet gestures when rendered inside a sheet. */
38
- export declare const ScrollView: ForwardRefExoticComponent<ScrollViewProps & RefAttributes<NativeScrollView>>;
39
- export declare function FlatList<Item>(props: FlatListProps<Item> & {
40
- ref?: Ref<NativeFlatList<Item>>;
41
- }): ReactElement;
42
- /** Copies text to this client's clipboard. Rejects when copying is unavailable or denied. */
43
- export declare function copyText(text: string): Promise<void>;
44
- /** Native input focus integrated with modal keyboard positioning. */
45
- export declare const TextInput: ForwardRefExoticComponent<TextInputProps & RefAttributes<NativeTextInput>>;
46
5
  //# sourceMappingURL=react-native.d.ts.map
@@ -1,2 +1,4 @@
1
- export {};
1
+ // COMPAT(pluginReactNativeEntrypoint): added in v0.13.0, remove after 2027-04-20
2
+ /** @deprecated Import Paseo UI from @getpaseo/plugin/client/ui. */
3
+ export * from "./ui.js";
2
4
  //# sourceMappingURL=react-native.js.map