@camerontaylor/paseo-plugin 0.8.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.
- package/dist/attachments.d.ts +26 -0
- package/dist/attachments.js +17 -0
- package/dist/client/buttons.d.ts +64 -0
- package/dist/client/buttons.js +2 -0
- package/dist/client/client-state.d.ts +15 -0
- package/dist/client/client-state.js +32 -0
- package/dist/client/contracts.d.ts +201 -0
- package/dist/client/contracts.js +2 -0
- package/dist/client/host.d.ts +19 -0
- package/dist/client/host.js +12 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.js +4 -0
- package/dist/client/paseo-context.d.ts +9 -0
- package/dist/client/paseo-context.js +16 -0
- package/dist/client/react-native.d.ts +46 -0
- package/dist/client/react-native.js +2 -0
- package/dist/client/rpc-context.d.ts +13 -0
- package/dist/client/rpc-context.js +18 -0
- package/dist/client/runtime-context-bridge.d.ts +5 -0
- package/dist/client/runtime-context-bridge.js +19 -0
- package/dist/client/shallow.d.ts +2 -0
- package/dist/client/shallow.js +45 -0
- package/dist/client/ui.d.ts +60 -0
- package/dist/client/ui.js +2 -0
- package/dist/contracts.d.ts +90 -0
- package/dist/contracts.js +2 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/rpc.d.ts +17 -0
- package/dist/rpc.js +13 -0
- package/dist/server/acp-internal/connection.d.ts +4 -0
- package/dist/server/acp-internal/connection.js +1187 -0
- package/dist/server/acp.d.ts +112 -0
- package/dist/server/acp.js +21 -0
- package/dist/server/contracts.d.ts +16 -0
- package/dist/server/contracts.js +2 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +2 -0
- package/dist/server/lifecycle.d.ts +92 -0
- package/dist/server/lifecycle.js +2 -0
- package/dist/server/provider.d.ts +610 -0
- package/dist/server/provider.js +811 -0
- package/dist/settings.d.ts +70 -0
- package/dist/settings.js +40 -0
- package/package.json +90 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { PluginAttachmentSourceContribution } from "./contracts.js";
|
|
3
|
+
export declare function defineAttachmentSource<Definition extends PluginAttachmentSourceContribution>(definition: Definition): Definition;
|
|
4
|
+
export declare const PluginAttachmentItemSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
identifier: z.ZodString;
|
|
7
|
+
title: z.ZodString;
|
|
8
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
9
|
+
url: z.ZodURL;
|
|
10
|
+
text: z.ZodString;
|
|
11
|
+
resourceType: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const PluginAttachmentSearchPayloadSchema: z.ZodObject<{
|
|
14
|
+
items: z.ZodArray<z.ZodObject<{
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
identifier: z.ZodString;
|
|
17
|
+
title: z.ZodString;
|
|
18
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
19
|
+
url: z.ZodURL;
|
|
20
|
+
text: z.ZodString;
|
|
21
|
+
resourceType: z.ZodString;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type PluginAttachmentItem = z.infer<typeof PluginAttachmentItemSchema>;
|
|
25
|
+
export type PluginAttachmentSearchPayload = z.infer<typeof PluginAttachmentSearchPayloadSchema>;
|
|
26
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function defineAttachmentSource(definition) {
|
|
3
|
+
return definition;
|
|
4
|
+
}
|
|
5
|
+
export const PluginAttachmentItemSchema = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
identifier: z.string(),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
subtitle: z.string().optional(),
|
|
10
|
+
url: z.url(),
|
|
11
|
+
text: z.string(),
|
|
12
|
+
resourceType: z.string(),
|
|
13
|
+
});
|
|
14
|
+
export const PluginAttachmentSearchPayloadSchema = z.object({
|
|
15
|
+
items: z.array(PluginAttachmentItemSchema),
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=attachments.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { PluginHostProps } from "./contracts.js";
|
|
3
|
+
export type PluginButtonContext = {
|
|
4
|
+
context: "workspace";
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
} | {
|
|
7
|
+
context: "agent";
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
agentId: string;
|
|
10
|
+
};
|
|
11
|
+
export type PluginButtonIconProps = PluginHostProps & PluginButtonContext & {
|
|
12
|
+
size: number;
|
|
13
|
+
color: string;
|
|
14
|
+
};
|
|
15
|
+
export type PluginButtonContentProps = PluginHostProps & PluginButtonContext & {
|
|
16
|
+
close(): void;
|
|
17
|
+
};
|
|
18
|
+
export type PluginButtonIcon = string | ComponentType<PluginButtonIconProps>;
|
|
19
|
+
export type PluginButtonBehavior = {
|
|
20
|
+
kind: "action";
|
|
21
|
+
onPress(): void | Promise<void>;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "menu";
|
|
24
|
+
items: readonly PluginButtonMenuEntry[];
|
|
25
|
+
} | {
|
|
26
|
+
kind: "popover";
|
|
27
|
+
Content: ComponentType<PluginButtonContentProps>;
|
|
28
|
+
};
|
|
29
|
+
export type PluginButtonMenuEntry = {
|
|
30
|
+
kind: "separator";
|
|
31
|
+
id: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "item";
|
|
34
|
+
id: string;
|
|
35
|
+
title: string;
|
|
36
|
+
icon?: PluginButtonIcon;
|
|
37
|
+
visible?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
behavior: PluginButtonBehavior;
|
|
40
|
+
};
|
|
41
|
+
export interface PluginButton {
|
|
42
|
+
title: string;
|
|
43
|
+
icon: PluginButtonIcon;
|
|
44
|
+
/** Omit for an icon-only header button. Composer pills use title when omitted. */
|
|
45
|
+
label?: string;
|
|
46
|
+
visible?: boolean;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
behavior: PluginButtonBehavior;
|
|
49
|
+
}
|
|
50
|
+
export interface PluginButtonRegistration {
|
|
51
|
+
/** Updates presentation in place. Supply a complete behavior to replace it. */
|
|
52
|
+
update(patch: Partial<PluginButton>): void;
|
|
53
|
+
/** Idempotent. Updates after removal do nothing. */
|
|
54
|
+
remove(): void;
|
|
55
|
+
}
|
|
56
|
+
export interface PluginHeaderButtonContribution {
|
|
57
|
+
id: string;
|
|
58
|
+
workspaceId: string;
|
|
59
|
+
button: PluginButton;
|
|
60
|
+
}
|
|
61
|
+
export interface PluginComposerPillContribution extends PluginHeaderButtonContribution {
|
|
62
|
+
agentId: string;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=buttons.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { PluginAgentSnapshot, PluginWorkspaceSnapshot } from "../contracts.js";
|
|
3
|
+
export interface PluginClientStateSource {
|
|
4
|
+
subscribe(listener: () => void): () => void;
|
|
5
|
+
getWorkspace(id: string): PluginWorkspaceSnapshot | null;
|
|
6
|
+
getAgent(id: string): PluginAgentSnapshot | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function usePluginClientStateSource(): PluginClientStateSource | null;
|
|
9
|
+
export declare function useWorkspace<Selection>(workspaceId: string, selector: (workspace: PluginWorkspaceSnapshot) => Selection): Selection | null;
|
|
10
|
+
export declare function useAgent<Selection>(agentId: string, selector: (agent: PluginAgentSnapshot) => Selection): Selection | null;
|
|
11
|
+
export declare function PluginClientStateProvider({ children, source, }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
source: PluginClientStateSource;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=client-state.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
4
|
+
import { shallowEqual } from "./shallow.js";
|
|
5
|
+
const PluginClientStateContext = createContext(null);
|
|
6
|
+
export function usePluginClientStateSource() {
|
|
7
|
+
return useContext(PluginClientStateContext);
|
|
8
|
+
}
|
|
9
|
+
function usePluginEntity(input) {
|
|
10
|
+
const source = usePluginClientStateSource();
|
|
11
|
+
if (!source)
|
|
12
|
+
throw new Error("Plugin state hooks must run inside a workspace panel");
|
|
13
|
+
return useSyncExternalStoreWithSelector(source.subscribe, () => input.read(source, input.id), () => input.read(source, input.id), (entity) => (entity ? input.selector(entity) : null), shallowEqual);
|
|
14
|
+
}
|
|
15
|
+
export function useWorkspace(workspaceId, selector) {
|
|
16
|
+
return usePluginEntity({
|
|
17
|
+
id: workspaceId,
|
|
18
|
+
read: (source, id) => source.getWorkspace(id),
|
|
19
|
+
selector,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function useAgent(agentId, selector) {
|
|
23
|
+
return usePluginEntity({
|
|
24
|
+
id: agentId,
|
|
25
|
+
read: (source, id) => source.getAgent(id),
|
|
26
|
+
selector,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function PluginClientStateProvider({ children, source, }) {
|
|
30
|
+
return (_jsx(PluginClientStateContext.Provider, { value: source, children: children }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=client-state.js.map
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { PaseoApi } from "@camerontaylor/paseo-client";
|
|
3
|
+
import type { AgentTimelineItem } from "@camerontaylor/paseo-protocol/agent-types";
|
|
4
|
+
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
5
|
+
import type { PluginRpcContract } from "../rpc.js";
|
|
6
|
+
import type { PluginButtonRegistration, PluginHeaderButtonContribution, PluginComposerPillContribution } from "./buttons.js";
|
|
7
|
+
import type { PluginTheme, PluginWorkspaceSnapshot, PluginAgentSnapshot, PluginThemeContribution, PluginAttachmentSourceContribution, PluginTimelineTransformResult, PluginCleanup } from "../contracts.js";
|
|
8
|
+
export interface PluginHostProps {
|
|
9
|
+
theme: PluginTheme;
|
|
10
|
+
host: {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
layout: {
|
|
15
|
+
compact: boolean;
|
|
16
|
+
platform: "ios" | "android" | "web";
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface PluginNavigableHostProps extends PluginHostProps {
|
|
20
|
+
/** Client-owned navigation. Undefined on older hosts; hide dependent affordances when absent. */
|
|
21
|
+
readonly navigation?: {
|
|
22
|
+
readonly openAgent: (input: {
|
|
23
|
+
readonly agentId: string;
|
|
24
|
+
}) => void;
|
|
25
|
+
readonly openWorkspace: (input: {
|
|
26
|
+
readonly workspaceId: string;
|
|
27
|
+
}) => void;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface PluginSurfaceProps extends PluginNavigableHostProps {
|
|
31
|
+
}
|
|
32
|
+
export interface PluginIconProps {
|
|
33
|
+
name: string;
|
|
34
|
+
size?: number;
|
|
35
|
+
color?: string;
|
|
36
|
+
}
|
|
37
|
+
export type PluginPanelLocation = "workspace" | "explorer";
|
|
38
|
+
export interface PluginOpenPanelOptions {
|
|
39
|
+
location?: PluginPanelLocation;
|
|
40
|
+
}
|
|
41
|
+
interface PluginWorkspacePanelBase {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
icon: string;
|
|
45
|
+
locations?: readonly PluginPanelLocation[];
|
|
46
|
+
}
|
|
47
|
+
export interface PluginWorkspacePanelProps extends PluginNavigableHostProps {
|
|
48
|
+
context: "workspace";
|
|
49
|
+
workspaceId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface PluginAgentPanelProps extends PluginNavigableHostProps {
|
|
52
|
+
context: "agent";
|
|
53
|
+
workspaceId: string;
|
|
54
|
+
agentId: string;
|
|
55
|
+
}
|
|
56
|
+
export interface PluginClientOpenPanelOptions extends PluginOpenPanelOptions {
|
|
57
|
+
workspaceId: string;
|
|
58
|
+
agentId?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface PluginClientContext extends PluginCommandCapabilities {
|
|
61
|
+
addSettingsScreen(contribution: PluginSettingsScreenContribution): PluginCleanup;
|
|
62
|
+
addSurface(id: string, Component: ComponentType<PluginSurfaceProps>): PluginCleanup;
|
|
63
|
+
addSidebarItem(contribution: PluginSidebarContribution): PluginCleanup;
|
|
64
|
+
addWorkspacePanel(contribution: PluginWorkspacePanelContribution): PluginCleanup;
|
|
65
|
+
addCommandCenterItem(contribution: PluginCommandCenterItemContribution): PluginCleanup;
|
|
66
|
+
addSlashCommand(contribution: PluginClientSlashCommandContribution): PluginCleanup;
|
|
67
|
+
addHeaderButton(contribution: PluginHeaderButtonContribution): PluginButtonRegistration;
|
|
68
|
+
addComposerPill(contribution: PluginComposerPillContribution): PluginButtonRegistration;
|
|
69
|
+
addAttachmentSource(contribution: PluginAttachmentSourceContribution): PluginCleanup;
|
|
70
|
+
addTheme(contribution: PluginThemeContribution): PluginCleanup;
|
|
71
|
+
addTimelineTransformer<ItemType extends AgentTimelineItem["type"]>(contribution: PluginTimelineTransformerContribution<ItemType>): PluginCleanup;
|
|
72
|
+
addTimelineRenderer<Schema extends ZodType>(contribution: PluginTimelineRendererContribution<Schema>): PluginCleanup;
|
|
73
|
+
openPanel(id: string, options: PluginClientOpenPanelOptions): void;
|
|
74
|
+
}
|
|
75
|
+
export type PluginClientContribution = (client: PluginClientContext) => PluginCleanup;
|
|
76
|
+
export type PluginWorkspacePanelContribution = (PluginWorkspacePanelBase & {
|
|
77
|
+
context: "workspace";
|
|
78
|
+
Component: ComponentType<PluginWorkspacePanelProps>;
|
|
79
|
+
}) | (PluginWorkspacePanelBase & {
|
|
80
|
+
context: "agent";
|
|
81
|
+
Component: ComponentType<PluginAgentPanelProps>;
|
|
82
|
+
});
|
|
83
|
+
export interface PluginSettingsScreenContribution {
|
|
84
|
+
id: string;
|
|
85
|
+
title: string;
|
|
86
|
+
icon: string;
|
|
87
|
+
Component: ComponentType<PluginSurfaceProps>;
|
|
88
|
+
}
|
|
89
|
+
export interface PluginSurfaceContribution {
|
|
90
|
+
id: string;
|
|
91
|
+
Component: ComponentType<PluginSurfaceProps>;
|
|
92
|
+
}
|
|
93
|
+
export interface PluginSidebarContribution {
|
|
94
|
+
id: string;
|
|
95
|
+
title: string;
|
|
96
|
+
icon: string;
|
|
97
|
+
surface: string;
|
|
98
|
+
}
|
|
99
|
+
export type PluginTimelineTransformerContribution<ItemType extends AgentTimelineItem["type"] = AgentTimelineItem["type"]> = ItemType extends AgentTimelineItem["type"] ? {
|
|
100
|
+
id: string;
|
|
101
|
+
query: {
|
|
102
|
+
itemType: ItemType;
|
|
103
|
+
};
|
|
104
|
+
transform(input: {
|
|
105
|
+
item: Extract<AgentTimelineItem, {
|
|
106
|
+
type: ItemType;
|
|
107
|
+
}>;
|
|
108
|
+
phase: "streaming" | "complete";
|
|
109
|
+
}): PluginTimelineTransformResult | undefined;
|
|
110
|
+
} : never;
|
|
111
|
+
export interface PluginTimelineItemProps<Data = unknown> extends PluginHostProps {
|
|
112
|
+
agentId: string;
|
|
113
|
+
item: {
|
|
114
|
+
type: "plugin";
|
|
115
|
+
kind: string;
|
|
116
|
+
version: number;
|
|
117
|
+
data: Data;
|
|
118
|
+
};
|
|
119
|
+
timestamp: Date;
|
|
120
|
+
}
|
|
121
|
+
export interface PluginTimelineRendererContribution<Schema extends ZodType = ZodType> {
|
|
122
|
+
kind: string;
|
|
123
|
+
version: number;
|
|
124
|
+
schema: Schema;
|
|
125
|
+
Component: ComponentType<PluginTimelineItemProps<ZodOutput<Schema>>>;
|
|
126
|
+
}
|
|
127
|
+
export interface PluginCommandCapabilities {
|
|
128
|
+
paseo: PaseoApi;
|
|
129
|
+
rpc<InputSchema extends ZodType, OutputSchema extends ZodType>(contract: PluginRpcContract<InputSchema, OutputSchema>, input: ZodInput<InputSchema>): Promise<ZodOutput<OutputSchema>>;
|
|
130
|
+
openSurface(id: string): void;
|
|
131
|
+
openSettings(id: string): void;
|
|
132
|
+
}
|
|
133
|
+
export interface PluginGlobalCommandContext extends PluginCommandCapabilities {
|
|
134
|
+
context: "global";
|
|
135
|
+
}
|
|
136
|
+
export interface PluginWorkspaceCommandContext extends PluginCommandCapabilities {
|
|
137
|
+
context: "workspace";
|
|
138
|
+
workspace: PluginWorkspaceSnapshot;
|
|
139
|
+
openPanel(id: string, options?: PluginOpenPanelOptions): void;
|
|
140
|
+
}
|
|
141
|
+
export interface PluginAgentCommandContext extends PluginCommandCapabilities {
|
|
142
|
+
context: "agent";
|
|
143
|
+
workspace: PluginWorkspaceSnapshot;
|
|
144
|
+
agent: PluginAgentSnapshot;
|
|
145
|
+
openPanel(id: string, options?: PluginOpenPanelOptions): void;
|
|
146
|
+
}
|
|
147
|
+
interface PluginCommandCenterItemBase {
|
|
148
|
+
id: string;
|
|
149
|
+
title: string;
|
|
150
|
+
icon: string;
|
|
151
|
+
keywords?: readonly string[];
|
|
152
|
+
}
|
|
153
|
+
export type PluginCommandCenterItemContribution = (PluginCommandCenterItemBase & {
|
|
154
|
+
context: "global";
|
|
155
|
+
onSelect(context: PluginGlobalCommandContext): void | Promise<void>;
|
|
156
|
+
}) | (PluginCommandCenterItemBase & {
|
|
157
|
+
context: "workspace";
|
|
158
|
+
onSelect(context: PluginWorkspaceCommandContext): void | Promise<void>;
|
|
159
|
+
}) | (PluginCommandCenterItemBase & {
|
|
160
|
+
context: "agent";
|
|
161
|
+
onSelect(context: PluginAgentCommandContext): void | Promise<void>;
|
|
162
|
+
});
|
|
163
|
+
interface PluginClientSlashCommandBase {
|
|
164
|
+
name: string;
|
|
165
|
+
description: string;
|
|
166
|
+
argumentHint: string;
|
|
167
|
+
}
|
|
168
|
+
export type PluginClientSlashCommandContribution = (PluginClientSlashCommandBase & {
|
|
169
|
+
context: "workspace";
|
|
170
|
+
onSubmit(context: PluginWorkspaceCommandContext & {
|
|
171
|
+
args: string;
|
|
172
|
+
}): void | Promise<void>;
|
|
173
|
+
}) | (PluginClientSlashCommandBase & {
|
|
174
|
+
context: "agent";
|
|
175
|
+
onSubmit(context: PluginAgentCommandContext & {
|
|
176
|
+
args: string;
|
|
177
|
+
}): void | Promise<void>;
|
|
178
|
+
});
|
|
179
|
+
export type SettingsState<Schema extends ZodType> = ({
|
|
180
|
+
status: "loading";
|
|
181
|
+
} | {
|
|
182
|
+
status: "error";
|
|
183
|
+
error: string;
|
|
184
|
+
} | {
|
|
185
|
+
status: "invalid";
|
|
186
|
+
error: string;
|
|
187
|
+
revision: string;
|
|
188
|
+
} | {
|
|
189
|
+
status: "ready";
|
|
190
|
+
values: ZodOutput<Schema>;
|
|
191
|
+
revision: string;
|
|
192
|
+
}) & {
|
|
193
|
+
saving: boolean;
|
|
194
|
+
saveError: string | null;
|
|
195
|
+
/** Save an entire document against the revision currently displayed. Never throws. */
|
|
196
|
+
save(values: ZodOutput<Schema>, revision: string): Promise<boolean>;
|
|
197
|
+
reset(): Promise<boolean>;
|
|
198
|
+
reload(): Promise<void>;
|
|
199
|
+
};
|
|
200
|
+
export {};
|
|
201
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { PluginClientStateProvider, type PluginClientStateSource } from "./client-state.js";
|
|
2
|
+
export { usePluginRuntimeContextBridge, type PluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
3
|
+
import type { PluginAttachmentSourceContribution } from "../contracts.js";
|
|
4
|
+
import { PluginRpcProvider } from "./rpc-context.js";
|
|
5
|
+
import { PaseoApiProvider } from "./paseo-context.js";
|
|
6
|
+
import { callPluginRpc } from "../rpc.js";
|
|
7
|
+
export declare function searchPluginAttachments(source: PluginAttachmentSourceContribution, invoke: (method: string, input: unknown) => Promise<unknown>, query: string): Promise<{
|
|
8
|
+
items: {
|
|
9
|
+
id: string;
|
|
10
|
+
identifier: string;
|
|
11
|
+
title: string;
|
|
12
|
+
url: string;
|
|
13
|
+
text: string;
|
|
14
|
+
resourceType: string;
|
|
15
|
+
subtitle?: string | undefined;
|
|
16
|
+
}[];
|
|
17
|
+
}>;
|
|
18
|
+
export { callPluginRpc, PaseoApiProvider, PluginRpcProvider };
|
|
19
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PluginAttachmentSearchPayloadSchema } from "../attachments.js";
|
|
2
|
+
export { PluginClientStateProvider } from "./client-state.js";
|
|
3
|
+
export { usePluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
4
|
+
import { PluginRpcProvider } from "./rpc-context.js";
|
|
5
|
+
import { PaseoApiProvider } from "./paseo-context.js";
|
|
6
|
+
import { callPluginRpc } from "../rpc.js";
|
|
7
|
+
export async function searchPluginAttachments(source, invoke, query) {
|
|
8
|
+
const output = await callPluginRpc(source.search, invoke, { query });
|
|
9
|
+
return PluginAttachmentSearchPayloadSchema.parseAsync(output);
|
|
10
|
+
}
|
|
11
|
+
export { callPluginRpc, PaseoApiProvider, PluginRpcProvider };
|
|
12
|
+
//# sourceMappingURL=host.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { PluginHostProps, PluginSurfaceProps, PluginIconProps, PluginPanelLocation, PluginOpenPanelOptions, PluginWorkspacePanelProps, PluginAgentPanelProps, PluginClientOpenPanelOptions, PluginClientContext, PluginClientContribution, PluginWorkspacePanelContribution, PluginSettingsScreenContribution, PluginSurfaceContribution, PluginSidebarContribution, PluginTimelineTransformerContribution, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginCommandCapabilities, PluginGlobalCommandContext, PluginWorkspaceCommandContext, PluginAgentCommandContext, PluginCommandCenterItemContribution, PluginClientSlashCommandContribution, SettingsState, } from "./contracts.js";
|
|
2
|
+
export type { PluginButton, PluginButtonBehavior, PluginButtonContentProps, PluginButtonContext, PluginButtonIcon, PluginButtonIconProps, PluginButtonMenuEntry, PluginButtonRegistration, PluginComposerPillContribution, PluginHeaderButtonContribution, } from "./buttons.js";
|
|
3
|
+
export { usePaseo } from "./paseo-context.js";
|
|
4
|
+
export { useAgent, useWorkspace } from "./client-state.js";
|
|
5
|
+
export { useRpc } from "./rpc-context.js";
|
|
6
|
+
import type { SettingsDefinition } from "../settings.js";
|
|
7
|
+
import type { SettingsState } from "./contracts.js";
|
|
8
|
+
import type { ZodType } from "zod";
|
|
9
|
+
export declare function useSettings<Schema extends ZodType>(definition: SettingsDefinition<Schema>): SettingsState<Schema>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PaseoApi } from "@camerontaylor/paseo-client";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export declare function usePaseoContextValue(): PaseoApi | null;
|
|
4
|
+
export declare function PaseoApiProvider({ children, paseo }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
paseo: PaseoApi;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function usePaseo(): PaseoApi;
|
|
9
|
+
//# sourceMappingURL=paseo-context.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const PaseoApiContext = createContext(null);
|
|
4
|
+
export function usePaseoContextValue() {
|
|
5
|
+
return useContext(PaseoApiContext);
|
|
6
|
+
}
|
|
7
|
+
export function PaseoApiProvider({ children, paseo }) {
|
|
8
|
+
return _jsx(PaseoApiContext.Provider, { value: paseo, children: children });
|
|
9
|
+
}
|
|
10
|
+
export function usePaseo() {
|
|
11
|
+
const paseo = usePaseoContextValue();
|
|
12
|
+
if (!paseo)
|
|
13
|
+
throw new Error("usePaseo must run inside a contributed plugin surface");
|
|
14
|
+
return paseo;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=paseo-context.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
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;
|
|
35
|
+
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
|
+
//# sourceMappingURL=react-native.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
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;
|
|
8
|
+
export declare function PluginRpcProvider({ children, invoke, }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
invoke(method: string, input: unknown): Promise<unknown>;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function useRpc<InputSchema extends ZodType, OutputSchema extends ZodType>(contract: PluginRpcContract<InputSchema, OutputSchema>): (input: ZodInput<InputSchema>) => Promise<ZodOutput<OutputSchema>>;
|
|
13
|
+
//# sourceMappingURL=rpc-context.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
3
|
+
import { callPluginRpc } from "../rpc.js";
|
|
4
|
+
const PluginRpcContext = createContext(null);
|
|
5
|
+
export function usePluginRpcContextValue() {
|
|
6
|
+
return useContext(PluginRpcContext);
|
|
7
|
+
}
|
|
8
|
+
export function PluginRpcProvider({ children, invoke, }) {
|
|
9
|
+
const value = useMemo(() => ({ invoke }), [invoke]);
|
|
10
|
+
return _jsx(PluginRpcContext.Provider, { value: value, children: children });
|
|
11
|
+
}
|
|
12
|
+
export function useRpc(contract) {
|
|
13
|
+
const context = usePluginRpcContextValue();
|
|
14
|
+
if (!context)
|
|
15
|
+
throw new Error("useRpc must run inside a contributed plugin surface");
|
|
16
|
+
return useCallback((input) => callPluginRpc(contract, context.invoke, input), [context, contract]);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=rpc-context.js.map
|
|
@@ -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
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function isIterable(value) {
|
|
2
|
+
return Symbol.iterator in value;
|
|
3
|
+
}
|
|
4
|
+
function hasEntries(value) {
|
|
5
|
+
return "entries" in value;
|
|
6
|
+
}
|
|
7
|
+
function compareEntries(left, right) {
|
|
8
|
+
const leftEntries = left instanceof Map ? left : new Map(left.entries());
|
|
9
|
+
const rightEntries = right instanceof Map ? right : new Map(right.entries());
|
|
10
|
+
if (leftEntries.size !== rightEntries.size)
|
|
11
|
+
return false;
|
|
12
|
+
for (const [key, value] of leftEntries) {
|
|
13
|
+
if (!rightEntries.has(key) || !Object.is(value, rightEntries.get(key)))
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
function compareIterables(left, right) {
|
|
19
|
+
const leftIterator = left[Symbol.iterator]();
|
|
20
|
+
const rightIterator = right[Symbol.iterator]();
|
|
21
|
+
let leftValue = leftIterator.next();
|
|
22
|
+
let rightValue = rightIterator.next();
|
|
23
|
+
while (!leftValue.done && !rightValue.done) {
|
|
24
|
+
if (!Object.is(leftValue.value, rightValue.value))
|
|
25
|
+
return false;
|
|
26
|
+
leftValue = leftIterator.next();
|
|
27
|
+
rightValue = rightIterator.next();
|
|
28
|
+
}
|
|
29
|
+
return Boolean(leftValue.done && rightValue.done);
|
|
30
|
+
}
|
|
31
|
+
export function shallowEqual(left, right) {
|
|
32
|
+
if (Object.is(left, right))
|
|
33
|
+
return true;
|
|
34
|
+
if (!left || !right || typeof left !== "object" || typeof right !== "object")
|
|
35
|
+
return false;
|
|
36
|
+
if (Object.getPrototypeOf(left) !== Object.getPrototypeOf(right))
|
|
37
|
+
return false;
|
|
38
|
+
if (isIterable(left) && isIterable(right)) {
|
|
39
|
+
if (hasEntries(left) && hasEntries(right))
|
|
40
|
+
return compareEntries(left, right);
|
|
41
|
+
return compareIterables(left, right);
|
|
42
|
+
}
|
|
43
|
+
return compareEntries({ entries: () => Object.entries(left) }, { entries: () => Object.entries(right) });
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=shallow.js.map
|