All files / src/context GrackleContextTypes.ts

0% Statements 0/0
0% Branches 1/1
0% Functions 1/1
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87                                                                                                                                                                             
/**
 * Type definitions for the GrackleContext value.
 * Kept separate so both the real provider (in @grackle-ai/web) and
 * MockGrackleProvider can use them without circular dependencies.
 *
 * @module
 */
 
import type {
  UsageStats,
  UseKnowledgeResult,
  UseEnvironmentsResult,
  UseSessionsResult,
  UseWorkspacesResult,
  UseTasksResult,
  UseTokensResult,
  UseCredentialsResult,
  UseCodespacesResult,
  UseDockerContainersResult,
  UsePersonasResult,
  UseAgentsResult,
  UsePluginsResult,
  UseSchedulesResult,
  UseStreamsResult,
  UseGitHubAccountsResult,
  UseResourcesResult,
  UseDocumentsResult,
  ConnectionStatus,
} from "../hooks/types.js";
 
/** Return type for the useGrackleSocket hook (and the GrackleContext value). */
export interface UseGrackleSocketResult {
  /** Current connection state of the event stream. */
  connectionStatus: ConnectionStatus;
  /** Environment state and actions. */
  environments: Omit<UseEnvironmentsResult, "handleEvent" | "handleLegacyMessage">;
  /** Session state and actions. */
  sessions: Omit<
    UseSessionsResult,
    "handleMessage" | "handleSessionEvent" | "handleLegacyMessage" | "loadSessions"
  >;
  /** Workspace state and actions. */
  workspaces: Omit<UseWorkspacesResult, "handleEvent" | "onDisconnect">;
  /** Task state and actions. */
  tasks: Omit<UseTasksResult, "handleEvent" | "onDisconnect" | "handleLegacyMessage">;
  /** Token state and actions. */
  tokens: Omit<UseTokensResult, "handleEvent">;
  /** Credential provider state and actions. */
  credentials: Omit<UseCredentialsResult, "handleEvent" | "loadCredentials">;
  /** GitHub Codespace state and actions. */
  codespaces: UseCodespacesResult;
  /** Docker container discovery (attach mode) state and actions. */
  dockerContainers: UseDockerContainersResult;
  /** Persona state and actions. */
  personas: Omit<UsePersonasResult, "handleEvent" | "loadPersonas">;
  /** Agent state and actions (#1417). */
  agents: Omit<UseAgentsResult, "handleEvent" | "loadAgents">;
  /** Schedule state and actions. */
  schedules: Omit<UseSchedulesResult, "handleEvent" | "loadSchedules">;
  /** IPC stream state and actions. */
  streams: Omit<UseStreamsResult, "handleEvent">;
  /** Knowledge graph state and actions. */
  knowledge: Omit<UseKnowledgeResult, "handleEvent">;
  /** Plugin state and actions. */
  plugins: Omit<UsePluginsResult, "domainHook">;
  /** GitHub account state and actions. */
  githubAccounts: Omit<UseGitHubAccountsResult, "domainHook">;
  /** Resource bridge: read/watch files from an environment's worktree (#1395). */
  resources: Omit<UseResourcesResult, "domainHook" | "contentVersion">;
  /** Live-docs pane: open/close/activate read-only document tabs (#1396). */
  documents: Omit<UseDocumentsResult, "domainHook">;
  /** App-level default persona ID setting. */
  appDefaultPersonaId: string;
  /** Update the app-level default persona ID. */
  setAppDefaultPersonaId: (personaId: string) => Promise<void>;
  /** Whether the user has completed onboarding. */
  onboardingCompleted: boolean | undefined;
  /** Mark onboarding as completed. */
  completeOnboarding: () => Promise<void>;
  /** Cached usage statistics keyed by "scope:id". */
  usageCache: Record<string, UsageStats>;
  /** Load usage statistics for a given scope and ID. */
  loadUsage: (scope: string, id: string) => Promise<void>;
  /** Refresh environments, sessions, workspaces, and tokens from the server. */
  refresh: () => void;
}