2026-04-24 16:52:40 -05:00
|
|
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
2026-04-24 21:30:48 -05:00
|
|
|
import { client } from "./client";
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
import { QK } from "./keys";
|
|
|
|
|
|
|
|
|
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
function err(e: unknown): never {
|
|
|
|
|
throw new Error(typeof e === "object" ? JSON.stringify(e) : String(e));
|
|
|
|
|
}
|
2026-04-24 21:30:48 -05:00
|
|
|
|
|
|
|
|
// ─── Workspaces ──────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function useWorkspaces(page = 1, pageSize = 20) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.workspaces(page, pageSize),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST("/v3/workspaces/list", {
|
|
|
|
|
params: { query: { page, page_size: pageSize } },
|
|
|
|
|
body: {},
|
|
|
|
|
});
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useWorkspace(workspaceId: string) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.workspace(workspaceId),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST("/v3/workspaces", {
|
|
|
|
|
body: { id: workspaceId, metadata: {} },
|
|
|
|
|
});
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
export function useUpdateWorkspace(workspaceId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (body: { metadata?: Record<string, unknown> }) => {
|
2026-04-24 16:52:40 -05:00
|
|
|
const { data, error } = await client.current.PUT("/v3/workspaces/{workspace_id}", {
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
body,
|
|
|
|
|
});
|
|
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["workspace", workspaceId] });
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["workspaces"] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useDeleteWorkspace() {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (workspaceId: string) => {
|
|
|
|
|
const { error } = await client.current.DELETE("/v3/workspaces/{workspace_id}", {
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
});
|
|
|
|
|
if (error) err(error);
|
|
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["workspaces"] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useScheduleDream(workspaceId: string) {
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (body: {
|
|
|
|
|
observer: string;
|
|
|
|
|
observed?: string | null;
|
|
|
|
|
dream_type: "omni";
|
|
|
|
|
session_id?: string | null;
|
|
|
|
|
}) => {
|
2026-04-24 16:52:40 -05:00
|
|
|
const { error } = await client.current.POST("/v3/workspaces/{workspace_id}/schedule_dream", {
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
body,
|
|
|
|
|
});
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
if (error) err(error);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-24 21:30:48 -05:00
|
|
|
export function useQueueStatus(workspaceId: string) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.queueStatus(workspaceId),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/queue/status",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId } } },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId),
|
|
|
|
|
refetchInterval: 10_000,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useSearchWorkspace(workspaceId: string, query: string, enabled = false) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.workspaceSearch(workspaceId, query),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
2026-04-24 16:52:40 -05:00
|
|
|
const { data, error } = await client.current.POST("/v3/workspaces/{workspace_id}/search", {
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
body: { query, limit: 20 },
|
|
|
|
|
});
|
|
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: enabled && Boolean(workspaceId) && Boolean(query),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Peers ────────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function usePeers(workspaceId: string, page = 1, pageSize = 20) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.peers(workspaceId, page, pageSize),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/peers/list",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId }, query: { page, page_size: pageSize } },
|
|
|
|
|
body: {},
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function usePeer(workspaceId: string, peerId: string) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.peer(workspaceId, peerId),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
2026-04-24 16:52:40 -05:00
|
|
|
const { data, error } = await client.current.POST("/v3/workspaces/{workspace_id}/peers", {
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
body: { id: peerId, metadata: {} },
|
|
|
|
|
});
|
|
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(peerId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
export function useUpdatePeer(workspaceId: string, peerId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (body: { metadata?: Record<string, unknown> }) => {
|
|
|
|
|
const { data, error } = await client.current.PUT(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId, peer_id: peerId } }, body },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["peer", workspaceId, peerId] });
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["peers", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-24 16:52:40 -05:00
|
|
|
export function usePeerRepresentation(workspaceId: string, peerId: string, target?: string) {
|
2026-04-24 21:30:48 -05:00
|
|
|
return useQuery({
|
2026-04-24 16:52:40 -05:00
|
|
|
queryKey: QK.peerRepresentation(workspaceId, peerId, target),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}/representation",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, peer_id: peerId } },
|
2026-04-24 16:52:40 -05:00
|
|
|
body: { max_conclusions: 20, ...(target ? { target } : {}) },
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(peerId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function usePeerCard(workspaceId: string, peerId: string) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.peerCard(workspaceId, peerId),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}/card",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId, peer_id: peerId } } },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(peerId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useSetPeerCard(workspaceId: string, peerId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (peerCard: string[]) => {
|
|
|
|
|
const { data, error } = await client.current.PUT(
|
2026-04-24 21:30:48 -05:00
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}/card",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, peer_id: peerId } },
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
body: { peer_card: peerCard },
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: QK.peerCard(workspaceId, peerId) });
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function usePeerContext(workspaceId: string, peerId: string) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.peerContext(workspaceId, peerId),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}/context",
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
{ params: { path: { workspace_id: workspaceId, peer_id: peerId } } },
|
2026-04-24 21:30:48 -05:00
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(peerId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function usePeerSessions(workspaceId: string, peerId: string, page = 1, pageSize = 20) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.peerSessions(workspaceId, peerId, page, pageSize),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}/sessions",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId, peer_id: peerId },
|
|
|
|
|
query: { page, page_size: pageSize },
|
|
|
|
|
},
|
|
|
|
|
body: {},
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(peerId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
export function useSearchPeer(workspaceId: string, peerId: string) {
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (query: string) => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}/search",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, peer_id: peerId } },
|
|
|
|
|
body: { query, limit: 20 },
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-24 21:30:48 -05:00
|
|
|
export function useChat(workspaceId: string, peerId: string) {
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
const qc = useQueryClient();
|
2026-04-24 21:30:48 -05:00
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (message: string) => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/peers/{peer_id}/chat",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, peer_id: peerId } },
|
|
|
|
|
body: { query: message, stream: false, reasoning_level: "low" },
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
qc.invalidateQueries({ queryKey: ["peer-context", workspaceId, peerId] });
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Sessions ─────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function useSessions(workspaceId: string, page = 1, pageSize = 20) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.sessions(workspaceId, page, pageSize),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/list",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId },
|
|
|
|
|
query: { page, page_size: pageSize },
|
|
|
|
|
},
|
2026-05-28 17:11:50 -04:00
|
|
|
body: { reverse: true },
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
export function useUpdateSession(workspaceId: string, sessionId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (body: { metadata?: Record<string, unknown> }) => {
|
|
|
|
|
const { data, error } = await client.current.PUT(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId, session_id: sessionId } }, body },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["sessions", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useDeleteSession(workspaceId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (sessionId: string) => {
|
|
|
|
|
const { error } = await client.current.DELETE(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId, session_id: sessionId } } },
|
|
|
|
|
);
|
|
|
|
|
if (error) err(error);
|
|
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["sessions", workspaceId] });
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["peer-sessions", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useCloneSession(workspaceId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (sessionId: string) => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/clone",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId, session_id: sessionId } } },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["sessions", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useSearchSession(workspaceId: string, sessionId: string) {
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (query: string) => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/search",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, session_id: sessionId } },
|
|
|
|
|
body: { query, limit: 20 },
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-24 21:30:48 -05:00
|
|
|
export function useSessionMessages(
|
|
|
|
|
workspaceId: string,
|
|
|
|
|
sessionId: string,
|
|
|
|
|
page = 1,
|
|
|
|
|
pageSize = 50,
|
|
|
|
|
) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.sessionMessages(workspaceId, sessionId, page, pageSize),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/messages/list",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId, session_id: sessionId },
|
|
|
|
|
query: { page, page_size: pageSize },
|
|
|
|
|
},
|
|
|
|
|
body: {},
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(sessionId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
export function useCreateMessages(workspaceId: string, sessionId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (
|
|
|
|
|
messages: Array<{ content: string; peer_id: string; metadata?: Record<string, unknown> }>,
|
|
|
|
|
) => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/messages",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, session_id: sessionId } },
|
|
|
|
|
body: { messages },
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["session-messages", workspaceId, sessionId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useUpdateMessage(workspaceId: string, sessionId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async ({
|
|
|
|
|
messageId,
|
|
|
|
|
body,
|
|
|
|
|
}: {
|
|
|
|
|
messageId: string;
|
|
|
|
|
body: { metadata?: Record<string, unknown> };
|
|
|
|
|
}) => {
|
|
|
|
|
const { data, error } = await client.current.PUT(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/messages/{message_id}",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: {
|
|
|
|
|
workspace_id: workspaceId,
|
|
|
|
|
session_id: sessionId,
|
|
|
|
|
message_id: messageId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
body,
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["session-messages", workspaceId, sessionId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Session ↔ Peer membership ────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function useSessionPeers(workspaceId: string, sessionId: string) {
|
2026-04-24 21:30:48 -05:00
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.sessionPeers(workspaceId, sessionId),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/peers",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId, session_id: sessionId } } },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(sessionId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SessionPeerConfigMap = Record<
|
|
|
|
|
string,
|
|
|
|
|
{ observe_me?: boolean | null; observe_others?: boolean | null }
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
|
export function useAddPeersToSession(workspaceId: string, sessionId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (peers: SessionPeerConfigMap) => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/peers",
|
2026-04-24 21:30:48 -05:00
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, session_id: sessionId } },
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
body: peers,
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["session-peers", workspaceId, sessionId] });
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["peer-sessions", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useSetSessionPeers(workspaceId: string, sessionId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (peers: SessionPeerConfigMap) => {
|
|
|
|
|
const { data, error } = await client.current.PUT(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/peers",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, session_id: sessionId } },
|
|
|
|
|
body: peers,
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["session-peers", workspaceId, sessionId] });
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["peer-sessions", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useRemovePeersFromSession(workspaceId: string, sessionId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (peerIds: string[]) => {
|
|
|
|
|
const { error } = await client.current.DELETE(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/peers",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId, session_id: sessionId } },
|
|
|
|
|
body: peerIds,
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
if (error) err(error);
|
|
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["session-peers", workspaceId, sessionId] });
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["peer-sessions", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function usePeerConfig(workspaceId: string, sessionId: string, peerId: string) {
|
|
|
|
|
return useQuery({
|
|
|
|
|
queryKey: QK.peerConfig(workspaceId, sessionId, peerId),
|
|
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/peers/{peer_id}/config",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId, session_id: sessionId, peer_id: peerId },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(sessionId) && Boolean(peerId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useSetPeerConfig(workspaceId: string, sessionId: string, peerId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (config: Record<string, unknown>) => {
|
|
|
|
|
const { data, error } = await client.current.PUT(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/peers/{peer_id}/config",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId, session_id: sessionId, peer_id: peerId },
|
|
|
|
|
},
|
|
|
|
|
body: config,
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: QK.peerConfig(workspaceId, sessionId, peerId) });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Session summaries & context ──────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function useSessionSummaries(workspaceId: string, sessionId: string) {
|
|
|
|
|
return useQuery({
|
|
|
|
|
queryKey: QK.sessionSummaries(workspaceId, sessionId),
|
|
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/summaries",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId, session_id: sessionId } } },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(sessionId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useSessionContext(workspaceId: string, sessionId: string) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.sessionContext(workspaceId, sessionId),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/sessions/{session_id}/context",
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
{ params: { path: { workspace_id: workspaceId, session_id: sessionId } } },
|
2026-04-24 21:30:48 -05:00
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId) && Boolean(sessionId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Conclusions ──────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function useConclusions(
|
|
|
|
|
workspaceId: string,
|
|
|
|
|
filters: Record<string, unknown> = {},
|
|
|
|
|
page = 1,
|
|
|
|
|
pageSize = 20,
|
2026-04-24 16:52:40 -05:00
|
|
|
reverse = false,
|
2026-04-24 21:30:48 -05:00
|
|
|
) {
|
|
|
|
|
return useQuery({
|
2026-04-24 16:52:40 -05:00
|
|
|
queryKey: QK.conclusions(workspaceId, filters, page, pageSize, reverse),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/conclusions/list",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId },
|
2026-04-24 16:52:40 -05:00
|
|
|
query: { page, page_size: pageSize, reverse },
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
body: filters,
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useQueryConclusions(
|
|
|
|
|
workspaceId: string,
|
|
|
|
|
query: string,
|
|
|
|
|
filters: Record<string, unknown> = {},
|
|
|
|
|
enabled = false,
|
|
|
|
|
) {
|
|
|
|
|
return useQuery({
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
queryKey: QK.conclusionsQuery(workspaceId, query, filters),
|
2026-04-24 21:30:48 -05:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/conclusions/query",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
body: { query, top_k: 10, ...filters },
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
2026-04-24 21:30:48 -05:00
|
|
|
},
|
|
|
|
|
enabled: enabled && Boolean(workspaceId) && Boolean(query),
|
|
|
|
|
});
|
|
|
|
|
}
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
|
|
|
|
|
export function useCreateConclusion(workspaceId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (conclusion: {
|
|
|
|
|
observer_id: string;
|
|
|
|
|
observed_id: string;
|
|
|
|
|
content: string;
|
|
|
|
|
session_id?: string | null;
|
|
|
|
|
}) => {
|
|
|
|
|
const { data, error } = await client.current.POST(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/conclusions",
|
|
|
|
|
{
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
body: { conclusions: [conclusion] },
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["conclusions", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useDeleteConclusion(workspaceId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (conclusionId: string) => {
|
|
|
|
|
const { error } = await client.current.DELETE(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/conclusions/{conclusion_id}",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId, conclusion_id: conclusionId },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
if (error) err(error);
|
|
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["conclusions", workspaceId] });
|
|
|
|
|
qc.invalidateQueries({ queryKey: ["conclusions-query", workspaceId] });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Webhooks ─────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function useWebhooks(workspaceId: string) {
|
|
|
|
|
return useQuery({
|
|
|
|
|
queryKey: QK.webhooks(workspaceId),
|
|
|
|
|
queryFn: async () => {
|
2026-04-24 16:52:40 -05:00
|
|
|
const { data, error } = await client.current.GET("/v3/workspaces/{workspace_id}/webhooks", {
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
});
|
|
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
enabled: Boolean(workspaceId),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useCreateWebhook(workspaceId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (url: string) => {
|
2026-04-24 16:52:40 -05:00
|
|
|
const { data, error } = await client.current.POST("/v3/workspaces/{workspace_id}/webhooks", {
|
|
|
|
|
params: { path: { workspace_id: workspaceId } },
|
|
|
|
|
body: { url },
|
|
|
|
|
});
|
|
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: QK.webhooks(workspaceId) });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useDeleteWebhook(workspaceId: string) {
|
|
|
|
|
const qc = useQueryClient();
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async (endpointId: string) => {
|
|
|
|
|
const { error } = await client.current.DELETE(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/webhooks/{endpoint_id}",
|
|
|
|
|
{
|
|
|
|
|
params: {
|
|
|
|
|
path: { workspace_id: workspaceId, endpoint_id: endpointId },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
if (error) err(error);
|
|
|
|
|
},
|
|
|
|
|
onSuccess: () => {
|
|
|
|
|
qc.invalidateQueries({ queryKey: QK.webhooks(workspaceId) });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useTestWebhook(workspaceId: string) {
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.GET(
|
|
|
|
|
"/v3/workspaces/{workspace_id}/webhooks/test",
|
|
|
|
|
{ params: { path: { workspace_id: workspaceId } } },
|
|
|
|
|
);
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ─── Keys ─────────────────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
export function useCreateKey() {
|
|
|
|
|
return useMutation({
|
|
|
|
|
mutationFn: async () => {
|
|
|
|
|
const { data, error } = await client.current.POST("/v3/keys", {});
|
2026-04-24 16:52:40 -05:00
|
|
|
return data ?? err(error);
|
feat: wire all remaining API endpoints
- src/api/keys.ts: QK singleton for all 20+ query key patterns
- src/api/queries.ts: rewritten with QK + full mutation coverage:
deleteWorkspace, updateWorkspace, scheduleDream,
updatePeer, setPeerCard, searchPeer,
deleteSession, updateSession, cloneSession, searchSession,
createMessages, updateMessage,
useSessionPeers, addPeersToSession, setSessionPeers,
removePeersFromSession, setPeerConfig,
createConclusion, deleteConclusion,
useWebhooks, createWebhook, deleteWebhook, testWebhook,
createKey
Shared primitives (just-in-time):
- ConfirmDialog: animated modal with keyboard/click-out dismiss
- FormModal: reusable modal shell
- InlineEditor: click-to-edit with commit/cancel
New surfaces:
- WorkspaceDetail: delete + schedule dream buttons
- ScheduleDreamModal: Zod-validated observer/session form
- WebhookManager: full CRUD + test emit (new /webhooks route)
- SessionDetail: delete, clone, session search, peer membership tab
- PeerDetail: editable peer card, semantic search tab
- ConclusionBrowser: create conclusion modal (Zod), per-row delete
2026-04-24 11:25:19 -05:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|