Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions packages/chat-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"./wire/participants": "./src/wire/participants.ts",
"./wire/display-name": "./src/wire/display-name.ts",
"./wire/agent-address": "./src/wire/agent-address.ts",
"./wire/reaction-emoji": "./src/wire/reaction-emoji.ts",
"./wire/workbench-host-naming": "./src/wire/workbench-host-naming.ts",
"./wire/stream-events": "./src/wire/stream-events.ts",
"./wire/consumer-inference-text": "./src/wire/consumer-inference-text.ts"
Expand All @@ -33,7 +32,6 @@
"@tanstack/react-query": "catalog:",
"@corbits/connections": "workspace:*",
"@corbits/jimmy-agent": "workspace:*",
"@corbits/mailbox": "github:corbitsdev/corbits-mailbox#bc964040fa42ffe4e5d5004f87edaab6486e5d60",
"arktype": "catalog:",
"@corbits/icons": "workspace:*",
"react": "^19.2.0",
Expand Down
102 changes: 0 additions & 102 deletions packages/chat-ui/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ export type {
OnboardingStepLabel,
WorkbenchOnboardingStep,
} from "./wire/blocks";
export { REACTION_EMOJI } from "./wire/reaction-emoji";
export type { ReactionEmoji } from "./wire/reaction-emoji";

export const WorkbenchKind = type("'workbench' | 'chat'");
export type WorkbenchKind = typeof WorkbenchKind.infer;

Expand Down Expand Up @@ -519,88 +516,6 @@ export function sendMessage(
);
}

/**
* Toggles this signed-in principal's reaction with `emoji` on a
* message — `POST .../reactions/toggle` (see
* `packages/chat/src/routes.ts`). Returns the emoji's fresh summary
* (count and whether this principal is now among the reactors); the
* caller re-renders from this rather than assuming its own optimistic
* guess, the same anti-drift rule `submitPoll`'s live tally follows.
*/
export function toggleReaction(
tenantId: string,
workbenchId: string,
messageId: string,
emoji: string,
): Promise<ReactionSummary> {
return request(
`/api/tenants/${tenantId}/chat/workbenches/${workbenchId}/messages/${messageId}/reactions/toggle`,
ReactionSummaryWire,
{ method: "POST", body: JSON.stringify({ emoji }) },
);
}

const PinnedWire = type({
messageId: "string",
pinnedBy: "string",
pinnedAt: "string",
});
export type Pinned = typeof PinnedWire.infer;

function pinPath(tenantId: string, workbenchId: string, messageId: string) {
return `/api/tenants/${tenantId}/chat/workbenches/${workbenchId}/messages/${messageId}/pin`;
}

export function pinMessage(
tenantId: string,
workbenchId: string,
messageId: string,
): Promise<Pinned> {
return request(pinPath(tenantId, workbenchId, messageId), PinnedWire, {
method: "POST",
});
}

export async function unpinMessage(
tenantId: string,
workbenchId: string,
messageId: string,
): Promise<void> {
const response = await fetch(pinPath(tenantId, workbenchId, messageId), {
method: "DELETE",
});
if (response.status === 401) {
throw new UnauthenticatedError();
}
if (!response.ok) {
throw new ChatApiError(
`The server answered ${response.status} for ${pinPath(tenantId, workbenchId, messageId)}.`,
response.status,
);
}
}

// A pinned message's own content, for the pinned strip's preview — the
// same `MessageItem` shape plus who pinned it and when. See `GET
// /workbenches/:id/pins` in `packages/chat/src/routes.ts`.
const PinnedMessageWire = MessageItem.and({
pinnedBy: "string",
pinnedAt: "string",
});
export type PinnedMessage = typeof PinnedMessageWire.infer;

const PinnedMessagesResponse = type({ items: PinnedMessageWire.array() });

export function listPinnedMessages(
tenantId: string,
workbenchId: string,
): Promise<readonly PinnedMessage[]> {
return request(
`/api/tenants/${tenantId}/chat/workbenches/${workbenchId}/pins`,
PinnedMessagesResponse,
).then((page) => page.items);
}

// `parentThreadId` is the thread this one hangs directly off: null for the
// root thread, the root thread's id for a depth-1 thread, a depth-1
// thread's id for a depth-2 sub-thread. Two levels, stop — see
Expand Down Expand Up @@ -648,23 +563,6 @@ export function listThreads(
);
}

const ThreadMessagesResponse = type({
thread: WorkbenchThread,
items: MessageItem.array(),
});
export type ThreadMessagesResponse = typeof ThreadMessagesResponse.infer;

export function listThreadMessages(
tenantId: string,
workbenchId: string,
threadId: string,
): Promise<ThreadMessagesResponse> {
return request(
`/api/tenants/${tenantId}/chat/workbenches/${workbenchId}/threads/${threadId}/messages`,
ThreadMessagesResponse,
);
}

/**
* A first-class fork: spawn a sub-thread rooted at any message inside a
* thread — something Slack doesn't have (CL-5948). Idempotent per origin
Expand Down
Loading
Loading