diff --git a/src/apps/officer-web/Screens/Dashboard/CapabilityPage.tsx b/src/apps/officer-web/Screens/Dashboard/CapabilityPage.tsx index 40b9cc72..841b82f7 100644 --- a/src/apps/officer-web/Screens/Dashboard/CapabilityPage.tsx +++ b/src/apps/officer-web/Screens/Dashboard/CapabilityPage.tsx @@ -9,7 +9,7 @@ import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog'; import { useClient } from 'hooks/useClient'; import { Card } from '@/components/Card'; -import { usePiChat, EmbeddableChat } from 'officerdev'; +import { useChat, EmbeddableChat } from 'officerdev'; type CapabilitySummary = { dirName: string; name: string; @@ -279,7 +279,7 @@ export const CapabilityChat = ({ ? (description ?? `Help me create the content for this new ${kind} file`) : `Help me understand and improve this ${kind} file`; - const pi = usePiChat(undefined, undefined, { replaceUrl: false }); + const pi = useChat(undefined, undefined, { replaceUrl: false }); const onResponseEndRef = useRef(onResponseEnd); onResponseEndRef.current = onResponseEnd; diff --git a/src/workspaces/officerdev/HOOK_CONVENTIONS.md b/src/workspaces/officerdev/HOOK_CONVENTIONS.md index 5cd12dfc..4a2f8ed3 100644 --- a/src/workspaces/officerdev/HOOK_CONVENTIONS.md +++ b/src/workspaces/officerdev/HOOK_CONVENTIONS.md @@ -20,12 +20,12 @@ import { useClient } from 'hooks/useClient'; const DEBOUNCE_MS = 1000; -export function usePiChat(sessionId?: string, model?: string | null) { +export function useChat(sessionId?: string, model?: string | null) { // ... return { messages, sendPrompt, stopGeneration }; } -export type UsePiChatType = ReturnType; +export type UseChatType = ReturnType; // ── Types ── @@ -46,7 +46,7 @@ Hooks that are self-contained (one function, a few types, maybe some helpers) st ``` hooks/ ├── useFilesAPI.ts -├── usePiChat.ts +├── useChat.ts └── index.ts ``` @@ -113,7 +113,7 @@ The root `hooks/index.ts` re-exports everything. Each entry is a single `export export * from './appRegistry'; export * from './useFilesAPI'; export * from './useFileViewerPanels'; -export * from './usePiChat'; +export * from './useChat'; ``` When adding a new hook, add one line here. Order alphabetically. diff --git a/src/workspaces/officerdev/src/apps/Chat/ChatPanelWrapper.tsx b/src/workspaces/officerdev/src/apps/Chat/ChatPanelWrapper.tsx index 742c5013..cbfe32a2 100644 --- a/src/workspaces/officerdev/src/apps/Chat/ChatPanelWrapper.tsx +++ b/src/workspaces/officerdev/src/apps/Chat/ChatPanelWrapper.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { useWorkspace } from '../../components/Workspace'; import { usePanelChannel } from 'hooks/usePanelChannel'; import { useSavedSessions, messagesToTranscript, type RawMessage } from 'state/useSavedSessions'; -import { usePiChat } from '../../hooks/usePiChat'; +import { useChat } from '../../hooks/useChat'; import { EmbeddableChat } from './EmbeddableChat'; import type { ChatSessionSelection } from './ChatHeader'; @@ -56,7 +56,7 @@ const ChatPanelInner = ({ [onTurnComplete, updateSessionMessages], ); - const chat = usePiChat(sessionId, model, { + const chat = useChat(sessionId, model, { replaceUrl: false, projectScoped: scoped, onTurnComplete: handleTurnComplete, diff --git a/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx b/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx index 3a6f21aa..7a8be639 100644 --- a/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx +++ b/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx @@ -1,4 +1,4 @@ -import type { UsePiChatType } from '../../../hooks/usePiChat'; +import type { UseChatType } from '../../../hooks/useChat'; import { useEmbeddableChat } from './useEmbeddableChat'; import { MessageList } from '../components/MessageList'; import { InputArea } from '../components/InputArea'; @@ -19,7 +19,7 @@ type EmbeddableChatProps = { sandboxed?: boolean; replaceUrl?: boolean; autoSend?: boolean; - chat?: UsePiChatType; + chat?: UseChatType; context?: string; contextId?: string; onMessageComplete?: () => void; diff --git a/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/useEmbeddableChat.ts b/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/useEmbeddableChat.ts index 6f02ce4b..0de7291e 100644 --- a/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/useEmbeddableChat.ts +++ b/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/useEmbeddableChat.ts @@ -1,7 +1,7 @@ import type { KeyboardEvent } from 'react'; import { useState, useRef, useEffect } from 'react'; import { useUserVisibleModels } from 'state/useModels'; -import { usePiChat, type UsePiChatType } from '../../../hooks/usePiChat'; +import { useChat, type UseChatType } from '../../../hooks/useChat'; import { useAttachments } from '../useAttachments'; import { useSlashCommands } from '../useSlashCommands'; @@ -20,7 +20,7 @@ type UseEmbeddableChatParams = { sandboxed?: boolean; replaceUrl?: boolean; autoSend?: boolean; - chat?: UsePiChatType; + chat?: UseChatType; context?: string; contextId?: string; }; @@ -28,7 +28,7 @@ type UseEmbeddableChatParams = { export function useEmbeddableChat(params: UseEmbeddableChatParams, onMessageComplete?: () => void) { const { initialMessage, defaultInput = '', promptPrefix, cwd, sandboxed, autoSend = false, chat: externalChat } = params; - const internalChat = usePiChat(params.sessionId, params.initialModel, { replaceUrl: params.replaceUrl ?? false, context: params.context, contextId: params.contextId }); + const internalChat = useChat(params.sessionId, params.initialModel, { replaceUrl: params.replaceUrl ?? false, context: params.context, contextId: params.contextId }); const chat = externalChat ?? internalChat; const { diff --git a/src/workspaces/officerdev/src/apps/Chat/index.ts b/src/workspaces/officerdev/src/apps/Chat/index.ts index 3497bc6d..bbcdc4f4 100644 --- a/src/workspaces/officerdev/src/apps/Chat/index.ts +++ b/src/workspaces/officerdev/src/apps/Chat/index.ts @@ -14,7 +14,7 @@ export { AttachmentList } from './components/AttachmentList'; export { AttachButton } from './components/AttachButton'; export { WebpageDialog } from './components/WebpageDialog'; export { EmbeddableChat, type UseEmbeddableChatType } from './EmbeddableChat'; -export { usePiChat, type UsePiChatType } from '../../hooks/usePiChat'; +export { useChat, type UseChatType } from '../../hooks/useChat'; export { ChatList } from './ChatList'; export { useSlashCommands } from './useSlashCommands'; export { useAttachments, type UseAttachmentsType } from './useAttachments'; diff --git a/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx b/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx index 3c5aa080..757db1c0 100644 --- a/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx +++ b/src/workspaces/officerdev/src/apps/ChatHistory/ChatDetailPanel.tsx @@ -5,7 +5,7 @@ import { usePanelChannel } from 'hooks/usePanelChannel'; import { useAuth } from 'hooks/useAuth'; import { useSavedSessions } from 'state/useSavedSessions'; import { useClaudeSessions } from 'state/useClaudeSessions'; -import { usePiChat, EmbeddableChat } from '../Chat'; +import { useChat, EmbeddableChat } from '../Chat'; import type { ChatMessage } from '../Chat/types'; export type SelectedSession = { @@ -113,7 +113,7 @@ function NewChat({ resumeSummary, resumeSessionId, initialMessages, savedId: ini // context 'chat' tells the backend to run this session from the dedicated claude_sessions cwd, so // its transcript lands in Claude's own store as an isolated project group (source of truth). - const chat = usePiChat(undefined, locationState?.model, { resumeSummary, resumeSessionId, initialMessages, onTurnComplete, context: 'chat' }); + const chat = useChat(undefined, locationState?.model, { resumeSummary, resumeSessionId, initialMessages, onTurnComplete, context: 'chat' }); chatSessionRef.current = chat.sessionId; const isSaved = savedId != null; diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx index 8bd194e4..8b635a90 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/TaskRunnerModal.tsx @@ -5,7 +5,7 @@ import { Dialog, DialogOverlay, DialogPortal } from '@/components/ui/dialog'; import * as DialogPrimitive from '@radix-ui/react-dialog'; import { cardStyle } from '@/components/Card'; import type { TaskInfo, ChatMessage } from '../../../Chat'; -import { usePiChat, MessageBubble, StreamingBubble, ModelSelector } from '../../../Chat'; +import { useChat, MessageBubble, StreamingBubble, ModelSelector } from '../../../Chat'; import { useSettings } from 'state/useSettings'; import { useUserVisibleModels } from 'state/useModels'; import { useClient } from 'hooks/useClient'; @@ -40,7 +40,7 @@ const playDing = () => { type Phase = 'ready' | 'running' | 'done'; -type PiMonoInnerProps = { +type AgenticTaskRunnerProps = { taskDirName: string; defaultInput: string; cwd: { root?: string; path: string }; @@ -50,9 +50,9 @@ type PiMonoInnerProps = { context: Record; }; -const PiMonoInner = ({ taskDirName, defaultInput, cwd, initialModel, taskInfo, sandboxed, context }: PiMonoInnerProps) => { +const AgenticTaskRunner = ({ taskDirName, defaultInput, cwd, initialModel, taskInfo, sandboxed, context }: AgenticTaskRunnerProps) => { const [phase, setPhase] = useState('ready'); - const chat = usePiChat(undefined, initialModel, { replaceUrl: false, taskInfo }); + const chat = useChat(undefined, initialModel, { replaceUrl: false, taskInfo }); const availableModels = useUserVisibleModels(); const client = useClient(); const [inputDefs, setInputDefs] = useState | null>(null); @@ -1513,12 +1513,12 @@ export const TaskRunnerModal = ({ open, onOpenChange, task, entryName, entryFull onClose={() => onOpenChange(false)} /> ) : ( - void; }; -export function usePiChat(initialSessionId?: string, initialModel?: string | null, options?: UsePiChatOptions) { +export function useChat(initialSessionId?: string, initialModel?: string | null, options?: UsePiChatOptions) { const { replaceUrl = true, storage, @@ -366,4 +366,4 @@ export function usePiChat(initialSessionId?: string, initialModel?: string | nul }; } -export type UsePiChatType = ReturnType; +export type UseChatType = ReturnType; diff --git a/src/workspaces/officerdev/src/index.ts b/src/workspaces/officerdev/src/index.ts index bbef4cfa..0eb2a1de 100644 --- a/src/workspaces/officerdev/src/index.ts +++ b/src/workspaces/officerdev/src/index.ts @@ -16,13 +16,13 @@ export { AttachButton, WebpageDialog, EmbeddableChat, - usePiChat, + useChat, ChatList, useSlashCommands, useAttachments, useAudioRecording, } from './apps/Chat'; -export type { UseEmbeddableChatType, UsePiChatType, UseAttachmentsType, UseAudioRecordingType } from './apps/Chat'; +export type { UseEmbeddableChatType, UseChatType, UseAttachmentsType, UseAudioRecordingType } from './apps/Chat'; export * from './apps/Chat/types'; export { SessionBar, SessionList, ChatDetailPanel } from './apps/ChatHistory'; export type { SelectedSession } from './apps/ChatHistory';