@palettelab/sdk 0.1.25 → 0.1.27
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/README.md +34 -1
- package/dist/components/index.d.mts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/{index-BFvgg3uv.d.ts → index-B45B_-c1.d.ts} +1 -1
- package/dist/{index-DZqNC7hK.d.mts → index-JYI7H9D0.d.mts} +1 -1
- package/dist/index.d.mts +130 -37
- package/dist/index.d.ts +130 -37
- package/dist/index.js +58 -6
- package/dist/index.mjs +57 -6
- package/dist/{plugin-EHBRmN0H.d.mts → plugin-BZE7PJAO.d.mts} +13 -1
- package/dist/{plugin-EHBRmN0H.d.ts → plugin-BZE7PJAO.d.ts} +13 -1
- package/dist/router/index.d.mts +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,6 +136,7 @@ import {
|
|
|
136
136
|
servicesProxy,
|
|
137
137
|
BrokerCallError,
|
|
138
138
|
events,
|
|
139
|
+
notifications,
|
|
139
140
|
usePluginTranslations,
|
|
140
141
|
translate,
|
|
141
142
|
normalizePaletteLanguage,
|
|
@@ -182,7 +183,8 @@ Public frontend helpers exported by `@palettelab/sdk`:
|
|
|
182
183
|
- Install config: `getInstallConfig(pluginId)`, `updateInstallConfig(pluginId, values)`.
|
|
183
184
|
- Connections: `getConnections(pluginId)`, `startConnection(pluginId, connectionId)`, `disconnectConnection(pluginId, connectionId)`, and `requireConnection(pluginId, connectionId)`.
|
|
184
185
|
- App-to-app broker: `broker.call(target, payload?)`, `broker.emit(target, payload?)`, `servicesProxy(namespaceVersion)`, `events.on(target, handler)`, `events.emit(target, payload?)`, and `BrokerCallError`.
|
|
185
|
-
-
|
|
186
|
+
- OS notifications: `notifications.push(input)` (also `palette.notifications.push(input)`) — push a persistent notification into the OS notification center.
|
|
187
|
+
- Organization/user: `UserClient`, `OrganizationClient`, including `current` (org settings: name, logo, category, description), `updateProfile`, `listMine`, `listMembers`, `getMember`, `getMemberByEmail`, `inviteMember`, and `updateMemberRole`.
|
|
186
188
|
- Permissions: `hasPermission(ctx, permission)`, `hasAnyPermission(ctx, permissions)`, `hasAllPermissions(ctx, permissions)`.
|
|
187
189
|
- Translations: `normalizePaletteLanguage`, `translate`, `usePluginTranslations`.
|
|
188
190
|
- OS context: `usePlatform().language`, `usePlatform().setLanguage()`, `usePlatform().colorMode`, and `usePlatform().setColorMode()`.
|
|
@@ -349,6 +351,7 @@ function App() {
|
|
|
349
351
|
Included clients:
|
|
350
352
|
|
|
351
353
|
- `palette.user.current()` and `palette.user.updateProfile()`
|
|
354
|
+
- `palette.organization.current()` — the organisation's settings (`name`, `logo_url`, `company_type` category, `description`, `slug`), always reflecting the latest values saved in Settings -> Organisation
|
|
352
355
|
- `palette.organization.currentId()`, `currentRole()`, `listMine()`, `listMembers()`, `getMember()`, `getMemberByEmail()`, `inviteMember()`, and `updateMemberRole()`
|
|
353
356
|
- `palette.dataRooms.list()`, `create()`, `get()`, `folder()`, `createFolder()`, `ensureFolder()`, `findRoomByName()`, `findFolderByName()`, `resolveFolderPath()`, `findFileByName()`, and `uploadFile()`
|
|
354
357
|
- `palette.config.get()` and `palette.config.update(values)`, with optional plugin ID override
|
|
@@ -503,6 +506,36 @@ const file = folder
|
|
|
503
506
|
: null
|
|
504
507
|
```
|
|
505
508
|
|
|
509
|
+
## OS Notifications
|
|
510
|
+
|
|
511
|
+
Push a persistent notification into the OS notification center (the bell).
|
|
512
|
+
Unlike a toast, it survives past the moment, shows your app's icon and name,
|
|
513
|
+
and opens/focuses your app window when clicked:
|
|
514
|
+
|
|
515
|
+
```ts
|
|
516
|
+
import { notifications } from "@palettelab/sdk"
|
|
517
|
+
// or: palette.notifications.push(...)
|
|
518
|
+
|
|
519
|
+
await notifications.push({
|
|
520
|
+
title: "Export complete",
|
|
521
|
+
body: "Your report is ready to download.",
|
|
522
|
+
severity: "success", // "info" | "success" | "warning" | "error"
|
|
523
|
+
targetApp: "reports-app", // app icon that owns the unread badge
|
|
524
|
+
route: "/exports/123", // optional deep link inside the target app
|
|
525
|
+
data: { exportId: 123 }, // arbitrary payload stored with the notification
|
|
526
|
+
})
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
`targetApp` controls which app icon receives the unread badge and which app
|
|
530
|
+
opens by default. `route` is optional; when present it resolves inside the
|
|
531
|
+
target app. The source app id is inferred from the URL — pass `appId` to
|
|
532
|
+
override.
|
|
533
|
+
|
|
534
|
+
Use the SDK helper rather than hand-building platform notification API calls.
|
|
535
|
+
Frontend notifications target the calling user and their active organisation,
|
|
536
|
+
are delivered live to the OS shell, and show as a toast plus a
|
|
537
|
+
notification-center entry. Use a plugin backend for cross-user notifications.
|
|
538
|
+
|
|
506
539
|
## Permissions
|
|
507
540
|
|
|
508
541
|
Use permission helpers to keep UI actions aligned with backend permission gates.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import react__default from 'react';
|
|
3
|
-
import { P as PlatformContext } from '../plugin-
|
|
3
|
+
import { P as PlatformContext } from '../plugin-BZE7PJAO.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Provider that wraps plugin components with the platform context.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import react__default from 'react';
|
|
3
|
-
import { P as PlatformContext } from '../plugin-
|
|
3
|
+
import { P as PlatformContext } from '../plugin-BZE7PJAO.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Provider that wraps plugin components with the platform context.
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-
|
|
1
|
+
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-JYI7H9D0.mjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-BZE7PJAO.mjs';
|
|
4
4
|
import '../data-room-Dtd9LLHf.mjs';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-
|
|
1
|
+
export { P as PlatformCtx, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from '../index-B45B_-c1.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-BZE7PJAO.js';
|
|
4
4
|
import '../data-room-Dtd9LLHf.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { f as PaletteLanguage, P as PlatformContext } from './plugin-BZE7PJAO.js';
|
|
3
3
|
import { T as Task, i as TaskStats, g as TaskCreatePayload, l as TaskUpdatePayload, D as DataRoom, a as DataRoomFolder, b as DataRoomFile, d as ChatThread, c as ChatMessage } from './data-room-Dtd9LLHf.js';
|
|
4
4
|
|
|
5
5
|
type TranslationPrimitive = string | number | boolean | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { f as PaletteLanguage, P as PlatformContext } from './plugin-BZE7PJAO.mjs';
|
|
3
3
|
import { T as Task, i as TaskStats, g as TaskCreatePayload, l as TaskUpdatePayload, D as DataRoom, a as DataRoomFolder, b as DataRoomFile, d as ChatThread, c as ChatMessage } from './data-room-Dtd9LLHf.mjs';
|
|
4
4
|
|
|
5
5
|
type TranslationPrimitive = string | number | boolean | null;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-
|
|
2
|
-
export { A as Agent,
|
|
1
|
+
import { P as PlatformContext, O as OrganizationInfo, a as OrgSummary, U as User } from './plugin-BZE7PJAO.mjs';
|
|
2
|
+
export { A as Agent, b as AgentConfig, c as AppCategory, d as AuthContextValue, e as PaletteColorMode, f as PaletteLanguage, g as PluginAgentDefinition, h as PluginComponentProps, i as PluginConnectionDefinition, j as PluginManifest, k as PluginToolDefinition } from './plugin-BZE7PJAO.mjs';
|
|
3
3
|
import { D as DataRoom, a as DataRoomFolder, b as DataRoomFile } from './data-room-Dtd9LLHf.mjs';
|
|
4
4
|
export { C as ChatAttachment, c as ChatMessage, d as ChatThread, 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';
|
|
5
5
|
export { AgentResource, ResourcesByGroup } from './types/index.mjs';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
|
-
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-
|
|
7
|
+
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-JYI7H9D0.mjs';
|
|
8
8
|
export { Link, PaletteAppRoute, PaletteAppRouter, notFound, useParams, usePathname, useRouter, useSearchParams } from './router/index.mjs';
|
|
9
9
|
export { PluginProvider } from './components/index.mjs';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
@@ -115,36 +115,6 @@ declare function requireConnection(pluginId: string, connectionId: string): Prom
|
|
|
115
115
|
declare function createMockPlatformContext(overrides?: Partial<PlatformContext>): PlatformContext;
|
|
116
116
|
declare function withPluginProvider(element: ReactElement, platform?: Partial<PlatformContext>): ReactElement;
|
|
117
117
|
|
|
118
|
-
/**
|
|
119
|
-
* OS broker events — subscribe + emit.
|
|
120
|
-
*
|
|
121
|
-
* import { palette } from "@palettelab/sdk"
|
|
122
|
-
*
|
|
123
|
-
* const unsubscribe = palette.events.on("org/v1#member.updated", (payload) => {
|
|
124
|
-
* // ...
|
|
125
|
-
* })
|
|
126
|
-
*
|
|
127
|
-
* await palette.events.emit("hr/v1#review.completed", { user_id: 42 })
|
|
128
|
-
*
|
|
129
|
-
* Subscriptions ride a single SSE connection to `GET /api/v1/os-broker/events/stream`.
|
|
130
|
-
* Sandboxed iframe apps subscribe via the host page's postMessage bridge.
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
type Handler = (payload: unknown, meta: EventMeta) => void;
|
|
134
|
-
type EventMeta = {
|
|
135
|
-
target: string;
|
|
136
|
-
organizationId: number | null;
|
|
137
|
-
occurredAt: string;
|
|
138
|
-
};
|
|
139
|
-
declare const events: {
|
|
140
|
-
on(target: string, handler: Handler): () => void;
|
|
141
|
-
emit(target: string, payload?: unknown): Promise<void>;
|
|
142
|
-
publishDurable(target: string, payload?: unknown): Promise<void>;
|
|
143
|
-
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
144
|
-
/** Diagnostic: list active subscriptions in this page. */
|
|
145
|
-
active(): string[];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
118
|
/**
|
|
149
119
|
* OS broker client — request/response helpers.
|
|
150
120
|
*
|
|
@@ -189,6 +159,95 @@ declare const broker: {
|
|
|
189
159
|
/** Typed proxy: `palette.services("org/v1").members.list({ ... })`. */
|
|
190
160
|
declare function servicesProxy(namespaceVersion: string): any;
|
|
191
161
|
|
|
162
|
+
/**
|
|
163
|
+
* MCP client — call org-approved MCP tools and browse the catalog.
|
|
164
|
+
*
|
|
165
|
+
* import { palette } from "@palettelab/sdk"
|
|
166
|
+
*
|
|
167
|
+
* // External connector tool (org admin configured the "notion" connector):
|
|
168
|
+
* const result = await palette.mcp.callTool("mcp.notion/v1#search_pages", { query: "Q3" })
|
|
169
|
+
*
|
|
170
|
+
* // Tool provided by another installed app:
|
|
171
|
+
* const summary = await palette.mcp.callTool("billing/v1#invoice.summarize", { id: 4 })
|
|
172
|
+
*
|
|
173
|
+
* const tools = await palette.mcp.listTools()
|
|
174
|
+
*
|
|
175
|
+
* Tool calls route through the OS broker (`mcp.*` namespaces are delegated to
|
|
176
|
+
* the platform's MCP dispatch), so manifest declarations, admin grants,
|
|
177
|
+
* schema validation, and audit apply exactly as for app-to-app calls. In a
|
|
178
|
+
* sandboxed iframe app the call is forwarded to the host via postMessage.
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
type McpEntryType = "tool" | "resource" | "prompt";
|
|
182
|
+
interface McpCatalogEntry {
|
|
183
|
+
id: number;
|
|
184
|
+
source: "connector" | "app" | "builtin";
|
|
185
|
+
connector_id: number | null;
|
|
186
|
+
provider_app_id: string | null;
|
|
187
|
+
entry_type: McpEntryType;
|
|
188
|
+
name: string;
|
|
189
|
+
title: string | null;
|
|
190
|
+
description: string | null;
|
|
191
|
+
input_schema: Record<string, unknown> | null;
|
|
192
|
+
output_schema: Record<string, unknown> | null;
|
|
193
|
+
annotations: Record<string, unknown> | null;
|
|
194
|
+
enabled: boolean;
|
|
195
|
+
expose_external: boolean;
|
|
196
|
+
}
|
|
197
|
+
interface McpConnectorSummary {
|
|
198
|
+
id: number;
|
|
199
|
+
slug: string;
|
|
200
|
+
name: string;
|
|
201
|
+
status: "active" | "disabled" | "error";
|
|
202
|
+
transport: string;
|
|
203
|
+
expose_to_agent: boolean;
|
|
204
|
+
last_discovered_at: string | null;
|
|
205
|
+
last_error: string | null;
|
|
206
|
+
}
|
|
207
|
+
declare const mcp: {
|
|
208
|
+
/**
|
|
209
|
+
* Invoke an MCP tool by qualified target — `mcp.{connector}/v1#{tool}` for
|
|
210
|
+
* external connectors, `{namespace}/v1#{tool}` for app-provided tools.
|
|
211
|
+
*/
|
|
212
|
+
callTool(target: string, args?: Record<string, unknown>, options?: BrokerCallOptions): Promise<unknown>;
|
|
213
|
+
/** Cached org catalog of MCP tools (connector + app + builtin sources). */
|
|
214
|
+
listTools(): Promise<McpCatalogEntry[]>;
|
|
215
|
+
resources(): Promise<McpCatalogEntry[]>;
|
|
216
|
+
prompts(): Promise<McpCatalogEntry[]>;
|
|
217
|
+
/** Connectors configured for this organisation (status only, no secrets). */
|
|
218
|
+
connectors(): Promise<McpConnectorSummary[]>;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* OS broker events — subscribe + emit.
|
|
223
|
+
*
|
|
224
|
+
* import { palette } from "@palettelab/sdk"
|
|
225
|
+
*
|
|
226
|
+
* const unsubscribe = palette.events.on("org/v1#member.updated", (payload) => {
|
|
227
|
+
* // ...
|
|
228
|
+
* })
|
|
229
|
+
*
|
|
230
|
+
* await palette.events.emit("hr/v1#review.completed", { user_id: 42 })
|
|
231
|
+
*
|
|
232
|
+
* Subscriptions ride a single SSE connection to `GET /api/v1/os-broker/events/stream`.
|
|
233
|
+
* Sandboxed iframe apps subscribe via the host page's postMessage bridge.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
type Handler = (payload: unknown, meta: EventMeta) => void;
|
|
237
|
+
type EventMeta = {
|
|
238
|
+
target: string;
|
|
239
|
+
organizationId: number | null;
|
|
240
|
+
occurredAt: string;
|
|
241
|
+
};
|
|
242
|
+
declare const events: {
|
|
243
|
+
on(target: string, handler: Handler): () => void;
|
|
244
|
+
emit(target: string, payload?: unknown): Promise<void>;
|
|
245
|
+
publishDurable(target: string, payload?: unknown): Promise<void>;
|
|
246
|
+
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
247
|
+
/** Diagnostic: list active subscriptions in this page. */
|
|
248
|
+
active(): string[];
|
|
249
|
+
};
|
|
250
|
+
|
|
192
251
|
/**
|
|
193
252
|
* OS notifications — push a notification into the OS-level notification pool.
|
|
194
253
|
*
|
|
@@ -198,7 +257,8 @@ declare function servicesProxy(namespaceVersion: string): any;
|
|
|
198
257
|
* title: "Export complete",
|
|
199
258
|
* body: "Your report is ready to download.",
|
|
200
259
|
* severity: "success",
|
|
201
|
-
*
|
|
260
|
+
* targetApp: "reports-app", // app icon that owns the unread badge
|
|
261
|
+
* route: "/exports/123", // optional deep link inside target app
|
|
202
262
|
* })
|
|
203
263
|
*
|
|
204
264
|
* The notification appears in the OS notification center (and as a transient
|
|
@@ -214,8 +274,8 @@ type OsNotificationInput = {
|
|
|
214
274
|
body?: string;
|
|
215
275
|
/**
|
|
216
276
|
* Route to open when the notification is clicked. Relative routes
|
|
217
|
-
* ("/exports/123") resolve inside
|
|
218
|
-
*
|
|
277
|
+
* ("/exports/123") resolve inside targetApp when provided, otherwise
|
|
278
|
+
* inside the calling app. Absolute "/apps/..." routes are used as-is.
|
|
219
279
|
*/
|
|
220
280
|
route?: string;
|
|
221
281
|
severity?: OsNotificationSeverity;
|
|
@@ -223,6 +283,8 @@ type OsNotificationInput = {
|
|
|
223
283
|
data?: Record<string, unknown>;
|
|
224
284
|
/** Override the source app id. Inferred from the URL when omitted. */
|
|
225
285
|
appId?: string;
|
|
286
|
+
/** App whose icon should receive the unread badge and open by default. */
|
|
287
|
+
targetApp?: string;
|
|
226
288
|
};
|
|
227
289
|
type OsNotification = {
|
|
228
290
|
id: number;
|
|
@@ -230,6 +292,7 @@ type OsNotification = {
|
|
|
230
292
|
title: string;
|
|
231
293
|
body: string | null;
|
|
232
294
|
source_app_id: string | null;
|
|
295
|
+
target_app_id: string | null;
|
|
233
296
|
action_route: string | null;
|
|
234
297
|
severity: OsNotificationSeverity | null;
|
|
235
298
|
is_read: boolean;
|
|
@@ -367,6 +430,12 @@ declare class OrganizationClient {
|
|
|
367
430
|
private assertPermission;
|
|
368
431
|
currentId(): number | null;
|
|
369
432
|
currentRole(): string | null;
|
|
433
|
+
/**
|
|
434
|
+
* Fetch the current organisation's settings (name, logo, category,
|
|
435
|
+
* description, slug). Always reflects the latest values saved in
|
|
436
|
+
* Settings -> Organisation.
|
|
437
|
+
*/
|
|
438
|
+
current(): Promise<OrganizationInfo>;
|
|
370
439
|
listMine(): Promise<OrgSummary[]>;
|
|
371
440
|
listMembers(): Promise<OrgMember[]>;
|
|
372
441
|
getMember(userId: string): Promise<OrgMember | null>;
|
|
@@ -427,6 +496,18 @@ declare function createPaletteClient(ctx?: PlatformContext): {
|
|
|
427
496
|
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
428
497
|
active(): string[];
|
|
429
498
|
};
|
|
499
|
+
/**
|
|
500
|
+
* MCP — call org-approved external connector tools or app-provided MCP
|
|
501
|
+
* tools (`palette.mcp.callTool("mcp.notion/v1#search_pages", {...})`) and
|
|
502
|
+
* browse the org catalog (`palette.mcp.listTools()`).
|
|
503
|
+
*/
|
|
504
|
+
mcp: {
|
|
505
|
+
callTool(target: string, args?: Record<string, unknown>, options?: BrokerCallOptions): Promise<unknown>;
|
|
506
|
+
listTools(): Promise<McpCatalogEntry[]>;
|
|
507
|
+
resources(): Promise<McpCatalogEntry[]>;
|
|
508
|
+
prompts(): Promise<McpCatalogEntry[]>;
|
|
509
|
+
connectors(): Promise<McpConnectorSummary[]>;
|
|
510
|
+
};
|
|
430
511
|
};
|
|
431
512
|
type PaletteClient = ReturnType<typeof createPaletteClient>;
|
|
432
513
|
declare const palette: {
|
|
@@ -481,10 +562,22 @@ declare const palette: {
|
|
|
481
562
|
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
482
563
|
active(): string[];
|
|
483
564
|
};
|
|
565
|
+
/**
|
|
566
|
+
* MCP — call org-approved external connector tools or app-provided MCP
|
|
567
|
+
* tools (`palette.mcp.callTool("mcp.notion/v1#search_pages", {...})`) and
|
|
568
|
+
* browse the org catalog (`palette.mcp.listTools()`).
|
|
569
|
+
*/
|
|
570
|
+
mcp: {
|
|
571
|
+
callTool(target: string, args?: Record<string, unknown>, options?: BrokerCallOptions): Promise<unknown>;
|
|
572
|
+
listTools(): Promise<McpCatalogEntry[]>;
|
|
573
|
+
resources(): Promise<McpCatalogEntry[]>;
|
|
574
|
+
prompts(): Promise<McpCatalogEntry[]>;
|
|
575
|
+
connectors(): Promise<McpConnectorSummary[]>;
|
|
576
|
+
};
|
|
484
577
|
};
|
|
485
578
|
|
|
486
579
|
declare function hasPermission(ctx: PlatformContext, permission: string): boolean;
|
|
487
580
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
488
581
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
489
582
|
|
|
490
|
-
export { BrokerCallError, type BrokerCallOptions, type ConnectionAuthStart, type ConnectionStatus, type ConnectionStatusValue, CrossAppGrantError, DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type EventMeta, type InstallConfig, MissingDependencyError, type OrgInviteMemberInput, type OrgInviteMemberResponse, type OrgMember, type OrgMemberRole, OrgSummary, OrganizationClient, type OsNotification, type OsNotificationInput, type OsNotificationSeverity, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, type SandboxBrokerMessage, StorageClient, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, broker, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, disconnectConnection, errorFromResponse, events, getBaseUrl, getConnections, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, notifications, palette, requireConnection, servicesProxy, setBaseUrl, startConnection, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
|
583
|
+
export { BrokerCallError, type BrokerCallOptions, type ConnectionAuthStart, type ConnectionStatus, type ConnectionStatusValue, CrossAppGrantError, DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type EventMeta, type InstallConfig, type McpCatalogEntry, type McpConnectorSummary, type McpEntryType, MissingDependencyError, type OrgInviteMemberInput, type OrgInviteMemberResponse, type OrgMember, type OrgMemberRole, OrgSummary, OrganizationClient, OrganizationInfo, type OsNotification, type OsNotificationInput, type OsNotificationSeverity, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, type SandboxBrokerMessage, StorageClient, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, broker, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, disconnectConnection, errorFromResponse, events, getBaseUrl, getConnections, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, mcp, notifications, palette, requireConnection, servicesProxy, setBaseUrl, startConnection, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-
|
|
2
|
-
export { A as Agent,
|
|
1
|
+
import { P as PlatformContext, O as OrganizationInfo, a as OrgSummary, U as User } from './plugin-BZE7PJAO.js';
|
|
2
|
+
export { A as Agent, b as AgentConfig, c as AppCategory, d as AuthContextValue, e as PaletteColorMode, f as PaletteLanguage, g as PluginAgentDefinition, h as PluginComponentProps, i as PluginConnectionDefinition, j as PluginManifest, k as PluginToolDefinition } from './plugin-BZE7PJAO.js';
|
|
3
3
|
import { D as DataRoom, a as DataRoomFolder, b as DataRoomFile } from './data-room-Dtd9LLHf.js';
|
|
4
4
|
export { C as ChatAttachment, c as ChatMessage, d as ChatThread, 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';
|
|
5
5
|
export { AgentResource, ResourcesByGroup } from './types/index.js';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
|
-
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-
|
|
7
|
+
export { P as PlatformCtx, T as TranslateOptions, a as TranslationDictionary, b as TranslationPrimitive, c as TranslationResources, d as TranslationValues, U as UsePluginTranslationsOptions, n as normalizePaletteLanguage, t as translate, u as usePlatform, e as usePluginChat, f as usePluginDataRooms, g as usePluginTasks, h as usePluginTranslations } from './index-B45B_-c1.js';
|
|
8
8
|
export { Link, PaletteAppRoute, PaletteAppRouter, notFound, useParams, usePathname, useRouter, useSearchParams } from './router/index.js';
|
|
9
9
|
export { PluginProvider } from './components/index.js';
|
|
10
10
|
import 'react/jsx-runtime';
|
|
@@ -115,36 +115,6 @@ declare function requireConnection(pluginId: string, connectionId: string): Prom
|
|
|
115
115
|
declare function createMockPlatformContext(overrides?: Partial<PlatformContext>): PlatformContext;
|
|
116
116
|
declare function withPluginProvider(element: ReactElement, platform?: Partial<PlatformContext>): ReactElement;
|
|
117
117
|
|
|
118
|
-
/**
|
|
119
|
-
* OS broker events — subscribe + emit.
|
|
120
|
-
*
|
|
121
|
-
* import { palette } from "@palettelab/sdk"
|
|
122
|
-
*
|
|
123
|
-
* const unsubscribe = palette.events.on("org/v1#member.updated", (payload) => {
|
|
124
|
-
* // ...
|
|
125
|
-
* })
|
|
126
|
-
*
|
|
127
|
-
* await palette.events.emit("hr/v1#review.completed", { user_id: 42 })
|
|
128
|
-
*
|
|
129
|
-
* Subscriptions ride a single SSE connection to `GET /api/v1/os-broker/events/stream`.
|
|
130
|
-
* Sandboxed iframe apps subscribe via the host page's postMessage bridge.
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
type Handler = (payload: unknown, meta: EventMeta) => void;
|
|
134
|
-
type EventMeta = {
|
|
135
|
-
target: string;
|
|
136
|
-
organizationId: number | null;
|
|
137
|
-
occurredAt: string;
|
|
138
|
-
};
|
|
139
|
-
declare const events: {
|
|
140
|
-
on(target: string, handler: Handler): () => void;
|
|
141
|
-
emit(target: string, payload?: unknown): Promise<void>;
|
|
142
|
-
publishDurable(target: string, payload?: unknown): Promise<void>;
|
|
143
|
-
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
144
|
-
/** Diagnostic: list active subscriptions in this page. */
|
|
145
|
-
active(): string[];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
118
|
/**
|
|
149
119
|
* OS broker client — request/response helpers.
|
|
150
120
|
*
|
|
@@ -189,6 +159,95 @@ declare const broker: {
|
|
|
189
159
|
/** Typed proxy: `palette.services("org/v1").members.list({ ... })`. */
|
|
190
160
|
declare function servicesProxy(namespaceVersion: string): any;
|
|
191
161
|
|
|
162
|
+
/**
|
|
163
|
+
* MCP client — call org-approved MCP tools and browse the catalog.
|
|
164
|
+
*
|
|
165
|
+
* import { palette } from "@palettelab/sdk"
|
|
166
|
+
*
|
|
167
|
+
* // External connector tool (org admin configured the "notion" connector):
|
|
168
|
+
* const result = await palette.mcp.callTool("mcp.notion/v1#search_pages", { query: "Q3" })
|
|
169
|
+
*
|
|
170
|
+
* // Tool provided by another installed app:
|
|
171
|
+
* const summary = await palette.mcp.callTool("billing/v1#invoice.summarize", { id: 4 })
|
|
172
|
+
*
|
|
173
|
+
* const tools = await palette.mcp.listTools()
|
|
174
|
+
*
|
|
175
|
+
* Tool calls route through the OS broker (`mcp.*` namespaces are delegated to
|
|
176
|
+
* the platform's MCP dispatch), so manifest declarations, admin grants,
|
|
177
|
+
* schema validation, and audit apply exactly as for app-to-app calls. In a
|
|
178
|
+
* sandboxed iframe app the call is forwarded to the host via postMessage.
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
type McpEntryType = "tool" | "resource" | "prompt";
|
|
182
|
+
interface McpCatalogEntry {
|
|
183
|
+
id: number;
|
|
184
|
+
source: "connector" | "app" | "builtin";
|
|
185
|
+
connector_id: number | null;
|
|
186
|
+
provider_app_id: string | null;
|
|
187
|
+
entry_type: McpEntryType;
|
|
188
|
+
name: string;
|
|
189
|
+
title: string | null;
|
|
190
|
+
description: string | null;
|
|
191
|
+
input_schema: Record<string, unknown> | null;
|
|
192
|
+
output_schema: Record<string, unknown> | null;
|
|
193
|
+
annotations: Record<string, unknown> | null;
|
|
194
|
+
enabled: boolean;
|
|
195
|
+
expose_external: boolean;
|
|
196
|
+
}
|
|
197
|
+
interface McpConnectorSummary {
|
|
198
|
+
id: number;
|
|
199
|
+
slug: string;
|
|
200
|
+
name: string;
|
|
201
|
+
status: "active" | "disabled" | "error";
|
|
202
|
+
transport: string;
|
|
203
|
+
expose_to_agent: boolean;
|
|
204
|
+
last_discovered_at: string | null;
|
|
205
|
+
last_error: string | null;
|
|
206
|
+
}
|
|
207
|
+
declare const mcp: {
|
|
208
|
+
/**
|
|
209
|
+
* Invoke an MCP tool by qualified target — `mcp.{connector}/v1#{tool}` for
|
|
210
|
+
* external connectors, `{namespace}/v1#{tool}` for app-provided tools.
|
|
211
|
+
*/
|
|
212
|
+
callTool(target: string, args?: Record<string, unknown>, options?: BrokerCallOptions): Promise<unknown>;
|
|
213
|
+
/** Cached org catalog of MCP tools (connector + app + builtin sources). */
|
|
214
|
+
listTools(): Promise<McpCatalogEntry[]>;
|
|
215
|
+
resources(): Promise<McpCatalogEntry[]>;
|
|
216
|
+
prompts(): Promise<McpCatalogEntry[]>;
|
|
217
|
+
/** Connectors configured for this organisation (status only, no secrets). */
|
|
218
|
+
connectors(): Promise<McpConnectorSummary[]>;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* OS broker events — subscribe + emit.
|
|
223
|
+
*
|
|
224
|
+
* import { palette } from "@palettelab/sdk"
|
|
225
|
+
*
|
|
226
|
+
* const unsubscribe = palette.events.on("org/v1#member.updated", (payload) => {
|
|
227
|
+
* // ...
|
|
228
|
+
* })
|
|
229
|
+
*
|
|
230
|
+
* await palette.events.emit("hr/v1#review.completed", { user_id: 42 })
|
|
231
|
+
*
|
|
232
|
+
* Subscriptions ride a single SSE connection to `GET /api/v1/os-broker/events/stream`.
|
|
233
|
+
* Sandboxed iframe apps subscribe via the host page's postMessage bridge.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
type Handler = (payload: unknown, meta: EventMeta) => void;
|
|
237
|
+
type EventMeta = {
|
|
238
|
+
target: string;
|
|
239
|
+
organizationId: number | null;
|
|
240
|
+
occurredAt: string;
|
|
241
|
+
};
|
|
242
|
+
declare const events: {
|
|
243
|
+
on(target: string, handler: Handler): () => void;
|
|
244
|
+
emit(target: string, payload?: unknown): Promise<void>;
|
|
245
|
+
publishDurable(target: string, payload?: unknown): Promise<void>;
|
|
246
|
+
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
247
|
+
/** Diagnostic: list active subscriptions in this page. */
|
|
248
|
+
active(): string[];
|
|
249
|
+
};
|
|
250
|
+
|
|
192
251
|
/**
|
|
193
252
|
* OS notifications — push a notification into the OS-level notification pool.
|
|
194
253
|
*
|
|
@@ -198,7 +257,8 @@ declare function servicesProxy(namespaceVersion: string): any;
|
|
|
198
257
|
* title: "Export complete",
|
|
199
258
|
* body: "Your report is ready to download.",
|
|
200
259
|
* severity: "success",
|
|
201
|
-
*
|
|
260
|
+
* targetApp: "reports-app", // app icon that owns the unread badge
|
|
261
|
+
* route: "/exports/123", // optional deep link inside target app
|
|
202
262
|
* })
|
|
203
263
|
*
|
|
204
264
|
* The notification appears in the OS notification center (and as a transient
|
|
@@ -214,8 +274,8 @@ type OsNotificationInput = {
|
|
|
214
274
|
body?: string;
|
|
215
275
|
/**
|
|
216
276
|
* Route to open when the notification is clicked. Relative routes
|
|
217
|
-
* ("/exports/123") resolve inside
|
|
218
|
-
*
|
|
277
|
+
* ("/exports/123") resolve inside targetApp when provided, otherwise
|
|
278
|
+
* inside the calling app. Absolute "/apps/..." routes are used as-is.
|
|
219
279
|
*/
|
|
220
280
|
route?: string;
|
|
221
281
|
severity?: OsNotificationSeverity;
|
|
@@ -223,6 +283,8 @@ type OsNotificationInput = {
|
|
|
223
283
|
data?: Record<string, unknown>;
|
|
224
284
|
/** Override the source app id. Inferred from the URL when omitted. */
|
|
225
285
|
appId?: string;
|
|
286
|
+
/** App whose icon should receive the unread badge and open by default. */
|
|
287
|
+
targetApp?: string;
|
|
226
288
|
};
|
|
227
289
|
type OsNotification = {
|
|
228
290
|
id: number;
|
|
@@ -230,6 +292,7 @@ type OsNotification = {
|
|
|
230
292
|
title: string;
|
|
231
293
|
body: string | null;
|
|
232
294
|
source_app_id: string | null;
|
|
295
|
+
target_app_id: string | null;
|
|
233
296
|
action_route: string | null;
|
|
234
297
|
severity: OsNotificationSeverity | null;
|
|
235
298
|
is_read: boolean;
|
|
@@ -367,6 +430,12 @@ declare class OrganizationClient {
|
|
|
367
430
|
private assertPermission;
|
|
368
431
|
currentId(): number | null;
|
|
369
432
|
currentRole(): string | null;
|
|
433
|
+
/**
|
|
434
|
+
* Fetch the current organisation's settings (name, logo, category,
|
|
435
|
+
* description, slug). Always reflects the latest values saved in
|
|
436
|
+
* Settings -> Organisation.
|
|
437
|
+
*/
|
|
438
|
+
current(): Promise<OrganizationInfo>;
|
|
370
439
|
listMine(): Promise<OrgSummary[]>;
|
|
371
440
|
listMembers(): Promise<OrgMember[]>;
|
|
372
441
|
getMember(userId: string): Promise<OrgMember | null>;
|
|
@@ -427,6 +496,18 @@ declare function createPaletteClient(ctx?: PlatformContext): {
|
|
|
427
496
|
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
428
497
|
active(): string[];
|
|
429
498
|
};
|
|
499
|
+
/**
|
|
500
|
+
* MCP — call org-approved external connector tools or app-provided MCP
|
|
501
|
+
* tools (`palette.mcp.callTool("mcp.notion/v1#search_pages", {...})`) and
|
|
502
|
+
* browse the org catalog (`palette.mcp.listTools()`).
|
|
503
|
+
*/
|
|
504
|
+
mcp: {
|
|
505
|
+
callTool(target: string, args?: Record<string, unknown>, options?: BrokerCallOptions): Promise<unknown>;
|
|
506
|
+
listTools(): Promise<McpCatalogEntry[]>;
|
|
507
|
+
resources(): Promise<McpCatalogEntry[]>;
|
|
508
|
+
prompts(): Promise<McpCatalogEntry[]>;
|
|
509
|
+
connectors(): Promise<McpConnectorSummary[]>;
|
|
510
|
+
};
|
|
430
511
|
};
|
|
431
512
|
type PaletteClient = ReturnType<typeof createPaletteClient>;
|
|
432
513
|
declare const palette: {
|
|
@@ -481,10 +562,22 @@ declare const palette: {
|
|
|
481
562
|
emitDurable(target: string, payload?: unknown): Promise<void>;
|
|
482
563
|
active(): string[];
|
|
483
564
|
};
|
|
565
|
+
/**
|
|
566
|
+
* MCP — call org-approved external connector tools or app-provided MCP
|
|
567
|
+
* tools (`palette.mcp.callTool("mcp.notion/v1#search_pages", {...})`) and
|
|
568
|
+
* browse the org catalog (`palette.mcp.listTools()`).
|
|
569
|
+
*/
|
|
570
|
+
mcp: {
|
|
571
|
+
callTool(target: string, args?: Record<string, unknown>, options?: BrokerCallOptions): Promise<unknown>;
|
|
572
|
+
listTools(): Promise<McpCatalogEntry[]>;
|
|
573
|
+
resources(): Promise<McpCatalogEntry[]>;
|
|
574
|
+
prompts(): Promise<McpCatalogEntry[]>;
|
|
575
|
+
connectors(): Promise<McpConnectorSummary[]>;
|
|
576
|
+
};
|
|
484
577
|
};
|
|
485
578
|
|
|
486
579
|
declare function hasPermission(ctx: PlatformContext, permission: string): boolean;
|
|
487
580
|
declare function hasAnyPermission(ctx: PlatformContext, permissions: string[]): boolean;
|
|
488
581
|
declare function hasAllPermissions(ctx: PlatformContext, permissions: string[]): boolean;
|
|
489
582
|
|
|
490
|
-
export { BrokerCallError, type BrokerCallOptions, type ConnectionAuthStart, type ConnectionStatus, type ConnectionStatusValue, CrossAppGrantError, DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type EventMeta, type InstallConfig, MissingDependencyError, type OrgInviteMemberInput, type OrgInviteMemberResponse, type OrgMember, type OrgMemberRole, OrgSummary, OrganizationClient, type OsNotification, type OsNotificationInput, type OsNotificationSeverity, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, type SandboxBrokerMessage, StorageClient, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, broker, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, disconnectConnection, errorFromResponse, events, getBaseUrl, getConnections, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, notifications, palette, requireConnection, servicesProxy, setBaseUrl, startConnection, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
|
583
|
+
export { BrokerCallError, type BrokerCallOptions, type ConnectionAuthStart, type ConnectionStatus, type ConnectionStatusValue, CrossAppGrantError, DataRoom, DataRoomClient, type DataRoomContents, DataRoomFile, DataRoomFolder, type DataRoomUploadOptions, type EventMeta, type InstallConfig, type McpCatalogEntry, type McpConnectorSummary, type McpEntryType, MissingDependencyError, type OrgInviteMemberInput, type OrgInviteMemberResponse, type OrgMember, type OrgMemberRole, OrgSummary, OrganizationClient, OrganizationInfo, type OsNotification, type OsNotificationInput, type OsNotificationSeverity, PaletteApiError, type PaletteClient, PlatformContext, type SandboxBridge, type SandboxBrokerMessage, StorageClient, type StorageUploadOptions, type StorageUploadProgress, type StorageUploadResult, type StorageUploadState, User, UserClient, apiFetch, apiUpload, broker, createMockPlatformContext, createPaletteClient, createSandboxBridge, dataRooms, disconnectConnection, errorFromResponse, events, getBaseUrl, getConnections, getInstallConfig, hasAllPermissions, hasAnyPermission, hasPermission, isPaletteApiError, isSandboxRuntime, mcp, notifications, palette, requireConnection, servicesProxy, setBaseUrl, startConnection, updateInstallConfig, uploadToSignedUrl, withPluginProvider };
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(src_exports, {
|
|
|
50
50
|
hasPermission: () => hasPermission,
|
|
51
51
|
isPaletteApiError: () => isPaletteApiError,
|
|
52
52
|
isSandboxRuntime: () => isSandboxRuntime,
|
|
53
|
+
mcp: () => mcp,
|
|
53
54
|
normalizePaletteLanguage: () => normalizePaletteLanguage,
|
|
54
55
|
notFound: () => notFound,
|
|
55
56
|
notifications: () => notifications,
|
|
@@ -665,11 +666,12 @@ var events = {
|
|
|
665
666
|
};
|
|
666
667
|
|
|
667
668
|
// src/notifications.ts
|
|
668
|
-
function resolveActionRoute(route, appId) {
|
|
669
|
-
|
|
669
|
+
function resolveActionRoute(route, appId, targetApp) {
|
|
670
|
+
const routeApp = targetApp || appId;
|
|
671
|
+
if (!route) return routeApp ? `/apps/${routeApp}` : void 0;
|
|
670
672
|
if (route.startsWith("/apps/")) return route;
|
|
671
|
-
if (!
|
|
672
|
-
return `/apps/${
|
|
673
|
+
if (!routeApp) return route;
|
|
674
|
+
return `/apps/${routeApp}${route.startsWith("/") ? route : `/${route}`}`;
|
|
673
675
|
}
|
|
674
676
|
var notifications = {
|
|
675
677
|
async push(input) {
|
|
@@ -681,7 +683,8 @@ var notifications = {
|
|
|
681
683
|
body: input.body,
|
|
682
684
|
type: "app",
|
|
683
685
|
source_app_id: appId,
|
|
684
|
-
|
|
686
|
+
target_app_id: input.targetApp,
|
|
687
|
+
action_route: resolveActionRoute(input.route, appId, input.targetApp),
|
|
685
688
|
severity: input.severity,
|
|
686
689
|
data: input.data
|
|
687
690
|
})
|
|
@@ -701,6 +704,39 @@ function hasAllPermissions(ctx, permissions) {
|
|
|
701
704
|
return permissions.every((permission) => hasPermission(ctx, permission));
|
|
702
705
|
}
|
|
703
706
|
|
|
707
|
+
// src/mcp.ts
|
|
708
|
+
async function fetchCatalog(entryType) {
|
|
709
|
+
const params = entryType ? `?entry_type=${entryType}` : "";
|
|
710
|
+
const res = await apiFetch(`/api/v1/mcp/catalog${params}`);
|
|
711
|
+
if (!res.ok) throw new Error(`mcp catalog request failed (${res.status})`);
|
|
712
|
+
return await res.json();
|
|
713
|
+
}
|
|
714
|
+
var mcp = {
|
|
715
|
+
/**
|
|
716
|
+
* Invoke an MCP tool by qualified target — `mcp.{connector}/v1#{tool}` for
|
|
717
|
+
* external connectors, `{namespace}/v1#{tool}` for app-provided tools.
|
|
718
|
+
*/
|
|
719
|
+
async callTool(target, args, options) {
|
|
720
|
+
return broker.call(target, args ?? {}, options);
|
|
721
|
+
},
|
|
722
|
+
/** Cached org catalog of MCP tools (connector + app + builtin sources). */
|
|
723
|
+
async listTools() {
|
|
724
|
+
return fetchCatalog("tool");
|
|
725
|
+
},
|
|
726
|
+
async resources() {
|
|
727
|
+
return fetchCatalog("resource");
|
|
728
|
+
},
|
|
729
|
+
async prompts() {
|
|
730
|
+
return fetchCatalog("prompt");
|
|
731
|
+
},
|
|
732
|
+
/** Connectors configured for this organisation (status only, no secrets). */
|
|
733
|
+
async connectors() {
|
|
734
|
+
const res = await apiFetch("/api/v1/mcp/connectors");
|
|
735
|
+
if (!res.ok) throw new Error(`mcp connectors request failed (${res.status})`);
|
|
736
|
+
return await res.json();
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
|
|
704
740
|
// src/storage.ts
|
|
705
741
|
var DEFAULT_CHUNK_SIZE = 8 * 1024 * 1024;
|
|
706
742
|
var MIN_CHUNK_SIZE = 256 * 1024;
|
|
@@ -923,6 +959,15 @@ var OrganizationClient = class {
|
|
|
923
959
|
currentRole() {
|
|
924
960
|
return this.ctx?.orgRole ?? null;
|
|
925
961
|
}
|
|
962
|
+
/**
|
|
963
|
+
* Fetch the current organisation's settings (name, logo, category,
|
|
964
|
+
* description, slug). Always reflects the latest values saved in
|
|
965
|
+
* Settings -> Organisation.
|
|
966
|
+
*/
|
|
967
|
+
async current() {
|
|
968
|
+
const res = await apiFetch("/api/v1/org");
|
|
969
|
+
return res.json();
|
|
970
|
+
}
|
|
926
971
|
async listMine() {
|
|
927
972
|
if (this.ctx?.orgs?.length) return this.ctx.orgs;
|
|
928
973
|
const res = await apiFetch("/api/v1/auth/my-orgs");
|
|
@@ -1037,7 +1082,13 @@ function createPaletteClient(ctx) {
|
|
|
1037
1082
|
/** Low-level broker accessor when you don't want the typed proxy. */
|
|
1038
1083
|
broker,
|
|
1039
1084
|
/** OS-broker pub/sub. `events.on(target, fn)` returns an unsubscribe function. */
|
|
1040
|
-
events
|
|
1085
|
+
events,
|
|
1086
|
+
/**
|
|
1087
|
+
* MCP — call org-approved external connector tools or app-provided MCP
|
|
1088
|
+
* tools (`palette.mcp.callTool("mcp.notion/v1#search_pages", {...})`) and
|
|
1089
|
+
* browse the org catalog (`palette.mcp.listTools()`).
|
|
1090
|
+
*/
|
|
1091
|
+
mcp
|
|
1041
1092
|
};
|
|
1042
1093
|
}
|
|
1043
1094
|
var palette = createPaletteClient();
|
|
@@ -1533,6 +1584,7 @@ function usePluginChat(agentId) {
|
|
|
1533
1584
|
hasPermission,
|
|
1534
1585
|
isPaletteApiError,
|
|
1535
1586
|
isSandboxRuntime,
|
|
1587
|
+
mcp,
|
|
1536
1588
|
normalizePaletteLanguage,
|
|
1537
1589
|
notFound,
|
|
1538
1590
|
notifications,
|
package/dist/index.mjs
CHANGED
|
@@ -589,11 +589,12 @@ var events = {
|
|
|
589
589
|
};
|
|
590
590
|
|
|
591
591
|
// src/notifications.ts
|
|
592
|
-
function resolveActionRoute(route, appId) {
|
|
593
|
-
|
|
592
|
+
function resolveActionRoute(route, appId, targetApp) {
|
|
593
|
+
const routeApp = targetApp || appId;
|
|
594
|
+
if (!route) return routeApp ? `/apps/${routeApp}` : void 0;
|
|
594
595
|
if (route.startsWith("/apps/")) return route;
|
|
595
|
-
if (!
|
|
596
|
-
return `/apps/${
|
|
596
|
+
if (!routeApp) return route;
|
|
597
|
+
return `/apps/${routeApp}${route.startsWith("/") ? route : `/${route}`}`;
|
|
597
598
|
}
|
|
598
599
|
var notifications = {
|
|
599
600
|
async push(input) {
|
|
@@ -605,7 +606,8 @@ var notifications = {
|
|
|
605
606
|
body: input.body,
|
|
606
607
|
type: "app",
|
|
607
608
|
source_app_id: appId,
|
|
608
|
-
|
|
609
|
+
target_app_id: input.targetApp,
|
|
610
|
+
action_route: resolveActionRoute(input.route, appId, input.targetApp),
|
|
609
611
|
severity: input.severity,
|
|
610
612
|
data: input.data
|
|
611
613
|
})
|
|
@@ -625,6 +627,39 @@ function hasAllPermissions(ctx, permissions) {
|
|
|
625
627
|
return permissions.every((permission) => hasPermission(ctx, permission));
|
|
626
628
|
}
|
|
627
629
|
|
|
630
|
+
// src/mcp.ts
|
|
631
|
+
async function fetchCatalog(entryType) {
|
|
632
|
+
const params = entryType ? `?entry_type=${entryType}` : "";
|
|
633
|
+
const res = await apiFetch(`/api/v1/mcp/catalog${params}`);
|
|
634
|
+
if (!res.ok) throw new Error(`mcp catalog request failed (${res.status})`);
|
|
635
|
+
return await res.json();
|
|
636
|
+
}
|
|
637
|
+
var mcp = {
|
|
638
|
+
/**
|
|
639
|
+
* Invoke an MCP tool by qualified target — `mcp.{connector}/v1#{tool}` for
|
|
640
|
+
* external connectors, `{namespace}/v1#{tool}` for app-provided tools.
|
|
641
|
+
*/
|
|
642
|
+
async callTool(target, args, options) {
|
|
643
|
+
return broker.call(target, args ?? {}, options);
|
|
644
|
+
},
|
|
645
|
+
/** Cached org catalog of MCP tools (connector + app + builtin sources). */
|
|
646
|
+
async listTools() {
|
|
647
|
+
return fetchCatalog("tool");
|
|
648
|
+
},
|
|
649
|
+
async resources() {
|
|
650
|
+
return fetchCatalog("resource");
|
|
651
|
+
},
|
|
652
|
+
async prompts() {
|
|
653
|
+
return fetchCatalog("prompt");
|
|
654
|
+
},
|
|
655
|
+
/** Connectors configured for this organisation (status only, no secrets). */
|
|
656
|
+
async connectors() {
|
|
657
|
+
const res = await apiFetch("/api/v1/mcp/connectors");
|
|
658
|
+
if (!res.ok) throw new Error(`mcp connectors request failed (${res.status})`);
|
|
659
|
+
return await res.json();
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
|
|
628
663
|
// src/storage.ts
|
|
629
664
|
var DEFAULT_CHUNK_SIZE = 8 * 1024 * 1024;
|
|
630
665
|
var MIN_CHUNK_SIZE = 256 * 1024;
|
|
@@ -847,6 +882,15 @@ var OrganizationClient = class {
|
|
|
847
882
|
currentRole() {
|
|
848
883
|
return this.ctx?.orgRole ?? null;
|
|
849
884
|
}
|
|
885
|
+
/**
|
|
886
|
+
* Fetch the current organisation's settings (name, logo, category,
|
|
887
|
+
* description, slug). Always reflects the latest values saved in
|
|
888
|
+
* Settings -> Organisation.
|
|
889
|
+
*/
|
|
890
|
+
async current() {
|
|
891
|
+
const res = await apiFetch("/api/v1/org");
|
|
892
|
+
return res.json();
|
|
893
|
+
}
|
|
850
894
|
async listMine() {
|
|
851
895
|
if (this.ctx?.orgs?.length) return this.ctx.orgs;
|
|
852
896
|
const res = await apiFetch("/api/v1/auth/my-orgs");
|
|
@@ -961,7 +1005,13 @@ function createPaletteClient(ctx) {
|
|
|
961
1005
|
/** Low-level broker accessor when you don't want the typed proxy. */
|
|
962
1006
|
broker,
|
|
963
1007
|
/** OS-broker pub/sub. `events.on(target, fn)` returns an unsubscribe function. */
|
|
964
|
-
events
|
|
1008
|
+
events,
|
|
1009
|
+
/**
|
|
1010
|
+
* MCP — call org-approved external connector tools or app-provided MCP
|
|
1011
|
+
* tools (`palette.mcp.callTool("mcp.notion/v1#search_pages", {...})`) and
|
|
1012
|
+
* browse the org catalog (`palette.mcp.listTools()`).
|
|
1013
|
+
*/
|
|
1014
|
+
mcp
|
|
965
1015
|
};
|
|
966
1016
|
}
|
|
967
1017
|
var palette = createPaletteClient();
|
|
@@ -1465,6 +1515,7 @@ export {
|
|
|
1465
1515
|
hasPermission,
|
|
1466
1516
|
isPaletteApiError,
|
|
1467
1517
|
isSandboxRuntime,
|
|
1518
|
+
mcp,
|
|
1468
1519
|
normalizePaletteLanguage,
|
|
1469
1520
|
notFound,
|
|
1470
1521
|
notifications,
|
|
@@ -6,6 +6,18 @@ interface OrgSummary {
|
|
|
6
6
|
theme_id: string;
|
|
7
7
|
logo_url: string | null;
|
|
8
8
|
}
|
|
9
|
+
/** Full organisation settings, as managed in Settings -> Organisation */
|
|
10
|
+
interface OrganizationInfo {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
/** Organisation category, e.g. "Marketing", "Design", "IT & Engineering" */
|
|
16
|
+
company_type: string | null;
|
|
17
|
+
logo_url: string | null;
|
|
18
|
+
created_at: string;
|
|
19
|
+
updated_at: string;
|
|
20
|
+
}
|
|
9
21
|
/** Authenticated user object */
|
|
10
22
|
interface User {
|
|
11
23
|
id: string;
|
|
@@ -262,4 +274,4 @@ interface PluginComponentProps {
|
|
|
262
274
|
platform: PlatformContext;
|
|
263
275
|
}
|
|
264
276
|
|
|
265
|
-
export type { Agent as A,
|
|
277
|
+
export type { Agent as A, OrganizationInfo as O, PlatformContext as P, User as U, OrgSummary as a, AgentConfig as b, AppCategory as c, AuthContextValue as d, PaletteColorMode as e, PaletteLanguage as f, PluginAgentDefinition as g, PluginComponentProps as h, PluginConnectionDefinition as i, PluginManifest as j, PluginToolDefinition as k };
|
|
@@ -6,6 +6,18 @@ interface OrgSummary {
|
|
|
6
6
|
theme_id: string;
|
|
7
7
|
logo_url: string | null;
|
|
8
8
|
}
|
|
9
|
+
/** Full organisation settings, as managed in Settings -> Organisation */
|
|
10
|
+
interface OrganizationInfo {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
/** Organisation category, e.g. "Marketing", "Design", "IT & Engineering" */
|
|
16
|
+
company_type: string | null;
|
|
17
|
+
logo_url: string | null;
|
|
18
|
+
created_at: string;
|
|
19
|
+
updated_at: string;
|
|
20
|
+
}
|
|
9
21
|
/** Authenticated user object */
|
|
10
22
|
interface User {
|
|
11
23
|
id: string;
|
|
@@ -262,4 +274,4 @@ interface PluginComponentProps {
|
|
|
262
274
|
platform: PlatformContext;
|
|
263
275
|
}
|
|
264
276
|
|
|
265
|
-
export type { Agent as A,
|
|
277
|
+
export type { Agent as A, OrganizationInfo as O, PlatformContext as P, User as U, OrgSummary as a, AgentConfig as b, AppCategory as c, AuthContextValue as d, PaletteColorMode as e, PaletteLanguage as f, PluginAgentDefinition as g, PluginComponentProps as h, PluginConnectionDefinition as i, PluginManifest as j, PluginToolDefinition as k };
|
package/dist/router/index.d.mts
CHANGED
|
@@ -61,6 +61,7 @@ declare function Link({ href, replace, onClick, children, ...props }: {
|
|
|
61
61
|
style?: react.CSSProperties | undefined;
|
|
62
62
|
id?: string | undefined | undefined;
|
|
63
63
|
target?: react.HTMLAttributeAnchorTarget | undefined;
|
|
64
|
+
resource?: string | undefined | undefined;
|
|
64
65
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
65
66
|
type?: string | undefined | undefined;
|
|
66
67
|
download?: any;
|
|
@@ -95,7 +96,6 @@ declare function Link({ href, replace, onClick, children, ...props }: {
|
|
|
95
96
|
prefix?: string | undefined | undefined;
|
|
96
97
|
property?: string | undefined | undefined;
|
|
97
98
|
rel?: string | undefined | undefined;
|
|
98
|
-
resource?: string | undefined | undefined;
|
|
99
99
|
rev?: string | undefined | undefined;
|
|
100
100
|
typeof?: string | undefined | undefined;
|
|
101
101
|
vocab?: string | undefined | undefined;
|
package/dist/router/index.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ declare function Link({ href, replace, onClick, children, ...props }: {
|
|
|
61
61
|
style?: react.CSSProperties | undefined;
|
|
62
62
|
id?: string | undefined | undefined;
|
|
63
63
|
target?: react.HTMLAttributeAnchorTarget | undefined;
|
|
64
|
+
resource?: string | undefined | undefined;
|
|
64
65
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
65
66
|
type?: string | undefined | undefined;
|
|
66
67
|
download?: any;
|
|
@@ -95,7 +96,6 @@ declare function Link({ href, replace, onClick, children, ...props }: {
|
|
|
95
96
|
prefix?: string | undefined | undefined;
|
|
96
97
|
property?: string | undefined | undefined;
|
|
97
98
|
rel?: string | undefined | undefined;
|
|
98
|
-
resource?: string | undefined | undefined;
|
|
99
99
|
rev?: string | undefined | undefined;
|
|
100
100
|
typeof?: string | undefined | undefined;
|
|
101
101
|
vocab?: string | undefined | undefined;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Agent,
|
|
1
|
+
export { A as Agent, b as AgentConfig, c as AppCategory, d as AuthContextValue, a as OrgSummary, O as OrganizationInfo, e as PaletteColorMode, f as PaletteLanguage, P as PlatformContext, g as PluginAgentDefinition, h as PluginComponentProps, i as PluginConnectionDefinition, j as PluginManifest, k as PluginToolDefinition, U as User } from '../plugin-BZE7PJAO.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 {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Agent,
|
|
1
|
+
export { A as Agent, b as AgentConfig, c as AppCategory, d as AuthContextValue, a as OrgSummary, O as OrganizationInfo, e as PaletteColorMode, f as PaletteLanguage, P as PlatformContext, g as PluginAgentDefinition, h as PluginComponentProps, i as PluginConnectionDefinition, j as PluginManifest, k as PluginToolDefinition, U as User } from '../plugin-BZE7PJAO.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 {
|