Add member work history and learning docs

This commit is contained in:
Yahya Alhinai
2026-06-28 08:05:59 +00:00
parent 1adb8413b5
commit 97e5af4487
48 changed files with 4491 additions and 221 deletions
+56 -1
View File
@@ -1,4 +1,10 @@
import type { InterventionOutcome, Pod, PodActivityEvent, PodInput } from '@podman/shared';
import type {
InterventionOutcome,
MemberWorkHistory,
Pod,
PodActivityEvent,
PodInput,
} from '@podman/shared';
const BACKEND_URL =
import.meta.env.VITE_BACKEND_URL ||
@@ -13,6 +19,19 @@ export interface MemoryStats {
outcomes: number;
}
export interface LiveConversationSession {
sessionId: string;
podId: string;
identity: string;
displayName: string;
room: string;
url: string;
token: string;
startedAt: string;
lastEventAt?: string;
endedAt?: string;
}
async function json<T>(res: Response): Promise<T> {
if (!res.ok) {
const body = (await res.json().catch(() => ({}))) as { error?: string };
@@ -85,6 +104,19 @@ export function podActivityStreamUrl(id: string): string {
return `${BACKEND_URL}/api/pods/${encodeURIComponent(id)}/activity/stream`;
}
export async function getMemberWorkHistory(
podId: string,
member: string,
): Promise<MemberWorkHistory> {
return json(
await fetch(
`${BACKEND_URL}/api/pods/${encodeURIComponent(podId)}/members/${encodeURIComponent(
member,
)}/history?hours=24&limit=80`,
),
);
}
export async function createPod(input: PodInput): Promise<Pod> {
return json(
await fetch(`${BACKEND_URL}/api/pods`, {
@@ -133,6 +165,29 @@ export async function testPodVoice(id: string): Promise<void> {
if (!res.ok) throw new Error(`voice test failed: ${res.status}`);
}
export async function startLiveConversation(
podId: string,
input: { identity: string; displayName?: string },
): Promise<LiveConversationSession> {
return json(
await fetch(`${BACKEND_URL}/api/pods/${encodeURIComponent(podId)}/live-conversation/start`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(input),
}),
);
}
export async function stopLiveConversation(podId: string, sessionId: string): Promise<void> {
const res = await fetch(
`${BACKEND_URL}/api/pods/${encodeURIComponent(
podId,
)}/live-conversation/${encodeURIComponent(sessionId)}/stop`,
{ method: 'POST' },
);
if (!res.ok) throw new Error(`live conversation stop failed: ${res.status}`);
}
export async function removeMember(id: string, name: string): Promise<Pod> {
return json(
await fetch(