dsh-mnemon-source-documents 0.5.13 → 0.6.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/README.md +10 -0
- package/lib/client.js +376 -1074
- package/lib/contracts.d.ts +7 -1
- package/lib/index.js +122 -31
- package/lib/types/client/api.d.ts +4 -1
- package/lib/types/client/pages.d.ts +1 -1
- package/lib/types/contracts.d.ts +7 -1
- package/package.json +3 -4
- package/presentation/locales.json +28 -18
- package/presentation/page.module.css +87 -10
- package/presentation/sidebar.module.css +28 -2
package/lib/contracts.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ interface DocumentRecord {
|
|
|
21
21
|
}
|
|
22
22
|
interface DocumentView extends DocumentRecord {
|
|
23
23
|
content: string;
|
|
24
|
+
/** Digest of the exact managed file read; deletion also fences external edits. */
|
|
25
|
+
fileRevision?: string;
|
|
24
26
|
}
|
|
25
27
|
interface DocumentSnapshot {
|
|
26
28
|
workspaceRoot: string;
|
|
@@ -63,10 +65,14 @@ type DocumentMutation = {
|
|
|
63
65
|
content?: string;
|
|
64
66
|
sourcePaths?: string[];
|
|
65
67
|
sessionIds?: string[];
|
|
68
|
+
} | {
|
|
69
|
+
action: 'delete';
|
|
70
|
+
id: string;
|
|
71
|
+
fileRevision?: string;
|
|
66
72
|
};
|
|
67
73
|
interface DocumentMutationResult {
|
|
68
74
|
success: true;
|
|
69
|
-
action: 'created' | 'updated' | 'archived';
|
|
75
|
+
action: 'created' | 'updated' | 'archived' | 'deleted';
|
|
70
76
|
document: DocumentView;
|
|
71
77
|
snapshot: DocumentSnapshot;
|
|
72
78
|
maintenance?: {
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DOCUMENTS_ACTIVE_LIMIT_BYTES, DOCUMENTS_DIRECTORY, DOCUMENTS_INDEX_FILE, DOCUMENTS_LOCK_FILE } from "./contracts.js";
|
|
1
|
+
import { DOCUMENTS_ACTIVE_LIMIT_BYTES, DOCUMENTS_DIRECTORY, DOCUMENTS_INDEX_FILE, DOCUMENTS_LOCK_FILE, DOCUMENT_FILENAME_PATTERN } from "./contracts.js";
|
|
2
2
|
import { createMemoryMutationReceipt, defineMemoryPlugin, defineMemorySource, installMemory, memoryConfigurationDigest, memoryInputRecord, memoryInputStringArray, memoryInputText, truncateMemoryText } from "dsh-mnemon/extension-sdk";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import z from "@deepseek-ai/schemastery";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { COMPOSABLE_MEMORY_API_VERSION } from "dsh-mnemon/contracts";
|
|
8
|
-
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { closeSync, existsSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
9
9
|
//#region src/config.ts
|
|
10
10
|
const Config = z.object({
|
|
11
11
|
dataDir: z.string(),
|
|
@@ -65,7 +65,7 @@ var DocumentCapacityError = class extends Error {
|
|
|
65
65
|
var DocumentConflictError = class extends Error {
|
|
66
66
|
code = "revision-conflict";
|
|
67
67
|
constructor() {
|
|
68
|
-
super("document
|
|
68
|
+
super("document index or content changed; reload before retrying");
|
|
69
69
|
this.name = "DocumentConflictError";
|
|
70
70
|
}
|
|
71
71
|
};
|
|
@@ -93,7 +93,10 @@ function hash(value) {
|
|
|
93
93
|
return createHash("sha256").update(value).digest("hex");
|
|
94
94
|
}
|
|
95
95
|
function indexRevision(index) {
|
|
96
|
-
return hash(JSON.stringify(
|
|
96
|
+
return hash(JSON.stringify({
|
|
97
|
+
version: index.version,
|
|
98
|
+
documents: index.documents.map(parseRecord)
|
|
99
|
+
}));
|
|
97
100
|
}
|
|
98
101
|
function copyIndex(index) {
|
|
99
102
|
return {
|
|
@@ -250,6 +253,14 @@ var DocumentController = class {
|
|
|
250
253
|
memoryBodyIds: []
|
|
251
254
|
};
|
|
252
255
|
projected = used + Buffer.byteLength(renderDocument(record, content), "utf8");
|
|
256
|
+
} else if (request.action === "delete") {
|
|
257
|
+
const current = this.requireDocument(index, request.id);
|
|
258
|
+
return {
|
|
259
|
+
projected: used - (current.status === "active" ? current.sizeBytes : 0),
|
|
260
|
+
limit: this.limitBytes,
|
|
261
|
+
fits: true,
|
|
262
|
+
candidates: []
|
|
263
|
+
};
|
|
253
264
|
} else {
|
|
254
265
|
const current = this.requireDocument(index, request.id);
|
|
255
266
|
if (current.status !== "active") throw new Error("archived documents are immutable; create a new active revision instead");
|
|
@@ -284,8 +295,17 @@ var DocumentController = class {
|
|
|
284
295
|
const includeArchived = options.includeArchived === true;
|
|
285
296
|
const limit = Math.max(1, Math.min(50, Math.trunc(options.limit ?? 20)));
|
|
286
297
|
const allowedIds = options.allowedIds === void 0 ? void 0 : new Set(options.allowedIds);
|
|
287
|
-
const ranked = index.documents.filter((record) => allowedIds === void 0 || allowedIds.has(record.id)).filter((record) => includeArchived || record.status === "active").
|
|
288
|
-
|
|
298
|
+
const ranked = index.documents.filter((record) => allowedIds === void 0 || allowedIds.has(record.id)).filter((record) => includeArchived || record.status === "active").flatMap((record) => {
|
|
299
|
+
let view;
|
|
300
|
+
try {
|
|
301
|
+
view = this.view(record);
|
|
302
|
+
} catch (error) {
|
|
303
|
+
if (error.code === "ENOENT") {
|
|
304
|
+
this.excerpts.delete(this.pathFor(record));
|
|
305
|
+
return [];
|
|
306
|
+
}
|
|
307
|
+
throw error;
|
|
308
|
+
}
|
|
289
309
|
const title = view.title.normalize("NFKC").toLocaleLowerCase();
|
|
290
310
|
const description = view.description.normalize("NFKC").toLocaleLowerCase();
|
|
291
311
|
const content = view.content.normalize("NFKC").toLocaleLowerCase();
|
|
@@ -298,13 +318,13 @@ var DocumentController = class {
|
|
|
298
318
|
if (titleMatch || descriptionMatch || contentMatch) tokenMatches += 1;
|
|
299
319
|
score += titleMatch ? 4 : descriptionMatch ? 2 : contentMatch ? 1 : 0;
|
|
300
320
|
}
|
|
301
|
-
return {
|
|
321
|
+
return [{
|
|
302
322
|
result: {
|
|
303
323
|
...view,
|
|
304
324
|
score
|
|
305
325
|
},
|
|
306
326
|
tokenMatches
|
|
307
|
-
};
|
|
327
|
+
}];
|
|
308
328
|
}).filter((candidate) => normalized === "" || candidate.result.score > 0 && candidate.tokenMatches >= requiredTokenMatches).sort((left, right) => right.result.score - left.result.score || Date.parse(right.result.updatedAt) - Date.parse(left.result.updatedAt)).slice(0, limit).map(({ result }) => ({
|
|
309
329
|
...result,
|
|
310
330
|
excerpt: excerpt(result.content)
|
|
@@ -334,6 +354,13 @@ var DocumentController = class {
|
|
|
334
354
|
this.queue = operation.catch(() => void 0);
|
|
335
355
|
return operation;
|
|
336
356
|
}
|
|
357
|
+
deleteDocument(id, expectedRevision, fileRevision) {
|
|
358
|
+
return this.mutate({
|
|
359
|
+
action: "delete",
|
|
360
|
+
id,
|
|
361
|
+
fileRevision
|
|
362
|
+
}, expectedRevision);
|
|
363
|
+
}
|
|
337
364
|
archive(id, expectedRevision, details) {
|
|
338
365
|
const operation = this.queue.then(() => this.withLock(() => {
|
|
339
366
|
const index = this.readIndex();
|
|
@@ -357,21 +384,23 @@ var DocumentController = class {
|
|
|
357
384
|
const rendered = renderDocument(updated, content);
|
|
358
385
|
updated.sizeBytes = Buffer.byteLength(rendered, "utf8");
|
|
359
386
|
const destination = this.pathFor(updated);
|
|
360
|
-
|
|
387
|
+
this.atomicWrite(destination, rendered);
|
|
361
388
|
try {
|
|
362
|
-
writeFileSync(destination, rendered, "utf8");
|
|
363
389
|
index.documents = index.documents.map((record) => record.id === id ? updated : record);
|
|
364
390
|
this.persistIndex(index);
|
|
365
391
|
} catch (error) {
|
|
366
|
-
|
|
392
|
+
rmSync(destination, { force: true });
|
|
367
393
|
throw error;
|
|
368
394
|
}
|
|
395
|
+
rmSync(source, { force: true });
|
|
396
|
+
this.excerpts.delete(source);
|
|
369
397
|
return {
|
|
370
398
|
success: true,
|
|
371
399
|
action: "archived",
|
|
372
400
|
document: {
|
|
373
401
|
...updated,
|
|
374
|
-
content
|
|
402
|
+
content,
|
|
403
|
+
fileRevision: hash(rendered)
|
|
375
404
|
},
|
|
376
405
|
snapshot: this.snapshotUnlocked(index)
|
|
377
406
|
};
|
|
@@ -382,6 +411,37 @@ var DocumentController = class {
|
|
|
382
411
|
mutateLocked(request, expectedRevision) {
|
|
383
412
|
const index = this.readIndex();
|
|
384
413
|
if (expectedRevision !== void 0 && this.revisionOf(index) !== expectedRevision) throw new DocumentConflictError();
|
|
414
|
+
if (request.action === "delete") {
|
|
415
|
+
if (expectedRevision === void 0 || expectedRevision === "") throw new Error("Documents deletion requires an index revision");
|
|
416
|
+
const current = this.requireDocument(index, request.id);
|
|
417
|
+
const path = this.pathFor(current);
|
|
418
|
+
const root = realpathSync(this.storageRoot);
|
|
419
|
+
if (!DOCUMENT_FILENAME_PATTERN.test(current.filename) || path !== join(this.directory, current.status, current.filename) || index.documents.some((record) => record !== current && this.pathFor(record) === path) || realpathSync(dirname(path)) !== join(root, "documents", current.status)) throw new Error("document index contains an unsafe managed path");
|
|
420
|
+
if (!lstatSync(path).isFile()) throw new Error("Documents deletion requires a regular managed file");
|
|
421
|
+
const original = readFileSync(path);
|
|
422
|
+
if (typeof request.fileRevision !== "string" || request.fileRevision === "") throw new Error("Documents deletion requires the current file revision");
|
|
423
|
+
const fileRevision = hash(original);
|
|
424
|
+
if (fileRevision !== request.fileRevision) throw new DocumentConflictError();
|
|
425
|
+
unlinkSync(path);
|
|
426
|
+
index.documents = index.documents.filter((record) => record.id !== current.id);
|
|
427
|
+
try {
|
|
428
|
+
this.persistIndex(index);
|
|
429
|
+
} catch (error) {
|
|
430
|
+
this.atomicWrite(path, original);
|
|
431
|
+
throw error;
|
|
432
|
+
}
|
|
433
|
+
this.excerpts.delete(path);
|
|
434
|
+
return {
|
|
435
|
+
success: true,
|
|
436
|
+
action: "deleted",
|
|
437
|
+
document: {
|
|
438
|
+
...current,
|
|
439
|
+
content: documentBody(original.toString("utf8")),
|
|
440
|
+
fileRevision
|
|
441
|
+
},
|
|
442
|
+
snapshot: this.snapshotUnlocked(index)
|
|
443
|
+
};
|
|
444
|
+
}
|
|
385
445
|
const now = this.now().toISOString();
|
|
386
446
|
if (request.action === "create") {
|
|
387
447
|
const title = normalizeLine(request.title, "document title", 160, true);
|
|
@@ -417,7 +477,8 @@ var DocumentController = class {
|
|
|
417
477
|
action: "created",
|
|
418
478
|
document: {
|
|
419
479
|
...record,
|
|
420
|
-
content
|
|
480
|
+
content,
|
|
481
|
+
fileRevision: hash(rendered)
|
|
421
482
|
},
|
|
422
483
|
snapshot: this.snapshotUnlocked(index)
|
|
423
484
|
};
|
|
@@ -447,7 +508,8 @@ var DocumentController = class {
|
|
|
447
508
|
action: "updated",
|
|
448
509
|
document: {
|
|
449
510
|
...updated,
|
|
450
|
-
content
|
|
511
|
+
content,
|
|
512
|
+
fileRevision: hash(rendered)
|
|
451
513
|
},
|
|
452
514
|
snapshot: this.snapshotUnlocked(index)
|
|
453
515
|
};
|
|
@@ -584,13 +646,15 @@ var DocumentController = class {
|
|
|
584
646
|
if (!path.startsWith(managedRoot)) throw new Error("document index contains an unsafe managed path");
|
|
585
647
|
return path;
|
|
586
648
|
}
|
|
587
|
-
readBody(record) {
|
|
588
|
-
return documentBody(
|
|
649
|
+
readBody(record, raw = readFileSync(this.pathFor(record))) {
|
|
650
|
+
return documentBody(raw.toString("utf8"));
|
|
589
651
|
}
|
|
590
652
|
view(record) {
|
|
653
|
+
const raw = readFileSync(this.pathFor(record));
|
|
591
654
|
return {
|
|
592
655
|
...record,
|
|
593
|
-
content: this.readBody(record)
|
|
656
|
+
content: this.readBody(record, raw),
|
|
657
|
+
fileRevision: hash(raw)
|
|
594
658
|
};
|
|
595
659
|
}
|
|
596
660
|
persistDocument(record, content) {
|
|
@@ -603,11 +667,16 @@ var DocumentController = class {
|
|
|
603
667
|
}
|
|
604
668
|
atomicWrite(path, content) {
|
|
605
669
|
const temporary = `${path}.${process.pid}.${crypto.randomUUID()}.tmp`;
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
670
|
+
try {
|
|
671
|
+
if (typeof content === "string") writeFileSync(temporary, content, {
|
|
672
|
+
encoding: "utf8",
|
|
673
|
+
mode: 384
|
|
674
|
+
});
|
|
675
|
+
else writeFileSync(temporary, content, { mode: 384 });
|
|
676
|
+
renameSync(temporary, path);
|
|
677
|
+
} finally {
|
|
678
|
+
rmSync(temporary, { force: true });
|
|
679
|
+
}
|
|
611
680
|
}
|
|
612
681
|
withLock(callback) {
|
|
613
682
|
const deadline = Date.now() + LOCK_TIMEOUT_MS;
|
|
@@ -721,6 +790,14 @@ function documentMutation(value, allowedIds) {
|
|
|
721
790
|
...input.sourcePaths === void 0 ? {} : { sourcePaths: memoryInputStringArray(input.sourcePaths, "sourcePaths") ?? [] },
|
|
722
791
|
...input.sessionIds === void 0 ? {} : { sessionIds: memoryInputStringArray(input.sessionIds, "sessionIds", 20) ?? [] }
|
|
723
792
|
};
|
|
793
|
+
} else if (action === "delete") {
|
|
794
|
+
const id = memoryInputText(input.id, "id", 300);
|
|
795
|
+
if (allowedIds !== void 0 && !allowedIds.includes(id)) throw new Error("Documents delete target is outside this View ReadGrant");
|
|
796
|
+
mutation = {
|
|
797
|
+
action,
|
|
798
|
+
id,
|
|
799
|
+
...input.fileRevision === void 0 ? {} : { fileRevision: memoryInputText(input.fileRevision, "fileRevision", 100) }
|
|
800
|
+
};
|
|
724
801
|
} else throw new Error(`unsupported Documents action: ${action}`);
|
|
725
802
|
return mutation;
|
|
726
803
|
}
|
|
@@ -761,7 +838,7 @@ function createDocumentsMemorySource(config = {}) {
|
|
|
761
838
|
}],
|
|
762
839
|
actions: [{
|
|
763
840
|
id: "manage",
|
|
764
|
-
description: "Create a project Document,
|
|
841
|
+
description: "Create a project Document, update one pinned into this View or created in this execution, or permanently delete a pinned active/archived managed copy after explicit user confirmation. Delete requires confirmed: true, expectedRevision from the latest Documents search metadata.indexRevision, and fileRevision from the target item provenance (or management document read). It does not archive or change project originals.",
|
|
765
842
|
capability: "write",
|
|
766
843
|
inputSchema: {
|
|
767
844
|
type: "object",
|
|
@@ -770,10 +847,17 @@ function createDocumentsMemorySource(config = {}) {
|
|
|
770
847
|
properties: {
|
|
771
848
|
action: {
|
|
772
849
|
type: "string",
|
|
773
|
-
enum: [
|
|
850
|
+
enum: [
|
|
851
|
+
"create",
|
|
852
|
+
"update",
|
|
853
|
+
"delete"
|
|
854
|
+
]
|
|
774
855
|
},
|
|
775
856
|
id: { type: "string" },
|
|
776
|
-
...CREATE_PROPERTIES
|
|
857
|
+
...CREATE_PROPERTIES,
|
|
858
|
+
confirmed: { type: "boolean" },
|
|
859
|
+
expectedRevision: { type: "string" },
|
|
860
|
+
fileRevision: { type: "string" }
|
|
777
861
|
}
|
|
778
862
|
}
|
|
779
863
|
}, {
|
|
@@ -930,7 +1014,8 @@ function createDocumentsMemorySource(config = {}) {
|
|
|
930
1014
|
description: document.description,
|
|
931
1015
|
status: document.status,
|
|
932
1016
|
relativePath: document.relativePath,
|
|
933
|
-
sourcePaths: document.sourcePaths.slice(0, 8)
|
|
1017
|
+
sourcePaths: document.sourcePaths.slice(0, 8),
|
|
1018
|
+
...document.fileRevision === void 0 ? {} : { fileRevision: document.fileRevision }
|
|
934
1019
|
}
|
|
935
1020
|
});
|
|
936
1021
|
}
|
|
@@ -958,7 +1043,8 @@ function createDocumentsMemorySource(config = {}) {
|
|
|
958
1043
|
metadata: {
|
|
959
1044
|
query: result.query,
|
|
960
1045
|
includeArchived: result.includeArchived,
|
|
961
|
-
total: result.total
|
|
1046
|
+
total: result.total,
|
|
1047
|
+
indexRevision: controller.revision()
|
|
962
1048
|
},
|
|
963
1049
|
id: `evidence:${randomUUID()}`,
|
|
964
1050
|
viewId: request.view.id,
|
|
@@ -994,8 +1080,9 @@ function createDocumentsMemorySource(config = {}) {
|
|
|
994
1080
|
default: throw new Error("unsupported Documents management read operation: " + request.operation);
|
|
995
1081
|
}
|
|
996
1082
|
else {
|
|
997
|
-
if (
|
|
1083
|
+
if (request.confirmed !== true) throw new Error("Documents management mutation requires explicit confirmation");
|
|
998
1084
|
if (request.operation === "mutate") value = await controller.mutate(documentMutation(request.input), request.expectedRevision);
|
|
1085
|
+
else if (request.operation === "delete") value = await controller.deleteDocument(memoryInputText(input.id, "id", 300), memoryInputText(request.expectedRevision, "expectedRevision", 100), memoryInputText(input.fileRevision, "fileRevision", 100));
|
|
999
1086
|
else if (request.operation === "archive") {
|
|
1000
1087
|
const document = controller.get(memoryInputText(input.id, "id", 300));
|
|
1001
1088
|
const revision = input.documentRevision === void 0 ? document.revision : input.documentRevision;
|
|
@@ -1016,8 +1103,12 @@ function createDocumentsMemorySource(config = {}) {
|
|
|
1016
1103
|
const root = workspace(request.view.scope);
|
|
1017
1104
|
if (root === void 0) throw new Error("Documents Action requires a workspace-scoped View");
|
|
1018
1105
|
const grant = request.grant;
|
|
1019
|
-
const
|
|
1020
|
-
const
|
|
1106
|
+
const input = memoryInputRecord(request.input, "Documents Action");
|
|
1107
|
+
const deleting = request.offer.sourceActionId === "manage" && input.action === "delete";
|
|
1108
|
+
if (deleting && input.confirmed !== true) throw new Error("Documents deletion requires explicit user confirmation");
|
|
1109
|
+
const mutation = request.offer.sourceActionId === "create" ? documentCreation(request.input) : documentMutation(request.input, deleting ? grant === void 0 ? [] : grantIds(grant, true) : [...grant === void 0 ? [] : grantIds(grant), ...created.get(request.view) ?? []]);
|
|
1110
|
+
const expectedRevision = deleting ? memoryInputText(input.expectedRevision, "expectedRevision", 100) : void 0;
|
|
1111
|
+
const result = await documents.forWorkspace(root).mutate(mutation, expectedRevision);
|
|
1021
1112
|
if (mutation.action === "create") {
|
|
1022
1113
|
let ids = created.get(request.view);
|
|
1023
1114
|
if (ids === void 0) {
|
|
@@ -3,7 +3,10 @@ import type { DocumentMutation, DocumentMutationResult, DocumentSearchResult, Do
|
|
|
3
3
|
export interface DocumentsPageClient {
|
|
4
4
|
documents(): Promise<DocumentSnapshot>;
|
|
5
5
|
document(id: string): Promise<DocumentView>;
|
|
6
|
-
searchDocuments(query: string, includeArchived?: boolean, limit?: number): Promise<DocumentSearchResult
|
|
6
|
+
searchDocuments(query: string, includeArchived?: boolean, limit?: number): Promise<DocumentSearchResult & {
|
|
7
|
+
revision?: string;
|
|
8
|
+
}>;
|
|
7
9
|
mutateDocument(request: DocumentMutation): Promise<DocumentMutationResult>;
|
|
8
10
|
archiveDocument(id: string): Promise<DocumentMutationResult>;
|
|
11
|
+
deleteDocument?(id: string, expectedRevision: string, fileRevision: string): Promise<DocumentMutationResult>;
|
|
9
12
|
}
|
package/lib/types/contracts.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface DocumentRecord {
|
|
|
20
20
|
}
|
|
21
21
|
export interface DocumentView extends DocumentRecord {
|
|
22
22
|
content: string;
|
|
23
|
+
/** Digest of the exact managed file read; deletion also fences external edits. */
|
|
24
|
+
fileRevision?: string;
|
|
23
25
|
}
|
|
24
26
|
export interface DocumentSnapshot {
|
|
25
27
|
workspaceRoot: string;
|
|
@@ -62,10 +64,14 @@ export type DocumentMutation = {
|
|
|
62
64
|
content?: string;
|
|
63
65
|
sourcePaths?: string[];
|
|
64
66
|
sessionIds?: string[];
|
|
67
|
+
} | {
|
|
68
|
+
action: 'delete';
|
|
69
|
+
id: string;
|
|
70
|
+
fileRevision?: string;
|
|
65
71
|
};
|
|
66
72
|
export interface DocumentMutationResult {
|
|
67
73
|
success: true;
|
|
68
|
-
action: 'created' | 'updated' | 'archived';
|
|
74
|
+
action: 'created' | 'updated' | 'archived' | 'deleted';
|
|
69
75
|
document: DocumentView;
|
|
70
76
|
snapshot: DocumentSnapshot;
|
|
71
77
|
maintenance?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon-source-documents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Self-contained documents Source for Composable View Memory.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,8 +47,7 @@
|
|
|
47
47
|
"verify": "pnpm typecheck && pnpm test && pnpm build"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@deepseek-ai/schemastery": "^3.18.4"
|
|
51
|
-
"markdown-to-jsx": "^7.7.0"
|
|
50
|
+
"@deepseek-ai/schemastery": "^3.18.4"
|
|
52
51
|
},
|
|
53
52
|
"peerDependencies": {
|
|
54
53
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"@types/node": "^22.0.0",
|
|
62
61
|
"@types/react": "^18.3.0",
|
|
63
62
|
"@types/react-dom": "^18.3.0",
|
|
64
|
-
"dsh-mnemon": "^0.5.
|
|
63
|
+
"dsh-mnemon": "^0.5.47",
|
|
65
64
|
"jsdom": "^26.0.0",
|
|
66
65
|
"react": "^18.2.0",
|
|
67
66
|
"react-dom": "^18.2.0",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"zh": {
|
|
3
3
|
"nav.documents": "档案",
|
|
4
4
|
"documents.title": "项目档案",
|
|
5
|
-
"documents.description": "
|
|
5
|
+
"documents.description": "按需检索的工作区文档,超限时自动归档。",
|
|
6
6
|
"documents.capacity": "{used} / {limit}",
|
|
7
7
|
"documents.summary": "档案存储摘要",
|
|
8
8
|
"documents.active": "活跃档案",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"documents.activeCapacity": "活跃容量",
|
|
13
13
|
"documents.capacityHint": "按实际 UTF-8 文件大小计算",
|
|
14
14
|
"documents.searchAria": "检索项目档案",
|
|
15
|
-
"documents.searchPlaceholder": "
|
|
15
|
+
"documents.searchPlaceholder": "搜索档案…",
|
|
16
16
|
"documents.search": "检索",
|
|
17
17
|
"documents.scope": "档案范围",
|
|
18
|
-
"documents.new": "
|
|
18
|
+
"documents.new": "新建",
|
|
19
19
|
"documents.newTitle": "创建托管档案",
|
|
20
20
|
"documents.editTitle": "编辑活跃档案",
|
|
21
|
-
"documents.editorHint": "
|
|
21
|
+
"documents.editorHint": "自动维护元数据与修订号,不修改项目源文件。",
|
|
22
22
|
"documents.managedCopy": "托管副本",
|
|
23
23
|
"documents.name": "标题",
|
|
24
24
|
"documents.routing": "检索说明",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"documents.sourcesPlaceholder": "src/index.ts, docs/architecture.md",
|
|
27
27
|
"documents.markdown": "Markdown 内容",
|
|
28
28
|
"documents.saving": "保存中…",
|
|
29
|
-
"documents.create": "
|
|
30
|
-
"documents.save": "
|
|
29
|
+
"documents.create": "创建",
|
|
30
|
+
"documents.save": "保存",
|
|
31
31
|
"documents.created": "已创建活跃档案。",
|
|
32
32
|
"documents.createdAfterArchive": "已先迁移 {count} 份旧档案,再创建活跃档案。",
|
|
33
33
|
"documents.updated": "已保存新的档案修订。",
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
"documents.selectText": "在左侧查看活跃项目知识或沿 Mnemon 引用打开归档原文。",
|
|
49
49
|
"documents.coldArchive": "归档原文",
|
|
50
50
|
"documents.edit": "编辑",
|
|
51
|
+
"documents.delete": "删除",
|
|
52
|
+
"documents.deleteConfirm": "永久删除这份档案?",
|
|
53
|
+
"documents.deleteDescription": "永久移除托管副本,项目源文件与记忆空间不受影响,且无法撤销。",
|
|
54
|
+
"documents.deleteNow": "确认删除",
|
|
55
|
+
"documents.deleting": "删除中…",
|
|
56
|
+
"documents.deleted": "档案已永久删除。",
|
|
51
57
|
"documents.path": "托管路径",
|
|
52
58
|
"documents.revision": "修订",
|
|
53
59
|
"documents.hash": "内容哈希",
|
|
@@ -55,17 +61,16 @@
|
|
|
55
61
|
"documents.archiveReceipt": "Mnemon 冷索引回执",
|
|
56
62
|
"documents.archiveNote": "归档说明",
|
|
57
63
|
"documents.archiveTitle": "迁入归档",
|
|
58
|
-
"documents.archiveDescription": "
|
|
64
|
+
"documents.archiveDescription": "生成摘要索引并移入归档,释放活跃容量。",
|
|
59
65
|
"documents.archive": "归档",
|
|
60
66
|
"documents.archiveConfirm": "确认归档这份档案?",
|
|
61
67
|
"documents.archiving": "归档中…",
|
|
62
|
-
"documents.archiveNow": "确认归档"
|
|
63
|
-
"documents.footnote": "`.mnemon/documents/index.json` 是控制面事实源;active 总量固定不超过 10 MB,archived 不计入上限,项目源文件不会被修改。"
|
|
68
|
+
"documents.archiveNow": "确认归档"
|
|
64
69
|
},
|
|
65
70
|
"en": {
|
|
66
71
|
"nav.documents": "Documents",
|
|
67
72
|
"documents.title": "Project Documents",
|
|
68
|
-
"documents.description": "
|
|
73
|
+
"documents.description": "Workspace documents searched on demand and archived when full.",
|
|
69
74
|
"documents.capacity": "{used} / {limit}",
|
|
70
75
|
"documents.summary": "Document storage summary",
|
|
71
76
|
"documents.active": "Active",
|
|
@@ -75,13 +80,13 @@
|
|
|
75
80
|
"documents.activeCapacity": "Active capacity",
|
|
76
81
|
"documents.capacityHint": "Measured from actual UTF-8 files",
|
|
77
82
|
"documents.searchAria": "Search project documents",
|
|
78
|
-
"documents.searchPlaceholder": "Search
|
|
83
|
+
"documents.searchPlaceholder": "Search documents…",
|
|
79
84
|
"documents.search": "Search",
|
|
80
85
|
"documents.scope": "Document scope",
|
|
81
|
-
"documents.new": "New
|
|
86
|
+
"documents.new": "New",
|
|
82
87
|
"documents.newTitle": "Create managed document",
|
|
83
88
|
"documents.editTitle": "Edit active document",
|
|
84
|
-
"documents.editorHint": "
|
|
89
|
+
"documents.editorHint": "Metadata and revisions are managed automatically; source files stay untouched.",
|
|
85
90
|
"documents.managedCopy": "Managed copy",
|
|
86
91
|
"documents.name": "Title",
|
|
87
92
|
"documents.routing": "Retrieval description",
|
|
@@ -89,8 +94,8 @@
|
|
|
89
94
|
"documents.sourcesPlaceholder": "src/index.ts, docs/architecture.md",
|
|
90
95
|
"documents.markdown": "Markdown content",
|
|
91
96
|
"documents.saving": "Saving…",
|
|
92
|
-
"documents.create": "Create
|
|
93
|
-
"documents.save": "Save
|
|
97
|
+
"documents.create": "Create",
|
|
98
|
+
"documents.save": "Save",
|
|
94
99
|
"documents.created": "Active document created.",
|
|
95
100
|
"documents.createdAfterArchive": "Archived {count} older document(s), then created the active document.",
|
|
96
101
|
"documents.updated": "New document revision saved.",
|
|
@@ -111,6 +116,12 @@
|
|
|
111
116
|
"documents.selectText": "Read active project knowledge or follow a Mnemon reference to an archived original.",
|
|
112
117
|
"documents.coldArchive": "Archived original",
|
|
113
118
|
"documents.edit": "Edit",
|
|
119
|
+
"documents.delete": "Delete",
|
|
120
|
+
"documents.deleteConfirm": "Permanently delete this document?",
|
|
121
|
+
"documents.deleteDescription": "Permanently removes the managed copy; project files and Memory Space notes stay untouched. This cannot be undone.",
|
|
122
|
+
"documents.deleteNow": "Confirm delete",
|
|
123
|
+
"documents.deleting": "Deleting…",
|
|
124
|
+
"documents.deleted": "Document permanently deleted.",
|
|
114
125
|
"documents.path": "Managed path",
|
|
115
126
|
"documents.revision": "Revision",
|
|
116
127
|
"documents.hash": "Content hash",
|
|
@@ -118,11 +129,10 @@
|
|
|
118
129
|
"documents.archiveReceipt": "Mnemon cold-index receipt",
|
|
119
130
|
"documents.archiveNote": "Archive note",
|
|
120
131
|
"documents.archiveTitle": "Move to archive",
|
|
121
|
-
"documents.archiveDescription": "
|
|
132
|
+
"documents.archiveDescription": "Index a summary in Memory Spaces and move the full text to archive.",
|
|
122
133
|
"documents.archive": "Archive",
|
|
123
134
|
"documents.archiveConfirm": "Archive this document?",
|
|
124
135
|
"documents.archiving": "Archiving…",
|
|
125
|
-
"documents.archiveNow": "Confirm archive"
|
|
126
|
-
"documents.footnote": "`.mnemon/documents/index.json` is the control-plane source of truth. active stays at or below 10 MB, archived is excluded, and project source files are never modified."
|
|
136
|
+
"documents.archiveNow": "Confirm archive"
|
|
127
137
|
}
|
|
128
138
|
}
|