Hooks
iOSAndroidExpo Go
Installation
pnpm dlx @kivacore/ui-cli add @kivacore/rn-hooks-use-kiva-agent-projectsRequired Packages(1 package)
pnpm add @tanstack/react-queryA verbatim port of the web hook. Endpoints: GET /v1/ai/projects, POST /v1/ai/projects ({ name, description?, tenant_ai_agent_id }), PATCH /v1/ai/projects/{id} ({ name }), DELETE /v1/ai/projects/{id}. The list is filtered client-side to the agent (and to userId when given). Pair it with KivaAgentProjectsView / KivaAgentSidebarProjectsSection.
Usage
import { KivaAgentProjectsView } from '@/components/kiva-native/kiva-agent';
import { useKivaAgentProjects } from '@/hooks/kiva-native/use-kiva-agent-projects';
const { projects, createProject, deleteProject } = useKivaAgentProjects({ client, agentId: AGENT_ID });API Reference
UseKivaAgentProjectsArgs
| Option | Type | Default | Description |
|---|---|---|---|
client | KivaAgentProjectsClient | null | undefined | - | Client with get / post / patch / delete |
agentId | string | - | Tenant AI agent ID (required) |
userId | string | null | null | Only projects owned by / shared with this user |
enabled | boolean | !!client | Toggle the list query |
UseKivaAgentProjectsResult
| Field | Type | Description |
|---|---|---|
projects | KivaAgentProject[] | { id, name, description?, agentId?, deploymentId?, createdBy?, sharedTo? } |
isLoading / error | boolean / Error | null | List query state |
refresh | () => Promise<void> | Invalidate the list |
createProject | (input: CreateProjectInput) => Promise<KivaAgentProject | null> | { name, description? } |
isCreating | boolean | Create pending |
renameProject | (projectId, name) => Promise<boolean> | Rename |
isRenaming | boolean | Rename pending |
deleteProject | (projectId) => Promise<boolean> | Delete |
isDeleting | boolean | Delete pending |