dsh-diff-approval 0.17.0 → 0.19.0

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.
@@ -19,9 +19,9 @@ export interface PendingDiffStore extends HostObservable<PendingDiffSnapshot> {
19
19
  /** Revert one operation. */
20
20
  revert: (sessionId: SessionId, id: string) => Promise<void>;
21
21
  /** Keep one diff block, then refresh so the entry's diff reflects the accept. */
22
- blockKeep: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
22
+ blockKeep: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean) => Promise<void>;
23
23
  /** Revert one diff block, then refresh so the entry's diff reflects the undo. */
24
- blockRevert: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
24
+ blockRevert: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean) => Promise<void>;
25
25
  /** Undo the session's last keep/revert, then refresh; resolves to the affected entry id when it is still pending. */
26
26
  undo: (sessionId: SessionId) => Promise<string | undefined>;
27
27
  /** Redo the session's last undone keep/revert, then refresh; resolves to the affected entry id when it is still pending. */
@@ -30,12 +30,16 @@ export interface PendingDiffStore extends HostObservable<PendingDiffSnapshot> {
30
30
  importVcs: (sessionId: SessionId, includeUntracked: boolean) => Promise<VcsImportValue>;
31
31
  /** Open one file with its default application or reveal it in the folder. */
32
32
  open: (sessionId: SessionId, id: string, action: DiffApprovalOpenAction) => Promise<void>;
33
+ /** Keep every pending entry of one session in a single host call, then refresh. */
34
+ keepAll: (sessionId: SessionId) => Promise<void>;
35
+ /** Revert every pending entry of one session in a single host call, then refresh. */
36
+ revertAll: (sessionId: SessionId) => Promise<void>;
37
+ /** Inline one workspace image as a base64 data URI (empty when unreadable). */
38
+ previewImage: (sessionId: SessionId, path: string) => Promise<string | undefined>;
33
39
  /** Drop every local fact (used on connection reset). */
34
40
  reset: () => void;
35
41
  /** Acknowledge a redo-cleared notice so the panel surfaces it only once. */
36
42
  clearRedoCleared: () => void;
37
- /** Acknowledge the just-resolved prompt so it is only surfaced once. */
38
- clearJustResolved: () => void;
39
43
  }
40
44
  /**
41
45
  * Create the store over the review-channel port.
@@ -67,6 +67,21 @@ export interface IntraRun {
67
67
  text: string;
68
68
  kind: 'same' | 'del' | 'add';
69
69
  }
70
+ /**
71
+ * Compute the intra-line runs for one del/add line pair, or `undefined` when
72
+ * the pair should not be annotated: identical lines (no internal change) or
73
+ * lines too dissimilar to be a modification (a rewrite, not an edit).
74
+ * Word-based via the `diff` package's `diffArrays` over `tokenizeLine`'s
75
+ * tokens, so an English edit highlights whole changed words and a CJK edit
76
+ * highlights the individual changed characters.
77
+ * @param oldText - the removed side's line text.
78
+ * @param newText - the added side's line text.
79
+ * @returns the del-side and add-side runs, or `undefined` to skip annotation.
80
+ */
81
+ export declare function intraRunsOf(oldText: string, newText: string): {
82
+ del: IntraRun[];
83
+ add: IntraRun[];
84
+ } | undefined;
70
85
  /** One matched del→add row pair within a change block. */
71
86
  interface BlockPair {
72
87
  delIndex: number;
@@ -88,6 +88,11 @@ export interface DiffApprovalBlockTarget {
88
88
  sessionId: SessionId;
89
89
  id: string;
90
90
  block: DiffApprovalBlockRange;
91
+ /** When true and this action clears the entry's last remaining change, remove
92
+ * the entry from the pending list as part of the same request. When false or
93
+ * absent, a fully-resolved entry stays listed (the panel's remove-and-keep
94
+ * prompt sets this from the user's choice). */
95
+ removeWhenResolved?: boolean | undefined;
91
96
  }
92
97
  /** Outcome of one keep/revert/undo/redo request. */
93
98
  export type DiffApprovalActionOutcome = 'kept' | 'reverted' | 'missing' | 'undone' | 'redone' | 'nothing';
@@ -100,6 +105,24 @@ export interface VcsImportValue {
100
105
  /** Whether a VCS root was found at all (false when the workspace is not in a git/svn/p4 checkout). */
101
106
  detected: boolean;
102
107
  }
108
+ /** Target of one preview-image read. */
109
+ export interface DiffApprovalPreviewImageTarget {
110
+ sessionId: SessionId;
111
+ /** The backend resolution path of the image (workspace-relative or absolute display path). */
112
+ path: string;
113
+ }
114
+ /** Value returned by the channel's preview-image endpoint. */
115
+ export interface DiffApprovalPreviewImageValue {
116
+ /** The image's base64 data URI (MIME from the file's extension), or `undefined`
117
+ * when the host could not read the file (absent, outside the workspace, or
118
+ * unreadable) — a missing value leaves the image unresolved in the preview. */
119
+ dataUri?: string | undefined;
120
+ }
121
+ /** Value returned by the channel's keep-all/revert-all endpoints. */
122
+ export interface DiffApprovalBulkValue {
123
+ /** How many pending entries were kept/reverted (0 when the session had none). */
124
+ affected: number;
125
+ }
103
126
  /** Value returned by the channel's keep and revert endpoints. */
104
127
  export interface DiffApprovalActionValue {
105
128
  /** What the request did; `missing` means no pending entry existed. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-diff-approval",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "DeepSeek Harness plugin: pending-edit review with whole-file diff and Keep/Revert",
5
5
  "packageManager": "pnpm@11.21.0",
6
6
  "author": "Wu Zhiwei",
@@ -60,6 +60,8 @@
60
60
  "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.5",
61
61
  "@shikijs/langs": "^4.4.3",
62
62
  "diff": "^9.0.0",
63
+ "dompurify": "^3.4.15",
64
+ "marked": "^18.0.11",
63
65
  "shiki": "^4.4.3"
64
66
  },
65
67
  "peerDependencies": {