feat: add chat sharing API (#24968)

This commit is contained in:
Danielle Maywood
2026-05-20 10:46:35 +01:00
committed by GitHub
parent 70ab2b9940
commit 96e3c49670
22 changed files with 1583 additions and 3 deletions
+1
View File
@@ -101,6 +101,7 @@ const makeChat = (
id,
organization_id: "test-org-id",
owner_id: "owner-1",
owner_username: "owner",
last_model_config_id: "model-1",
mcp_server_ids: [],
labels: {},
+29
View File
@@ -1480,6 +1480,8 @@ export interface Chat {
readonly id: string;
readonly organization_id: string;
readonly owner_id: string;
readonly owner_username?: string;
readonly owner_name?: string;
readonly workspace_id?: string;
readonly build_id?: string;
readonly agent_id?: string;
@@ -1524,6 +1526,12 @@ export interface Chat {
readonly children: readonly Chat[];
}
// From codersdk/chats.go
export interface ChatACL {
readonly users: readonly ChatUser[];
readonly groups: readonly ChatGroup[];
}
// From codersdk/chats.go
export type ChatAttachmentMediaType =
| "application/json"
@@ -2049,6 +2057,11 @@ export const ChatGitWatchWorkspaceNoAgentsMessage =
*/
export const ChatGitWatchWorkspaceNotFoundMessage = "Chat workspace not found.";
// From codersdk/chats.go
export interface ChatGroup extends Group {
readonly role: ChatRole;
}
// From codersdk/chats.go
/**
* ChatInputPart is a single user input part for creating a chat.
@@ -2652,6 +2665,11 @@ export interface ChatRetentionDaysResponse {
readonly retention_days: number;
}
// From codersdk/chats.go
export type ChatRole = "" | "read";
export const ChatRoles: ChatRole[] = ["", "read"];
// From codersdk/chats.go
export interface ChatSkillPart {
readonly type: "skill";
@@ -2975,6 +2993,11 @@ export interface ChatUsageLimitStatus {
readonly period_end?: string;
}
// From codersdk/chats.go
export interface ChatUser extends MinimalUser {
readonly role: ChatRole;
}
// From codersdk/chats.go
/**
* ChatWatchEvent represents an event from the global chat watch stream.
@@ -8377,6 +8400,12 @@ export interface UpdateAppearanceConfig {
readonly announcement_banners: readonly BannerConfig[];
}
// From codersdk/chats.go
export interface UpdateChatACL {
readonly user_roles?: Record<string, ChatRole>;
readonly group_roles?: Record<string, ChatRole>;
}
// From codersdk/chats.go
/**
* UpdateChatAutoArchiveDaysRequest is a request to update the chat
@@ -128,6 +128,7 @@ const mockModelConfigs: TypesGen.ChatModelConfig[] = [
const baseChatFields = {
organization_id: "test-org-id",
owner_id: MockUserOwner.id,
owner_username: MockUserOwner.username,
workspace_id: mockWorkspace.id,
last_model_config_id: MODEL_CONFIG_ID,
mcp_server_ids: [],
@@ -52,6 +52,7 @@ const buildChat = (overrides: Partial<TypesGen.Chat> = {}): TypesGen.Chat => ({
id: AGENT_ID,
organization_id: "test-org-id",
owner_id: "owner-1",
owner_username: "owner",
title: "Help me refactor",
status: "completed",
last_model_config_id: defaultModelConfigID,
@@ -144,6 +144,7 @@ const buildChat = (overrides: Partial<Chat> = {}): Chat => ({
id: "chat-default",
organization_id: "test-org-id",
owner_id: "owner-1",
owner_username: "owner",
title: "Agent",
status: "completed",
last_model_config_id: defaultModelConfigs[0].id,
@@ -207,6 +207,7 @@ const makeChat = (chatID: string): TypesGen.Chat => ({
id: chatID,
organization_id: "test-org-id",
owner_id: "owner-1",
owner_username: "owner",
last_model_config_id: "model-1",
mcp_server_ids: [],
labels: {},
@@ -60,6 +60,7 @@ export const WithParentChat: Story = {
id: "parent-chat-1",
organization_id: "test-org-id",
owner_id: "owner-id",
owner_username: "owner",
last_model_config_id: "model-config-1",
mcp_server_ids: [],
labels: {},
@@ -59,6 +59,7 @@ const buildChat = (overrides: Partial<Chat> = {}): Chat => ({
id: "chat-default",
organization_id: "test-org-id",
owner_id: "owner-1",
owner_username: "owner",
title: "Agent",
status: "completed",
last_model_config_id: defaultModelConfigs[0].id,
@@ -57,6 +57,7 @@ const buildChat = (overrides: Partial<Chat> = {}): Chat => ({
id: "chat-default",
organization_id: "test-org-id",
owner_id: "owner-1",
owner_username: "owner",
title: "Agent",
status: "completed",
last_model_config_id: "model-1",