@palettelab/sdk 0.1.9 → 0.1.11

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/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-o-qmdCBl.mjs';
2
- export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PluginAgentDefinition, e as PluginComponentProps, f as PluginManifest, g as PluginToolDefinition } from './plugin-o-qmdCBl.mjs';
1
+ import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-DZRaxKt3.mjs';
2
+ export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteLanguage, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition } from './plugin-DZRaxKt3.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 { PlatformCtx, usePlatform, usePluginChat, usePluginDataRooms, usePluginTasks } from './hooks/index.mjs';
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-BL37Z-Ns.mjs';
8
8
  export { PluginProvider } from './components/index.mjs';
9
9
  import 'react/jsx-runtime';
10
10
 
@@ -43,8 +43,10 @@ type SandboxBridge = {
43
43
  apiFetch: PlatformContext["apiFetch"];
44
44
  navigate: (path: string) => void;
45
45
  showToast: (message: string, type?: ToastType) => void;
46
+ getLanguage: () => PlatformContext["language"];
47
+ setLanguage: PlatformContext["setLanguage"];
46
48
  };
47
- declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast">): SandboxBridge;
49
+ declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast"> & Partial<Pick<PlatformContext, "language" | "setLanguage">>): SandboxBridge;
48
50
  declare function isSandboxRuntime(): boolean;
49
51
 
50
52
  type InstallConfig = Record<string, unknown>;
@@ -63,7 +65,14 @@ interface DataRoomUploadOptions {
63
65
  folderId?: number | null;
64
66
  contentType?: string;
65
67
  }
68
+ interface FindByNameOptions {
69
+ caseSensitive?: boolean;
70
+ }
71
+ interface EnsureFolderOptions extends FindByNameOptions {
72
+ parentFolderId?: number | null;
73
+ }
66
74
  declare class DataRoomClient {
75
+ private matchesName;
67
76
  list(): Promise<DataRoom[]>;
68
77
  create(input: {
69
78
  name: string;
@@ -71,6 +80,21 @@ declare class DataRoomClient {
71
80
  }): Promise<DataRoom>;
72
81
  get(roomId: number): Promise<DataRoomContents>;
73
82
  folder(roomId: number, folderId: number): Promise<DataRoomContents>;
83
+ findRoomByName(name: string, options?: FindByNameOptions): Promise<DataRoom | null>;
84
+ requireRoomByName(name: string, options?: FindByNameOptions): Promise<DataRoom>;
85
+ ensureRoom(name: string, description?: string | null): Promise<DataRoom>;
86
+ createFolder(roomId: number, input: {
87
+ name: string;
88
+ parentFolderId?: number | null;
89
+ }): Promise<DataRoomFolder>;
90
+ findFolderByName(roomId: number, name: string, options?: EnsureFolderOptions): Promise<DataRoomFolder | null>;
91
+ ensureFolder(roomId: number, name: string, options?: EnsureFolderOptions): Promise<DataRoomFolder>;
92
+ resolveFolderPath(roomId: number, path: string | string[], options?: FindByNameOptions & {
93
+ create?: boolean;
94
+ }): Promise<DataRoomFolder | null>;
95
+ findFileByName(roomId: number, name: string, options?: FindByNameOptions & {
96
+ folderId?: number | null;
97
+ }): Promise<DataRoomFile | null>;
74
98
  requestUpload(roomId: number, file: File, options?: DataRoomUploadOptions): Promise<{
75
99
  upload_url: string;
76
100
  blob_path: string;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-o-qmdCBl.js';
2
- export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PluginAgentDefinition, e as PluginComponentProps, f as PluginManifest, g as PluginToolDefinition } from './plugin-o-qmdCBl.js';
1
+ import { P as PlatformContext, O as OrgSummary, U as User } from './plugin-DZRaxKt3.js';
2
+ export { A as Agent, a as AgentConfig, b as AppCategory, c as AuthContextValue, d as PaletteLanguage, e as PluginAgentDefinition, f as PluginComponentProps, g as PluginManifest, h as PluginToolDefinition } from './plugin-DZRaxKt3.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 { PlatformCtx, usePlatform, usePluginChat, usePluginDataRooms, usePluginTasks } from './hooks/index.js';
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-DEvPH60n.js';
8
8
  export { PluginProvider } from './components/index.js';
9
9
  import 'react/jsx-runtime';
10
10
 
@@ -43,8 +43,10 @@ type SandboxBridge = {
43
43
  apiFetch: PlatformContext["apiFetch"];
44
44
  navigate: (path: string) => void;
45
45
  showToast: (message: string, type?: ToastType) => void;
46
+ getLanguage: () => PlatformContext["language"];
47
+ setLanguage: PlatformContext["setLanguage"];
46
48
  };
47
- declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast">): SandboxBridge;
49
+ declare function createSandboxBridge(platform: Pick<PlatformContext, "apiFetch" | "navigate" | "showToast"> & Partial<Pick<PlatformContext, "language" | "setLanguage">>): SandboxBridge;
48
50
  declare function isSandboxRuntime(): boolean;
49
51
 
50
52
  type InstallConfig = Record<string, unknown>;
@@ -63,7 +65,14 @@ interface DataRoomUploadOptions {
63
65
  folderId?: number | null;
64
66
  contentType?: string;
65
67
  }
68
+ interface FindByNameOptions {
69
+ caseSensitive?: boolean;
70
+ }
71
+ interface EnsureFolderOptions extends FindByNameOptions {
72
+ parentFolderId?: number | null;
73
+ }
66
74
  declare class DataRoomClient {
75
+ private matchesName;
67
76
  list(): Promise<DataRoom[]>;
68
77
  create(input: {
69
78
  name: string;
@@ -71,6 +80,21 @@ declare class DataRoomClient {
71
80
  }): Promise<DataRoom>;
72
81
  get(roomId: number): Promise<DataRoomContents>;
73
82
  folder(roomId: number, folderId: number): Promise<DataRoomContents>;
83
+ findRoomByName(name: string, options?: FindByNameOptions): Promise<DataRoom | null>;
84
+ requireRoomByName(name: string, options?: FindByNameOptions): Promise<DataRoom>;
85
+ ensureRoom(name: string, description?: string | null): Promise<DataRoom>;
86
+ createFolder(roomId: number, input: {
87
+ name: string;
88
+ parentFolderId?: number | null;
89
+ }): Promise<DataRoomFolder>;
90
+ findFolderByName(roomId: number, name: string, options?: EnsureFolderOptions): Promise<DataRoomFolder | null>;
91
+ ensureFolder(roomId: number, name: string, options?: EnsureFolderOptions): Promise<DataRoomFolder>;
92
+ resolveFolderPath(roomId: number, path: string | string[], options?: FindByNameOptions & {
93
+ create?: boolean;
94
+ }): Promise<DataRoomFolder | null>;
95
+ findFileByName(roomId: number, name: string, options?: FindByNameOptions & {
96
+ folderId?: number | null;
97
+ }): Promise<DataRoomFile | null>;
74
98
  requestUpload(roomId: number, file: File, options?: DataRoomUploadOptions): Promise<{
75
99
  upload_url: string;
76
100
  blob_path: string;
package/dist/index.js CHANGED
@@ -41,13 +41,16 @@ __export(src_exports, {
41
41
  hasPermission: () => hasPermission,
42
42
  isPaletteApiError: () => isPaletteApiError,
43
43
  isSandboxRuntime: () => isSandboxRuntime,
44
+ normalizePaletteLanguage: () => normalizePaletteLanguage,
44
45
  setBaseUrl: () => setBaseUrl,
46
+ translate: () => translate,
45
47
  updateInstallConfig: () => updateInstallConfig,
46
48
  uploadToSignedUrl: () => uploadToSignedUrl,
47
49
  usePlatform: () => usePlatform,
48
50
  usePluginChat: () => usePluginChat,
49
51
  usePluginDataRooms: () => usePluginDataRooms,
50
52
  usePluginTasks: () => usePluginTasks,
53
+ usePluginTranslations: () => usePluginTranslations,
51
54
  withPluginProvider: () => withPluginProvider
52
55
  });
53
56
  module.exports = __toCommonJS(src_exports);
@@ -140,7 +143,10 @@ function createSandboxBridge(platform) {
140
143
  return {
141
144
  apiFetch: platform.apiFetch,
142
145
  navigate: platform.navigate,
143
- showToast: platform.showToast
146
+ showToast: platform.showToast,
147
+ getLanguage: () => platform.language ?? "en",
148
+ setLanguage: platform.setLanguage ?? (() => {
149
+ })
144
150
  };
145
151
  }
146
152
  function isSandboxRuntime() {
@@ -214,6 +220,11 @@ function createMockPlatformContext(overrides = {}) {
214
220
  orgs: [],
215
221
  agents: [],
216
222
  permissions: [],
223
+ language: "en",
224
+ fallbackLanguage: "en",
225
+ supportedLanguages: ["en", "ko"],
226
+ setLanguage: () => {
227
+ },
217
228
  apiFetch: async () => new Response(JSON.stringify({}), { status: 200 }),
218
229
  navigate: () => {
219
230
  },
@@ -231,6 +242,10 @@ function withPluginProvider(element, platform = {}) {
231
242
 
232
243
  // src/data-rooms.ts
233
244
  var DataRoomClient = class {
245
+ matchesName(actual, expected, options = {}) {
246
+ if (options.caseSensitive) return actual === expected;
247
+ return actual.localeCompare(expected, void 0, { sensitivity: "accent" }) === 0;
248
+ }
234
249
  async list() {
235
250
  const res = await apiFetch("/api/v1/data-rooms");
236
251
  return res.json();
@@ -250,6 +265,50 @@ var DataRoomClient = class {
250
265
  const res = await apiFetch(`/api/v1/data-rooms/${roomId}/folders/${folderId}`);
251
266
  return res.json();
252
267
  }
268
+ async findRoomByName(name, options = {}) {
269
+ const rooms = await this.list();
270
+ return rooms.find((room) => this.matchesName(room.name, name, options)) ?? null;
271
+ }
272
+ async requireRoomByName(name, options = {}) {
273
+ const room = await this.findRoomByName(name, options);
274
+ if (!room) throw new Error(`Data Room not found: ${name}`);
275
+ return room;
276
+ }
277
+ async ensureRoom(name, description) {
278
+ return await this.findRoomByName(name) ?? this.create({ name, description });
279
+ }
280
+ async createFolder(roomId, input) {
281
+ const res = await apiFetch(`/api/v1/data-rooms/${roomId}/folders`, {
282
+ method: "POST",
283
+ body: JSON.stringify({
284
+ name: input.name,
285
+ parent_folder_id: input.parentFolderId ?? null
286
+ })
287
+ });
288
+ return res.json();
289
+ }
290
+ async findFolderByName(roomId, name, options = {}) {
291
+ const contents = options.parentFolderId ? await this.folder(roomId, options.parentFolderId) : await this.get(roomId);
292
+ return contents.folders.find((folder) => this.matchesName(folder.name, name, options)) ?? null;
293
+ }
294
+ async ensureFolder(roomId, name, options = {}) {
295
+ return await this.findFolderByName(roomId, name, options) ?? this.createFolder(roomId, { name, parentFolderId: options.parentFolderId ?? null });
296
+ }
297
+ async resolveFolderPath(roomId, path, options = {}) {
298
+ const parts = Array.isArray(path) ? path : path.split("/").map((part) => part.trim()).filter(Boolean);
299
+ let parentFolderId = null;
300
+ let current = null;
301
+ for (const part of parts) {
302
+ current = options.create ? await this.ensureFolder(roomId, part, { ...options, parentFolderId }) : await this.findFolderByName(roomId, part, { ...options, parentFolderId });
303
+ if (!current) return null;
304
+ parentFolderId = current.id;
305
+ }
306
+ return current;
307
+ }
308
+ async findFileByName(roomId, name, options = {}) {
309
+ const contents = options.folderId ? await this.folder(roomId, options.folderId) : await this.get(roomId);
310
+ return contents.files.find((file) => this.matchesName(file.original_filename, name, options)) ?? null;
311
+ }
253
312
  async requestUpload(roomId, file, options = {}) {
254
313
  const res = await apiFetch(`/api/v1/data-rooms/${roomId}/files/request-upload`, {
255
314
  method: "POST",
@@ -387,14 +446,77 @@ function createPaletteClient(ctx) {
387
446
  };
388
447
  }
389
448
 
390
- // src/hooks/use-plugin-tasks.ts
449
+ // src/i18n.ts
391
450
  var import_react3 = require("react");
451
+ function normalizePaletteLanguage(language, fallback = "en") {
452
+ const trimmed = language?.trim().toLowerCase();
453
+ if (!trimmed) return fallback;
454
+ return trimmed.split("-")[0] || fallback;
455
+ }
456
+ function languageCandidates(language, fallbackLanguage = "en") {
457
+ const candidates = [
458
+ language,
459
+ normalizePaletteLanguage(language, fallbackLanguage),
460
+ fallbackLanguage,
461
+ normalizePaletteLanguage(fallbackLanguage, "en"),
462
+ "en"
463
+ ].filter(Boolean);
464
+ return Array.from(new Set(candidates));
465
+ }
466
+ function getValue(dictionary, key) {
467
+ if (!dictionary) return void 0;
468
+ let current = dictionary;
469
+ for (const part of key.split(".")) {
470
+ if (current === null || typeof current !== "object" || Array.isArray(current)) return void 0;
471
+ current = current[part];
472
+ }
473
+ if (typeof current === "string" || typeof current === "number" || typeof current === "boolean" || current === null) {
474
+ return current;
475
+ }
476
+ return void 0;
477
+ }
478
+ function interpolate(template, values) {
479
+ if (!values) return template;
480
+ return template.replace(/\{\{?\s*([a-zA-Z0-9_.-]+)\s*\}?\}/g, (match, key) => {
481
+ const value = values[key];
482
+ return value === void 0 || value === null ? match : String(value);
483
+ });
484
+ }
485
+ function translate(resources, key, options = {}) {
486
+ const fallbackLanguage = normalizePaletteLanguage(options.fallbackLanguage, "en");
487
+ for (const language of languageCandidates(options.language, fallbackLanguage)) {
488
+ const value = getValue(resources[language], key);
489
+ if (value !== void 0) {
490
+ return interpolate(String(value ?? ""), options.values);
491
+ }
492
+ }
493
+ return interpolate(options.defaultValue ?? key, options.values);
494
+ }
495
+ function usePluginTranslations(resources, options = {}) {
496
+ const platform = usePlatform();
497
+ const language = normalizePaletteLanguage(platform.language, options.fallbackLanguage ?? platform.fallbackLanguage);
498
+ const fallbackLanguage = normalizePaletteLanguage(options.fallbackLanguage ?? platform.fallbackLanguage, "en");
499
+ const t = (0, import_react3.useCallback)(
500
+ (key, values, defaultValue) => translate(resources, key, { language, fallbackLanguage, values, defaultValue }),
501
+ [fallbackLanguage, language, resources]
502
+ );
503
+ return {
504
+ language,
505
+ fallbackLanguage,
506
+ supportedLanguages: platform.supportedLanguages,
507
+ setLanguage: platform.setLanguage,
508
+ t
509
+ };
510
+ }
511
+
512
+ // src/hooks/use-plugin-tasks.ts
513
+ var import_react4 = require("react");
392
514
  function usePluginTasks(agentId) {
393
515
  const { apiFetch: apiFetch2 } = usePlatform();
394
- const [tasks, setTasks] = (0, import_react3.useState)([]);
395
- const [stats, setStats] = (0, import_react3.useState)(null);
396
- const [loading, setLoading] = (0, import_react3.useState)(true);
397
- const fetchTasks = (0, import_react3.useCallback)(async () => {
516
+ const [tasks, setTasks] = (0, import_react4.useState)([]);
517
+ const [stats, setStats] = (0, import_react4.useState)(null);
518
+ const [loading, setLoading] = (0, import_react4.useState)(true);
519
+ const fetchTasks = (0, import_react4.useCallback)(async () => {
398
520
  try {
399
521
  const params = new URLSearchParams();
400
522
  if (agentId) params.set("agent_id", String(agentId));
@@ -403,18 +525,18 @@ function usePluginTasks(agentId) {
403
525
  } catch {
404
526
  }
405
527
  }, [apiFetch2, agentId]);
406
- const fetchStats = (0, import_react3.useCallback)(async () => {
528
+ const fetchStats = (0, import_react4.useCallback)(async () => {
407
529
  try {
408
530
  const res = await apiFetch2("/api/v1/tasks/stats");
409
531
  setStats(await res.json());
410
532
  } catch {
411
533
  }
412
534
  }, [apiFetch2]);
413
- (0, import_react3.useEffect)(() => {
535
+ (0, import_react4.useEffect)(() => {
414
536
  setLoading(true);
415
537
  Promise.all([fetchTasks(), fetchStats()]).finally(() => setLoading(false));
416
538
  }, [fetchTasks, fetchStats]);
417
- const createTask = (0, import_react3.useCallback)(async (payload) => {
539
+ const createTask = (0, import_react4.useCallback)(async (payload) => {
418
540
  const res = await apiFetch2("/api/v1/tasks", {
419
541
  method: "POST",
420
542
  body: JSON.stringify(payload)
@@ -423,7 +545,7 @@ function usePluginTasks(agentId) {
423
545
  await Promise.all([fetchTasks(), fetchStats()]);
424
546
  return task;
425
547
  }, [apiFetch2, fetchTasks, fetchStats]);
426
- const updateTask = (0, import_react3.useCallback)(async (taskId, payload) => {
548
+ const updateTask = (0, import_react4.useCallback)(async (taskId, payload) => {
427
549
  const res = await apiFetch2(`/api/v1/tasks/${taskId}`, {
428
550
  method: "PATCH",
429
551
  body: JSON.stringify(payload)
@@ -432,7 +554,7 @@ function usePluginTasks(agentId) {
432
554
  await Promise.all([fetchTasks(), fetchStats()]);
433
555
  return task;
434
556
  }, [apiFetch2, fetchTasks, fetchStats]);
435
- const deleteTask = (0, import_react3.useCallback)(async (taskId) => {
557
+ const deleteTask = (0, import_react4.useCallback)(async (taskId) => {
436
558
  await apiFetch2(`/api/v1/tasks/${taskId}`, { method: "DELETE" });
437
559
  await Promise.all([fetchTasks(), fetchStats()]);
438
560
  }, [apiFetch2, fetchTasks, fetchStats]);
@@ -440,23 +562,23 @@ function usePluginTasks(agentId) {
440
562
  }
441
563
 
442
564
  // src/hooks/use-plugin-data-rooms.ts
443
- var import_react4 = require("react");
565
+ var import_react5 = require("react");
444
566
  function usePluginDataRooms() {
445
567
  const { apiFetch: apiFetch2 } = usePlatform();
446
- const [rooms, setRooms] = (0, import_react4.useState)([]);
447
- const [loading, setLoading] = (0, import_react4.useState)(true);
448
- const fetchRooms = (0, import_react4.useCallback)(async () => {
568
+ const [rooms, setRooms] = (0, import_react5.useState)([]);
569
+ const [loading, setLoading] = (0, import_react5.useState)(true);
570
+ const fetchRooms = (0, import_react5.useCallback)(async () => {
449
571
  try {
450
572
  const res = await apiFetch2("/api/v1/data-rooms");
451
573
  setRooms(await res.json());
452
574
  } catch {
453
575
  }
454
576
  }, [apiFetch2]);
455
- (0, import_react4.useEffect)(() => {
577
+ (0, import_react5.useEffect)(() => {
456
578
  setLoading(true);
457
579
  fetchRooms().finally(() => setLoading(false));
458
580
  }, [fetchRooms]);
459
- const fetchFolder = (0, import_react4.useCallback)(async (roomId, folderId) => {
581
+ const fetchFolder = (0, import_react5.useCallback)(async (roomId, folderId) => {
460
582
  const path = folderId ? `/api/v1/data-rooms/${roomId}/folders/${folderId}` : `/api/v1/data-rooms/${roomId}`;
461
583
  const res = await apiFetch2(path);
462
584
  return res.json();
@@ -465,19 +587,19 @@ function usePluginDataRooms() {
465
587
  }
466
588
 
467
589
  // src/hooks/use-plugin-chat.ts
468
- var import_react5 = require("react");
590
+ var import_react6 = require("react");
469
591
  function usePluginChat(agentId) {
470
592
  const { apiFetch: apiFetch2 } = usePlatform();
471
- const [threads, setThreads] = (0, import_react5.useState)([]);
472
- const [messages, setMessages] = (0, import_react5.useState)([]);
473
- const [streaming, setStreaming] = (0, import_react5.useState)(false);
474
- const [activeThreadId, setActiveThreadId] = (0, import_react5.useState)(null);
475
- const abortRef = (0, import_react5.useRef)(null);
476
- const fetchThreads = (0, import_react5.useCallback)(async () => {
593
+ const [threads, setThreads] = (0, import_react6.useState)([]);
594
+ const [messages, setMessages] = (0, import_react6.useState)([]);
595
+ const [streaming, setStreaming] = (0, import_react6.useState)(false);
596
+ const [activeThreadId, setActiveThreadId] = (0, import_react6.useState)(null);
597
+ const abortRef = (0, import_react6.useRef)(null);
598
+ const fetchThreads = (0, import_react6.useCallback)(async () => {
477
599
  const res = await apiFetch2(`/api/v1/chat/${agentId}/threads`);
478
600
  setThreads(await res.json());
479
601
  }, [apiFetch2, agentId]);
480
- const createThread = (0, import_react5.useCallback)(async () => {
602
+ const createThread = (0, import_react6.useCallback)(async () => {
481
603
  const res = await apiFetch2(`/api/v1/chat/${agentId}/threads`, { method: "POST" });
482
604
  const thread = await res.json();
483
605
  setActiveThreadId(thread.id);
@@ -485,13 +607,13 @@ function usePluginChat(agentId) {
485
607
  await fetchThreads();
486
608
  return thread;
487
609
  }, [apiFetch2, agentId, fetchThreads]);
488
- const fetchMessages = (0, import_react5.useCallback)(async (threadId) => {
610
+ const fetchMessages = (0, import_react6.useCallback)(async (threadId) => {
489
611
  const res = await apiFetch2(`/api/v1/chat/threads/${threadId}/messages`);
490
612
  const msgs = await res.json();
491
613
  setMessages(msgs);
492
614
  setActiveThreadId(threadId);
493
615
  }, [apiFetch2]);
494
- const sendMessage = (0, import_react5.useCallback)(async (threadId, content) => {
616
+ const sendMessage = (0, import_react6.useCallback)(async (threadId, content) => {
495
617
  setStreaming(true);
496
618
  abortRef.current = new AbortController();
497
619
  const userMsg = {
@@ -559,7 +681,7 @@ function usePluginChat(agentId) {
559
681
  abortRef.current = null;
560
682
  }
561
683
  }, []);
562
- const stopStreaming = (0, import_react5.useCallback)(() => {
684
+ const stopStreaming = (0, import_react6.useCallback)(() => {
563
685
  abortRef.current?.abort();
564
686
  }, []);
565
687
  return {
@@ -597,12 +719,15 @@ function usePluginChat(agentId) {
597
719
  hasPermission,
598
720
  isPaletteApiError,
599
721
  isSandboxRuntime,
722
+ normalizePaletteLanguage,
600
723
  setBaseUrl,
724
+ translate,
601
725
  updateInstallConfig,
602
726
  uploadToSignedUrl,
603
727
  usePlatform,
604
728
  usePluginChat,
605
729
  usePluginDataRooms,
606
730
  usePluginTasks,
731
+ usePluginTranslations,
607
732
  withPluginProvider
608
733
  });