@getpaseo/plugin 0.8.0-beta.1 → 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.
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=buttons.js.map
@@ -3,6 +3,7 @@ import type { PaseoApi } from "@getpaseo/client";
3
3
  import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
4
4
  import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
5
5
  import type { PluginRpcContract } from "../rpc.js";
6
+ import type { PluginButtonRegistration, PluginHeaderButtonContribution, PluginComposerPillContribution } from "./buttons.js";
6
7
  import type { PluginTheme, PluginWorkspaceSnapshot, PluginAgentSnapshot, PluginThemeContribution, PluginAttachmentSourceContribution, PluginTimelineTransformResult, PluginCleanup } from "../contracts.js";
7
8
  export interface PluginHostProps {
8
9
  theme: PluginTheme;
@@ -52,18 +53,6 @@ export interface PluginAgentPanelProps extends PluginNavigableHostProps {
52
53
  workspaceId: string;
53
54
  agentId: string;
54
55
  }
55
- export interface PluginComposerPillProps extends PluginHostProps {
56
- workspaceId: string;
57
- agentId: string;
58
- }
59
- export interface PluginComposerPillContribution {
60
- id: string;
61
- title: string;
62
- workspaceId: string;
63
- agentId: string;
64
- Component: ComponentType<PluginComposerPillProps>;
65
- onPress(): void | Promise<void>;
66
- }
67
56
  export interface PluginClientOpenPanelOptions extends PluginOpenPanelOptions {
68
57
  workspaceId: string;
69
58
  agentId?: string;
@@ -75,7 +64,8 @@ export interface PluginClientContext extends PluginCommandCapabilities {
75
64
  addWorkspacePanel(contribution: PluginWorkspacePanelContribution): PluginCleanup;
76
65
  addCommandCenterItem(contribution: PluginCommandCenterItemContribution): PluginCleanup;
77
66
  addSlashCommand(contribution: PluginClientSlashCommandContribution): PluginCleanup;
78
- addComposerPill(contribution: PluginComposerPillContribution): PluginCleanup;
67
+ addHeaderButton(contribution: PluginHeaderButtonContribution): PluginButtonRegistration;
68
+ addComposerPill(contribution: PluginComposerPillContribution): PluginButtonRegistration;
79
69
  addAttachmentSource(contribution: PluginAttachmentSourceContribution): PluginCleanup;
80
70
  addTheme(contribution: PluginThemeContribution): PluginCleanup;
81
71
  addTimelineTransformer<ItemType extends AgentTimelineItem["type"]>(contribution: PluginTimelineTransformerContribution<ItemType>): PluginCleanup;
@@ -1,4 +1,5 @@
1
- export type { PluginHostProps, PluginSurfaceProps, PluginIconProps, PluginPanelLocation, PluginOpenPanelOptions, PluginWorkspacePanelProps, PluginAgentPanelProps, PluginComposerPillProps, PluginComposerPillContribution, PluginClientOpenPanelOptions, PluginClientContext, PluginClientContribution, PluginWorkspacePanelContribution, PluginSettingsScreenContribution, PluginSurfaceContribution, PluginSidebarContribution, PluginTimelineTransformerContribution, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginCommandCapabilities, PluginGlobalCommandContext, PluginWorkspaceCommandContext, PluginAgentCommandContext, PluginCommandCenterItemContribution, PluginClientSlashCommandContribution, SettingsState, } from "./contracts.js";
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";
2
3
  export { usePaseo } from "./paseo-context.js";
3
4
  export { useAgent, useWorkspace } from "./client-state.js";
4
5
  export { useRpc } from "./rpc-context.js";
@@ -1,6 +1,6 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { Readable, Writable } from "node:stream";
3
- import { ClientSideConnection, PROTOCOL_VERSION, ndJsonStream, } from "@agentclientprotocol/sdk";
3
+ import { ClientSideConnection, CLIENT_METHODS, PROTOCOL_VERSION, ndJsonStream, } from "@agentclientprotocol/sdk";
4
4
  import { z } from "zod";
5
5
  import { PROVIDER_PROTOCOL_VERSION, ProviderEventSchema, ProviderInputSchema, negotiateProviderCapabilities, requireProviderCapabilities, } from "../provider.js";
6
6
  const ADAPTER_CAPABILITIES = [
@@ -317,9 +317,8 @@ class AcpRuntime {
317
317
  const client = {
318
318
  requestPermission: (request) => this.requestPermission(request),
319
319
  sessionUpdate: (notification) => this.enqueueNotification(() => this.sessionUpdate(notification)),
320
- extNotification: (method, params) => this.enqueueNotification(() => this.vendorNotification(method, params)),
321
320
  };
322
- this.connection = new ClientSideConnection(() => client, stream);
321
+ this.connection = new ClientSideConnection(() => client, routeVendorNotifications(stream, (method, params) => this.vendorNotification(method, params)));
323
322
  if (!child)
324
323
  void this.connection.closed.then(() => this.handleUnexpectedTransportClose());
325
324
  child?.on("error", (error) => {
@@ -933,6 +932,28 @@ class AcpRuntime {
933
932
  });
934
933
  }
935
934
  }
935
+ function routeVendorNotifications(stream, receive) {
936
+ const clientMethods = new Set(Object.values(CLIENT_METHODS));
937
+ return {
938
+ writable: stream.writable,
939
+ readable: stream.readable.pipeThrough(new TransformStream({
940
+ transform(message, controller) {
941
+ if ("method" in message && !("id" in message) && !clientMethods.has(message.method)) {
942
+ // The SDK dispatches extensions asynchronously and can resolve a later response first.
943
+ // Run synchronous vendor transforms in wire order, inside the configuration transaction.
944
+ try {
945
+ receive(message.method, message.params);
946
+ }
947
+ catch (error) {
948
+ console.error("Error handling ACP vendor notification", error);
949
+ }
950
+ }
951
+ else
952
+ controller.enqueue(message);
953
+ },
954
+ })),
955
+ };
956
+ }
936
957
  function selectPermissionOption(options, response) {
937
958
  if (response.selectedActionId !== undefined) {
938
959
  return (options.find((option) => option.optionId === response.selectedActionId &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/plugin",
3
- "version": "0.8.0-beta.1",
3
+ "version": "0.8.0",
4
4
  "description": "Paseo plugin SDK package",
5
5
  "files": [
6
6
  "dist",
@@ -65,8 +65,8 @@
65
65
  "use-sync-external-store": "^1.6.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@getpaseo/client": "0.8.0-beta.1",
69
- "@getpaseo/protocol": "0.8.0-beta.1",
68
+ "@getpaseo/client": "0.8.0",
69
+ "@getpaseo/protocol": "0.8.0",
70
70
  "@types/node": "^20.9.0",
71
71
  "@types/react": "~19.2.0",
72
72
  "react": "19.1.0",
@@ -76,8 +76,8 @@
76
76
  "zod": "^4.4.3"
77
77
  },
78
78
  "peerDependencies": {
79
- "@getpaseo/client": "0.8.0-beta.1",
80
- "@getpaseo/protocol": "0.8.0-beta.1",
79
+ "@getpaseo/client": "0.8.0",
80
+ "@getpaseo/protocol": "0.8.0",
81
81
  "react": "~19.1.0",
82
82
  "react-native": ">=0.81.5",
83
83
  "zod": "^4.4.3"