@whybebabo/dsh-file-review-tab 0.0.0-stage → 0.7.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 +22 -0
- package/README.md +134 -2
- package/cordis.patch.yml +6 -0
- package/lib/client.js +8386 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +373 -0
- package/lib/remote.js +8 -0
- package/lib/typert-descriptors.js +136 -0
- package/lib/typert.host.js +22 -0
- package/lib/types/change-types.d.ts +117 -0
- package/lib/types/client/FileReviewTab.d.ts +20 -0
- package/lib/types/client/NativeDiff.d.ts +52 -0
- package/lib/types/client/ProducedFiles.d.ts +40 -0
- package/lib/types/client/chat-locales.d.ts +66 -0
- package/lib/types/client/deep-link.d.ts +83 -0
- package/lib/types/client/deleted-paths.d.ts +28 -0
- package/lib/types/client/diff-hunks.d.ts +86 -0
- package/lib/types/client/diff-text.d.ts +8 -0
- package/lib/types/client/index.d.ts +43 -0
- package/lib/types/client/locales.d.ts +79 -0
- package/lib/types/client/mutation-call.d.ts +34 -0
- package/lib/types/client/recorded-diffs.d.ts +10 -0
- package/lib/types/client/recorded-fetch.d.ts +30 -0
- package/lib/types/client/session-changes.d.ts +110 -0
- package/lib/types/client/snapshot-compat.d.ts +32 -0
- package/lib/types/client/turn-deliverables.d.ts +91 -0
- package/lib/types/file-review-service.d.ts +22 -0
- package/lib/types/index.d.ts +26 -0
- package/lib/types/mutation-order.d.ts +111 -0
- package/lib/types/remote.d.ts +26 -0
- package/lib/types/typert-descriptors.d.ts +13 -0
- package/lib/types/typert.host.d.ts +5 -0
- package/package.json +141 -6
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The comparison surface: a faithful port of dsh's own FileDiff renderer.
|
|
3
|
+
*
|
|
4
|
+
* The sidebar review tab and the chat hover preview both draw this, so both look
|
|
5
|
+
* like the built-in comparison rather than a look-alike. Structure, class usage
|
|
6
|
+
* and the `data-diff-*` / `data-review-*` attributes match the native component
|
|
7
|
+
* (read out of the running app's asar) so the host's own styles, the chat card's
|
|
8
|
+
* preview rules, and anything else keying off those attributes keep working.
|
|
9
|
+
*
|
|
10
|
+
* Syntax highlighting rides the shared `useCodeHighlighter` from the primitives
|
|
11
|
+
* package — the same one the built-in diff uses — so grammars are loaded once for
|
|
12
|
+
* the whole app instead of per plugin.
|
|
13
|
+
*/
|
|
14
|
+
import { type NativeDiffHunk } from './diff-hunks.ts';
|
|
15
|
+
/** Localized copy the comparison needs. */
|
|
16
|
+
export interface NativeDiffLabels {
|
|
17
|
+
readonly created: string;
|
|
18
|
+
readonly deleted: string;
|
|
19
|
+
readonly unchanged: string;
|
|
20
|
+
readonly truncated: (count: string) => string;
|
|
21
|
+
/** Shown while the comparison is still being resolved. */
|
|
22
|
+
readonly loading: string;
|
|
23
|
+
/** Shown when the two sides can no longer be reconstructed. */
|
|
24
|
+
readonly missing: string;
|
|
25
|
+
}
|
|
26
|
+
export interface NativeDiffProps {
|
|
27
|
+
readonly hunks: readonly NativeDiffHunk[];
|
|
28
|
+
/** Source path, used to pick the syntax grammar. */
|
|
29
|
+
readonly path: string;
|
|
30
|
+
/** Side-by-side when true (and the change is two-sided). */
|
|
31
|
+
readonly split: boolean;
|
|
32
|
+
/** Wrap long lines instead of scrolling them. */
|
|
33
|
+
readonly wrap: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Why the two sides differ in shape rather than content, when they do:
|
|
36
|
+
* 'created' and 'deleted' are native's own notes.
|
|
37
|
+
*/
|
|
38
|
+
readonly note?: 'created' | 'deleted' | 'unchanged' | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Force one of native's non-content states instead of drawing hunks:
|
|
41
|
+
* 'loading' while the change is still being read, 'missing' when it is gone.
|
|
42
|
+
*/
|
|
43
|
+
readonly status?: 'loading' | 'missing' | undefined;
|
|
44
|
+
readonly labels: NativeDiffLabels;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Render one file comparison.
|
|
48
|
+
* @param props - hunks, view mode, labels and the optional note.
|
|
49
|
+
* @returns The comparison body, in the layout the mode selects.
|
|
50
|
+
*/
|
|
51
|
+
export declare function NativeDiff({ hunks, path, split, wrap, note, status, labels, }: NativeDiffProps): import("react").JSX.Element;
|
|
52
|
+
//# sourceMappingURL=NativeDiff.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { TurnTailOwnerProps } from '@deepseek-ai/dsh-client-ui-chat/client';
|
|
3
|
+
import type { FileReviewRequest, FileReviewResult } from '../change-types.ts';
|
|
4
|
+
import type { NS } from './chat-locales.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Turn-tail owner currency plus the opener and locale supplied by the slot.
|
|
7
|
+
*
|
|
8
|
+
* dsh 0.2.0's `conversation.chat.turnTail` is a `list` slot, so there is no
|
|
9
|
+
* chain selector to receive a pre-matched value on: the component runs the
|
|
10
|
+
* claim test itself ({@link selectProducedFiles}) and renders nothing when the
|
|
11
|
+
* closing turn produced no files.
|
|
12
|
+
*/
|
|
13
|
+
export type ProducedFilesProps = TurnTailOwnerProps & {
|
|
14
|
+
/** Session workspace root, used to resolve the hover preview's path label. */
|
|
15
|
+
projectRoot?: string | undefined;
|
|
16
|
+
/** Session key used to synchronize undo/redo state with the sidebar tab. */
|
|
17
|
+
reviewSessionId?: string | undefined;
|
|
18
|
+
inspectChanges?: (request: FileReviewRequest) => Promise<FileReviewResult>;
|
|
19
|
+
applyChanges?: (request: FileReviewRequest) => Promise<FileReviewResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Open the plugin's sidebar tab with the given paths pre-expanded
|
|
22
|
+
* (the 审查 button passes every produced path; a file row passes its own).
|
|
23
|
+
* The owning turn number rides along so the tab expands only this turn's
|
|
24
|
+
* rows — a path that recurs in other turns stays collapsed there.
|
|
25
|
+
*/
|
|
26
|
+
openInSidebarTab?: (paths: readonly string[], turn?: number) => void;
|
|
27
|
+
} & PropsLocale<typeof NS>;
|
|
28
|
+
/**
|
|
29
|
+
* Turn-tail list entry: claim the turn, then render the card.
|
|
30
|
+
*
|
|
31
|
+
* The claim test lives here rather than in a chain selector because
|
|
32
|
+
* `conversation.chat.turnTail` is an additive `list` in dsh 0.2.0. Splitting
|
|
33
|
+
* the test from the card keeps the card's hook order unconditional: the
|
|
34
|
+
* wrapper holds no hooks, so early-returning null for an unsettled turn can
|
|
35
|
+
* never change how many hooks the card below it calls.
|
|
36
|
+
* @param props - turn-tail owner currency plus the plugin's injected face.
|
|
37
|
+
* @returns the produced-files card, or null when this turn produced no files.
|
|
38
|
+
*/
|
|
39
|
+
export declare function ProducedFiles(props: ProducedFilesProps): import("react").JSX.Element | null;
|
|
40
|
+
//# sourceMappingURL=ProducedFiles.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** `file-review` namespace dictionaries. */
|
|
2
|
+
/** Dictionary namespace owned by this plugin. */
|
|
3
|
+
export declare const NS = "file-review";
|
|
4
|
+
/** English dictionary (the key-set source of truth). */
|
|
5
|
+
export declare const en: {
|
|
6
|
+
'produced.summary': string;
|
|
7
|
+
'produced.editedOne': string;
|
|
8
|
+
'produced.edited': string;
|
|
9
|
+
'produced.added': string;
|
|
10
|
+
'produced.deletedStat': string;
|
|
11
|
+
'produced.previewHint': string;
|
|
12
|
+
'produced.expandAria': string;
|
|
13
|
+
'produced.collapse': string;
|
|
14
|
+
'produced.collapseAria': string;
|
|
15
|
+
'produced.all': string;
|
|
16
|
+
'produced.viewDiff': string;
|
|
17
|
+
'produced.openReview': string;
|
|
18
|
+
'produced.moreOne': string;
|
|
19
|
+
'produced.more': string;
|
|
20
|
+
'produced.open': string;
|
|
21
|
+
'produced.review': string;
|
|
22
|
+
'produced.reviewAll': string;
|
|
23
|
+
'produced.undo': string;
|
|
24
|
+
'produced.redo': string;
|
|
25
|
+
'produced.undoing': string;
|
|
26
|
+
'produced.redoing': string;
|
|
27
|
+
'produced.toggleUnavailable': string;
|
|
28
|
+
'produced.undoSuccess': string;
|
|
29
|
+
'produced.redoSuccess': string;
|
|
30
|
+
'produced.undoPartial': string;
|
|
31
|
+
'produced.redoPartial': string;
|
|
32
|
+
'produced.undoPartialDescription': string;
|
|
33
|
+
'produced.redoPartialDescription': string;
|
|
34
|
+
'produced.skippedFiles': string;
|
|
35
|
+
'produced.undoError': string;
|
|
36
|
+
'produced.redoError': string;
|
|
37
|
+
'produced.noticeClose': string;
|
|
38
|
+
'produced.noticeDismiss': string;
|
|
39
|
+
'produced.deleted': string;
|
|
40
|
+
'produced.deletedOne': string;
|
|
41
|
+
'produced.deletedAll': string;
|
|
42
|
+
'review.title': string;
|
|
43
|
+
'review.fileOne': string;
|
|
44
|
+
'review.files': string;
|
|
45
|
+
'review.close': string;
|
|
46
|
+
'review.resize': string;
|
|
47
|
+
'review.resizeHint': string;
|
|
48
|
+
'review.openInEditor': string;
|
|
49
|
+
'review.copy': string;
|
|
50
|
+
'review.copied': string;
|
|
51
|
+
'review.showUnchanged': string;
|
|
52
|
+
'review.hideUnchanged': string;
|
|
53
|
+
'review.stats': string;
|
|
54
|
+
'review.unavailable': string;
|
|
55
|
+
'diff.created': string;
|
|
56
|
+
'diff.deleted': string;
|
|
57
|
+
'diff.unchanged': string;
|
|
58
|
+
'diff.truncated': string;
|
|
59
|
+
'diff.loading': string;
|
|
60
|
+
'diff.missing': string;
|
|
61
|
+
};
|
|
62
|
+
/** Union of this namespace's dictionary keys. */
|
|
63
|
+
export type DeliverablesKey = keyof typeof en;
|
|
64
|
+
/** Simplified Chinese dictionary. */
|
|
65
|
+
export declare const zh: Record<DeliverablesKey, string>;
|
|
66
|
+
//# sourceMappingURL=chat-locales.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat → sidebar deep-link channel.
|
|
3
|
+
*
|
|
4
|
+
* The chat turn-tail row knows which paths (and which turn) the user wants to
|
|
5
|
+
* inspect, but better-sidebar's native right Sidebar mints its own tab ids and
|
|
6
|
+
* does not refresh an already-open tab's `meta` (dsh-better-sidebar #632 /
|
|
7
|
+
* 0.19.1 adapter behaviour). Passing a `path` seed is also unsafe there: the
|
|
8
|
+
* native surface routes path-bearing opens to the file editor, so the review
|
|
9
|
+
* tab would never mount.
|
|
10
|
+
*
|
|
11
|
+
* The channel therefore carries the seed inside this plugin: the chat row
|
|
12
|
+
* publishes it and then opens the tab by type; the tab body subscribes and
|
|
13
|
+
* replays whatever arrived, whether it mounted just now or was already open.
|
|
14
|
+
* Sessions are keyed separately, and each publish gets a monotonic nonce so a
|
|
15
|
+
* replay can never be mistaken for a fresh link.
|
|
16
|
+
*/
|
|
17
|
+
/** One chat-issued review target inside a session. */
|
|
18
|
+
export interface FileReviewSeed {
|
|
19
|
+
readonly paths: readonly string[];
|
|
20
|
+
/** Turn anchor: expand only this turn's rows for the given paths. */
|
|
21
|
+
readonly turn?: number;
|
|
22
|
+
/** Monotonic publish id; a new value means a new link to replay. */
|
|
23
|
+
readonly nonce: number;
|
|
24
|
+
}
|
|
25
|
+
/** A row a deep link resolved to, keyed the way the tab keys its state. */
|
|
26
|
+
export interface DeepLinkRow {
|
|
27
|
+
readonly turn: number;
|
|
28
|
+
readonly path: string;
|
|
29
|
+
}
|
|
30
|
+
/** Everything one replay must do, computed without touching component state. */
|
|
31
|
+
export interface DeepLinkPlan {
|
|
32
|
+
/** Rows to expand, as `turn|path` state keys. */
|
|
33
|
+
readonly expanded: readonly string[];
|
|
34
|
+
/** The row to scroll to (the first match), or null when nothing matched. */
|
|
35
|
+
readonly first: DeepLinkRow | null;
|
|
36
|
+
/**
|
|
37
|
+
* Archive section to reveal: a link into an auto-archived turn must render
|
|
38
|
+
* that turn before its row can be scrolled to. Null when the target is
|
|
39
|
+
* already in the main list.
|
|
40
|
+
*/
|
|
41
|
+
readonly archive: {
|
|
42
|
+
readonly pages: number;
|
|
43
|
+
} | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a deep link against EVERY change the tab can render, including turns
|
|
47
|
+
* still hidden behind a closed archive section.
|
|
48
|
+
*
|
|
49
|
+
* The target is deliberately resolved against the full change set rather than
|
|
50
|
+
* the currently mounted rows. A link into an archived turn is replayed in the
|
|
51
|
+
* same commit that opens the archive, so at that moment its rows are not
|
|
52
|
+
* mounted yet; resolving against the mounted set made the match fail, the
|
|
53
|
+
* pending scroll get cleared, and the link land nowhere with no retry.
|
|
54
|
+
*
|
|
55
|
+
* @param turns - Every turn, ascending (the source of truth for all rows).
|
|
56
|
+
* @param archivedTurns - The auto-archived subset, newest first.
|
|
57
|
+
* @param paths - Paths the link targets.
|
|
58
|
+
* @param targetTurn - Turn anchor, or undefined for a path-only (legacy) link.
|
|
59
|
+
* @returns The expand set, the scroll target, and the archive reveal to apply.
|
|
60
|
+
*/
|
|
61
|
+
export declare function planDeepLink(turns: readonly {
|
|
62
|
+
readonly turn: number;
|
|
63
|
+
readonly live: boolean;
|
|
64
|
+
readonly files: readonly {
|
|
65
|
+
readonly path: string;
|
|
66
|
+
}[];
|
|
67
|
+
}[], archivedTurns: readonly {
|
|
68
|
+
readonly turn: number;
|
|
69
|
+
}[], paths: readonly string[], targetTurn: number | undefined): DeepLinkPlan;
|
|
70
|
+
type SeedListener = (sessionId: string, seed: FileReviewSeed) => void;
|
|
71
|
+
type InvalidationListener = (sessionId: string) => void;
|
|
72
|
+
/** Publish a deep link for one session and return the stored seed. */
|
|
73
|
+
export declare function publishFileReviewSeed(sessionId: string, paths: readonly string[], turn?: number): FileReviewSeed;
|
|
74
|
+
/** The most recent seed for a session, if the tab has not consumed it yet. */
|
|
75
|
+
export declare function currentFileReviewSeed(sessionId: string): FileReviewSeed | undefined;
|
|
76
|
+
/** Observe every publish; the caller filters by session. */
|
|
77
|
+
export declare function subscribeFileReviewSeed(listener: SeedListener): () => void;
|
|
78
|
+
/** Notify every mounted review surface that one session's disk state changed. */
|
|
79
|
+
export declare function publishFileReviewInvalidation(sessionId: string): void;
|
|
80
|
+
/** Observe disk-state invalidations issued by this plugin's review surfaces. */
|
|
81
|
+
export declare function subscribeFileReviewInvalidation(listener: InvalidationListener): () => void;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=deep-link.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Literal deletion-path extraction from terminal command text (unknown-safe).
|
|
3
|
+
*
|
|
4
|
+
* dsh has no dedicated delete-file tool: agents delete through the Bash/Pwsh
|
|
5
|
+
* terminals, whose `tool/call` arguments carry the raw command line in
|
|
6
|
+
* `command`. There is no filesystem snapshot to consult, so this parser is deliberately
|
|
7
|
+
* conservative — it only reports paths that appear VERBATIM as arguments of a
|
|
8
|
+
* known deletion command:
|
|
9
|
+
*
|
|
10
|
+
* - command substitution (`$(…)`, backticks) or process substitution anywhere
|
|
11
|
+
* in a segment disqualifies that whole segment;
|
|
12
|
+
* - glob characters (`* ? [`) or variable expansion (`$`) in an argument
|
|
13
|
+
* disqualify that argument (the affected set cannot be enumerated post
|
|
14
|
+
* hoc);
|
|
15
|
+
* - shell separators (`&&`, `||`, `|`, `;`, newline) split the line so
|
|
16
|
+
* `rm a && rm b` reports both while `echo rm x` reports nothing.
|
|
17
|
+
*
|
|
18
|
+
* A reported path is display-only vocabulary: the file is gone, so it carries
|
|
19
|
+
* no diff hunks and no undo. Directories deleted with `rm -r` surface as the
|
|
20
|
+
* directory path itself.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Deletion paths named literally by one terminal command line, in argument
|
|
24
|
+
* order, deduplicated. `undefined`/non-string titles and non-terminal views
|
|
25
|
+
* report nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function deletedPathsFromCommand(command: string): readonly string[];
|
|
28
|
+
//# sourceMappingURL=deleted-paths.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line pairing and hunk building shared by every comparison this plugin draws.
|
|
3
|
+
*
|
|
4
|
+
* The sidebar review tab and the chat hover preview both render dsh's own native
|
|
5
|
+
* FileDiff markup, so pairing, numbering, hunk trimming and counting live here
|
|
6
|
+
* once. Counts come from the same pairing the viewer draws with, which is what
|
|
7
|
+
* keeps a "+N" badge from ever disagreeing with the lines on screen.
|
|
8
|
+
*
|
|
9
|
+
* Recorded changes arrive as full before/after snapshots, while dsh's own diff
|
|
10
|
+
* service delivers pre-trimmed hunks. {@link toNativeHunks} bridges the two by
|
|
11
|
+
* trimming context the same way, so a one-line edit in a long file renders as one
|
|
12
|
+
* small hunk instead of the whole file.
|
|
13
|
+
*/
|
|
14
|
+
import type { ProducedFileDiff } from '../change-types.ts';
|
|
15
|
+
/** How one drawn line relates to the two sides of the comparison. */
|
|
16
|
+
export type DiffLineKind = 'context' | 'del' | 'add';
|
|
17
|
+
/** One line of a comparison, already numbered against both sides. */
|
|
18
|
+
export interface DiffLine {
|
|
19
|
+
readonly kind: DiffLineKind;
|
|
20
|
+
readonly oldNumber: number | null;
|
|
21
|
+
readonly newNumber: number | null;
|
|
22
|
+
readonly text: string;
|
|
23
|
+
}
|
|
24
|
+
/** Added and removed line totals. */
|
|
25
|
+
export interface DiffStats {
|
|
26
|
+
readonly added: number;
|
|
27
|
+
readonly removed: number;
|
|
28
|
+
}
|
|
29
|
+
/** Optional native note shown above a comparison. */
|
|
30
|
+
export type DiffNote = 'created' | 'deleted' | 'unchanged' | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* One comparison in the shape dsh's own FileDiff renders: a header coordinate
|
|
33
|
+
* pair plus `+`/`-`/` ` prefixed lines.
|
|
34
|
+
*/
|
|
35
|
+
export interface NativeDiffHunk {
|
|
36
|
+
readonly oldStart: number;
|
|
37
|
+
readonly oldLines: number;
|
|
38
|
+
readonly newStart: number;
|
|
39
|
+
readonly newLines: number;
|
|
40
|
+
readonly lines: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/** Whether a comparison touches only one side, which forces the unified view. */
|
|
43
|
+
export declare function isOneSided(hunks: readonly NativeDiffHunk[]): boolean;
|
|
44
|
+
/** Pair one recorded before/after snapshot into numbered lines. */
|
|
45
|
+
export declare function pairLines(diff: ProducedFileDiff): DiffLine[];
|
|
46
|
+
/** Count added and removed lines using the viewer's exact line-diff algorithm. */
|
|
47
|
+
export declare function summarizeDiffs(diffs: readonly ProducedFileDiff[]): DiffStats;
|
|
48
|
+
/**
|
|
49
|
+
* Derive the comparison note from the recorded change rather than hunk count alone.
|
|
50
|
+
*
|
|
51
|
+
* The creation note comes from the explicit `created` flag, never from
|
|
52
|
+
* `oldText === null`. Null old text means the prior content is unavailable, and
|
|
53
|
+
* that is also what `mutation-call.ts` synthesizes when a result carries no
|
|
54
|
+
* `meta.diffs` for a `write` overwrite, a `str_replace_editor insert` or an
|
|
55
|
+
* `edit` with an empty `old_string` — all edits to files that already existed.
|
|
56
|
+
* Inferring creation from null labeled those "created in this turn".
|
|
57
|
+
*
|
|
58
|
+
* Creation is a FILE-level fact, so ANY authoritative creation record for the
|
|
59
|
+
* path carries it. `diffs` holds one file's hunks in settlement order, and a
|
|
60
|
+
* file created and then edited in the same turn keeps its creation hunk
|
|
61
|
+
* alongside the later ordinary ones; requiring `every` hunk to be flagged lost
|
|
62
|
+
* the note precisely there. Only the explicitly flagged hunks count, so a
|
|
63
|
+
* file whose prior content is merely unknown stays unlabeled.
|
|
64
|
+
*/
|
|
65
|
+
export declare function diffNote(diffs: readonly ProducedFileDiff[], hunks: readonly NativeDiffHunk[], deleted?: boolean): DiffNote;
|
|
66
|
+
/**
|
|
67
|
+
* The message a comparison with nothing to draw shows. A file removed by a
|
|
68
|
+
* command has no content left, which is a different fact from a change whose
|
|
69
|
+
* two sides could not be reconstructed — so it keeps its own explanation
|
|
70
|
+
* instead of the generic one.
|
|
71
|
+
* @param deleted - whether the change removed the file.
|
|
72
|
+
* @param deletedHint - copy for a command-deleted file.
|
|
73
|
+
* @param missing - copy for a change that cannot be reconstructed.
|
|
74
|
+
* @returns the copy to show.
|
|
75
|
+
*/
|
|
76
|
+
export declare function missingMessage(deleted: boolean, deletedHint: string, missing: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Convert recorded comparisons into dsh's served hunk shape.
|
|
79
|
+
* @param diffs - the recorded before/after snapshots for one file.
|
|
80
|
+
* @param contextLines - unchanged lines kept on each side of a change.
|
|
81
|
+
* @returns the hunks to render, in order.
|
|
82
|
+
*/
|
|
83
|
+
export declare function toNativeHunks(diffs: readonly ProducedFileDiff[], contextLines?: number): NativeDiffHunk[];
|
|
84
|
+
/** Serialize recorded hunks as one plain-text unified diff. */
|
|
85
|
+
export declare function nativeDiffText(hunks: readonly NativeDiffHunk[]): string;
|
|
86
|
+
//# sourceMappingURL=diff-hunks.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split one side of a diff into content lines without manufacturing a final
|
|
3
|
+
* empty line for a trailing line terminator.
|
|
4
|
+
* @param text - One diff side's text.
|
|
5
|
+
* @returns Content lines without the terminating newline.
|
|
6
|
+
*/
|
|
7
|
+
export declare function diffContentLines(text: string): string[];
|
|
8
|
+
//# sourceMappingURL=diff-text.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-review-tab plugin, browser half: TWO coexisting surfaces over the same
|
|
3
|
+
* produced-file vocabulary —
|
|
4
|
+
*
|
|
5
|
+
* 1. the chat turn-tail row (the original dsh-file-review card: "Edited N
|
|
6
|
+
* files · +M -K / Undo / Review"), registered into the
|
|
7
|
+
* 'conversation.chat.turnTail' list at order -2. This slot was a
|
|
8
|
+
* first-claim-wins chain through DSH 0.1.5 and is an additive list from
|
|
9
|
+
* 0.1.6-alpha.2, so entries coexist instead of electing: the row declares an
|
|
10
|
+
* `id` and renders null for a turn it does not claim (see ProducedFiles); and
|
|
11
|
+
* 2. the 'file-review' better-sidebar tab (per-session change list + inline
|
|
12
|
+
* red/green diffs + per-turn/per-file undo).
|
|
13
|
+
*
|
|
14
|
+
* The Host half's undo/redo capability reaches both surfaces through the
|
|
15
|
+
* package's Typert remote contribution, mounted here exactly like
|
|
16
|
+
* dsh-file-review did. Every registration is wrapped in ctx.effect so fiber
|
|
17
|
+
* disposal (HMR / plugin disable) unregisters cleanly.
|
|
18
|
+
*/
|
|
19
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
20
|
+
import { type DeliverablesKey } from './chat-locales.ts';
|
|
21
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
22
|
+
interface LocaleNamespaceMap {
|
|
23
|
+
/** Turn-tail row copy (the chat-side surface). */
|
|
24
|
+
'file-review': DeliverablesKey;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Required services: the sidebar registry, session snapshots, locale, remote,
|
|
29
|
+
* and the slot registry (turn-tail chain). The conversation Definition
|
|
30
|
+
* registry is deliberately NOT a static inject: its service name moved across
|
|
31
|
+
* dsh releases (<= 0.1.1: root `conversationEvents`; 0.1.2-alpha.1+:
|
|
32
|
+
* `uiConversation.events`), so a hard inject on either name leaves the whole
|
|
33
|
+
* plugin forever "pending" on the other version and fails web boot (issue
|
|
34
|
+
* #6). It is resolved dynamically in apply() instead.
|
|
35
|
+
*/
|
|
36
|
+
export declare const inject: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Client plugin body: attach locale, mount the Typert remote, register the
|
|
39
|
+
* chat turn-tail row AND the sidebar tab.
|
|
40
|
+
* @param ctx - client root context.
|
|
41
|
+
*/
|
|
42
|
+
export declare function apply(ctx: Context): void;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal zh/en copy for the file-review sidebar tab. Follows the DSH i18n
|
|
3
|
+
* system: the client apply attaches the locale service (`ctx.locale`,
|
|
4
|
+
* provided by `@deepseek-ai/dsh-client-locale`) through {@link attachLocale},
|
|
5
|
+
* and `t()` resolves the active locale from it. Without an attached service
|
|
6
|
+
* (standalone/test compositions) the browser language is used. Mirrors the
|
|
7
|
+
* dsh-better-sidebar locales pattern.
|
|
8
|
+
*/
|
|
9
|
+
/** The dictionary namespace this plugin owns in the DSH locale registry. */
|
|
10
|
+
export declare const LOCALE_NS = "fileReviewTab";
|
|
11
|
+
/** The zh dictionary (the key-set source of truth). */
|
|
12
|
+
export declare const zh: {
|
|
13
|
+
readonly tabTitle: "文件审查";
|
|
14
|
+
readonly empty: "本会话暂无文件改动";
|
|
15
|
+
readonly sessionUnavailable: "会话不可用";
|
|
16
|
+
readonly remoteUnavailable: "文件审查服务不可用";
|
|
17
|
+
readonly turn: "第 {n} 轮";
|
|
18
|
+
readonly turnLive: "进行中";
|
|
19
|
+
readonly files: "{count} 个文件";
|
|
20
|
+
readonly filesOne: "1 个文件";
|
|
21
|
+
readonly undo: "撤销";
|
|
22
|
+
readonly redo: "重新应用";
|
|
23
|
+
readonly undoing: "正在撤销…";
|
|
24
|
+
readonly redoing: "正在重新应用…";
|
|
25
|
+
readonly undoTurn: "撤销本轮";
|
|
26
|
+
readonly redoTurn: "重新应用本轮";
|
|
27
|
+
readonly toggleUnavailable: "没有可安全还原的文件";
|
|
28
|
+
readonly stateUndone: "已撤销";
|
|
29
|
+
readonly stateConflict: "内容冲突";
|
|
30
|
+
readonly stateUnsupported: "不可还原";
|
|
31
|
+
readonly stateError: "错误";
|
|
32
|
+
readonly deleted: "已删除";
|
|
33
|
+
readonly deletedHint: "该文件在本轮中被终端命令删除,内容已不存在,无法查看差异或撤销。";
|
|
34
|
+
readonly archived: "已归档 {n} 轮";
|
|
35
|
+
readonly archivedExpand: "展开已归档轮次";
|
|
36
|
+
readonly archivedCollapse: "收起已归档轮次";
|
|
37
|
+
readonly loadMore: "加载更多(还有 {n} 轮)";
|
|
38
|
+
readonly undoSuccess: "已成功撤销更改";
|
|
39
|
+
readonly redoSuccess: "已成功重新应用更改";
|
|
40
|
+
readonly undoPartial: "部分文件未能撤销";
|
|
41
|
+
readonly redoPartial: "部分文件未能重新应用";
|
|
42
|
+
readonly toggleError: "操作失败";
|
|
43
|
+
readonly openInEditor: "在编辑器中打开";
|
|
44
|
+
readonly open: "打开 {name}";
|
|
45
|
+
readonly copy: "复制差异";
|
|
46
|
+
readonly copied: "已复制";
|
|
47
|
+
readonly showUnchanged: "显示 {count} 行未更改内容";
|
|
48
|
+
readonly hideUnchanged: "隐藏 {count} 行未更改内容";
|
|
49
|
+
readonly stats: "新增 {added} 行,删除 {removed} 行";
|
|
50
|
+
readonly unavailable: "无法为此更改还原可审查的差异。";
|
|
51
|
+
readonly refresh: "刷新状态";
|
|
52
|
+
readonly refreshAria: "重新检查每个文件的撤销状态";
|
|
53
|
+
readonly selectFile: "选择要查看的文件";
|
|
54
|
+
readonly split: "切换为左右对比";
|
|
55
|
+
readonly unified: "切换为单栏对比";
|
|
56
|
+
readonly splitAria: "左右对比";
|
|
57
|
+
readonly wrap: "开启自动换行";
|
|
58
|
+
readonly nowrap: "关闭自动换行";
|
|
59
|
+
readonly wrapAria: "自动换行";
|
|
60
|
+
readonly diffLoading: "正在读取改动…";
|
|
61
|
+
readonly diffMissing: "这轮改动的内容已不可用";
|
|
62
|
+
readonly diffCreated: "本轮新建的文件";
|
|
63
|
+
readonly diffDeleted: "本轮删除的文件";
|
|
64
|
+
readonly diffUnchanged: "两侧内容相同";
|
|
65
|
+
readonly diffTruncated: "只显示前 {count} 行";
|
|
66
|
+
};
|
|
67
|
+
/** Union of this namespace's dictionary keys. */
|
|
68
|
+
export type CopyKey = keyof typeof zh;
|
|
69
|
+
/** The en dictionary. */
|
|
70
|
+
export declare const en: Record<CopyKey, string>;
|
|
71
|
+
/** Attach (or detach, with undefined) the DSH locale service. */
|
|
72
|
+
export declare function attachLocale(service: {
|
|
73
|
+
getSnapshot(): {
|
|
74
|
+
active: string;
|
|
75
|
+
};
|
|
76
|
+
} | undefined): void;
|
|
77
|
+
/** Translate a copy key; `{name}` placeholders interpolate from `params`. */
|
|
78
|
+
export declare function t(key: CopyKey, params?: Record<string, string | number>): string;
|
|
79
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared file-mutation facts for dsh 0.1.5.
|
|
3
|
+
*
|
|
4
|
+
* The Conversation Definition contract no longer hands matches a pre-rendered
|
|
5
|
+
* wire view, so both the chat turn-tail row and the sidebar tab derive a
|
|
6
|
+
* mutation from the same two sources the dsh 0.1.5 tooling uses:
|
|
7
|
+
*
|
|
8
|
+
* - `tool/call` arguments identify the mutated path and the intended hunks
|
|
9
|
+
* (`write` / `edit` / `str_replace_editor`), or the terminal command whose
|
|
10
|
+
* literal rm-family arguments name deleted paths (`bash` / `pwsh`);
|
|
11
|
+
* - `tool/result` `meta.diffs` carries the applied contextual hunks that
|
|
12
|
+
* dsh-tool-fs attaches on settlement (no line numbers in 0.1.5).
|
|
13
|
+
*
|
|
14
|
+
* Unknown tools and malformed arguments yield null, keeping the vocabulary
|
|
15
|
+
* conservative: a call only produces review data when its shape is known.
|
|
16
|
+
*/
|
|
17
|
+
import type { ProducedFileDiff } from '../change-types.ts';
|
|
18
|
+
/** One mutation call's parsed intent, captured at `tool/call` time. */
|
|
19
|
+
export interface CallIntent {
|
|
20
|
+
/** The single path the call mutates; null for a deletion-only terminal call. */
|
|
21
|
+
readonly path: string | null;
|
|
22
|
+
/** Call-argument-derived hunks, used when the result carries no meta diff. */
|
|
23
|
+
readonly diffs: readonly ProducedFileDiff[];
|
|
24
|
+
/** Literal paths a terminal call deletes. */
|
|
25
|
+
readonly deletions: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The call-argument-derived mutation intent for one write/edit/str_replace_editor
|
|
29
|
+
* or terminal call. Unknown tools and malformed arguments return null.
|
|
30
|
+
*/
|
|
31
|
+
export declare function callIntent(name: string, argsRaw: unknown): CallIntent | null;
|
|
32
|
+
/** Validate the tool-private result metadata's contextual diff hunks. */
|
|
33
|
+
export declare function appliedDiffs(meta: unknown): readonly ProducedFileDiff[] | null;
|
|
34
|
+
//# sourceMappingURL=mutation-call.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProducedFileDiff } from '../change-types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Line-level hunks for one file mutation, or a single whole-file entry when the
|
|
4
|
+
* file was created (`before === null`, mirroring the write tool's null-content
|
|
5
|
+
* card). Returns [] only when an existing file's content is unchanged: a
|
|
6
|
+
* `before === null` mutation always changed the filesystem, even when `after`
|
|
7
|
+
* is empty, because the file came into existence.
|
|
8
|
+
*/
|
|
9
|
+
export declare function diffsFromBeforeAfter(path: string, before: string | null, after: string): readonly ProducedFileDiff[];
|
|
10
|
+
//# sourceMappingURL=recorded-diffs.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pacing for the client's `recorded` (Code Mode mutation) fetch.
|
|
3
|
+
*
|
|
4
|
+
* The fetch re-arms whenever a root's settled-dispatch count changes, and a busy
|
|
5
|
+
* `run_code` can change it rapidly. Two ways to get that wrong, both of which
|
|
6
|
+
* leave the tab showing only the mutations recorded before it first looked:
|
|
7
|
+
*
|
|
8
|
+
* - Debouncing from each update (restarting the timer whenever one arrives)
|
|
9
|
+
* pushes the fetch out for as long as updates keep coming.
|
|
10
|
+
* - Anchoring on "the last fetch" alone starves the FIRST fetch: while updates
|
|
11
|
+
* keep arriving, no fetch has completed, so the anchor never exists and the
|
|
12
|
+
* window is re-armed forever.
|
|
13
|
+
*
|
|
14
|
+
* So the delay is always measured from a real instant — the last fetch, or the
|
|
15
|
+
* moment the fetch was first armed when none has completed yet. An update can
|
|
16
|
+
* then only ever schedule the next fetch for `anchor + interval`, and nothing an
|
|
17
|
+
* update does can push it later.
|
|
18
|
+
*/
|
|
19
|
+
/** Minimum gap between two `recorded` fetches, in milliseconds. */
|
|
20
|
+
export declare const RECORDED_FETCH_INTERVAL = 200;
|
|
21
|
+
/**
|
|
22
|
+
* Delay before the next `recorded` fetch.
|
|
23
|
+
* @param anchor - Timestamp of the last completed fetch, or of the moment the
|
|
24
|
+
* fetch was first armed when none has completed yet. Must never be a value that
|
|
25
|
+
* an incoming update can reset, or the fetch starves.
|
|
26
|
+
* @param now - Current timestamp.
|
|
27
|
+
* @returns Milliseconds to wait; 0 once the interval has already elapsed.
|
|
28
|
+
*/
|
|
29
|
+
export declare function recordedFetchDelay(anchor: number, now: number): number;
|
|
30
|
+
//# sourceMappingURL=recorded-fetch.d.ts.map
|