@getpaseo/plugin 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/attachments.d.ts +2 -0
  2. package/dist/attachments.js +3 -0
  3. package/dist/client/buttons.d.ts +64 -0
  4. package/dist/client/buttons.js +2 -0
  5. package/dist/{client-state.d.ts → client/client-state.d.ts} +1 -1
  6. package/dist/client/contracts.d.ts +201 -0
  7. package/dist/client/contracts.js +2 -0
  8. package/dist/client/host.d.ts +19 -0
  9. package/dist/client/host.js +12 -0
  10. package/dist/client/index.d.ts +10 -0
  11. package/dist/client/index.js +4 -0
  12. package/dist/client/react-native.d.ts +46 -0
  13. package/dist/{rpc-context.d.ts → client/rpc-context.d.ts} +1 -1
  14. package/dist/{rpc-context.js → client/rpc-context.js} +1 -1
  15. package/dist/client/ui.d.ts +60 -0
  16. package/dist/client/ui.js +2 -0
  17. package/dist/contracts.d.ts +3 -172
  18. package/dist/index.d.ts +4 -8
  19. package/dist/index.js +3 -4
  20. package/dist/rpc.d.ts +2 -0
  21. package/dist/server/acp-internal/connection.d.ts +4 -0
  22. package/dist/server/acp-internal/connection.js +1187 -0
  23. package/dist/server/acp.d.ts +112 -0
  24. package/dist/server/acp.js +21 -0
  25. package/dist/server/contracts.d.ts +16 -0
  26. package/dist/server/contracts.js +2 -0
  27. package/dist/server/index.d.ts +3 -0
  28. package/dist/server/index.js +2 -0
  29. package/dist/server/lifecycle.d.ts +92 -0
  30. package/dist/server/lifecycle.js +2 -0
  31. package/dist/server/provider.d.ts +610 -0
  32. package/dist/server/provider.js +811 -0
  33. package/dist/settings.d.ts +70 -0
  34. package/dist/settings.js +40 -0
  35. package/package.json +45 -17
  36. package/dist/host.d.ts +0 -43
  37. package/dist/host.js +0 -43
  38. package/dist/react-native.d.ts +0 -29
  39. package/dist/server.d.ts +0 -6
  40. package/dist/server.js +0 -6
  41. /package/dist/{client-state.js → client/client-state.js} +0 -0
  42. /package/dist/{paseo-context.d.ts → client/paseo-context.d.ts} +0 -0
  43. /package/dist/{paseo-context.js → client/paseo-context.js} +0 -0
  44. /package/dist/{react-native.js → client/react-native.js} +0 -0
  45. /package/dist/{runtime-context-bridge.d.ts → client/runtime-context-bridge.d.ts} +0 -0
  46. /package/dist/{runtime-context-bridge.js → client/runtime-context-bridge.js} +0 -0
  47. /package/dist/{shallow.d.ts → client/shallow.d.ts} +0 -0
  48. /package/dist/{shallow.js → client/shallow.js} +0 -0
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ import type { ZodType } from "zod";
3
+ export interface SettingsDefinition<Schema extends ZodType = ZodType> {
4
+ id: string;
5
+ scope: "host";
6
+ version: number;
7
+ schema: Schema;
8
+ /** Convert a previous stored version to the current schema. Runs on the host. */
9
+ migrate?: (values: unknown, fromVersion: number) => unknown | Promise<unknown>;
10
+ }
11
+ export declare function defineSettings<Schema extends ZodType>(definition: SettingsDefinition<Schema>): SettingsDefinition<Schema>;
12
+ export declare const SettingsReadResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
13
+ status: z.ZodLiteral<"ready">;
14
+ revision: z.ZodString;
15
+ values: z.ZodJSONSchema;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ status: z.ZodLiteral<"invalid">;
18
+ revision: z.ZodString;
19
+ error: z.ZodString;
20
+ }, z.core.$strip>], "status">;
21
+ export declare const SettingsWriteResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
+ status: z.ZodLiteral<"saved">;
23
+ revision: z.ZodString;
24
+ values: z.ZodJSONSchema;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ status: z.ZodLiteral<"conflict">;
27
+ error: z.ZodString;
28
+ }, z.core.$strip>, z.ZodObject<{
29
+ status: z.ZodLiteral<"invalid">;
30
+ error: z.ZodString;
31
+ }, z.core.$strip>], "status">;
32
+ export declare function settingsRpc(id: string): {
33
+ read: import("./rpc.js").PluginRpcContract<z.ZodObject<{}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
34
+ status: z.ZodLiteral<"ready">;
35
+ revision: z.ZodString;
36
+ values: z.ZodJSONSchema;
37
+ }, z.core.$strip>, z.ZodObject<{
38
+ status: z.ZodLiteral<"invalid">;
39
+ revision: z.ZodString;
40
+ error: z.ZodString;
41
+ }, z.core.$strip>], "status">>;
42
+ write: import("./rpc.js").PluginRpcContract<z.ZodObject<{
43
+ revision: z.ZodString;
44
+ values: z.ZodJSONSchema;
45
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ status: z.ZodLiteral<"saved">;
47
+ revision: z.ZodString;
48
+ values: z.ZodJSONSchema;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ status: z.ZodLiteral<"conflict">;
51
+ error: z.ZodString;
52
+ }, z.core.$strip>, z.ZodObject<{
53
+ status: z.ZodLiteral<"invalid">;
54
+ error: z.ZodString;
55
+ }, z.core.$strip>], "status">>;
56
+ reset: import("./rpc.js").PluginRpcContract<z.ZodObject<{
57
+ revision: z.ZodString;
58
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
59
+ status: z.ZodLiteral<"saved">;
60
+ revision: z.ZodString;
61
+ values: z.ZodJSONSchema;
62
+ }, z.core.$strip>, z.ZodObject<{
63
+ status: z.ZodLiteral<"conflict">;
64
+ error: z.ZodString;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ status: z.ZodLiteral<"invalid">;
67
+ error: z.ZodString;
68
+ }, z.core.$strip>], "status">>;
69
+ };
70
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { z } from "zod";
2
+ import { defineRpc } from "./rpc.js";
3
+ export function defineSettings(definition) {
4
+ if (!/^[a-z][a-z0-9_-]*$/.test(definition.id))
5
+ throw new Error("Invalid settings ID");
6
+ if (definition.scope !== "host")
7
+ throw new Error("Only host-scoped settings are supported");
8
+ if (!Number.isSafeInteger(definition.version) || definition.version < 1)
9
+ throw new Error("Invalid settings version");
10
+ return definition;
11
+ }
12
+ export const SettingsReadResultSchema = z.discriminatedUnion("status", [
13
+ z.object({ status: z.literal("ready"), revision: z.string(), values: z.json() }),
14
+ z.object({ status: z.literal("invalid"), revision: z.string(), error: z.string() }),
15
+ ]);
16
+ export const SettingsWriteResultSchema = z.discriminatedUnion("status", [
17
+ z.object({ status: z.literal("saved"), revision: z.string(), values: z.json() }),
18
+ z.object({ status: z.literal("conflict"), error: z.string() }),
19
+ z.object({ status: z.literal("invalid"), error: z.string() }),
20
+ ]);
21
+ export function settingsRpc(id) {
22
+ return {
23
+ read: defineRpc({
24
+ name: `settings.${id}.read`,
25
+ input: z.object({}),
26
+ output: SettingsReadResultSchema,
27
+ }),
28
+ write: defineRpc({
29
+ name: `settings.${id}.write`,
30
+ input: z.object({ revision: z.string(), values: z.json() }),
31
+ output: SettingsWriteResultSchema,
32
+ }),
33
+ reset: defineRpc({
34
+ name: `settings.${id}.reset`,
35
+ input: z.object({ revision: z.string() }),
36
+ output: SettingsWriteResultSchema,
37
+ }),
38
+ };
39
+ }
40
+ //# sourceMappingURL=settings.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/plugin",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "Paseo plugin SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -14,19 +14,39 @@
14
14
  "default": "./dist/index.js"
15
15
  },
16
16
  "./server": {
17
- "types": "./dist/server.d.ts",
18
- "source": "./src/server.ts",
19
- "default": "./dist/server.js"
17
+ "types": "./dist/server/index.d.ts",
18
+ "source": "./src/server/index.ts",
19
+ "default": "./dist/server/index.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"
21
+ "./server/provider": {
22
+ "types": "./dist/server/provider.d.ts",
23
+ "source": "./src/server/provider.ts",
24
+ "default": "./dist/server/provider.js"
25
25
  },
26
- "./host": {
27
- "types": "./dist/host.d.ts",
28
- "source": "./src/host.ts",
29
- "default": "./dist/host.js"
26
+ "./server/acp": {
27
+ "types": "./dist/server/acp.d.ts",
28
+ "source": "./src/server/acp.ts",
29
+ "default": "./dist/server/acp.js"
30
+ },
31
+ "./client/react-native": {
32
+ "types": "./dist/client/react-native.d.ts",
33
+ "source": "./src/client/react-native.ts",
34
+ "default": "./dist/client/react-native.js"
35
+ },
36
+ "./client/host": {
37
+ "types": "./dist/client/host.d.ts",
38
+ "source": "./src/client/host.ts",
39
+ "default": "./dist/client/host.js"
40
+ },
41
+ "./client/ui": {
42
+ "types": "./dist/client/ui.d.ts",
43
+ "source": "./src/client/ui.ts",
44
+ "default": "./dist/client/ui.js"
45
+ },
46
+ "./client": {
47
+ "types": "./dist/client/index.d.ts",
48
+ "source": "./src/client/index.ts",
49
+ "default": "./dist/client/index.js"
30
50
  }
31
51
  },
32
52
  "publishConfig": {
@@ -41,22 +61,30 @@
41
61
  "test": "vitest run"
42
62
  },
43
63
  "dependencies": {
64
+ "@agentclientprotocol/sdk": "^1.4.0",
44
65
  "use-sync-external-store": "^1.6.0"
45
66
  },
46
67
  "devDependencies": {
47
- "@getpaseo/client": "0.7.2",
48
- "@getpaseo/protocol": "0.7.2",
68
+ "@getpaseo/client": "0.8.0",
69
+ "@getpaseo/protocol": "0.8.0",
49
70
  "@types/node": "^20.9.0",
50
71
  "@types/react": "~19.2.0",
51
72
  "react": "19.1.0",
73
+ "react-native": "0.81.5",
52
74
  "typescript": "^5.9.3",
53
75
  "vitest": "^4.1.6",
54
76
  "zod": "^4.4.3"
55
77
  },
56
78
  "peerDependencies": {
57
- "@getpaseo/client": "0.7.2",
58
- "@getpaseo/protocol": "0.7.2",
59
- "react": "19.1.0",
79
+ "@getpaseo/client": "0.8.0",
80
+ "@getpaseo/protocol": "0.8.0",
81
+ "react": "~19.1.0",
82
+ "react-native": ">=0.81.5",
60
83
  "zod": "^4.4.3"
84
+ },
85
+ "peerDependenciesMeta": {
86
+ "react-native": {
87
+ "optional": true
88
+ }
61
89
  }
62
90
  }
package/dist/host.d.ts DELETED
@@ -1,43 +0,0 @@
1
- export { PluginClientStateProvider, type PluginClientStateSource } from "./client-state.js";
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";
4
- import { PluginRpcProvider } from "./rpc-context.js";
5
- import { PaseoApiProvider } from "./paseo-context.js";
6
- import { callPluginRpc } from "./rpc.js";
7
- import type { ComponentType } from "react";
8
- interface PluginCollector {
9
- addSurface(id: string, Component: ComponentType<PluginSurfaceProps>): void;
10
- addSidebarItem(contribution: PluginSidebarContribution): void;
11
- addWorkspacePanel(contribution: PluginWorkspacePanelContribution): void;
12
- addCommandCenterItem(contribution: PluginCommandCenterItemContribution): void;
13
- addClientSide(contribution: PluginClientContribution): void;
14
- addAttachmentSource(contribution: PluginAttachmentSourceContribution): void;
15
- addTheme(contribution: PluginThemeContribution): void;
16
- addTimelineTransformer(contribution: PluginTimelineTransformerContribution): void;
17
- addTimelineRenderer(contribution: PluginTimelineRendererContribution): void;
18
- }
19
- export interface PluginRegistrationCollector {
20
- surfaces: PluginSurfaceContribution[];
21
- sidebarItems: PluginSidebarContribution[];
22
- workspacePanels: PluginWorkspacePanelContribution[];
23
- commandCenterItems: PluginCommandCenterItemContribution[];
24
- clientSide: PluginClientContribution | null;
25
- attachmentSources: PluginAttachmentSourceContribution[];
26
- themes: PluginThemeContribution[];
27
- timelineTransformers: PluginTimelineTransformerContribution[];
28
- timelineRenderers: PluginTimelineRendererContribution[];
29
- }
30
- export declare function createPluginContext(collector: PluginCollector): Pick<PluginContext, "addSurface" | "addSidebarItem" | "addWorkspacePanel" | "addCommandCenterItem" | "addClientSide" | "addAttachmentSource" | "addTheme" | "addTimelineTransformer" | "addTimelineRenderer">;
31
- export declare function searchPluginAttachments(source: PluginAttachmentSourceContribution, invoke: (method: string, input: unknown) => Promise<unknown>, query: string): Promise<{
32
- items: {
33
- id: string;
34
- identifier: string;
35
- title: string;
36
- url: string;
37
- text: string;
38
- resourceType: string;
39
- subtitle?: string | undefined;
40
- }[];
41
- }>;
42
- export { callPluginRpc, PaseoApiProvider, PluginRpcProvider };
43
- //# sourceMappingURL=host.d.ts.map
package/dist/host.js DELETED
@@ -1,43 +0,0 @@
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 function createPluginContext(collector) {
8
- return {
9
- addSurface(id, Component) {
10
- collector.addSurface(id, Component);
11
- },
12
- addSidebarItem(contribution) {
13
- collector.addSidebarItem(contribution);
14
- },
15
- addWorkspacePanel(contribution) {
16
- collector.addWorkspacePanel(contribution);
17
- },
18
- addCommandCenterItem(contribution) {
19
- collector.addCommandCenterItem(contribution);
20
- },
21
- addClientSide(contribution) {
22
- collector.addClientSide(contribution);
23
- },
24
- addAttachmentSource(contribution) {
25
- collector.addAttachmentSource(contribution);
26
- },
27
- addTheme(contribution) {
28
- collector.addTheme(contribution);
29
- },
30
- addTimelineTransformer(contribution) {
31
- collector.addTimelineTransformer(contribution);
32
- },
33
- addTimelineRenderer(contribution) {
34
- collector.addTimelineRenderer(contribution);
35
- },
36
- };
37
- }
38
- export async function searchPluginAttachments(source, invoke, query) {
39
- const output = await callPluginRpc(source.search, invoke, { query });
40
- return PluginAttachmentSearchPayloadSchema.parseAsync(output);
41
- }
42
- export { callPluginRpc, PaseoApiProvider, PluginRpcProvider };
43
- //# sourceMappingURL=host.js.map
@@ -1,29 +0,0 @@
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/server.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { PluginAttachmentSourceContribution } from "./contracts.js";
2
- export { PluginAttachmentItemSchema, PluginAttachmentSearchPayloadSchema, type PluginAttachmentItem, type PluginAttachmentSearchPayload, } from "./attachments.js";
3
- export type { PluginAttachmentSourceContribution, PluginHandlerContext } from "./contracts.js";
4
- export { defineRpc, type PluginRpcContract } from "./rpc.js";
5
- export declare function defineAttachmentSource<Definition extends PluginAttachmentSourceContribution>(definition: Definition): Definition;
6
- //# sourceMappingURL=server.d.ts.map
package/dist/server.js DELETED
@@ -1,6 +0,0 @@
1
- export { PluginAttachmentItemSchema, PluginAttachmentSearchPayloadSchema, } from "./attachments.js";
2
- export { defineRpc } from "./rpc.js";
3
- export function defineAttachmentSource(definition) {
4
- return definition;
5
- }
6
- //# sourceMappingURL=server.js.map
File without changes
File without changes