@palettelab/sdk 0.1.19 → 0.1.21

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.
@@ -119,6 +119,7 @@ interface PluginManifest {
119
119
  connections?: PluginConnectionDefinition[];
120
120
  provides?: PluginProvidesDefinition;
121
121
  requires?: PluginRequiresDefinition;
122
+ consumes?: PluginConsumesDefinition;
122
123
  public_routes?: string[];
123
124
  rate_limit?: {
124
125
  per_minute?: number;
@@ -148,10 +149,36 @@ interface PluginServiceDefinition {
148
149
  description?: string;
149
150
  permissions?: string[];
150
151
  routes?: PluginServiceRouteDefinition[];
152
+ methods?: PluginServiceMethodDefinition[];
153
+ }
154
+ interface PluginServiceMethodDefinition {
155
+ id?: string;
156
+ name?: string;
157
+ scope?: string;
158
+ version?: string;
159
+ label?: string;
160
+ description?: string;
161
+ input_schema?: Record<string, unknown> | string;
162
+ input?: Record<string, unknown> | string;
163
+ output_schema?: Record<string, unknown> | string;
164
+ output?: Record<string, unknown> | string;
165
+ route_method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
166
+ route_path?: string;
167
+ }
168
+ interface PluginEventDefinition {
169
+ id?: string;
170
+ topic?: string;
171
+ name?: string;
172
+ version?: string;
173
+ label?: string;
174
+ description?: string;
175
+ payload_schema?: Record<string, unknown> | string;
176
+ schema?: Record<string, unknown> | string;
151
177
  }
152
178
  interface PluginProvidesDefinition {
179
+ namespace?: string;
153
180
  services?: PluginServiceDefinition[];
154
- events?: string[];
181
+ events?: Array<string | PluginEventDefinition>;
155
182
  }
156
183
  interface PluginAppDependencyDefinition {
157
184
  id: string;
@@ -167,6 +194,15 @@ interface PluginRequiresDefinition {
167
194
  services?: PluginServiceDependencyDefinition[];
168
195
  events?: string[];
169
196
  }
197
+ interface PluginConsumedBrokerTargetDefinition {
198
+ target: string;
199
+ required?: boolean;
200
+ reason?: string;
201
+ }
202
+ interface PluginConsumesDefinition {
203
+ services?: Array<string | PluginConsumedBrokerTargetDefinition>;
204
+ events?: Array<string | PluginConsumedBrokerTargetDefinition>;
205
+ }
170
206
  interface PluginAgentDefinition {
171
207
  name: string;
172
208
  field: string;
@@ -119,6 +119,7 @@ interface PluginManifest {
119
119
  connections?: PluginConnectionDefinition[];
120
120
  provides?: PluginProvidesDefinition;
121
121
  requires?: PluginRequiresDefinition;
122
+ consumes?: PluginConsumesDefinition;
122
123
  public_routes?: string[];
123
124
  rate_limit?: {
124
125
  per_minute?: number;
@@ -148,10 +149,36 @@ interface PluginServiceDefinition {
148
149
  description?: string;
149
150
  permissions?: string[];
150
151
  routes?: PluginServiceRouteDefinition[];
152
+ methods?: PluginServiceMethodDefinition[];
153
+ }
154
+ interface PluginServiceMethodDefinition {
155
+ id?: string;
156
+ name?: string;
157
+ scope?: string;
158
+ version?: string;
159
+ label?: string;
160
+ description?: string;
161
+ input_schema?: Record<string, unknown> | string;
162
+ input?: Record<string, unknown> | string;
163
+ output_schema?: Record<string, unknown> | string;
164
+ output?: Record<string, unknown> | string;
165
+ route_method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
166
+ route_path?: string;
167
+ }
168
+ interface PluginEventDefinition {
169
+ id?: string;
170
+ topic?: string;
171
+ name?: string;
172
+ version?: string;
173
+ label?: string;
174
+ description?: string;
175
+ payload_schema?: Record<string, unknown> | string;
176
+ schema?: Record<string, unknown> | string;
151
177
  }
152
178
  interface PluginProvidesDefinition {
179
+ namespace?: string;
153
180
  services?: PluginServiceDefinition[];
154
- events?: string[];
181
+ events?: Array<string | PluginEventDefinition>;
155
182
  }
156
183
  interface PluginAppDependencyDefinition {
157
184
  id: string;
@@ -167,6 +194,15 @@ interface PluginRequiresDefinition {
167
194
  services?: PluginServiceDependencyDefinition[];
168
195
  events?: string[];
169
196
  }
197
+ interface PluginConsumedBrokerTargetDefinition {
198
+ target: string;
199
+ required?: boolean;
200
+ reason?: string;
201
+ }
202
+ interface PluginConsumesDefinition {
203
+ services?: Array<string | PluginConsumedBrokerTargetDefinition>;
204
+ events?: Array<string | PluginConsumedBrokerTargetDefinition>;
205
+ }
170
206
  interface PluginAgentDefinition {
171
207
  name: string;
172
208
  field: string;
@@ -59,13 +59,14 @@ declare function Link({ href, replace, onClick, children, ...props }: {
59
59
  title?: string | undefined | undefined;
60
60
  slot?: string | undefined | undefined;
61
61
  style?: react.CSSProperties | undefined;
62
+ id?: string | undefined | undefined;
63
+ target?: react.HTMLAttributeAnchorTarget | undefined;
62
64
  defaultValue?: string | number | readonly string[] | undefined;
63
65
  type?: string | undefined | undefined;
64
66
  download?: any;
65
67
  hrefLang?: string | undefined | undefined;
66
68
  media?: string | undefined | undefined;
67
69
  ping?: string | undefined | undefined;
68
- target?: react.HTMLAttributeAnchorTarget | undefined;
69
70
  referrerPolicy?: react.HTMLAttributeReferrerPolicy | undefined;
70
71
  defaultChecked?: boolean | undefined | undefined;
71
72
  suppressContentEditableWarning?: boolean | undefined | undefined;
@@ -80,7 +81,6 @@ declare function Link({ href, replace, onClick, children, ...props }: {
80
81
  draggable?: (boolean | "true" | "false") | undefined;
81
82
  enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
82
83
  hidden?: boolean | undefined | undefined;
83
- id?: string | undefined | undefined;
84
84
  lang?: string | undefined | undefined;
85
85
  nonce?: string | undefined | undefined;
86
86
  spellCheck?: (boolean | "true" | "false") | undefined;
@@ -59,13 +59,14 @@ declare function Link({ href, replace, onClick, children, ...props }: {
59
59
  title?: string | undefined | undefined;
60
60
  slot?: string | undefined | undefined;
61
61
  style?: react.CSSProperties | undefined;
62
+ id?: string | undefined | undefined;
63
+ target?: react.HTMLAttributeAnchorTarget | undefined;
62
64
  defaultValue?: string | number | readonly string[] | undefined;
63
65
  type?: string | undefined | undefined;
64
66
  download?: any;
65
67
  hrefLang?: string | undefined | undefined;
66
68
  media?: string | undefined | undefined;
67
69
  ping?: string | undefined | undefined;
68
- target?: react.HTMLAttributeAnchorTarget | undefined;
69
70
  referrerPolicy?: react.HTMLAttributeReferrerPolicy | undefined;
70
71
  defaultChecked?: boolean | undefined | undefined;
71
72
  suppressContentEditableWarning?: boolean | undefined | undefined;
@@ -80,7 +81,6 @@ declare function Link({ href, replace, onClick, children, ...props }: {
80
81
  draggable?: (boolean | "true" | "false") | undefined;
81
82
  enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
82
83
  hidden?: boolean | undefined | undefined;
83
- id?: string | undefined | undefined;
84
84
  lang?: string | undefined | undefined;
85
85
  nonce?: string | undefined | undefined;
86
86
  spellCheck?: (boolean | "true" | "false") | undefined;
@@ -103,6 +103,21 @@ function currentSearchParams() {
103
103
  if (typeof window === "undefined") return new URLSearchParams();
104
104
  return new URLSearchParams(window.location.search);
105
105
  }
106
+ function preserveCurrentPreviewParams(path, pluginId) {
107
+ if (typeof window === "undefined" || !pluginId || /^https?:\/\//i.test(path)) return path;
108
+ const currentParams = new URLSearchParams(window.location.search);
109
+ const previewPublishId = currentParams.get("preview_publish_id");
110
+ const previewToken = currentParams.get("preview_token");
111
+ if (!previewPublishId || !previewToken) return path;
112
+ const [beforeHash, hash = ""] = path.split("#", 2);
113
+ const [pathname, query = ""] = beforeHash.split("?", 2);
114
+ if (pathname !== `/apps/${pluginId}` && !pathname.startsWith(`/apps/${pluginId}/`)) return path;
115
+ const params = new URLSearchParams(query);
116
+ params.set("preview_publish_id", previewPublishId);
117
+ params.set("preview_token", previewToken);
118
+ const serialized = params.toString();
119
+ return `${pathname}${serialized ? `?${serialized}` : ""}${hash ? `#${hash}` : ""}`;
120
+ }
106
121
  var PaletteRouteErrorBoundary = class extends import_react2.Component {
107
122
  constructor() {
108
123
  super(...arguments);
@@ -180,8 +195,9 @@ function PaletteAppRouter({
180
195
  const currentPath = typeof window === "undefined" ? "" : window.location.pathname;
181
196
  const inPalettePath = platform.pluginId && (currentPath.startsWith(`/apps/${platform.pluginId}`) || platform.routePath !== void 0);
182
197
  const osPath = inPalettePath && platform.pluginId ? `/apps/${platform.pluginId}${pathname === "/" ? "" : pathname}${queryPart ? `?${queryPart}` : ""}` : next;
183
- if (replace && typeof window !== "undefined") window.history.replaceState(null, "", osPath);
184
- else platform.navigate(osPath);
198
+ const preservedOsPath = preserveCurrentPreviewParams(osPath, platform.pluginId);
199
+ if (replace && typeof window !== "undefined") window.history.replaceState(null, "", preservedOsPath);
200
+ else platform.navigate(preservedOsPath);
185
201
  }, [platform]);
186
202
  const state = (0, import_react2.useMemo)(() => ({
187
203
  pathname: location.pathname,
@@ -82,6 +82,21 @@ function currentSearchParams() {
82
82
  if (typeof window === "undefined") return new URLSearchParams();
83
83
  return new URLSearchParams(window.location.search);
84
84
  }
85
+ function preserveCurrentPreviewParams(path, pluginId) {
86
+ if (typeof window === "undefined" || !pluginId || /^https?:\/\//i.test(path)) return path;
87
+ const currentParams = new URLSearchParams(window.location.search);
88
+ const previewPublishId = currentParams.get("preview_publish_id");
89
+ const previewToken = currentParams.get("preview_token");
90
+ if (!previewPublishId || !previewToken) return path;
91
+ const [beforeHash, hash = ""] = path.split("#", 2);
92
+ const [pathname, query = ""] = beforeHash.split("?", 2);
93
+ if (pathname !== `/apps/${pluginId}` && !pathname.startsWith(`/apps/${pluginId}/`)) return path;
94
+ const params = new URLSearchParams(query);
95
+ params.set("preview_publish_id", previewPublishId);
96
+ params.set("preview_token", previewToken);
97
+ const serialized = params.toString();
98
+ return `${pathname}${serialized ? `?${serialized}` : ""}${hash ? `#${hash}` : ""}`;
99
+ }
85
100
  var PaletteRouteErrorBoundary = class extends Component {
86
101
  constructor() {
87
102
  super(...arguments);
@@ -159,8 +174,9 @@ function PaletteAppRouter({
159
174
  const currentPath = typeof window === "undefined" ? "" : window.location.pathname;
160
175
  const inPalettePath = platform.pluginId && (currentPath.startsWith(`/apps/${platform.pluginId}`) || platform.routePath !== void 0);
161
176
  const osPath = inPalettePath && platform.pluginId ? `/apps/${platform.pluginId}${pathname === "/" ? "" : pathname}${queryPart ? `?${queryPart}` : ""}` : next;
162
- if (replace && typeof window !== "undefined") window.history.replaceState(null, "", osPath);
163
- else platform.navigate(osPath);
177
+ const preservedOsPath = preserveCurrentPreviewParams(osPath, platform.pluginId);
178
+ if (replace && typeof window !== "undefined") window.history.replaceState(null, "", preservedOsPath);
179
+ else platform.navigate(preservedOsPath);
164
180
  }, [platform]);
165
181
  const state = useMemo(() => ({
166
182
  pathname: location.pathname,
@@ -1,4 +1,4 @@
1
- export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition, U as User } from '../plugin-dpLzOtF6.mjs';
1
+ export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition, U as User } from '../plugin-DXqw6d0s.mjs';
2
2
  export { C as ChatAttachment, c as ChatMessage, d as ChatThread, D as DataRoom, b as DataRoomFile, a as DataRoomFolder, e as DataRoomPermission, T as Task, f as TaskAgentSnippet, g as TaskCreatePayload, h as TaskPriority, i as TaskStats, j as TaskStatus, k as TaskType, l as TaskUpdatePayload } from '../data-room-Dtd9LLHf.mjs';
3
3
 
4
4
  interface AgentResource {
@@ -1,4 +1,4 @@
1
- export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition, U as User } from '../plugin-dpLzOtF6.js';
1
+ export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginConnectionDefinition, h as PluginManifest, i as PluginToolDefinition, U as User } from '../plugin-DXqw6d0s.js';
2
2
  export { C as ChatAttachment, c as ChatMessage, d as ChatThread, D as DataRoom, b as DataRoomFile, a as DataRoomFolder, e as DataRoomPermission, T as Task, f as TaskAgentSnippet, g as TaskCreatePayload, h as TaskPriority, i as TaskStats, j as TaskStatus, k as TaskType, l as TaskUpdatePayload } from '../data-room-Dtd9LLHf.js';
3
3
 
4
4
  interface AgentResource {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palettelab/sdk",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Palette Platform SDK for building plugins and apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",