open-index/open-npm huggingface dataset:
npm package: @meridianlabs/inspect-scout-viewer
Description: Inspect Scout viewer for evaluation logs.
Latest version: 0.4.21

# Inspect Scout Viewer

A React-based web viewer for Inspect AI evaluation logs.

## Prerequisites

This project uses [pnpm](https://pnpm.io/) as its package manager, managed through [corepack](https://nodejs.org/api/corepack.html).

### Setup

**Enable corepack** (required once):
```bash
corepack enable
```

That's it! Corepack is built into Node.js 16.9+ and will automatically install the correct pnpm version (specified in `package.json`) when you run pnpm commands.

**Alternative:** If you prefer to install pnpm manually, see the [official pnpm installation guide](https://pnpm.io/installation).

### Install Dependencies

```bash
pnpm install
```

## Development

Start the development server:

```bash
pnpm dev
```

Build for production:

```bash
pnpm build
```

Watch mode for development:

```bash
pnpm watch
```

Preview production build:

```bash
pnpm preview
```

## Code Quality

Run linting:

```bash
pnpm lint
```

Auto-fix linting issues:

```bash
pnpm lint:fix
```

Format code:

```bash
pnpm format
```

Check formatting:

```bash
pnpm format:check
```

Type check:

```bash
pnpm typecheck
```

Run all checks (lint, format, typecheck):

```bash
pnpm check
```

## TypeScript Types from OpenAPI

Types are auto-generated from the FastAPI OpenAPI spec to keep client/server in sync.

### How It Works

The type generation pipeline:
```
Python Pydantic models → openapi.json → generated.ts → built app
```

1. **Export schema**: Python script exports OpenAPI spec from FastAPI to `openapi.json`
2. **Generate types**: `openapi-typescript` generates TypeScript types from schema
3. **Type adapter**: `src/types/api-types.ts` re-exports types with clean names
4. **Usage**: Import types from `src/types/index.ts` in your code

### Updating Types After API Changes

When Python Pydantic models change:

```bash
# 1. Export updated OpenAPI schema
.venv/bin/python scripts/export_openapi_schema.py

# 2. Types regenerate automatically on next build
pnpm build
```

Commit both `openapi.json` and `src/types/generated.ts`.

### Manual Type Generation

```bash
pnpm types:generate
```

### CI Validation

CI automatically validates the type generation pipeline:

- **`openapi-schema` job**: Regenerates `openapi.json` and fails if it differs from committed version
- **`js-build` job**: Regenerates `generated.ts` and fails if it differs from committed version

If CI fails, run the commands shown in the error message and commit the updated files.

## Tech Stack

- React 19
- TypeScript
- Vite
- Bootstrap 5
- AG Grid
- React Router
npm package: @meridianlabs/log-viewer
Description: Log viewer for inspect_ai logs.
Latest version: 0.3.201

# Inspect Log Viewer

React tools for viewing eval logs produced by [Inspect-AI](https://inspect.aisi.org.uk/).

## Installation

```bash
npm install @meridianlabs/log-viewer
```

## CSS Requirements

The log viewer requires CSS styles to display correctly. Import the bundled styles:

```typescript
import "@meridianlabs/log-viewer/styles/index.css";
```

This includes all required dependencies (Bootstrap, Bootstrap Icons, Prism.js themes).

### Example Usage

```tsx
import { useEffect, useState } from "react";
import {
    App as InspectApp,
    createViewServerApi,
    clientApi,
    initializeStore,
    ClientAPI,
    Capabilities,
} from "@meridianlabs/log-viewer";
import "@meridianlabs/log-viewer/styles/index.css";

export function App() {
    const [api, setApi] = useState<ClientAPI | null>(null);

    useEffect(() => {
        async function initializeApi() {
            // Get log directory from URL parameter
            const urlParams = new URLSearchParams(window.location.search);
            const logDir = urlParams.get("log_dir");

            if (!logDir) {
                console.error("Missing log_dir URL parameter");
                return;
            }

            // Create API instance
            const viewServerApi = createViewServerApi({
                // optional params
                logDir: logDir,
                apiBaseUrl: "https://mycompany.com/api",
            });
            const clientApiInstance = clientApi(viewServerApi);

            // Set up capabilities and storage
            const capabilities: Capabilities = {
                downloadFiles: true,
                webWorkers: true,
                streamSamples: true,
                streamSampleData: true,
                nativeFind: false,
            };

            // Initialize store and set API
            initializeStore(clientApiInstance, capabilities, undefined);
            setApi(clientApiInstance);
        }

        initializeApi();
    }, []);

    if (!api) {
        return <div>Loading...</div>;
    }

    return <InspectApp api={api} />;
}
```

## Developing

The Inspect log viewer is built into a bundled JS file using `vite`. For users who clone or install from the repo directly, we keep a bundled version committed in the `dist` folder. **When you make changes, your commits/PRs must include updates to the bundled files in the `dist` folder as well as the source code changes.**

### Before You Commit:

Run these commands in the `src/inspect_ai/_view/www` directory:

1. **Lint code:**

    ```bash
    yarn lint
    ```

    Fix any errors reported.

2. **Format code:**

    ```bash
    yarn prettier:write
    ```

3. **Build for library distribution:**

    ```bash
    yarn build:lib
    ```

4. **Build bundled output for the `dist` directory:**
    ```bash
    yarn build
    ```
    Don't forget to stage newly updated changes in the `dist` folder.

You may optionally set the `VIEW_SERVER_API_URL` environment variable at build time to use an API server running on a different host.