@deepseek-ai/dsh-experimental-session-inspector 0.2.1-alpha.1
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/LICENSE +21 -0
- package/README.i18n.yaml +34 -0
- package/README.md +105 -0
- package/README.zh.md +105 -0
- package/lib/client.js +5444 -0
- package/lib/index.js +6 -0
- package/lib/types/client/index.d.ts +10 -0
- package/lib/types/client/locales.d.ts +69 -0
- package/lib/types/client/views/InspectorDetails.d.ts +17 -0
- package/lib/types/client/views/InspectorObjectTree.d.ts +26 -0
- package/lib/types/client/views/InspectorTable.d.ts +43 -0
- package/lib/types/client/views/TypeFilter.d.ts +15 -0
- package/lib/types/client/views/View.d.ts +42 -0
- package/lib/types/client/views/chat-node/dom.d.ts +28 -0
- package/lib/types/client/views/chat-node/highlight.d.ts +20 -0
- package/lib/types/client/views/chat-node/model.d.ts +52 -0
- package/lib/types/client/views/chat-node/objects.d.ts +24 -0
- package/lib/types/client/views/chat-node/pick-match.d.ts +27 -0
- package/lib/types/client/views/chat-node/picker.d.ts +43 -0
- package/lib/types/client/views/chat-node/reveal-target.d.ts +14 -0
- package/lib/types/client/views/chat-node/reveal.d.ts +25 -0
- package/lib/types/client/views/format.d.ts +11 -0
- package/lib/types/client/views/index.d.ts +8 -0
- package/lib/types/client/views/object-value.d.ts +28 -0
- package/lib/types/client/views/objects.d.ts +39 -0
- package/lib/types/client/views/raw-json.d.ts +11 -0
- package/lib/types/client/views/session-log/chat-target.d.ts +16 -0
- package/lib/types/client/views/session-log/groups.d.ts +18 -0
- package/lib/types/client/views/session-log/model.d.ts +54 -0
- package/lib/types/client/views/session-log/stream.d.ts +37 -0
- package/lib/types/client/views/table-layout.d.ts +56 -0
- package/lib/types/client/views/table-model.d.ts +76 -0
- package/lib/types/client/views/type-filter.d.ts +41 -0
- package/lib/types/index.d.ts +4 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +77 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Incremental raw Session rows with lossless Assistant stream children. */
|
|
2
|
+
import type { SessionEventSource } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
3
|
+
import { type ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
4
|
+
import type { InspectorRecord, InspectorRow } from '../table-model.ts';
|
|
5
|
+
import type { InspectorPickTarget } from '../chat-node/pick-match.ts';
|
|
6
|
+
import type { SessionLogAnchor } from './chat-target.ts';
|
|
7
|
+
/** Session-owned log projection; subscriptions exist only while the table is observed. */
|
|
8
|
+
export declare class SessionLogModel implements ObservableSnapshot<readonly InspectorRow[]> {
|
|
9
|
+
private readonly source;
|
|
10
|
+
private readonly rows;
|
|
11
|
+
private readonly records;
|
|
12
|
+
private readonly roots;
|
|
13
|
+
private readonly attempts;
|
|
14
|
+
private groups;
|
|
15
|
+
/** Preserve live-to-durable row identities only while their rows remain in the loaded window. */
|
|
16
|
+
private readonly settledRoots;
|
|
17
|
+
private readonly streams;
|
|
18
|
+
private revision;
|
|
19
|
+
private subscribers;
|
|
20
|
+
private disconnect;
|
|
21
|
+
/**
|
|
22
|
+
* @param source - The existing Session window, shared with Chat and Trajectory.
|
|
23
|
+
*/
|
|
24
|
+
constructor(source: SessionEventSource);
|
|
25
|
+
/** @returns Stable table order; row contents have independent sources. */
|
|
26
|
+
getSnapshot: () => readonly InspectorRow[];
|
|
27
|
+
/**
|
|
28
|
+
* Recover an event's placement without interpreting formatted table cells.
|
|
29
|
+
* @param key - Selected root or delta row.
|
|
30
|
+
* @returns The owning event and chunk, or undefined if the row is unavailable.
|
|
31
|
+
*/
|
|
32
|
+
chatAnchor(key: string): SessionLogAnchor | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a picked Chat object in the loaded log, without creating synthetic records.
|
|
35
|
+
* @param target - DOM identity enriched with the owning Chat Node's sequence and Turn/Step.
|
|
36
|
+
* @returns Tool call, exact anchor, Assistant, Step, or Turn row; reasoning parts prefer a block-start child.
|
|
37
|
+
*/
|
|
38
|
+
pick(target: InspectorPickTarget): string | undefined;
|
|
39
|
+
/** @param listener - Structural invalidation callback. @returns Subscription disposer. */
|
|
40
|
+
subscribe: (listener: () => void) => (() => void);
|
|
41
|
+
/**
|
|
42
|
+
* Obtain a cached row source, initially empty when its record is unavailable.
|
|
43
|
+
* @param key - Stable table row identity.
|
|
44
|
+
* @returns Its independently observable raw data.
|
|
45
|
+
*/
|
|
46
|
+
row: (key: string) => ObservableSnapshot<InspectorRecord | undefined>;
|
|
47
|
+
private put;
|
|
48
|
+
private accept;
|
|
49
|
+
private prune;
|
|
50
|
+
private root;
|
|
51
|
+
private add;
|
|
52
|
+
private addChunk;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Block-indexed hierarchy for one live or durable Assistant stream. */
|
|
2
|
+
import type { StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
import type { InspectorRow } from '../table-model.ts';
|
|
4
|
+
/** Keeps original delta rows under their blocks and a bounded reasoning prefix for folded headers. */
|
|
5
|
+
export declare class AssistantLogStream {
|
|
6
|
+
private readonly parent;
|
|
7
|
+
private readonly blocks;
|
|
8
|
+
private count;
|
|
9
|
+
/** @param parent - Stable Assistant event or live-attempt row identity. */
|
|
10
|
+
constructor(parent: string);
|
|
11
|
+
/**
|
|
12
|
+
* Count all received chunks, including children of folded blocks.
|
|
13
|
+
* @returns Number of original chunks received by this stream.
|
|
14
|
+
*/
|
|
15
|
+
get length(): number;
|
|
16
|
+
/**
|
|
17
|
+
* Add one original chunk and update the matching block's disclosure state.
|
|
18
|
+
* Chunks without a loaded block-start remain direct Assistant children.
|
|
19
|
+
* @param chunk - Original chunk, correlated by block index.
|
|
20
|
+
* @returns One row insertion, an optional replaced block header, and its folded preview.
|
|
21
|
+
*/
|
|
22
|
+
append(chunk: StreamChunk): {
|
|
23
|
+
readonly key: string;
|
|
24
|
+
readonly index: number;
|
|
25
|
+
readonly position: number;
|
|
26
|
+
readonly row: InspectorRow;
|
|
27
|
+
readonly header?: {
|
|
28
|
+
readonly position: number;
|
|
29
|
+
readonly row: InspectorRow;
|
|
30
|
+
};
|
|
31
|
+
readonly collapsed?: {
|
|
32
|
+
readonly key: string;
|
|
33
|
+
readonly summary: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Live folding preserves the visible anchor and places unused viewport space after all data rows. */
|
|
2
|
+
import type { InspectorRow, InspectorTableHierarchy } from './table-model.ts';
|
|
3
|
+
/** Fixed table row and header height, in CSS pixels. */
|
|
4
|
+
export declare const INSPECTOR_ROW_HEIGHT = 30;
|
|
5
|
+
/** One data row in the virtual scroll layout. */
|
|
6
|
+
export type InspectorTableItem = {
|
|
7
|
+
readonly key: string;
|
|
8
|
+
readonly rowIndex: number;
|
|
9
|
+
readonly size: number;
|
|
10
|
+
readonly row: InspectorRow;
|
|
11
|
+
};
|
|
12
|
+
/** Last committed scroll geometry, measured before a source update. */
|
|
13
|
+
export interface InspectorViewport {
|
|
14
|
+
readonly offset: number;
|
|
15
|
+
readonly height: number;
|
|
16
|
+
}
|
|
17
|
+
/** A disclosure row's measured position relative to the scroll viewport. */
|
|
18
|
+
export interface InspectorRowAnchor {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly top: number;
|
|
21
|
+
}
|
|
22
|
+
/** View-local spacing; constructing without a predecessor resets retained blank areas. */
|
|
23
|
+
export declare class InspectorTableLayout {
|
|
24
|
+
private readonly hierarchy;
|
|
25
|
+
/** Visible data rows and their virtual sizes; excludes the table header and trailing space. */
|
|
26
|
+
readonly items: readonly InspectorTableItem[];
|
|
27
|
+
/** Whether a live block closure shortened the previous visible hierarchy. */
|
|
28
|
+
readonly preservedCollapse: boolean;
|
|
29
|
+
/** Trailing space in CSS pixels retained to keep the viewport anchor stable. */
|
|
30
|
+
readonly bottomPadding: number;
|
|
31
|
+
/** Anchored scroll offset in CSS pixels, or undefined when no anchor adjustment is needed. */
|
|
32
|
+
readonly scrollOffset: number | undefined;
|
|
33
|
+
private readonly minimumExtent;
|
|
34
|
+
private readonly rowIndexes;
|
|
35
|
+
/**
|
|
36
|
+
* @param hierarchy - Current visible data rows.
|
|
37
|
+
* @param previous - Previous committed layout, omitted after manual disclosure changes.
|
|
38
|
+
* @param viewport - Scroll geometry before the current row change.
|
|
39
|
+
* @param anchor - Clicked disclosure row to retain at its measured viewport position.
|
|
40
|
+
*/
|
|
41
|
+
constructor(hierarchy: InspectorTableHierarchy, previous?: InspectorTableLayout, viewport?: InspectorViewport, anchor?: InspectorRowAnchor);
|
|
42
|
+
/**
|
|
43
|
+
* Keep the enclosing headers visible above the first visible data row.
|
|
44
|
+
* @param itemIndex - First visible virtual item.
|
|
45
|
+
* @returns Ancestor indexes in the virtual layout.
|
|
46
|
+
*/
|
|
47
|
+
stickyIndexes(itemIndex: number): readonly number[];
|
|
48
|
+
/**
|
|
49
|
+
* Resolve each sticky level below the table header and already occupied sticky rows.
|
|
50
|
+
* @param offset - Scroll offset in CSS pixels.
|
|
51
|
+
* @returns Active ancestor indexes, outermost first.
|
|
52
|
+
*/
|
|
53
|
+
stickyIndexesAtOffset(offset: number): readonly number[];
|
|
54
|
+
private anchorOffset;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=table-layout.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Row identities and raw values shared by the two virtual inspector tables. */
|
|
2
|
+
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
3
|
+
/** One table position; children immediately follow their parent. */
|
|
4
|
+
export interface InspectorRow {
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly parent?: string;
|
|
7
|
+
readonly depth: number;
|
|
8
|
+
/** Disclosure default; a block lifecycle transition resets any earlier user override. */
|
|
9
|
+
readonly disclosure?: 'open' | 'closed';
|
|
10
|
+
}
|
|
11
|
+
/** One user disclosure choice, valid only for the lifecycle state in which it was made. */
|
|
12
|
+
export interface InspectorDisclosure {
|
|
13
|
+
readonly state: InspectorRow['disclosure'];
|
|
14
|
+
readonly collapsed: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve a manual choice or the block lifecycle default.
|
|
18
|
+
* @param row - Current row metadata.
|
|
19
|
+
* @param choices - Table-local user choices.
|
|
20
|
+
* @returns Whether the row's descendants are hidden.
|
|
21
|
+
*/
|
|
22
|
+
export declare function inspectorRowCollapsed(row: InspectorRow, choices: ReadonlyMap<string, InspectorDisclosure>): boolean;
|
|
23
|
+
/** Table-local hierarchy index for disclosure and virtualized sticky ancestors. */
|
|
24
|
+
export declare class InspectorTableHierarchy {
|
|
25
|
+
/** Depth-first row order with folded descendants omitted. */
|
|
26
|
+
readonly rows: readonly InspectorRow[];
|
|
27
|
+
private readonly byKey;
|
|
28
|
+
private readonly branches;
|
|
29
|
+
/**
|
|
30
|
+
* @param rows - Complete depth-first row order.
|
|
31
|
+
* @param choices - Table-local disclosure overrides.
|
|
32
|
+
*/
|
|
33
|
+
constructor(rows: readonly InspectorRow[], choices: ReadonlyMap<string, InspectorDisclosure>);
|
|
34
|
+
/**
|
|
35
|
+
* Identify rows that own descendants or an explicit disclosure state.
|
|
36
|
+
* @param key - Row identity.
|
|
37
|
+
* @returns Whether this row owns a disclosure.
|
|
38
|
+
*/
|
|
39
|
+
isBranch(key: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Find the current row's visible parent headers, including itself when it is a header.
|
|
42
|
+
* @param index - First row at the viewport's scroll offset.
|
|
43
|
+
* @returns Ordered indexes retained above the virtual viewport.
|
|
44
|
+
*/
|
|
45
|
+
stickyIndexes(index: number): readonly number[];
|
|
46
|
+
}
|
|
47
|
+
/** Raw data and compact metadata for one independently updated row. */
|
|
48
|
+
export interface InspectorRecord {
|
|
49
|
+
readonly type: string;
|
|
50
|
+
readonly identity: string;
|
|
51
|
+
readonly location: string;
|
|
52
|
+
/** Unix epoch milliseconds. */
|
|
53
|
+
readonly time?: number;
|
|
54
|
+
readonly value: unknown;
|
|
55
|
+
/** Owner-supplied preview for domain-specific field formatting. */
|
|
56
|
+
readonly summary?: string;
|
|
57
|
+
/** Parent summary used only while its children are folded. */
|
|
58
|
+
readonly collapsedSummary?: string;
|
|
59
|
+
}
|
|
60
|
+
/** Converts a keyed source without changing snapshot identity on unchanged input. */
|
|
61
|
+
export declare class InspectorRecordSource<T> implements ObservableSnapshot<InspectorRecord | undefined> {
|
|
62
|
+
private readonly source;
|
|
63
|
+
private readonly project;
|
|
64
|
+
private previous;
|
|
65
|
+
private snapshot;
|
|
66
|
+
/**
|
|
67
|
+
* @param source - Existing keyed business source.
|
|
68
|
+
* @param project - Raw metadata projection, evaluated only after its input changes.
|
|
69
|
+
*/
|
|
70
|
+
constructor(source: ObservableSnapshot<T | undefined>, project: (value: T) => InspectorRecord);
|
|
71
|
+
/** @returns Stable metadata for the current raw value. */
|
|
72
|
+
getSnapshot: () => InspectorRecord | undefined;
|
|
73
|
+
/** @param listener - Row invalidation callback. @returns Its disposer. */
|
|
74
|
+
subscribe: (listener: () => void) => (() => void);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=table-model.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Confirmed type filtering preserves the ancestors needed to inspect matching nested rows. */
|
|
2
|
+
import type { InspectorRow } from './table-model.ts';
|
|
3
|
+
/** Filtered row order and the distinction between matches and contextual ancestors. */
|
|
4
|
+
export interface InspectorTypeMatches {
|
|
5
|
+
readonly rows: readonly InspectorRow[];
|
|
6
|
+
readonly matches: ReadonlySet<string>;
|
|
7
|
+
}
|
|
8
|
+
/** Case-insensitive containment filter; optional surrounding stars have the same meaning as omission. */
|
|
9
|
+
export declare class InspectorTypeFilter {
|
|
10
|
+
/** Trimmed type fragment without optional surrounding stars; preserves the entered case. */
|
|
11
|
+
readonly query: string;
|
|
12
|
+
private readonly needle;
|
|
13
|
+
/** @param query - Type fragment; empty text or only stars clears filtering. */
|
|
14
|
+
constructor(query: string);
|
|
15
|
+
/**
|
|
16
|
+
* Distinguish a type restriction from an empty or all-stars query.
|
|
17
|
+
* @returns Whether this filter restricts the table.
|
|
18
|
+
*/
|
|
19
|
+
get active(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Match a type by case-insensitive containment, accepting all types when filtering is inactive.
|
|
22
|
+
* @param type - Current raw type, absent while its record is unavailable.
|
|
23
|
+
* @returns Whether the record matches the filter.
|
|
24
|
+
*/
|
|
25
|
+
matches(type: string | undefined): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Retain matching rows and their ancestors; matching descendants start visible even under closed blocks.
|
|
28
|
+
* @param rows - Complete loaded hierarchy, before user disclosure choices.
|
|
29
|
+
* @param typeOf - Current type reader, independent of React row subscriptions.
|
|
30
|
+
* @returns Matching rows and contextual ancestors in their original order.
|
|
31
|
+
*/
|
|
32
|
+
apply(rows: readonly InspectorRow[], typeOf: (key: string) => string | undefined): InspectorTypeMatches;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve candidates asynchronously from all loaded rows, not the already filtered subset.
|
|
35
|
+
* @param rows - Complete loaded row list.
|
|
36
|
+
* @param typeOf - Current raw type reader.
|
|
37
|
+
* @returns Distinct matching types in deterministic order.
|
|
38
|
+
*/
|
|
39
|
+
suggest(rows: readonly InspectorRow[], typeOf: (key: string) => string | undefined): Promise<readonly string[]>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=type-filter.d.ts.map
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepseek-ai/dsh-experimental-session-inspector",
|
|
3
|
+
"description": "Experimental virtualized Session log and live Chat group/node inspectors",
|
|
4
|
+
"version": "0.2.1-alpha.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/experimental/session-inspector"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./client": {
|
|
22
|
+
"types": "./lib/types/client/index.d.ts",
|
|
23
|
+
"default": "./lib/client.js"
|
|
24
|
+
},
|
|
25
|
+
"./locale/*.json": "./locale/*.json",
|
|
26
|
+
"./src/*": "./src/*",
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"dsh": {
|
|
30
|
+
"client": {
|
|
31
|
+
"inject": [
|
|
32
|
+
"@deepseek-ai/dsh-client-locale",
|
|
33
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-session",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-renderer"
|
|
37
|
+
],
|
|
38
|
+
"platform": "web"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"locale/*.json",
|
|
43
|
+
"lib/index.js",
|
|
44
|
+
"lib/client.js",
|
|
45
|
+
"lib/types/**/*.d.ts"
|
|
46
|
+
],
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@testing-library/react": "^16.1.0",
|
|
53
|
+
"@types/react-dom": "~18.3.0",
|
|
54
|
+
"react-dom": "^18.2.0",
|
|
55
|
+
"@tanstack/react-virtual": "^3.14.9",
|
|
56
|
+
"@types/react": "~18.3.1",
|
|
57
|
+
"react": "^18.2.0",
|
|
58
|
+
"@deepseek-ai/dsh-client-test-runtime": "0.2.1-alpha.1",
|
|
59
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.1-alpha.1",
|
|
60
|
+
"@deepseek-ai/dsh-client-store": "0.2.1-alpha.1",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.2.1-alpha.1",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-alpha.1",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-alpha.1",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.1-alpha.1",
|
|
65
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.1",
|
|
66
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
67
|
+
"@deepseek-ai/dsh-client-locale": "0.2.1-alpha.1",
|
|
68
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.1",
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.1",
|
|
71
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.1-alpha.1"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"bundle": "tsdown",
|
|
75
|
+
"watch": "tsdown --watch"
|
|
76
|
+
}
|
|
77
|
+
}
|