@getpaseo/plugin 0.7.0-beta.1 → 0.7.0-beta.3
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-state.d.ts +1 -0
- package/dist/client-state.js +4 -1
- package/dist/contracts.d.ts +36 -3
- package/dist/host.d.ts +5 -2
- package/dist/host.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/paseo-context.d.ts +1 -0
- package/dist/paseo-context.js +4 -1
- package/dist/react-native.d.ts +29 -0
- package/dist/react-native.js +2 -0
- package/dist/rpc-context.d.ts +4 -0
- package/dist/rpc-context.js +4 -1
- package/dist/runtime-context-bridge.d.ts +5 -0
- package/dist/runtime-context-bridge.js +19 -0
- package/package.json +10 -5
package/dist/client-state.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface PluginClientStateSource {
|
|
|
5
5
|
getWorkspace(id: string): PluginWorkspaceSnapshot | null;
|
|
6
6
|
getAgent(id: string): PluginAgentSnapshot | null;
|
|
7
7
|
}
|
|
8
|
+
export declare function usePluginClientStateSource(): PluginClientStateSource | null;
|
|
8
9
|
export declare function useWorkspace<Selection>(workspaceId: string, selector: (workspace: PluginWorkspaceSnapshot) => Selection): Selection | null;
|
|
9
10
|
export declare function useAgent<Selection>(agentId: string, selector: (agent: PluginAgentSnapshot) => Selection): Selection | null;
|
|
10
11
|
export declare function PluginClientStateProvider({ children, source, }: {
|
package/dist/client-state.js
CHANGED
|
@@ -3,8 +3,11 @@ import { createContext, useContext } from "react";
|
|
|
3
3
|
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
4
4
|
import { shallowEqual } from "./shallow.js";
|
|
5
5
|
const PluginClientStateContext = createContext(null);
|
|
6
|
+
export function usePluginClientStateSource() {
|
|
7
|
+
return useContext(PluginClientStateContext);
|
|
8
|
+
}
|
|
6
9
|
function usePluginEntity(input) {
|
|
7
|
-
const source =
|
|
10
|
+
const source = usePluginClientStateSource();
|
|
8
11
|
if (!source)
|
|
9
12
|
throw new Error("Plugin state hooks must run inside a workspace panel");
|
|
10
13
|
return useSyncExternalStoreWithSelector(source.subscribe, () => input.read(source, input.id), () => input.read(source, input.id), (entity) => (entity ? input.selector(entity) : null), shallowEqual);
|
package/dist/contracts.d.ts
CHANGED
|
@@ -29,7 +29,18 @@ export interface PluginHostProps {
|
|
|
29
29
|
platform: "ios" | "android" | "web";
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
interface PluginNavigableHostProps extends PluginHostProps {
|
|
33
|
+
/** Client-owned navigation. Undefined on older hosts; hide dependent affordances when absent. */
|
|
34
|
+
readonly navigation?: {
|
|
35
|
+
readonly openAgent: (input: {
|
|
36
|
+
readonly agentId: string;
|
|
37
|
+
}) => void;
|
|
38
|
+
readonly openWorkspace: (input: {
|
|
39
|
+
readonly workspaceId: string;
|
|
40
|
+
}) => void;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface PluginSurfaceProps extends PluginNavigableHostProps {
|
|
33
44
|
}
|
|
34
45
|
export interface PluginIconProps {
|
|
35
46
|
name: string;
|
|
@@ -82,15 +93,36 @@ interface PluginWorkspacePanelBase {
|
|
|
82
93
|
icon: string;
|
|
83
94
|
locations?: readonly PluginPanelLocation[];
|
|
84
95
|
}
|
|
85
|
-
export interface PluginWorkspacePanelProps extends
|
|
96
|
+
export interface PluginWorkspacePanelProps extends PluginNavigableHostProps {
|
|
86
97
|
context: "workspace";
|
|
87
98
|
workspaceId: string;
|
|
88
99
|
}
|
|
89
|
-
export interface PluginAgentPanelProps extends
|
|
100
|
+
export interface PluginAgentPanelProps extends PluginNavigableHostProps {
|
|
90
101
|
context: "agent";
|
|
91
102
|
workspaceId: string;
|
|
92
103
|
agentId: string;
|
|
93
104
|
}
|
|
105
|
+
export interface PluginComposerPillProps extends PluginHostProps {
|
|
106
|
+
workspaceId: string;
|
|
107
|
+
agentId: string;
|
|
108
|
+
}
|
|
109
|
+
export interface PluginComposerPillContribution {
|
|
110
|
+
id: string;
|
|
111
|
+
title: string;
|
|
112
|
+
workspaceId: string;
|
|
113
|
+
agentId: string;
|
|
114
|
+
Component: ComponentType<PluginComposerPillProps>;
|
|
115
|
+
onPress(): void | Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
export interface PluginClientOpenPanelOptions extends PluginOpenPanelOptions {
|
|
118
|
+
workspaceId: string;
|
|
119
|
+
agentId?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface PluginClientContext extends PluginCommandCapabilities {
|
|
122
|
+
addComposerPill(contribution: PluginComposerPillContribution): PluginCleanup;
|
|
123
|
+
openPanel(id: string, options: PluginClientOpenPanelOptions): void;
|
|
124
|
+
}
|
|
125
|
+
export type PluginClientContribution = (client: PluginClientContext) => PluginCleanup;
|
|
94
126
|
export type PluginWorkspacePanelContribution = (PluginWorkspacePanelBase & {
|
|
95
127
|
context: "workspace";
|
|
96
128
|
Component: ComponentType<PluginWorkspacePanelProps>;
|
|
@@ -215,6 +247,7 @@ export interface PluginContext {
|
|
|
215
247
|
addSidebarItem(contribution: PluginSidebarContribution): void;
|
|
216
248
|
addWorkspacePanel(contribution: PluginWorkspacePanelContribution): void;
|
|
217
249
|
addCommandCenterItem(contribution: PluginCommandCenterItemContribution): void;
|
|
250
|
+
addClientSide(contribution: PluginClientContribution): void;
|
|
218
251
|
addAttachmentSource(contribution: PluginAttachmentSourceContribution): void;
|
|
219
252
|
addTheme(contribution: PluginThemeContribution): void;
|
|
220
253
|
addTimelineTransformer<ItemType extends AgentTimelineItem["type"]>(contribution: PluginTimelineTransformerContribution<ItemType>): void;
|
package/dist/host.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { PluginClientStateProvider, type PluginClientStateSource } from "./client-state.js";
|
|
2
|
-
|
|
2
|
+
export { usePluginRuntimeContextBridge, type PluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
3
|
+
import type { PluginAttachmentSourceContribution, PluginCommandCenterItemContribution, PluginClientContribution, PluginContext, PluginSidebarContribution, PluginSurfaceContribution, PluginSurfaceProps, PluginThemeContribution, PluginTimelineRendererContribution, PluginTimelineTransformerContribution, PluginWorkspacePanelContribution } from "./contracts.js";
|
|
3
4
|
import { PluginRpcProvider } from "./rpc-context.js";
|
|
4
5
|
import { PaseoApiProvider } from "./paseo-context.js";
|
|
5
6
|
import { callPluginRpc } from "./rpc.js";
|
|
@@ -9,6 +10,7 @@ interface PluginCollector {
|
|
|
9
10
|
addSidebarItem(contribution: PluginSidebarContribution): void;
|
|
10
11
|
addWorkspacePanel(contribution: PluginWorkspacePanelContribution): void;
|
|
11
12
|
addCommandCenterItem(contribution: PluginCommandCenterItemContribution): void;
|
|
13
|
+
addClientSide(contribution: PluginClientContribution): void;
|
|
12
14
|
addAttachmentSource(contribution: PluginAttachmentSourceContribution): void;
|
|
13
15
|
addTheme(contribution: PluginThemeContribution): void;
|
|
14
16
|
addTimelineTransformer(contribution: PluginTimelineTransformerContribution): void;
|
|
@@ -19,12 +21,13 @@ export interface PluginRegistrationCollector {
|
|
|
19
21
|
sidebarItems: PluginSidebarContribution[];
|
|
20
22
|
workspacePanels: PluginWorkspacePanelContribution[];
|
|
21
23
|
commandCenterItems: PluginCommandCenterItemContribution[];
|
|
24
|
+
clientSide: PluginClientContribution | null;
|
|
22
25
|
attachmentSources: PluginAttachmentSourceContribution[];
|
|
23
26
|
themes: PluginThemeContribution[];
|
|
24
27
|
timelineTransformers: PluginTimelineTransformerContribution[];
|
|
25
28
|
timelineRenderers: PluginTimelineRendererContribution[];
|
|
26
29
|
}
|
|
27
|
-
export declare function createPluginContext(collector: PluginCollector): Pick<PluginContext, "addSurface" | "addSidebarItem" | "addWorkspacePanel" | "addCommandCenterItem" | "addAttachmentSource" | "addTheme" | "addTimelineTransformer" | "addTimelineRenderer">;
|
|
30
|
+
export declare function createPluginContext(collector: PluginCollector): Pick<PluginContext, "addSurface" | "addSidebarItem" | "addWorkspacePanel" | "addCommandCenterItem" | "addClientSide" | "addAttachmentSource" | "addTheme" | "addTimelineTransformer" | "addTimelineRenderer">;
|
|
28
31
|
export declare function searchPluginAttachments(source: PluginAttachmentSourceContribution, invoke: (method: string, input: unknown) => Promise<unknown>, query: string): Promise<{
|
|
29
32
|
items: {
|
|
30
33
|
id: string;
|
package/dist/host.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PluginAttachmentSearchPayloadSchema } from "./attachments.js";
|
|
2
2
|
export { PluginClientStateProvider } from "./client-state.js";
|
|
3
|
+
export { usePluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
3
4
|
import { PluginRpcProvider } from "./rpc-context.js";
|
|
4
5
|
import { PaseoApiProvider } from "./paseo-context.js";
|
|
5
6
|
import { callPluginRpc } from "./rpc.js";
|
|
@@ -17,6 +18,9 @@ export function createPluginContext(collector) {
|
|
|
17
18
|
addCommandCenterItem(contribution) {
|
|
18
19
|
collector.addCommandCenterItem(contribution);
|
|
19
20
|
},
|
|
21
|
+
addClientSide(contribution) {
|
|
22
|
+
collector.addClientSide(contribution);
|
|
23
|
+
},
|
|
20
24
|
addAttachmentSource(contribution) {
|
|
21
25
|
collector.addAttachmentSource(contribution);
|
|
22
26
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ComponentType } from "react";
|
|
|
2
2
|
import type { PluginIconProps } from "./contracts.js";
|
|
3
3
|
export { PluginAttachmentItemSchema, PluginAttachmentSearchPayloadSchema, defineAttachmentSource, defineRpc, type PluginAttachmentItem, type PluginAttachmentSearchPayload, type PluginRpcContract, } from "./server.js";
|
|
4
4
|
export declare const Icon: ComponentType<PluginIconProps>;
|
|
5
|
-
export type { PluginAttachmentSourceContribution, PluginAgentCommandContext, PluginAgentPanelProps, PluginAgentSnapshot, PluginCleanup, PluginCommandCapabilities, PluginCommandCenterItemContribution, PluginContribution, PluginContext, PluginGlobalCommandContext, PluginHandlerContext, PluginHostProps, PluginOpenPanelOptions, PluginIconProps, PluginPanelLocation, PluginTheme, PluginSidebarContribution, PluginSurfaceContribution, PluginSurfaceProps, PluginThemeColors, PluginThemeContribution, PluginTimelineData, PluginTimelineItem, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginTimelineTransformerContribution, PluginTimelineTransformResult, PluginWorkspaceCommandContext, PluginWorkspacePanelContribution, PluginWorkspacePanelProps, PluginWorkspaceSnapshot, } from "./contracts.js";
|
|
5
|
+
export type { PluginAttachmentSourceContribution, PluginAgentCommandContext, PluginAgentPanelProps, PluginAgentSnapshot, PluginCleanup, PluginCommandCapabilities, PluginCommandCenterItemContribution, PluginClientContext, PluginClientContribution, PluginClientOpenPanelOptions, PluginComposerPillContribution, PluginComposerPillProps, PluginContribution, PluginContext, PluginGlobalCommandContext, PluginHandlerContext, PluginHostProps, PluginOpenPanelOptions, PluginIconProps, PluginPanelLocation, PluginTheme, PluginSidebarContribution, PluginSurfaceContribution, PluginSurfaceProps, PluginThemeColors, PluginThemeContribution, PluginTimelineData, PluginTimelineItem, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginTimelineTransformerContribution, PluginTimelineTransformResult, PluginWorkspaceCommandContext, PluginWorkspacePanelContribution, PluginWorkspacePanelProps, PluginWorkspaceSnapshot, } from "./contracts.js";
|
|
6
6
|
export { usePaseo } from "./paseo-context.js";
|
|
7
7
|
export { useAgent, useWorkspace } from "./client-state.js";
|
|
8
8
|
export { useRpc } from "./rpc-context.js";
|
package/dist/paseo-context.d.ts
CHANGED
package/dist/paseo-context.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
const PaseoApiContext = createContext(null);
|
|
4
|
+
export function usePaseoContextValue() {
|
|
5
|
+
return useContext(PaseoApiContext);
|
|
6
|
+
}
|
|
4
7
|
export function PaseoApiProvider({ children, paseo }) {
|
|
5
8
|
return _jsx(PaseoApiContext.Provider, { value: paseo, children: children });
|
|
6
9
|
}
|
|
7
10
|
export function usePaseo() {
|
|
8
|
-
const paseo =
|
|
11
|
+
const paseo = usePaseoContextValue();
|
|
9
12
|
if (!paseo)
|
|
10
13
|
throw new Error("usePaseo must run inside a contributed plugin surface");
|
|
11
14
|
return paseo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ComponentType, FunctionComponent, ReactNode } from "react";
|
|
2
|
+
import type { PluginIconProps } from "./contracts.js";
|
|
3
|
+
export interface ModalProps {
|
|
4
|
+
title: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
open: boolean;
|
|
7
|
+
onOpenChange(open: boolean): void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface ModalContentProps {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface ModalComponent extends FunctionComponent<ModalProps> {
|
|
14
|
+
Content: ComponentType<ModalContentProps>;
|
|
15
|
+
}
|
|
16
|
+
export type ToastVariant = "default" | "info" | "success" | "warning" | "error";
|
|
17
|
+
export interface ToastOptions {
|
|
18
|
+
variant?: ToastVariant;
|
|
19
|
+
durationMs?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ToastApi {
|
|
22
|
+
show(message: string, options?: ToastOptions): void;
|
|
23
|
+
error(message: string): void;
|
|
24
|
+
}
|
|
25
|
+
export declare const Icon: ComponentType<PluginIconProps>;
|
|
26
|
+
export declare const Modal: ModalComponent;
|
|
27
|
+
export declare function useToast(): ToastApi;
|
|
28
|
+
export type { PluginIconProps } from "./contracts.js";
|
|
29
|
+
//# sourceMappingURL=react-native.d.ts.map
|
package/dist/rpc-context.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
3
3
|
import { type PluginRpcContract } from "./rpc.js";
|
|
4
|
+
export interface PluginRpcContextValue {
|
|
5
|
+
invoke(method: string, input: unknown): Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare function usePluginRpcContextValue(): PluginRpcContextValue | null;
|
|
4
8
|
export declare function PluginRpcProvider({ children, invoke, }: {
|
|
5
9
|
children: ReactNode;
|
|
6
10
|
invoke(method: string, input: unknown): Promise<unknown>;
|
package/dist/rpc-context.js
CHANGED
|
@@ -2,12 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
3
3
|
import { callPluginRpc } from "./rpc.js";
|
|
4
4
|
const PluginRpcContext = createContext(null);
|
|
5
|
+
export function usePluginRpcContextValue() {
|
|
6
|
+
return useContext(PluginRpcContext);
|
|
7
|
+
}
|
|
5
8
|
export function PluginRpcProvider({ children, invoke, }) {
|
|
6
9
|
const value = useMemo(() => ({ invoke }), [invoke]);
|
|
7
10
|
return _jsx(PluginRpcContext.Provider, { value: value, children: children });
|
|
8
11
|
}
|
|
9
12
|
export function useRpc(contract) {
|
|
10
|
-
const context =
|
|
13
|
+
const context = usePluginRpcContextValue();
|
|
11
14
|
if (!context)
|
|
12
15
|
throw new Error("useRpc must run inside a contributed plugin surface");
|
|
13
16
|
return useCallback((input) => callPluginRpc(contract, context.invoke, input), [context, contract]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type PluginRuntimeContextBridge = (children: ReactNode) => ReactNode;
|
|
3
|
+
/** Rebuilds plugin runtime contexts inside React Native portal hosts. */
|
|
4
|
+
export declare function usePluginRuntimeContextBridge(): PluginRuntimeContextBridge;
|
|
5
|
+
//# sourceMappingURL=runtime-context-bridge.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { PluginClientStateProvider, usePluginClientStateSource } from "./client-state.js";
|
|
4
|
+
import { PaseoApiProvider, usePaseoContextValue } from "./paseo-context.js";
|
|
5
|
+
import { PluginRpcProvider, usePluginRpcContextValue } from "./rpc-context.js";
|
|
6
|
+
/** Rebuilds plugin runtime contexts inside React Native portal hosts. */
|
|
7
|
+
export function usePluginRuntimeContextBridge() {
|
|
8
|
+
const paseo = usePaseoContextValue();
|
|
9
|
+
const rpc = usePluginRpcContextValue();
|
|
10
|
+
const state = usePluginClientStateSource();
|
|
11
|
+
if (!paseo || !rpc) {
|
|
12
|
+
throw new Error("Plugin UI must run inside a contributed plugin surface");
|
|
13
|
+
}
|
|
14
|
+
return useCallback((children) => {
|
|
15
|
+
const content = state ? (_jsx(PluginClientStateProvider, { source: state, children: children })) : (children);
|
|
16
|
+
return (_jsx(PaseoApiProvider, { paseo: paseo, children: _jsx(PluginRpcProvider, { invoke: rpc.invoke, children: content }) }));
|
|
17
|
+
}, [paseo, rpc, state]);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=runtime-context-bridge.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpaseo/plugin",
|
|
3
|
-
"version": "0.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.3",
|
|
4
4
|
"description": "Paseo plugin SDK package",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
"source": "./src/server.ts",
|
|
19
19
|
"default": "./dist/server.js"
|
|
20
20
|
},
|
|
21
|
+
"./react-native": {
|
|
22
|
+
"types": "./dist/react-native.d.ts",
|
|
23
|
+
"source": "./src/react-native.ts",
|
|
24
|
+
"default": "./dist/react-native.js"
|
|
25
|
+
},
|
|
21
26
|
"./host": {
|
|
22
27
|
"types": "./dist/host.d.ts",
|
|
23
28
|
"source": "./src/host.ts",
|
|
@@ -39,8 +44,8 @@
|
|
|
39
44
|
"use-sync-external-store": "^1.6.0"
|
|
40
45
|
},
|
|
41
46
|
"devDependencies": {
|
|
42
|
-
"@getpaseo/client": "0.7.0-beta.
|
|
43
|
-
"@getpaseo/protocol": "0.7.0-beta.
|
|
47
|
+
"@getpaseo/client": "0.7.0-beta.3",
|
|
48
|
+
"@getpaseo/protocol": "0.7.0-beta.3",
|
|
44
49
|
"@types/node": "^20.9.0",
|
|
45
50
|
"@types/react": "~19.2.0",
|
|
46
51
|
"react": "19.1.0",
|
|
@@ -49,8 +54,8 @@
|
|
|
49
54
|
"zod": "^4.4.3"
|
|
50
55
|
},
|
|
51
56
|
"peerDependencies": {
|
|
52
|
-
"@getpaseo/client": "0.7.0-beta.
|
|
53
|
-
"@getpaseo/protocol": "0.7.0-beta.
|
|
57
|
+
"@getpaseo/client": "0.7.0-beta.3",
|
|
58
|
+
"@getpaseo/protocol": "0.7.0-beta.3",
|
|
54
59
|
"react": "19.1.0",
|
|
55
60
|
"zod": "^4.4.3"
|
|
56
61
|
}
|