@palettelab/sdk 0.1.22 → 0.1.24
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 +79 -0
- 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-CGSwI4TZ.d.ts → index-BFvgg3uv.d.ts} +2 -2
- package/dist/{index-CmY9M7Rg.d.mts → index-DZqNC7hK.d.mts} +2 -2
- package/dist/index.d.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +10 -2
- package/dist/index.mjs +10 -2
- package/dist/{plugin-DXqw6d0s.d.mts → plugin-EHBRmN0H.d.mts} +7 -1
- package/dist/{plugin-DXqw6d0s.d.ts → plugin-EHBRmN0H.d.ts} +7 -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
|
@@ -185,6 +185,7 @@ Public frontend helpers exported by `@palettelab/sdk`:
|
|
|
185
185
|
- Organization/user: `UserClient`, `OrganizationClient`, including `current`, `updateProfile`, `listMine`, `listMembers`, `getMember`, `getMemberByEmail`, `inviteMember`, and `updateMemberRole`.
|
|
186
186
|
- Permissions: `hasPermission(ctx, permission)`, `hasAnyPermission(ctx, permissions)`, `hasAllPermissions(ctx, permissions)`.
|
|
187
187
|
- Translations: `normalizePaletteLanguage`, `translate`, `usePluginTranslations`.
|
|
188
|
+
- OS context: `usePlatform().language`, `usePlatform().setLanguage()`, `usePlatform().colorMode`, and `usePlatform().setColorMode()`.
|
|
188
189
|
- Hooks: `usePluginTasks`, `usePluginDataRooms`, `usePluginChat`.
|
|
189
190
|
- Sandbox: `createSandboxBridge`, `isSandboxRuntime`.
|
|
190
191
|
- Testing: `createMockPlatformContext`, `withPluginProvider`.
|
|
@@ -249,6 +250,32 @@ function App() {
|
|
|
249
250
|
The same context is available in `pltt dev`, so local development and OS runtime
|
|
250
251
|
use the same translation path.
|
|
251
252
|
|
|
253
|
+
## App Color Mode And OS Theme
|
|
254
|
+
|
|
255
|
+
Palette OS also passes the current light/dark mode into every plugin through
|
|
256
|
+
`usePlatform()`. Apps can read `colorMode` to update app-owned styling or call
|
|
257
|
+
`setColorMode()` to request an OS-level light/dark change.
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
import { usePlatform } from "@palettelab/sdk"
|
|
261
|
+
|
|
262
|
+
function ThemeAwarePanel() {
|
|
263
|
+
const { colorMode, setColorMode } = usePlatform()
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<section data-color-mode={colorMode}>
|
|
267
|
+
<button onClick={() => setColorMode(colorMode === "dark" ? "light" : "dark")}>
|
|
268
|
+
Switch to {colorMode === "dark" ? "light" : "dark"}
|
|
269
|
+
</button>
|
|
270
|
+
</section>
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Native React apps re-render when Palette OS changes between light and dark mode.
|
|
276
|
+
For non-React code, Palette OS also dispatches a `palette:theme-change` browser
|
|
277
|
+
event with `{ colorMode: "light" | "dark" }` in `event.detail`.
|
|
278
|
+
|
|
252
279
|
## Next-Compatible Apps
|
|
253
280
|
|
|
254
281
|
The Palette appstore runtime loads plugin frontends as native React modules. If
|
|
@@ -366,6 +393,18 @@ events through the SDK. The app manifest must list the targets under
|
|
|
366
393
|
`consumes.services` or `consumes.events`; Palette checks the manifest and the
|
|
367
394
|
org install grant before dispatching.
|
|
368
395
|
|
|
396
|
+
The model is intentionally contract-first:
|
|
397
|
+
|
|
398
|
+
- Provider apps declare `provides.namespace`, `provides.services[].methods`,
|
|
399
|
+
optional JSON schemas, and `provides.events`.
|
|
400
|
+
- Consumer apps declare exact qualified targets such as
|
|
401
|
+
`hr/v1#approvalChain.get` under `consumes.services` or `consumes.events`.
|
|
402
|
+
- Installs use a dependency plan so required provider apps can be installed
|
|
403
|
+
first.
|
|
404
|
+
- Org owners/admins can grant or revoke each consumed service/event target after
|
|
405
|
+
install.
|
|
406
|
+
- Every service call and event subscription is checked again at runtime.
|
|
407
|
+
|
|
369
408
|
```tsx
|
|
370
409
|
import { createPaletteClient, usePlatform } from "@palettelab/sdk"
|
|
371
410
|
|
|
@@ -390,6 +429,45 @@ call when a generated helper is not available.
|
|
|
390
429
|
managing target strings by hand. Broker failures are surfaced as
|
|
391
430
|
`MissingDependencyError`, `CrossAppGrantError`, or `BrokerCallError`.
|
|
392
431
|
|
|
432
|
+
In Palette native runtime, the SDK calls `/api/v1/os-broker/dispatch` and
|
|
433
|
+
`/api/v1/os-broker/events/stream` directly with the current app identity. In
|
|
434
|
+
iframe sandbox runtime, the SDK sends `palette.broker.call`,
|
|
435
|
+
`palette.broker.emit`, and `palette.broker.subscribe` messages to the Palette
|
|
436
|
+
host. The host forwards the request through the same broker endpoints, so
|
|
437
|
+
sandboxed apps still get the same manifest, install, grant, and schema checks.
|
|
438
|
+
|
|
439
|
+
Declare the frontend dependency in `palette-plugin.json`:
|
|
440
|
+
|
|
441
|
+
```json
|
|
442
|
+
{
|
|
443
|
+
"consumes": {
|
|
444
|
+
"services": [
|
|
445
|
+
{
|
|
446
|
+
"target": "hr/v1#approvalChain.get",
|
|
447
|
+
"required": true,
|
|
448
|
+
"reason": "Route leave approvals through HR"
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
"events": [
|
|
452
|
+
{
|
|
453
|
+
"target": "hr/v1#hierarchy.updated",
|
|
454
|
+
"required": false,
|
|
455
|
+
"reason": "Refresh approval-chain cache"
|
|
456
|
+
}
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Generated service clients use the default exported `palette` client from the
|
|
463
|
+
SDK. That lets generated files work in both app components and shared modules:
|
|
464
|
+
|
|
465
|
+
```ts
|
|
466
|
+
import { hr } from "./.palette/types/services"
|
|
467
|
+
|
|
468
|
+
const chain = await hr.approvalChain.get({ user_id })
|
|
469
|
+
```
|
|
470
|
+
|
|
393
471
|
### Data Room Folders By Name
|
|
394
472
|
|
|
395
473
|
Apps can create or reuse custom Data Room folders by name:
|
|
@@ -514,6 +592,7 @@ import { createSandboxBridge, isSandboxRuntime } from "@palettelab/sdk"
|
|
|
514
592
|
if (isSandboxRuntime()) {
|
|
515
593
|
const bridge = createSandboxBridge()
|
|
516
594
|
const result = await bridge.apiFetch("/api/v1/tasks")
|
|
595
|
+
const colorMode = bridge.getColorMode()
|
|
517
596
|
console.log(result)
|
|
518
597
|
}
|
|
519
598
|
```
|
|
@@ -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-EHBRmN0H.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-EHBRmN0H.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-DZqNC7hK.mjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-EHBRmN0H.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-BFvgg3uv.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '../plugin-
|
|
3
|
+
import '../plugin-EHBRmN0H.js';
|
|
4
4
|
import '../data-room-Dtd9LLHf.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { e as PaletteLanguage, P as PlatformContext } from './plugin-EHBRmN0H.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;
|
|
@@ -35,7 +35,7 @@ declare const PlatformCtx: react.Context<PlatformContext | null>;
|
|
|
35
35
|
/**
|
|
36
36
|
* Access the platform context from within a plugin component.
|
|
37
37
|
*
|
|
38
|
-
* Provides: user, organizationId, agents, apiFetch, navigate, showToast
|
|
38
|
+
* Provides: user, organizationId, agents, language, colorMode, apiFetch, navigate, showToast
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```tsx
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { e as PaletteLanguage, P as PlatformContext } from './plugin-EHBRmN0H.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;
|
|
@@ -35,7 +35,7 @@ declare const PlatformCtx: react.Context<PlatformContext | null>;
|
|
|
35
35
|
/**
|
|
36
36
|
* Access the platform context from within a plugin component.
|
|
37
37
|
*
|
|
38
|
-
* Provides: user, organizationId, agents, apiFetch, navigate, showToast
|
|
38
|
+
* Provides: user, organizationId, agents, language, colorMode, apiFetch, navigate, showToast
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```tsx
|
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, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as
|
|
1
|
+
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-EHBRmN0H.mjs';
|
|
2
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteColorMode, e as PaletteLanguage, f as PluginAgentDefinition, g as PluginComponentProps, h as PluginConnectionDefinition, i as PluginManifest, j as PluginToolDefinition } from './plugin-EHBRmN0H.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-DZqNC7hK.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';
|
|
@@ -77,8 +77,10 @@ type SandboxBridge = {
|
|
|
77
77
|
showToast: (message: string, type?: ToastType) => void;
|
|
78
78
|
getLanguage: () => PlatformContext["language"];
|
|
79
79
|
setLanguage: PlatformContext["setLanguage"];
|
|
80
|
+
getColorMode: () => PlatformContext["colorMode"];
|
|
81
|
+
setColorMode: PlatformContext["setColorMode"];
|
|
80
82
|
};
|
|
81
|
-
declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast"> & Partial<Pick<PlatformContext, "language" | "setLanguage">>): SandboxBridge;
|
|
83
|
+
declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast"> & Partial<Pick<PlatformContext, "language" | "setLanguage" | "colorMode" | "setColorMode">>): SandboxBridge;
|
|
82
84
|
declare function isSandboxRuntime(): boolean;
|
|
83
85
|
|
|
84
86
|
type InstallConfig = Record<string, unknown>;
|
|
@@ -230,9 +232,11 @@ declare class DataRoomClient {
|
|
|
230
232
|
upload_url: string;
|
|
231
233
|
blob_path: string;
|
|
232
234
|
file_url: string;
|
|
235
|
+
content_type?: string;
|
|
233
236
|
}>;
|
|
234
237
|
confirmUpload(roomId: number, file: File, upload: {
|
|
235
238
|
blob_path: string;
|
|
239
|
+
content_type?: string;
|
|
236
240
|
}, options?: DataRoomUploadOptions): Promise<DataRoomFile>;
|
|
237
241
|
uploadFile(roomId: number, file: File, options?: DataRoomUploadOptions): Promise<DataRoomFile>;
|
|
238
242
|
}
|
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, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as
|
|
1
|
+
import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-EHBRmN0H.js';
|
|
2
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteColorMode, e as PaletteLanguage, f as PluginAgentDefinition, g as PluginComponentProps, h as PluginConnectionDefinition, i as PluginManifest, j as PluginToolDefinition } from './plugin-EHBRmN0H.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-BFvgg3uv.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';
|
|
@@ -77,8 +77,10 @@ type SandboxBridge = {
|
|
|
77
77
|
showToast: (message: string, type?: ToastType) => void;
|
|
78
78
|
getLanguage: () => PlatformContext["language"];
|
|
79
79
|
setLanguage: PlatformContext["setLanguage"];
|
|
80
|
+
getColorMode: () => PlatformContext["colorMode"];
|
|
81
|
+
setColorMode: PlatformContext["setColorMode"];
|
|
80
82
|
};
|
|
81
|
-
declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast"> & Partial<Pick<PlatformContext, "language" | "setLanguage">>): SandboxBridge;
|
|
83
|
+
declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast"> & Partial<Pick<PlatformContext, "language" | "setLanguage" | "colorMode" | "setColorMode">>): SandboxBridge;
|
|
82
84
|
declare function isSandboxRuntime(): boolean;
|
|
83
85
|
|
|
84
86
|
type InstallConfig = Record<string, unknown>;
|
|
@@ -230,9 +232,11 @@ declare class DataRoomClient {
|
|
|
230
232
|
upload_url: string;
|
|
231
233
|
blob_path: string;
|
|
232
234
|
file_url: string;
|
|
235
|
+
content_type?: string;
|
|
233
236
|
}>;
|
|
234
237
|
confirmUpload(roomId: number, file: File, upload: {
|
|
235
238
|
blob_path: string;
|
|
239
|
+
content_type?: string;
|
|
236
240
|
}, options?: DataRoomUploadOptions): Promise<DataRoomFile>;
|
|
237
241
|
uploadFile(roomId: number, file: File, options?: DataRoomUploadOptions): Promise<DataRoomFile>;
|
|
238
242
|
}
|
package/dist/index.js
CHANGED
|
@@ -164,6 +164,9 @@ function createSandboxBridge(platform) {
|
|
|
164
164
|
showToast: platform.showToast,
|
|
165
165
|
getLanguage: () => platform.language ?? "en",
|
|
166
166
|
setLanguage: platform.setLanguage ?? (() => {
|
|
167
|
+
}),
|
|
168
|
+
getColorMode: () => platform.colorMode ?? "light",
|
|
169
|
+
setColorMode: platform.setColorMode ?? (() => {
|
|
167
170
|
})
|
|
168
171
|
};
|
|
169
172
|
}
|
|
@@ -269,6 +272,9 @@ function createMockPlatformContext(overrides = {}) {
|
|
|
269
272
|
supportedLanguages: ["en", "ko"],
|
|
270
273
|
setLanguage: () => {
|
|
271
274
|
},
|
|
275
|
+
colorMode: "light",
|
|
276
|
+
setColorMode: () => {
|
|
277
|
+
},
|
|
272
278
|
apiFetch: async () => new Response(JSON.stringify({}), { status: 200 }),
|
|
273
279
|
navigate: () => {
|
|
274
280
|
},
|
|
@@ -367,13 +373,14 @@ var DataRoomClient = class {
|
|
|
367
373
|
return res.json();
|
|
368
374
|
}
|
|
369
375
|
async confirmUpload(roomId, file, upload, options = {}) {
|
|
376
|
+
const contentType = upload.content_type ?? options.contentType ?? file.type ?? "application/octet-stream";
|
|
370
377
|
const res = await apiFetch(`/api/v1/data-rooms/${roomId}/files/confirm-upload`, {
|
|
371
378
|
method: "POST",
|
|
372
379
|
body: JSON.stringify({
|
|
373
380
|
blob_path: upload.blob_path,
|
|
374
381
|
original_filename: file.name,
|
|
375
382
|
file_size: file.size,
|
|
376
|
-
mime_type:
|
|
383
|
+
mime_type: contentType,
|
|
377
384
|
folder_id: options.folderId ?? null
|
|
378
385
|
})
|
|
379
386
|
});
|
|
@@ -381,9 +388,10 @@ var DataRoomClient = class {
|
|
|
381
388
|
}
|
|
382
389
|
async uploadFile(roomId, file, options = {}) {
|
|
383
390
|
const upload = await this.requestUpload(roomId, file, options);
|
|
391
|
+
const contentType = upload.content_type ?? options.contentType ?? file.type ?? "application/octet-stream";
|
|
384
392
|
const put = await fetch(upload.upload_url, {
|
|
385
393
|
method: "PUT",
|
|
386
|
-
headers: { "Content-Type":
|
|
394
|
+
headers: { "Content-Type": contentType },
|
|
387
395
|
body: file
|
|
388
396
|
});
|
|
389
397
|
if (!put.ok) throw new Error(`Upload failed: ${put.statusText}`);
|
package/dist/index.mjs
CHANGED
|
@@ -89,6 +89,9 @@ function createSandboxBridge(platform) {
|
|
|
89
89
|
showToast: platform.showToast,
|
|
90
90
|
getLanguage: () => platform.language ?? "en",
|
|
91
91
|
setLanguage: platform.setLanguage ?? (() => {
|
|
92
|
+
}),
|
|
93
|
+
getColorMode: () => platform.colorMode ?? "light",
|
|
94
|
+
setColorMode: platform.setColorMode ?? (() => {
|
|
92
95
|
})
|
|
93
96
|
};
|
|
94
97
|
}
|
|
@@ -194,6 +197,9 @@ function createMockPlatformContext(overrides = {}) {
|
|
|
194
197
|
supportedLanguages: ["en", "ko"],
|
|
195
198
|
setLanguage: () => {
|
|
196
199
|
},
|
|
200
|
+
colorMode: "light",
|
|
201
|
+
setColorMode: () => {
|
|
202
|
+
},
|
|
197
203
|
apiFetch: async () => new Response(JSON.stringify({}), { status: 200 }),
|
|
198
204
|
navigate: () => {
|
|
199
205
|
},
|
|
@@ -292,13 +298,14 @@ var DataRoomClient = class {
|
|
|
292
298
|
return res.json();
|
|
293
299
|
}
|
|
294
300
|
async confirmUpload(roomId, file, upload, options = {}) {
|
|
301
|
+
const contentType = upload.content_type ?? options.contentType ?? file.type ?? "application/octet-stream";
|
|
295
302
|
const res = await apiFetch(`/api/v1/data-rooms/${roomId}/files/confirm-upload`, {
|
|
296
303
|
method: "POST",
|
|
297
304
|
body: JSON.stringify({
|
|
298
305
|
blob_path: upload.blob_path,
|
|
299
306
|
original_filename: file.name,
|
|
300
307
|
file_size: file.size,
|
|
301
|
-
mime_type:
|
|
308
|
+
mime_type: contentType,
|
|
302
309
|
folder_id: options.folderId ?? null
|
|
303
310
|
})
|
|
304
311
|
});
|
|
@@ -306,9 +313,10 @@ var DataRoomClient = class {
|
|
|
306
313
|
}
|
|
307
314
|
async uploadFile(roomId, file, options = {}) {
|
|
308
315
|
const upload = await this.requestUpload(roomId, file, options);
|
|
316
|
+
const contentType = upload.content_type ?? options.contentType ?? file.type ?? "application/octet-stream";
|
|
309
317
|
const put = await fetch(upload.upload_url, {
|
|
310
318
|
method: "PUT",
|
|
311
|
-
headers: { "Content-Type":
|
|
319
|
+
headers: { "Content-Type": contentType },
|
|
312
320
|
body: file
|
|
313
321
|
});
|
|
314
322
|
if (!put.ok) throw new Error(`Upload failed: ${put.statusText}`);
|
|
@@ -69,6 +69,8 @@ interface AgentConfig {
|
|
|
69
69
|
|
|
70
70
|
/** BCP-47 language tag used by Palette OS and plugin translation helpers */
|
|
71
71
|
type PaletteLanguage = string;
|
|
72
|
+
/** Palette OS light/dark interface mode */
|
|
73
|
+
type PaletteColorMode = "light" | "dark";
|
|
72
74
|
/** App store category */
|
|
73
75
|
type AppCategory = "All" | "Productivity" | "Design" | "Marketing" | "Analytics";
|
|
74
76
|
/** Plugin manifest — corresponds to palette-plugin.json */
|
|
@@ -240,6 +242,10 @@ interface PlatformContext {
|
|
|
240
242
|
supportedLanguages: PaletteLanguage[];
|
|
241
243
|
/** Update the Palette OS language preference */
|
|
242
244
|
setLanguage: (language: PaletteLanguage) => void;
|
|
245
|
+
/** Current Palette OS light/dark interface mode */
|
|
246
|
+
colorMode: PaletteColorMode;
|
|
247
|
+
/** Update the Palette OS light/dark interface mode */
|
|
248
|
+
setColorMode: (mode: PaletteColorMode) => void;
|
|
243
249
|
/** API fetch helper with auth handling */
|
|
244
250
|
apiFetch: (path: string, init?: RequestInit) => Promise<Response>;
|
|
245
251
|
/** Navigate to a platform route */
|
|
@@ -256,4 +262,4 @@ interface PluginComponentProps {
|
|
|
256
262
|
platform: PlatformContext;
|
|
257
263
|
}
|
|
258
264
|
|
|
259
|
-
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c,
|
|
265
|
+
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c, PaletteColorMode as d, PaletteLanguage as e, PluginAgentDefinition as f, PluginComponentProps as g, PluginConnectionDefinition as h, PluginManifest as i, PluginToolDefinition as j };
|
|
@@ -69,6 +69,8 @@ interface AgentConfig {
|
|
|
69
69
|
|
|
70
70
|
/** BCP-47 language tag used by Palette OS and plugin translation helpers */
|
|
71
71
|
type PaletteLanguage = string;
|
|
72
|
+
/** Palette OS light/dark interface mode */
|
|
73
|
+
type PaletteColorMode = "light" | "dark";
|
|
72
74
|
/** App store category */
|
|
73
75
|
type AppCategory = "All" | "Productivity" | "Design" | "Marketing" | "Analytics";
|
|
74
76
|
/** Plugin manifest — corresponds to palette-plugin.json */
|
|
@@ -240,6 +242,10 @@ interface PlatformContext {
|
|
|
240
242
|
supportedLanguages: PaletteLanguage[];
|
|
241
243
|
/** Update the Palette OS language preference */
|
|
242
244
|
setLanguage: (language: PaletteLanguage) => void;
|
|
245
|
+
/** Current Palette OS light/dark interface mode */
|
|
246
|
+
colorMode: PaletteColorMode;
|
|
247
|
+
/** Update the Palette OS light/dark interface mode */
|
|
248
|
+
setColorMode: (mode: PaletteColorMode) => void;
|
|
243
249
|
/** API fetch helper with auth handling */
|
|
244
250
|
apiFetch: (path: string, init?: RequestInit) => Promise<Response>;
|
|
245
251
|
/** Navigate to a platform route */
|
|
@@ -256,4 +262,4 @@ interface PluginComponentProps {
|
|
|
256
262
|
platform: PlatformContext;
|
|
257
263
|
}
|
|
258
264
|
|
|
259
|
-
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c,
|
|
265
|
+
export type { Agent as A, OrgSummary as O, PlatformContext as P, User as U, AgentConfig as a, AppCategory as b, AuthContextValue as c, PaletteColorMode as d, PaletteLanguage as e, PluginAgentDefinition as f, PluginComponentProps as g, PluginConnectionDefinition as h, PluginManifest as i, PluginToolDefinition as j };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -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,
|
|
1
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteColorMode, e as PaletteLanguage, P as PlatformContext, f as PluginAgentDefinition, g as PluginComponentProps, h as PluginConnectionDefinition, i as PluginManifest, j as PluginToolDefinition, U as User } from '../plugin-EHBRmN0H.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, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteLanguage, P as PlatformContext,
|
|
1
|
+
export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, O as OrgSummary, d as PaletteColorMode, e as PaletteLanguage, P as PlatformContext, f as PluginAgentDefinition, g as PluginComponentProps, h as PluginConnectionDefinition, i as PluginManifest, j as PluginToolDefinition, U as User } from '../plugin-EHBRmN0H.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 {
|