@metrevals/inspect-scout-viewer 0.3.153-beta.1765542109 → 0.4.4-beta.20251223202036

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/api/api.d.ts +7 -2
  2. package/lib/api/jsonrpc.d.ts +1 -0
  3. package/lib/api/request.d.ts +6 -1
  4. package/lib/app/appearance/icons.d.ts +2 -0
  5. package/lib/app/arrowHelpers.d.ts +4 -0
  6. package/lib/app/components/ColumnHeader.d.ts +6 -0
  7. package/lib/app/components/Explanation.d.ts +12 -0
  8. package/lib/app/{values → components}/Identifier.d.ts +2 -2
  9. package/lib/app/{navbar → components}/Navbar.d.ts +1 -0
  10. package/lib/app/components/TaskName.d.ts +8 -0
  11. package/lib/app/components/Value.d.ts +15 -0
  12. package/lib/app/hooks.d.ts +10 -15
  13. package/lib/app/scanJobs/ScanJobGrid.d.ts +5 -1
  14. package/lib/app/scanResults/ScanResultHeader.d.ts +9 -0
  15. package/lib/app/{result → scanResults}/info/InfoPanel.d.ts +2 -2
  16. package/lib/app/scanResults/metadata/MetadataPanel.d.ts +7 -0
  17. package/lib/app/scanResults/result/ResultBody.d.ts +7 -0
  18. package/lib/app/{result → scanResults}/result/ResultPanel.d.ts +2 -2
  19. package/lib/app/scanResults/result/ResultSidebar.d.ts +7 -0
  20. package/lib/app/{result → scanResults}/transcript/TranscriptPanel.d.ts +2 -2
  21. package/lib/app/scans/ScansPanel.d.ts +2 -0
  22. package/lib/app/scans/ScansPanelBody.d.ts +6 -0
  23. package/lib/app/scans/ScansPanelTitle.d.ts +6 -0
  24. package/lib/app/scans/info/ScanInfo.d.ts +5 -0
  25. package/lib/app/scans/results/ScanDataframeClearFiltersButton.d.ts +2 -0
  26. package/lib/app/scans/results/ScanDataframeColumnsPopover.d.ts +5 -0
  27. package/lib/app/scans/results/ScanDataframeFilterColumnsButton.d.ts +1 -0
  28. package/lib/app/scans/results/ScanResultsBody.d.ts +12 -0
  29. package/lib/app/scans/results/ScanResultsOutline.d.ts +5 -0
  30. package/lib/app/scans/results/ScanResultsPanel.d.ts +5 -0
  31. package/lib/app/{scanner → scans}/results/list/ScanResultsList.d.ts +2 -0
  32. package/lib/app/{scanner → scans}/results/list/ScanResultsRow.d.ts +2 -2
  33. package/lib/app/scans/results/types.d.ts +1 -0
  34. package/lib/app/server/hooks.d.ts +11 -0
  35. package/lib/app/types.d.ts +64 -72
  36. package/lib/app/utils/refs.d.ts +3 -2
  37. package/lib/app/utils/results.d.ts +8 -7
  38. package/lib/components/CopyButton.d.ts +2 -1
  39. package/lib/components/DataframeView.d.ts +1 -0
  40. package/lib/components/MarkdownDiv.d.ts +1 -0
  41. package/lib/components/MarkdownDivWithReferences.d.ts +3 -0
  42. package/lib/content/MetaDataGrid.d.ts +5 -2
  43. package/lib/content/RenderedText.d.ts +3 -0
  44. package/lib/content/types.d.ts +1 -0
  45. package/lib/hooks/useMapAsyncData.d.ts +27 -0
  46. package/lib/index.d.ts +1 -1
  47. package/lib/index.js +81623 -81108
  48. package/lib/index.js.map +1 -1
  49. package/lib/state/store.d.ts +7 -16
  50. package/lib/styles/index.css +399 -291
  51. package/lib/types/index.d.ts +39 -24
  52. package/lib/utils/asyncData.d.ts +66 -0
  53. package/lib/utils/asyncDataFromQuery.d.ts +13 -0
  54. package/lib/utils/brand.d.ts +70 -0
  55. package/lib/utils/path.d.ts +7 -4
  56. package/package.json +29 -24
  57. package/lib/app/result/ScanResultHeader.d.ts +0 -7
  58. package/lib/app/result/input/InputPanel.d.ts +0 -6
  59. package/lib/app/scanner/ScannerPanel.d.ts +0 -2
  60. package/lib/app/scanner/ScannerPanelBody.d.ts +0 -3
  61. package/lib/app/scanner/ScannerPanelTitle.d.ts +0 -2
  62. package/lib/app/scanner/info/ScanInfo.d.ts +0 -2
  63. package/lib/app/scanner/results/ScanResultsBody.d.ts +0 -2
  64. package/lib/app/scanner/results/ScanResultsOutline.d.ts +0 -2
  65. package/lib/app/scanner/results/ScanResultsPanel.d.ts +0 -2
  66. package/lib/app/values/Explanation.d.ts +0 -7
  67. package/lib/app/values/Value.d.ts +0 -10
  68. /package/lib/app/{values → components}/Error.d.ts +0 -0
  69. /package/lib/app/{values → components}/ValidationResult.d.ts +0 -0
  70. /package/lib/app/{navbar → components}/useBreadcrumbTruncation.d.ts +0 -0
  71. /package/lib/app/{result → scanResults}/ScanResultNav.d.ts +0 -0
  72. /package/lib/app/{result → scanResults}/ScanResultPanel.d.ts +0 -0
  73. /package/lib/app/{result → scanResults}/error/ErrorPanel.d.ts +0 -0
  74. /package/lib/app/{scanner → scans}/results/ScanDataframeWrapTextButton.d.ts +0 -0
  75. /package/lib/app/{scanner → scans}/results/ScanResultsFilter.d.ts +0 -0
  76. /package/lib/app/{scanner → scans}/results/ScanResultsGroup.d.ts +0 -0
  77. /package/lib/app/{scanner → scans}/results/ScanResultsSearch.d.ts +0 -0
  78. /package/lib/app/{scanner → scans}/results/list/ScanHeader.d.ts +0 -0
  79. /package/lib/app/{scanner → scans}/results/list/ScanResultsGroup.d.ts +0 -0
@@ -1,8 +1,4 @@
1
1
  import { ChatMessageAssistant, ChatMessageSystem, ChatMessageTool, ChatMessageUser, ContentImage, ContentText, Events } from './log';
2
- export interface Scans {
3
- results_dir: string;
4
- scans: Status[];
5
- }
6
2
  export interface Status {
7
3
  complete: boolean;
8
4
  spec: ScanSpec;
@@ -32,12 +28,6 @@ export interface Model {
32
28
  config: Record<string, unknown>;
33
29
  args: Record<string, unknown>;
34
30
  }
35
- export interface Transcript {
36
- type: string;
37
- count: number;
38
- data: string;
39
- fields: Array<Record<string, string>>;
40
- }
41
31
  export interface ScanSpec {
42
32
  scan_file?: string;
43
33
  scan_id: string;
@@ -50,7 +40,12 @@ export interface ScanSpec {
50
40
  packages?: Record<string, unknown>;
51
41
  revision?: Record<string, unknown>;
52
42
  scanners: Record<string, Scanner>;
53
- transcripts?: Transcript;
43
+ transcripts?: {
44
+ type: string;
45
+ location?: string;
46
+ transcript_ids: Record<string, string | null>;
47
+ count?: number;
48
+ };
54
49
  }
55
50
  export interface Scanner {
56
51
  name: string;
@@ -64,6 +59,7 @@ export interface ScannerSummary {
64
59
  tokens: number;
65
60
  model_usage: Record<string, ModelUsage>;
66
61
  validations: Array<boolean | Record<string, boolean>>;
62
+ metrics: Record<string, Record<string, number>>;
67
63
  }
68
64
  export interface ModelUsage {
69
65
  input_tokens: number;
@@ -75,25 +71,44 @@ export interface ModelUsage {
75
71
  }
76
72
  export type ChatMessages = ChatMessage[];
77
73
  export type ChatMessage = ChatMessageSystem | ChatMessageUser | ChatMessageAssistant | ChatMessageTool;
78
- export interface Transcript {
74
+ export interface TranscriptInfo {
79
75
  id: string;
80
76
  source_id: string;
81
- source_url: string;
77
+ source_uri: string;
78
+ source_type: string;
79
+ filename?: string;
80
+ date?: string;
81
+ task_set?: string;
82
+ task_id?: string;
83
+ task_repeat?: number;
84
+ agent?: string;
85
+ agent_args?: string;
86
+ model?: string;
87
+ model_options?: string;
88
+ score?: string;
89
+ success?: boolean;
90
+ total_time?: number;
91
+ total_tokens?: number;
92
+ error?: string;
93
+ limit?: string;
94
+ metadata: TranscriptMetadata;
95
+ }
96
+ export interface Transcript extends TranscriptInfo {
82
97
  messages: ChatMessages;
83
98
  events: Events;
84
- metadata: TranscriptMetadata;
85
99
  }
86
100
  export interface TranscriptMetadata {
87
- sample_id: string;
88
- id: string | number;
89
- epoch: number;
90
- eval_id: string;
91
- log: string;
92
- eval_created: string;
93
- eval_metadata: Record<string, unknown>;
94
- task_name: string;
95
- model: string;
96
- score: string;
101
+ sample_id?: string;
102
+ id?: string | number;
103
+ epoch?: number;
104
+ eval_id?: string;
105
+ log?: string;
106
+ date?: string;
107
+ eval_metadata?: Record<string, unknown>;
108
+ task?: string;
109
+ task_name?: string;
110
+ model?: string;
111
+ score?: string;
97
112
  [key: string]: unknown;
98
113
  }
99
114
  export interface ContentTool {
@@ -0,0 +1,66 @@
1
+ import { Brand } from './brand';
2
+ /**
3
+ * AsyncData represents the possible states of some asynchronous operation like
4
+ * a network request to an API. When the request is first made, it's `loading`, but
5
+ * once we get a response, it will either represent the requested `data` or maybe
6
+ * the operation failed due to an `error`.
7
+ *
8
+ * @typeParam T - the data that will be returned
9
+ */
10
+ export type AsyncData<T> = AsyncDataLoading | AsyncDataNotLoading<T>;
11
+ export type AsyncDataLoading = Brand<{
12
+ data?: undefined;
13
+ loading: true;
14
+ error?: undefined;
15
+ }, "_please_use_AsyncData.loading_rather_than_your_own_instance_of_this_type_">;
16
+ /**
17
+ * The different states the async data can be in when loading is finished.
18
+ *
19
+ * @typeParam T - the data type that can be returned when error is undefined
20
+ */
21
+ export type AsyncDataNotLoading<T> = {
22
+ data: T;
23
+ loading: false;
24
+ error?: undefined;
25
+ } | {
26
+ data?: undefined;
27
+ loading: false;
28
+ error: Error;
29
+ };
30
+ type AsyncDataMap<Mapping> = {
31
+ [K in keyof Mapping]: AsyncData<Mapping[K]>;
32
+ };
33
+ /**
34
+ * The `compose` function allows a set of `AsyncData` values to be combined into
35
+ * a single `AsyncData`. The complex type of the function represents a transformation
36
+ * from an argument like this...
37
+ *
38
+ * ```typescript
39
+ * { a: AsyncData<A>, b: AsyncData<B>, c: AsyncData<C> }
40
+ *```
41
+ * ...to a return value like this...
42
+ *```
43
+ * AsyncData<{ a: A, b: B, c: C }>
44
+ *```
45
+ *
46
+ * In practice, this can be used to create hooks that depend on multiple API
47
+ * calls.
48
+ *
49
+ */
50
+ export declare function compose<Mapping>(hooks: AsyncDataMap<Mapping>): AsyncData<Mapping>;
51
+ /**
52
+ * The `data` function wraps the provided data in an `AsyncData` object, indicating
53
+ * that the data is not loading and there is no error.
54
+ *
55
+ * @template T - The type of the data
56
+ * @param {T} data - The data to wrap
57
+ * @returns {AsyncData<T>} - An `AsyncData` object with `loading` set to `false`
58
+ * and `data` set to the provided data
59
+ */
60
+ export declare function data<T>(data: T): AsyncData<T>;
61
+ /**
62
+ * The `loading` constant is an instance of `AsyncDataLoading` that can be shared
63
+ * to provide identity stability. It represents the state when the data is loading.
64
+ */
65
+ export declare const loading: AsyncDataLoading;
66
+ export {};
@@ -0,0 +1,13 @@
1
+ import { QueryKey, UseQueryOptions } from '@tanstack/react-query';
2
+ import { AsyncData } from './asyncData';
3
+ /**
4
+ * Custom hook that retrieves data using `useQuery` from the `@tanstack/react-query`
5
+ * library. It wraps the `QueryResult` from the hook in a simpler `AsyncData`.
6
+ *
7
+ * @param options - An object of type `UseQueryOptions`.
8
+ * @returns An object of type `AsyncData`. If the query is pending, it returns a
9
+ * loading state. If there's an error, it returns an object with the error and loading
10
+ * state as false. If the query is successful, it returns the data and loading state
11
+ * as false.
12
+ */
13
+ export declare function useAsyncDataFromQuery<TQueryFnData = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseQueryOptions<TQueryFnData, Error, TData, TQueryKey>): AsyncData<TData>;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Branded types for nominal typing in TypeScript.
3
+ *
4
+ * Branded types create distinct types from the same base type,
5
+ * preventing accidental misuse at compile time with zero runtime overhead.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * type UserId = Brand<number, "UserId">;
10
+ * type PostId = Brand<number, "PostId">;
11
+ *
12
+ * const makeUserId = make<UserId>();
13
+ * const makePostId = make<PostId>();
14
+ *
15
+ * const userId = makeUserId(42);
16
+ * const postId = makePostId(42);
17
+ * getUser(postId); // ✗ compile error - PostId !== UserId
18
+ * ```
19
+ *
20
+ * @module
21
+ */
22
+ declare const __brand: unique symbol;
23
+ /**
24
+ * Creates a branded type from a base type.
25
+ *
26
+ * The brand exists only at compile time—no runtime overhead.
27
+ *
28
+ * @typeParam Base - The underlying primitive or object type
29
+ * @typeParam Branding - A unique type used to distinguish this brand (often the entity type itself)
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * type UserId = Brand<number, User>;
34
+ * type PostId = Brand<number, Post>;
35
+ * // UserId and PostId are incompatible even though both are numbers
36
+ * ```
37
+ */
38
+ export type Brand<Base, Branding> = Base & {
39
+ [__brand]: Branding;
40
+ };
41
+ /**
42
+ * Extracts the base type from a branded type.
43
+ *
44
+ * @typeParam B - A branded type
45
+ * @returns The underlying base type without the brand
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * type UserId = Brand<number, User>;
50
+ * type Base = BaseOf<UserId>; // number
51
+ * ```
52
+ */
53
+ type BaseOf<B extends Brand<unknown, unknown>> = Omit<B, typeof __brand>;
54
+ /** A function that converts a base value into a branded value. */
55
+ type Brander<B extends Brand<unknown, unknown>> = (value: BaseOf<B>) => B;
56
+ /**
57
+ * Creates a brander function for a given branded type.
58
+ *
59
+ * @typeParam B - The branded type to produce
60
+ * @returns A function that casts base values to the branded type
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * type UserId = Brand<number, "UserId">;
65
+ * const makeUserId = make<UserId>();
66
+ * const id = makeUserId(42);
67
+ * ```
68
+ */
69
+ export declare function make<B extends Brand<unknown, unknown>>(): Brander<B>;
70
+ export {};
@@ -13,11 +13,14 @@ export declare const dirname: (path: string) => string;
13
13
  export declare const isInDirectory: (path: string, directory: string) => boolean;
14
14
  export declare const ensureTrailingSlash: (path?: string) => string;
15
15
  /**
16
- * Converts an absolute path to a relative path based on the results directory.
17
- * Handles nested subdirectories within the results directory.
18
- * For example: "/Users/user/scans/subdir/scan_id=123" -> "subdir/scan_id=123"
16
+ * Converts an absolute path to a relative path based on the basePath directory.
17
+ * Handles nested subdirectories within the basePath directory.
18
+ * For example:
19
+ * ```
20
+ * toRelativePath("/Users/user/scans/subdir/scan_id=123", "/Users/user/scans") === "subdir/scan_id=123"
21
+ * ```
19
22
  */
20
- export declare const toRelativePath: (absolutePath: string, basePath: string) => string;
23
+ export declare const toRelativePath: (absolutePath: string | undefined, basePath: string | undefined) => string;
21
24
  /**
22
25
  * Converts a relative path to an absolute path based on the results directory.
23
26
  * For example: "subdir/scan_id=123" + "/Users/user/scans/" -> "/Users/user/scans/subdir/scan_id=123"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metrevals/inspect-scout-viewer",
3
- "version": "0.3.153-beta.1765542109",
3
+ "version": "0.4.4-beta.20251223202036",
4
4
  "description": "Inspect Scout viewer for evaluation logs.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,25 +14,12 @@
14
14
  ],
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/METR/inspect_scout",
17
+ "url": "https://github.com/meridianlabs-ai/inspect_scout",
18
18
  "directory": "src/inspect_scout/_view/www"
19
19
  },
20
- "packageManager": "pnpm@10.20.0",
21
- "scripts": {
22
- "build": "npm run build:app",
23
- "build:lib": "vite build --mode library",
24
- "build:app": "vite build --mode development",
25
- "watch": "vite build --watch",
26
- "watch:dev": "NODE_ENV=development vite build --watch --mode development",
27
- "dev": "vite",
28
- "prepublishOnly": "pnpm build:lib",
29
- "preview": "vite preview",
30
- "lint": "eslint . --max-warnings 0",
31
- "lint:fix": "eslint . --fix --max-warnings 0",
32
- "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
33
- "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
34
- "typecheck": "tsc --noEmit",
35
- "check": "pnpm lint:fix && pnpm format && pnpm typecheck"
20
+ "engines": {
21
+ "node": "22.21.1",
22
+ "pnpm": ">=9.0.0"
36
23
  },
37
24
  "exports": {
38
25
  ".": {
@@ -42,11 +29,13 @@
42
29
  "./styles/index.css": "./lib/styles/index.css"
43
30
  },
44
31
  "peerDependencies": {
32
+ "@tanstack/react-query": "^5.0.0",
45
33
  "react": "^19.0.0",
46
34
  "react-dom": "^19.0.0"
47
35
  },
48
36
  "devDependencies": {
49
37
  "@eslint/js": "^9.38.0",
38
+ "@testing-library/react": "^16.3.1",
50
39
  "@types/bootstrap": "^5.2.10",
51
40
  "@types/css-modules": "^1.0.5",
52
41
  "@types/eslint__js": "^9.14.0",
@@ -64,6 +53,7 @@
64
53
  "eslint-plugin-react": "^7.37.5",
65
54
  "eslint-plugin-react-hooks": "^7.0.1",
66
55
  "eslint-plugin-react-refresh": "^0.4.24",
56
+ "jsdom": "^27.3.0",
67
57
  "postcss-url": "^10.1.3",
68
58
  "prettier": "^3.6.2",
69
59
  "react": "^19.2.0",
@@ -73,8 +63,11 @@
73
63
  "typescript": "^5.7.3",
74
64
  "typescript-eslint": "^8.46.2",
75
65
  "typescript-plugin-css-modules": "^5.2.0",
66
+ "@tanstack/react-query": "^5.90.12",
67
+ "@tanstack/react-query-devtools": "^5.91.1",
76
68
  "vite": "^7.1.5",
77
- "vite-plugin-dts": "^4.3.0"
69
+ "vite-plugin-dts": "^4.3.0",
70
+ "vitest": "^4.0.16"
78
71
  },
79
72
  "dependencies": {
80
73
  "@popperjs/core": "^2.11.8",
@@ -100,9 +93,21 @@
100
93
  "react-virtuoso": "^4.14.1",
101
94
  "zustand": "^5.0.8"
102
95
  },
103
- "pnpm": {
104
- "overrides": {
105
- "yaml": "^2.4.2"
106
- }
96
+ "scripts": {
97
+ "build": "npm run build:app",
98
+ "build:lib": "vite build --mode library",
99
+ "build:app": "vite build --mode development",
100
+ "watch": "vite build --watch",
101
+ "watch:dev": "NODE_ENV=development vite build --watch --mode development",
102
+ "dev": "vite",
103
+ "preview": "vite preview",
104
+ "lint": "eslint . --max-warnings 0",
105
+ "lint:fix": "eslint . --fix --max-warnings 0",
106
+ "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
107
+ "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
108
+ "typecheck": "tsc --noEmit",
109
+ "check": "pnpm lint:fix && pnpm format && pnpm typecheck",
110
+ "test": "vitest run",
111
+ "test:watch": "vitest"
107
112
  }
108
- }
113
+ }
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- import { ScannerData } from '../types';
3
- interface ScanResultHeaderProps {
4
- result?: ScannerData;
5
- }
6
- export declare const ScanResultHeader: FC<ScanResultHeaderProps>;
7
- export {};
@@ -1,6 +0,0 @@
1
- import { FC } from 'react';
2
- import { ScannerData } from '../../types';
3
- export interface InputPanelProps {
4
- result?: ScannerData;
5
- }
6
- export declare const InputPanel: FC<InputPanelProps>;
@@ -1,2 +0,0 @@
1
- import { default as React } from 'react';
2
- export declare const ScannerPanel: React.FC;
@@ -1,3 +0,0 @@
1
- export declare const kSegmentList = "list";
2
- export declare const kSegmentDataframe = "dataframe";
3
- export declare const ScannerPanelBody: React.FC;
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const ScannerPanelTitle: FC;
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const ScanInfo: FC;
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const ScanResultsBody: FC;
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const ScanResultsOutline: FC;
@@ -1,2 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const ScanResultsPanel: FC;
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- import { ScannerCore } from '../types';
3
- interface ExplanationProps {
4
- result?: ScannerCore;
5
- }
6
- export declare const Explanation: FC<ExplanationProps>;
7
- export {};
@@ -1,10 +0,0 @@
1
- import { FC } from 'react';
2
- import { ScannerCore } from '../types';
3
- interface ValueProps {
4
- result: ScannerCore;
5
- style: "inline" | "block";
6
- maxTableSize?: number;
7
- interactive?: boolean;
8
- }
9
- export declare const Value: FC<ValueProps>;
10
- export {};
File without changes