@sagmans/dsh-tui 0.3.0 → 0.4.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.
- package/README.md +158 -6
- package/cordis.patch.yml +14 -0
- package/lib/agent/projections.d.ts +22 -6
- package/lib/agent/projections.d.ts.map +1 -1
- package/lib/agent/projections.js +21 -10
- package/lib/agent/projections.js.map +1 -1
- package/lib/agent/prompt-history.d.ts +89 -0
- package/lib/agent/prompt-history.d.ts.map +1 -0
- package/lib/agent/prompt-history.js +380 -0
- package/lib/agent/prompt-history.js.map +1 -0
- package/lib/agent/status.d.ts +6 -0
- package/lib/agent/status.d.ts.map +1 -1
- package/lib/agent/status.js +1 -0
- package/lib/agent/status.js.map +1 -1
- package/lib/herdr/client.d.ts +57 -0
- package/lib/herdr/client.d.ts.map +1 -0
- package/lib/herdr/client.js +218 -0
- package/lib/herdr/client.js.map +1 -0
- package/lib/herdr/constants.d.ts +93 -0
- package/lib/herdr/constants.d.ts.map +1 -0
- package/lib/herdr/constants.js +79 -0
- package/lib/herdr/constants.js.map +1 -0
- package/lib/herdr/reporter.d.ts +60 -0
- package/lib/herdr/reporter.d.ts.map +1 -0
- package/lib/herdr/reporter.js +217 -0
- package/lib/herdr/reporter.js.map +1 -0
- package/lib/herdr/state.d.ts +57 -0
- package/lib/herdr/state.d.ts.map +1 -0
- package/lib/herdr/state.js +62 -0
- package/lib/herdr/state.js.map +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +252 -20
- package/lib/index.js.map +1 -1
- package/lib/input/actions.d.ts +1 -1
- package/lib/input/actions.d.ts.map +1 -1
- package/lib/input/actions.js +3 -0
- package/lib/input/actions.js.map +1 -1
- package/lib/input/ghost.d.ts +46 -0
- package/lib/input/ghost.d.ts.map +1 -0
- package/lib/input/ghost.js +58 -0
- package/lib/input/ghost.js.map +1 -0
- package/lib/input/keymap.d.ts.map +1 -1
- package/lib/input/keymap.js +2 -0
- package/lib/input/keymap.js.map +1 -1
- package/lib/input/submission.d.ts +24 -1
- package/lib/input/submission.d.ts.map +1 -1
- package/lib/input/submission.js +28 -1
- package/lib/input/submission.js.map +1 -1
- package/lib/stash/lock.d.ts +72 -0
- package/lib/stash/lock.d.ts.map +1 -0
- package/lib/stash/lock.js +374 -0
- package/lib/stash/lock.js.map +1 -0
- package/lib/stash/paths.d.ts +22 -0
- package/lib/stash/paths.d.ts.map +1 -0
- package/lib/stash/paths.js +83 -0
- package/lib/stash/paths.js.map +1 -0
- package/lib/stash/private-fs.d.ts +61 -0
- package/lib/stash/private-fs.d.ts.map +1 -0
- package/lib/stash/private-fs.js +379 -0
- package/lib/stash/private-fs.js.map +1 -0
- package/lib/stash/schema.d.ts +57 -0
- package/lib/stash/schema.d.ts.map +1 -0
- package/lib/stash/schema.js +127 -0
- package/lib/stash/schema.js.map +1 -0
- package/lib/stash/store.d.ts +92 -0
- package/lib/stash/store.d.ts.map +1 -0
- package/lib/stash/store.js +262 -0
- package/lib/stash/store.js.map +1 -0
- package/lib/stash.d.ts +91 -0
- package/lib/stash.d.ts.map +1 -0
- package/lib/stash.js +296 -0
- package/lib/stash.js.map +1 -0
- package/lib/theme-settings.d.ts +37 -8
- package/lib/theme-settings.d.ts.map +1 -1
- package/lib/theme-settings.js +60 -3
- package/lib/theme-settings.js.map +1 -1
- package/lib/theme-tokens.d.ts +1 -1
- package/lib/theme-tokens.d.ts.map +1 -1
- package/lib/theme-tokens.js +8 -0
- package/lib/theme-tokens.js.map +1 -1
- package/lib/todo-guard.d.ts +116 -0
- package/lib/todo-guard.d.ts.map +1 -0
- package/lib/todo-guard.js +259 -0
- package/lib/todo-guard.js.map +1 -0
- package/lib/ui/editor.d.ts +41 -1
- package/lib/ui/editor.d.ts.map +1 -1
- package/lib/ui/editor.js +98 -4
- package/lib/ui/editor.js.map +1 -1
- package/lib/ui/history-picker.d.ts +15 -0
- package/lib/ui/history-picker.d.ts.map +1 -0
- package/lib/ui/history-picker.js +26 -0
- package/lib/ui/history-picker.js.map +1 -0
- package/lib/ui/picker.d.ts +11 -1
- package/lib/ui/picker.d.ts.map +1 -1
- package/lib/ui/picker.js +17 -2
- package/lib/ui/picker.js.map +1 -1
- package/lib/ui/prompt.d.ts +2 -0
- package/lib/ui/prompt.d.ts.map +1 -1
- package/lib/ui/prompt.js +4 -0
- package/lib/ui/prompt.js.map +1 -1
- package/lib/ui/stash-picker.d.ts +43 -0
- package/lib/ui/stash-picker.d.ts.map +1 -0
- package/lib/ui/stash-picker.js +78 -0
- package/lib/ui/stash-picker.js.map +1 -0
- package/lib/ui/status.d.ts +2 -0
- package/lib/ui/status.d.ts.map +1 -1
- package/lib/ui/status.js +7 -0
- package/lib/ui/status.js.map +1 -1
- package/lib/work.d.ts +3 -1
- package/lib/work.d.ts.map +1 -1
- package/lib/work.js +9 -1
- package/lib/work.js.map +1 -1
- package/package.json +5 -1
package/lib/stash.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// User-facing prompt-stash operations, independent of the terminal surface.
|
|
2
|
+
//
|
|
3
|
+
// Every command funnels through one serial queue, so a chord and a typed command
|
|
4
|
+
// can never interleave a read-modify-write on the same bank. The surface is
|
|
5
|
+
// reached through a small host seam, which keeps these operations testable
|
|
6
|
+
// without a terminal and keeps the editor's own text rules — an expanded paste
|
|
7
|
+
// and an empty bar — in exactly one place.
|
|
8
|
+
import { FileTooLargeError } from "./stash/private-fs.js";
|
|
9
|
+
import { StashCommittedError } from "./stash/lock.js";
|
|
10
|
+
import { resolveStashPaths, stashBaseDir } from "./stash/paths.js";
|
|
11
|
+
import { loadStashStore, UnsupportedStashSchemaError, } from "./stash/store.js";
|
|
12
|
+
const EDITOR_BLOCKED_MESSAGE = 'clear or stash the current draft before applying or popping';
|
|
13
|
+
const EDITOR_BUSY_MESSAGE = 'the prompt bar is answering a question; finish or cancel it first';
|
|
14
|
+
const NOTHING_TO_STASH_MESSAGE = 'nothing to stash';
|
|
15
|
+
const NO_DRAFTS_MESSAGE = 'no stashed drafts';
|
|
16
|
+
const CORRUPT_RECOVERY_MESSAGE = 'corrupt stash data was quarantined to';
|
|
17
|
+
const CORRUPT_RECOVERY_UNSYNCED_MESSAGE = ' (its directory could not be synced, so the copy may not survive a crash)';
|
|
18
|
+
const stashedMessage = (index) => `Stashed [${index}]`;
|
|
19
|
+
const appliedMessage = (index) => `Applied [${index}]`;
|
|
20
|
+
const poppedMessage = (index) => `Popped [${index}]`;
|
|
21
|
+
const droppedMessage = (index) => `Dropped [${index}]`;
|
|
22
|
+
const clearedMessage = (count) => `Cleared ${count} draft${count === 1 ? '' : 's'}`;
|
|
23
|
+
const selectorMissingMessage = (selector) => `no stash matching "${selector}"`;
|
|
24
|
+
const committedMessage = (error, done) => error.releaseFailure === undefined
|
|
25
|
+
? `${done}, but the ${error.failure.phase} step failed`
|
|
26
|
+
: `${done}, but the ${error.failure.phase} and ${error.releaseFailure.phase} steps failed`;
|
|
27
|
+
const removalFailedMessage = (error, done) => `${done}, but removing the entry failed: ${error instanceof Error ? error.message : 'unknown error'}`;
|
|
28
|
+
function describeFailure(error) {
|
|
29
|
+
const detail = error instanceof Error ? error.message : 'unknown error';
|
|
30
|
+
return error instanceof UnsupportedStashSchemaError || error instanceof FileTooLargeError
|
|
31
|
+
? `stash unavailable: ${detail}`
|
|
32
|
+
: `stash failed: ${detail}`;
|
|
33
|
+
}
|
|
34
|
+
export class PromptStash {
|
|
35
|
+
host;
|
|
36
|
+
options;
|
|
37
|
+
paths;
|
|
38
|
+
now;
|
|
39
|
+
write;
|
|
40
|
+
store;
|
|
41
|
+
count = 0;
|
|
42
|
+
/** The queue a second command waits behind, so writes never interleave. */
|
|
43
|
+
tail = Promise.resolve();
|
|
44
|
+
constructor(host, options) {
|
|
45
|
+
this.host = host;
|
|
46
|
+
this.options = options;
|
|
47
|
+
this.paths = resolveStashPaths(options.cwd, options.baseDir ?? stashBaseDir());
|
|
48
|
+
this.now = options.now;
|
|
49
|
+
this.write = options.write;
|
|
50
|
+
}
|
|
51
|
+
/** How many drafts this directory holds, as last read. */
|
|
52
|
+
get entryCount() {
|
|
53
|
+
return this.count;
|
|
54
|
+
}
|
|
55
|
+
/** Load the bank once at startup so the status count is real before a command. */
|
|
56
|
+
async open() {
|
|
57
|
+
try {
|
|
58
|
+
await this.ensure();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
this.host.notice(describeFailure(error));
|
|
62
|
+
}
|
|
63
|
+
this.sync();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Persist the draft the reader is looking at, or the one named on the command
|
|
67
|
+
* line.
|
|
68
|
+
*
|
|
69
|
+
* An argument is written into the editor before the write is attempted —
|
|
70
|
+
* before the bank is even opened — because the command line it came from is
|
|
71
|
+
* already gone: a refused write has to leave the draft where the reader can
|
|
72
|
+
* retry it instead of losing the only copy. A command that names nothing — the
|
|
73
|
+
* chord, or a bare `/stash` — parks whatever the bar is holding.
|
|
74
|
+
*/
|
|
75
|
+
stashEditor(typed) {
|
|
76
|
+
const named = typed !== undefined && typed.trim() !== '';
|
|
77
|
+
// The draft goes back into the bar before anything can fail, including
|
|
78
|
+
// opening the bank: the command line it was typed on is already gone, so
|
|
79
|
+
// this is the only copy until a write lands.
|
|
80
|
+
if (named && this.host.editorIsAvailable())
|
|
81
|
+
this.host.setEditorText(typed);
|
|
82
|
+
return this.run(async (store) => {
|
|
83
|
+
if (!this.editorIsAvailable())
|
|
84
|
+
return;
|
|
85
|
+
const text = named ? typed : this.host.getEditorText();
|
|
86
|
+
if (text.trim() === '') {
|
|
87
|
+
this.host.notice(NOTHING_TO_STASH_MESSAGE);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
let resolved;
|
|
91
|
+
let warning;
|
|
92
|
+
try {
|
|
93
|
+
resolved = await store.add({ text });
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (!(error instanceof StashCommittedError))
|
|
97
|
+
throw error;
|
|
98
|
+
// The draft is on disk; only the step after the write failed. Reporting
|
|
99
|
+
// a failure here would invite a retry that stashes the same draft twice.
|
|
100
|
+
resolved = error.result;
|
|
101
|
+
warning = committedMessage(error, stashedMessage(resolved.index));
|
|
102
|
+
}
|
|
103
|
+
// Only clear what was actually persisted, and only while the bar is still
|
|
104
|
+
// the reader's: a question can borrow it during the write, and clearing
|
|
105
|
+
// there would erase the answer instead of the draft that was parked.
|
|
106
|
+
if (this.host.editorIsAvailable() && this.host.getEditorText() === text)
|
|
107
|
+
this.host.setEditorText('');
|
|
108
|
+
this.host.notice(warning ?? stashedMessage(resolved.index));
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/** Put a draft in an empty editor without removing it. */
|
|
112
|
+
apply(selector) {
|
|
113
|
+
return this.run(async (store) => {
|
|
114
|
+
await store.refresh();
|
|
115
|
+
if (!this.editorIsReady())
|
|
116
|
+
return;
|
|
117
|
+
const resolved = store.find(selector);
|
|
118
|
+
if (resolved === undefined) {
|
|
119
|
+
this.host.notice(this.missingMessage(selector));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.host.setEditorText(resolved.entry.text);
|
|
123
|
+
this.host.notice(appliedMessage(resolved.index));
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** Put a draft in an empty editor and remove it from the bank. */
|
|
127
|
+
pop(selector) {
|
|
128
|
+
return this.run(async (store) => {
|
|
129
|
+
// Re-read before resolving so "newest" is newest on disk, not newest as of
|
|
130
|
+
// the last command; the removal re-reads again under the lock.
|
|
131
|
+
await store.refresh();
|
|
132
|
+
await this.popFrom(store, selector);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/** Open the list and pop whatever the reader takes. */
|
|
136
|
+
list(cwdLabel) {
|
|
137
|
+
return this.run(async (store) => {
|
|
138
|
+
await store.refresh();
|
|
139
|
+
if (store.entryCount === 0) {
|
|
140
|
+
this.host.notice(NO_DRAFTS_MESSAGE);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
// The list is handed each entry with the index the bank gives it, so the
|
|
144
|
+
// row a reader picks and the selector they could have typed agree.
|
|
145
|
+
const rows = store.entries.map((entry, index) => ({ entry, index }));
|
|
146
|
+
const picked = await this.host.pick(rows, cwdLabel);
|
|
147
|
+
if (picked === undefined)
|
|
148
|
+
return;
|
|
149
|
+
await this.popFrom(store, picked);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/** Delete one draft without using it. */
|
|
153
|
+
drop(selector) {
|
|
154
|
+
return this.run(async (store) => {
|
|
155
|
+
let resolved;
|
|
156
|
+
let warning;
|
|
157
|
+
try {
|
|
158
|
+
resolved = await store.drop(selector);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
if (!(error instanceof StashCommittedError))
|
|
162
|
+
throw error;
|
|
163
|
+
resolved = error.result;
|
|
164
|
+
if (resolved === undefined)
|
|
165
|
+
return;
|
|
166
|
+
warning = committedMessage(error, droppedMessage(resolved.index));
|
|
167
|
+
}
|
|
168
|
+
if (resolved === undefined) {
|
|
169
|
+
this.host.notice(this.missingMessage(selector));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
this.host.notice(warning ?? droppedMessage(resolved.index));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/** Confirm, then delete every draft the confirmation named. */
|
|
176
|
+
clear() {
|
|
177
|
+
return this.run(async (store) => {
|
|
178
|
+
await store.refresh();
|
|
179
|
+
const count = store.entryCount;
|
|
180
|
+
if (count === 0) {
|
|
181
|
+
this.host.notice(NO_DRAFTS_MESSAGE);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// The ids the reader was shown, not the ids on disk afterwards: another
|
|
185
|
+
// surface can stash while the dialog is open, and those drafts were never
|
|
186
|
+
// part of what this confirmation agreed to delete.
|
|
187
|
+
const confirmedIds = store.entries.map(entry => entry.id);
|
|
188
|
+
if (!(await this.host.confirm(confirmedIds.length)))
|
|
189
|
+
return;
|
|
190
|
+
let removed = confirmedIds.length;
|
|
191
|
+
let warning;
|
|
192
|
+
try {
|
|
193
|
+
removed = await store.clear(confirmedIds);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
if (!(error instanceof StashCommittedError))
|
|
197
|
+
throw error;
|
|
198
|
+
removed = error.result;
|
|
199
|
+
warning = committedMessage(error, clearedMessage(removed));
|
|
200
|
+
}
|
|
201
|
+
this.host.notice(warning ?? clearedMessage(removed));
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Put one entry in an empty editor, then remove it.
|
|
206
|
+
*
|
|
207
|
+
* The editor is filled before the entry is removed, so a crash between the two
|
|
208
|
+
* leaves the draft in the bank rather than only in a terminal that is gone.
|
|
209
|
+
*/
|
|
210
|
+
async popFrom(store, selector) {
|
|
211
|
+
if (!this.editorIsReady())
|
|
212
|
+
return;
|
|
213
|
+
const resolved = store.find(selector);
|
|
214
|
+
if (resolved === undefined) {
|
|
215
|
+
this.host.notice(this.missingMessage(selector));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this.host.setEditorText(resolved.entry.text);
|
|
219
|
+
try {
|
|
220
|
+
const removed = await store.removeById(resolved.entry.id);
|
|
221
|
+
this.host.notice(poppedMessage(removed?.index ?? resolved.index));
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
if (error instanceof StashCommittedError) {
|
|
225
|
+
this.host.notice(committedMessage(error, poppedMessage(resolved.index)));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.host.notice(removalFailedMessage(error, poppedMessage(resolved.index)));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
editorIsReady() {
|
|
232
|
+
if (!this.editorIsAvailable())
|
|
233
|
+
return false;
|
|
234
|
+
if (this.host.getEditorText().trim() === '')
|
|
235
|
+
return true;
|
|
236
|
+
this.host.notice(EDITOR_BLOCKED_MESSAGE);
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Whether the bar is the reader's to write in.
|
|
241
|
+
*
|
|
242
|
+
* A question borrows the bar and empties it, so an empty check alone would
|
|
243
|
+
* let a pop write the draft into an answer, and the draft's only other copy is
|
|
244
|
+
* deleted right afterwards.
|
|
245
|
+
*/
|
|
246
|
+
editorIsAvailable() {
|
|
247
|
+
if (this.host.editorIsAvailable())
|
|
248
|
+
return true;
|
|
249
|
+
this.host.notice(EDITOR_BUSY_MESSAGE);
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
missingMessage(selector) {
|
|
253
|
+
const trimmed = selector?.trim();
|
|
254
|
+
return trimmed === undefined || trimmed === ''
|
|
255
|
+
? NO_DRAFTS_MESSAGE
|
|
256
|
+
: selectorMissingMessage(trimmed);
|
|
257
|
+
}
|
|
258
|
+
async ensure() {
|
|
259
|
+
if (this.store !== undefined)
|
|
260
|
+
return this.store;
|
|
261
|
+
const store = await loadStashStore(this.paths, this.now, this.write);
|
|
262
|
+
this.store = store;
|
|
263
|
+
return store;
|
|
264
|
+
}
|
|
265
|
+
run(operation) {
|
|
266
|
+
return this.enqueue(async () => {
|
|
267
|
+
try {
|
|
268
|
+
await operation(await this.ensure());
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
this.host.notice(describeFailure(error));
|
|
272
|
+
}
|
|
273
|
+
finally {
|
|
274
|
+
this.sync();
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
enqueue(operation) {
|
|
279
|
+
const run = this.tail.then(operation, operation);
|
|
280
|
+
this.tail = run.catch(() => undefined);
|
|
281
|
+
return run;
|
|
282
|
+
}
|
|
283
|
+
/** Publish the bank's size and any quarantine the last read produced. */
|
|
284
|
+
sync() {
|
|
285
|
+
if (this.store !== undefined) {
|
|
286
|
+
this.count = this.store.entryCount;
|
|
287
|
+
const quarantine = this.store.takeQuarantine();
|
|
288
|
+
if (quarantine !== undefined) {
|
|
289
|
+
const durability = quarantine.syncFailed ? CORRUPT_RECOVERY_UNSYNCED_MESSAGE : '';
|
|
290
|
+
this.host.notice(`${CORRUPT_RECOVERY_MESSAGE} ${quarantine.path}${durability}`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
this.host.render();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=stash.js.map
|
package/lib/stash.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stash.js","sourceRoot":"","sources":["../src/stash.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,iFAAiF;AACjF,4EAA4E;AAC5E,2EAA2E;AAC3E,+EAA+E;AAC/E,2CAA2C;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAA;AAEnF,OAAO,EACL,cAAc,EACd,2BAA2B,GAG5B,MAAM,kBAAkB,CAAA;AAEzB,MAAM,sBAAsB,GAAG,6DAA6D,CAAA;AAC5F,MAAM,mBAAmB,GAAG,mEAAmE,CAAA;AAC/F,MAAM,wBAAwB,GAAG,kBAAkB,CAAA;AACnD,MAAM,iBAAiB,GAAG,mBAAmB,CAAA;AAC7C,MAAM,wBAAwB,GAAG,uCAAuC,CAAA;AACxE,MAAM,iCAAiC,GAAG,2EAA2E,CAAA;AAErH,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,YAAY,KAAK,GAAG,CAAA;AACtE,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,YAAY,KAAK,GAAG,CAAA;AACtE,MAAM,aAAa,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,WAAW,KAAK,GAAG,CAAA;AACpE,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,YAAY,KAAK,GAAG,CAAA;AACt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