MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / updateWorkspaceMetadata

Function updateWorkspaceMetadata

ui/src/components/workspace/api.ts:413–428  ·  view source on GitHub ↗
(
  id: string,
  metadata: WorkspaceMetadataPatch,
)

Source from the content-addressed store, hash-verified

411export type WorkspaceMetadataPatch = { displayName?: string | null; description?: string | null };
412
413export async function updateWorkspaceMetadata(
414 id: string,
415 metadata: WorkspaceMetadataPatch,
416): Promise<Workspace> {
417 const res = await fetch(`/api/workspaces/${encodeURIComponent(id)}/metadata`, {
418 method: 'PATCH',
419 headers: { 'content-type': 'application/json' },
420 body: JSON.stringify(metadata),
421 });
422 if (!res.ok) {
423 const msg = await res.text().catch(() => '');
424 throw new Error(`update workspace metadata failed: ${res.status} ${msg}`);
425 }
426 const body = (await res.json()) as { workspace: Workspace };
427 return body.workspace;
428}
429
430/**
431 * Kill the PTY for this workspace. Server-side PersistentSession disposes,

Callers 1

WorkspacesProviderFunction · 0.90

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected