@metrevals/inspect-scout-viewer 0.4.3-beta.1765899631 → 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.
package/lib/api/api.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import { StateStorage } from 'zustand/middleware';
2
2
  import { ScanResultInputData } from '../app/types';
3
- import { Scans, Status } from '../types';
3
+ import { Status } from '../types';
4
4
  export type ClientStorage = StateStorage;
5
5
  export interface ScanApi {
6
- getScans(): Promise<Scans>;
6
+ getTranscriptsDir(): Promise<string>;
7
+ getTranscripts(transcriptsDir?: string): Promise<unknown[]>;
8
+ getScansDir(): Promise<string>;
9
+ getScans(scansDir?: string): Promise<Status[]>;
7
10
  getScan(scanLocation: string): Promise<Status>;
8
11
  getScannerDataframe(scanLocation: string, scanner: string): Promise<ArrayBuffer | Uint8Array>;
9
12
  getScannerDataframeInput(scanLocation: string, scanner: string, uuid: string): Promise<ScanResultInputData>;
@@ -8,11 +8,15 @@ export interface Request<T> {
8
8
  body?: string;
9
9
  parse?: (text: string) => Promise<T>;
10
10
  handleError?: (status: number) => T | undefined;
11
+ /**
12
+ * Opt into browser caching. Only use for endpoints that set appropriate caching
13
+ * headers (e.g., ETag). Caching is disabled by default.
14
+ */
15
+ enableBrowserCache?: boolean;
11
16
  }
12
17
  export type HeaderProvider = () => Promise<Record<string, string>>;
13
18
  export interface ServerRequestApi {
14
19
  fetchString: (method: HttpMethod, path: string, headers?: Record<string, string>, body?: string) => Promise<{
15
- parsed: any;
16
20
  raw: string;
17
21
  }>;
18
22
  fetchBytes: (method: HttpMethod, path: string) => Promise<ArrayBuffer>;
@@ -0,0 +1,4 @@
1
+ import { ColumnTable } from 'arquero';
2
+ import { ScanResultData, ScanResultSummary } from './types';
3
+ export declare const parseScanResultData: (filtered: ColumnTable) => Promise<ScanResultData>;
4
+ export declare const parseScanResultSummaries: (rowData: object[]) => Promise<ScanResultSummary[]>;
@@ -2,6 +2,7 @@ import { FC, ReactNode } from 'react';
2
2
  interface NavbarProps {
3
3
  children?: ReactNode;
4
4
  bordered?: boolean;
5
+ resultsDir?: string;
5
6
  }
6
7
  export declare const Navbar: FC<NavbarProps>;
7
8
  export {};
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ interface TaskNameProps {
3
+ taskSet?: string;
4
+ taskId?: string | number;
5
+ taskRepeat?: number;
6
+ }
7
+ export declare const TaskName: FC<TaskNameProps>;
8
+ export {};
@@ -1,16 +1,13 @@
1
1
  import { ColumnTable } from 'arquero';
2
- import { ScanResultData, ScanResultSummary, ScanResultInputData } from './types';
3
- export declare const useSelectedScanner: () => string | undefined;
4
- export declare const useScannerData: (columnTable?: ColumnTable, scanResultUuid?: string) => {
5
- data: ScanResultData | undefined;
6
- isLoading: boolean;
7
- };
8
- export declare const useSelectedResultsRow: (scanResultUuid?: string) => {
9
- data: ScanResultData | undefined;
10
- isLoading: boolean;
11
- };
12
- export declare const useSelectedScanResultInputData: () => ScanResultInputData | undefined;
13
- export declare const useScannerCores: (columnTable?: ColumnTable) => {
2
+ import { Status } from '../types';
3
+ import { AsyncData } from '../utils/asyncData';
4
+ import { ScanResultData, ScanResultInputData, ScanResultSummary } from './types';
5
+ export declare const useSelectedScan: () => AsyncData<Status>;
6
+ export declare const useSelectedScanner: () => AsyncData<string>;
7
+ export declare const useSelectedScanDataframe: () => AsyncData<ColumnTable>;
8
+ export declare const useSelectedScanResultData: (scanResultUuid: string | undefined) => AsyncData<ScanResultData | undefined>;
9
+ export declare const useSelectedScanResultInputData: () => AsyncData<ScanResultInputData>;
10
+ export declare const useScanResultSummaries: (columnTable?: ColumnTable) => {
14
11
  data: ScanResultSummary[];
15
12
  isLoading: boolean;
16
13
  };
@@ -1,2 +1,6 @@
1
1
  import { FC } from 'react';
2
- export declare const ScanJobGrid: FC;
2
+ import { Status } from '../../types';
3
+ export declare const ScanJobGrid: FC<{
4
+ scans: Status[];
5
+ resultsDir: string | undefined;
6
+ }>;
@@ -1,9 +1,8 @@
1
1
  import { FC } from 'react';
2
2
  import { Status } from '../../types';
3
- import { ScanResultInputData, ScanResultData } from '../types';
3
+ import { ScanResultInputData } from '../types';
4
4
  interface ScanResultHeaderProps {
5
- result?: ScanResultData;
6
- status?: Status;
5
+ scan?: Status;
7
6
  inputData?: ScanResultInputData;
8
7
  }
9
8
  export declare const ScanResultHeader: FC<ScanResultHeaderProps>;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare const ScansPanel: React.FC;
@@ -0,0 +1,6 @@
1
+ import { Status } from '../../types';
2
+ export declare const kSegmentList = "list";
3
+ export declare const kSegmentDataframe = "dataframe";
4
+ export declare const ScansPanelBody: React.FC<{
5
+ selectedScan: Status;
6
+ }>;
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ import { Status } from '../../types';
3
+ export declare const ScansPanelTitle: FC<{
4
+ resultsDir: string | undefined;
5
+ selectedScan: Status;
6
+ }>;
@@ -1,2 +1,5 @@
1
1
  import { FC } from 'react';
2
- export declare const ScanInfo: FC;
2
+ import { Status } from '../../../types';
3
+ export declare const ScanInfo: FC<{
4
+ selectedScan: Status;
5
+ }>;
@@ -1,2 +1,12 @@
1
+ import { ColumnTable } from 'arquero';
1
2
  import { FC } from 'react';
2
- export declare const ScanResultsBody: FC;
3
+ import { Status } from '../../../types';
4
+ export declare const ScanResultsBody: FC<{
5
+ selectedScan: Status;
6
+ scannerId: string;
7
+ selectedScanner: {
8
+ columnTable: ColumnTable | undefined;
9
+ isLoading: boolean;
10
+ error: string | undefined;
11
+ };
12
+ }>;
@@ -1,2 +1,5 @@
1
1
  import { FC } from 'react';
2
- export declare const ScanResultsOutline: FC;
2
+ import { Status } from '../../../types';
3
+ export declare const ScanResultsOutline: FC<{
4
+ selectedScan: Status;
5
+ }>;
@@ -1,2 +1,5 @@
1
1
  import { FC } from 'react';
2
- export declare const ScanResultsPanel: FC;
2
+ import { Status } from '../../../types';
3
+ export declare const ScanResultsPanel: FC<{
4
+ selectedScan: Status;
5
+ }>;
@@ -1,5 +1,6 @@
1
1
  import { ColumnTable } from 'arquero';
2
2
  import { FC } from 'react';
3
+ import { Status } from '../../../../types';
3
4
  export interface GridDescriptor {
4
5
  gridStyle: Record<string, string>;
5
6
  columns: string[];
@@ -7,6 +8,7 @@ export interface GridDescriptor {
7
8
  interface ScanResultsListProps {
8
9
  id: string;
9
10
  columnTable?: ColumnTable;
11
+ selectedScan: Status;
10
12
  }
11
13
  export declare const ScanResultsList: FC<ScanResultsListProps>;
12
14
  export {};
@@ -1,4 +1,11 @@
1
- export declare const useServerScans: () => void;
2
- export declare const useServerScanner: () => void;
3
- export declare const useServerScannerDataframe: () => void;
4
- export declare const useServerScannerDataframeInput: () => void;
1
+ import { ColumnTable } from 'arquero';
2
+ import { Status } from '../../types';
3
+ import { AsyncData } from '../../utils/asyncData';
4
+ import { ScanResultInputData } from '../types';
5
+ export declare const useServerScansDir: () => AsyncData<string>;
6
+ export declare const useServerScans: () => AsyncData<Status[]>;
7
+ export declare const useServerScan: (location: string | undefined) => AsyncData<Status>;
8
+ export declare const useServerScanDataframe: (location: string | undefined, scanner: string | undefined) => AsyncData<ColumnTable>;
9
+ export declare const useServerScanDataframeInput: (location: string | undefined, scanner: string | undefined, uuid: string | undefined) => AsyncData<ScanResultInputData>;
10
+ export declare const useServerTranscriptsDir: () => AsyncData<string>;
11
+ export declare const useServerTranscripts: (location: string | undefined) => AsyncData<unknown[]>;
@@ -1,41 +1,33 @@
1
1
  import { EventType } from '../transcript/types';
2
2
  import { ModelUsage, Transcript } from '../types';
3
3
  import { JsonValue, ChatMessageSystem, ChatMessageUser, ChatMessageAssistant, ChatMessageTool, Events, Messages } from '../types/log';
4
- export type Input = Transcript | Messages | Events | MessageType | EventType;
5
- export type InputType = "transcript" | "message" | "messages" | "event" | "events";
6
4
  export interface ScanResultInputData {
7
5
  input: Input;
8
6
  inputType: InputType;
9
7
  }
10
- export interface SortColumn {
11
- column: string;
12
- direction: "asc" | "desc";
13
- }
14
- export type ErrorScope = "scanjobs" | "scanner" | "dataframe" | "dataframe_input";
15
- export type ResultGroup = "source" | "label" | "id" | "epoch" | "none";
16
- export type ValueType = "boolean" | "number" | "string" | "array" | "object" | "null";
8
+ export type Input = Transcript | Messages | Events | MessageType | EventType;
9
+ export type InputType = "transcript" | "message" | "messages" | "event" | "events";
17
10
  export interface ScanResultSummary {
18
11
  uuid?: string;
19
- inputType: InputType;
20
12
  explanation?: string;
21
13
  label?: string;
14
+ timestamp?: Date;
15
+ inputType: InputType;
22
16
  eventReferences: ScanResultReference[];
23
17
  messageReferences: ScanResultReference[];
24
18
  validationResult: boolean | Record<string, boolean>;
25
19
  validationTarget: boolean | Record<string, boolean>;
26
20
  value: string | boolean | number | null | unknown[] | object;
27
21
  valueType: ValueType;
28
- transcriptMetadata: Record<string, JsonValue>;
29
- transcriptSourceId: string;
30
22
  scanError?: string;
31
23
  scanErrorRefusal?: boolean;
24
+ transcriptSourceId: string;
25
+ transcriptTaskSet?: string;
26
+ transcriptTaskId?: string | number;
27
+ transcriptTaskRepeat?: number;
28
+ transcriptModel?: string;
29
+ transcriptMetadata: Record<string, JsonValue>;
32
30
  }
33
- export interface ScanResultReference {
34
- type: "message" | "event";
35
- id: string;
36
- cite?: string;
37
- }
38
- export type MessageType = ChatMessageSystem | ChatMessageUser | ChatMessageAssistant | ChatMessageTool;
39
31
  export interface ScanResultData extends ScanResultSummary {
40
32
  answer?: string;
41
33
  inputIds: string[];
@@ -55,7 +47,29 @@ export interface ScanResultData extends ScanResultSummary {
55
47
  scannerParams: Record<string, JsonValue>;
56
48
  transcriptId: string;
57
49
  transcriptSourceUri: string;
50
+ transcriptDate?: Date;
51
+ transcriptAgent?: string;
52
+ transcriptAgentArgs?: Record<string, unknown>;
53
+ transcriptScore?: JsonValue;
54
+ transcriptSuccess?: boolean;
55
+ transcriptTotalTime?: number;
56
+ transcroptTotalTokens?: number;
57
+ transcriptError?: string;
58
+ transcriptLimit?: string;
58
59
  }
60
+ export interface ScanResultReference {
61
+ type: "message" | "event";
62
+ id: string;
63
+ cite?: string;
64
+ }
65
+ export type MessageType = ChatMessageSystem | ChatMessageUser | ChatMessageAssistant | ChatMessageTool;
66
+ export interface SortColumn {
67
+ column: string;
68
+ direction: "asc" | "desc";
69
+ }
70
+ export type ErrorScope = "scanjobs" | "scanner" | "dataframe" | "dataframe_input";
71
+ export type ResultGroup = "source" | "label" | "id" | "epoch" | "model" | "none";
72
+ export type ValueType = "boolean" | "number" | "string" | "array" | "object" | "null";
59
73
  export declare function isStringValue(result: ScanResultSummary): result is ScanResultSummary & {
60
74
  valueType: "string";
61
75
  value: string;
@@ -1,8 +1,9 @@
1
1
  import { ScanResultSummary } from '../types';
2
2
  export interface IdentifierInfo {
3
- id: string;
4
- secondaryId?: string;
5
- epoch?: string;
3
+ taskSet?: string;
4
+ id: string | number;
5
+ secondaryId?: string | number;
6
+ epoch?: number;
6
7
  }
7
8
  export declare const resultIdentifierStr: (summary?: ScanResultSummary) => string | undefined;
8
9
  export declare const resultIdentifier: (summary?: ScanResultSummary) => IdentifierInfo;
@@ -0,0 +1,27 @@
1
+ import { AsyncData } from '../utils/asyncData';
2
+ /**
3
+ * The `useMapAsyncData` function is a custom React hook that transforms the data
4
+ * in an `AsyncData` object or an array of `AsyncData` objects. It uses the `useMemo`
5
+ * hook to avoid unnecessary recalculations.
6
+ *
7
+ * @template TBefore - The type of the data before the transformation
8
+ * @template TAfter - The type of the data after the transformation
9
+ * @param {AsyncData<TBefore> | AsyncData<TBefore>[]} input - The `AsyncData` object(s)
10
+ * to transform
11
+ * @param {(before: TBefore) => TAfter} transform - The function to transform the
12
+ * data
13
+ * @param {(err: Error) => Error} [errorTransform] - The function to transform any
14
+ * errors (optional)
15
+ * @returns {AsyncData<TAfter> | AsyncData<TAfter>[]} - The transformed `AsyncData`
16
+ * object(s)
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const asyncData = { loading: false, data: 5 };
21
+ * const transform = (num: number) => num * 2;
22
+ * const result = useMapAsyncData(asyncData, transform);
23
+ * console.log(result); // { loading: false, data: 10 }
24
+ * ```
25
+ */
26
+ export declare function useMapAsyncData<TBefore, TAfter>(input: AsyncData<TBefore>, transform: (before: TBefore) => TAfter, errorTransform?: (err: Error) => Error): AsyncData<TAfter>;
27
+ export declare function useMapAsyncData<TBefore, TAfter>(input: AsyncData<TBefore>[], transform: (before: TBefore) => TAfter, errorTransform?: (err: Error) => Error): AsyncData<TAfter>[];