@chenhw7/dsh-memory 0.1.3 → 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 +102 -120
- package/README.zh-CN.md +104 -119
- package/cordis.patch.yml +13 -8
- package/lib/client/index.js +1591 -195
- package/lib/context/conflict.d.ts +19 -2
- package/lib/context/conflict.d.ts.map +1 -1
- package/lib/context/conflict.js +33 -0
- package/lib/context/conflict.js.map +1 -1
- package/lib/context/index.d.ts +34 -10
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +195 -24
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +28 -1
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +60 -3
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +27 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +22 -0
- package/lib/index.js.map +1 -1
- package/lib/notes/index.d.ts +66 -0
- package/lib/notes/index.d.ts.map +1 -0
- package/lib/notes/index.js +180 -0
- package/lib/notes/index.js.map +1 -0
- package/lib/notes/render.d.ts +32 -0
- package/lib/notes/render.d.ts.map +1 -0
- package/lib/notes/render.js +68 -0
- package/lib/notes/render.js.map +1 -0
- package/lib/notes/scope.d.ts +35 -0
- package/lib/notes/scope.d.ts.map +1 -0
- package/lib/notes/scope.js +44 -0
- package/lib/notes/scope.js.map +1 -0
- package/lib/notes/settings.d.ts +35 -0
- package/lib/notes/settings.d.ts.map +1 -0
- package/lib/notes/settings.js +36 -0
- package/lib/notes/settings.js.map +1 -0
- package/lib/notes/writer.d.ts +32 -0
- package/lib/notes/writer.d.ts.map +1 -0
- package/lib/notes/writer.js +71 -0
- package/lib/notes/writer.js.map +1 -0
- package/lib/remote/index.d.ts +31 -4
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +44 -7
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +7 -2
- package/lib/remote/typert.remote-client.js +8 -2
- package/lib/review/accumulator.d.ts +53 -18
- package/lib/review/accumulator.d.ts.map +1 -1
- package/lib/review/accumulator.js +176 -36
- package/lib/review/accumulator.js.map +1 -1
- package/lib/review/dedup.d.ts +16 -3
- package/lib/review/dedup.d.ts.map +1 -1
- package/lib/review/dedup.js +21 -4
- package/lib/review/dedup.js.map +1 -1
- package/lib/review/extract.d.ts +81 -5
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +224 -31
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts +15 -2
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +137 -55
- package/lib/review/index.js.map +1 -1
- package/lib/scanner.d.ts +15 -0
- package/lib/scanner.d.ts.map +1 -1
- package/lib/scanner.js +20 -0
- package/lib/scanner.js.map +1 -1
- package/lib/store/bm25.d.ts +48 -0
- package/lib/store/bm25.d.ts.map +1 -0
- package/lib/store/bm25.js +115 -0
- package/lib/store/bm25.js.map +1 -0
- package/lib/store/index.d.ts +26 -3
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +111 -68
- package/lib/store/index.js.map +1 -1
- package/lib/tool/index.d.ts +3 -1
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +52 -9
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +17 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +44 -30
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scope×category render matrix for project notes (§4 of
|
|
3
|
+
* docs/PROJECT_NOTES.md): which store entries land in the notes files.
|
|
4
|
+
* Pure functions, zero host imports — shared by the notes renderer and by
|
|
5
|
+
* `memory-context` (which excludes the same set from its own snapshot/index
|
|
6
|
+
* injection so content never appears twice in the prompt).
|
|
7
|
+
*
|
|
8
|
+
* @module @chenhw7/dsh-memory/notes/scope
|
|
9
|
+
*/
|
|
10
|
+
/** Categories rendered into CONVENTIONS.md. */
|
|
11
|
+
export const NOTES_CONVENTION_CATEGORIES = ['convention', 'preference'];
|
|
12
|
+
/** Categories rendered into PITFALLS.md (project- and global-scoped only). */
|
|
13
|
+
export const NOTES_PITFALL_CATEGORIES = ['failure', 'procedure', 'tool-quirk'];
|
|
14
|
+
/**
|
|
15
|
+
* Decide whether an entry is rendered into the notes files, and into which
|
|
16
|
+
* one. Rules (docs/PROJECT_NOTES.md §4):
|
|
17
|
+
* - `project`-scoped entries must match the current project name; an unknown
|
|
18
|
+
* project (no cwd) excludes them.
|
|
19
|
+
* - Conventions come from all three scopes (project > global > personal is
|
|
20
|
+
* the render order, doubling as the precedence hint).
|
|
21
|
+
* - Pitfalls come from `project` and `global` scopes only.
|
|
22
|
+
* - Entries without a category, or with categories outside the matrix
|
|
23
|
+
* (`insight`, `correction`, …), are never rendered.
|
|
24
|
+
*
|
|
25
|
+
* @param entry - the entry to classify.
|
|
26
|
+
* @param projectName - the current project name (cwd basename), or undefined.
|
|
27
|
+
* @returns the target notes file kind, or `undefined` when not rendered.
|
|
28
|
+
*/
|
|
29
|
+
export function isRenderedEntry(entry, projectName) {
|
|
30
|
+
const category = entry.category;
|
|
31
|
+
if (category === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const inProject = entry.scope === 'project';
|
|
34
|
+
if (inProject && (projectName === undefined || entry.projectName !== projectName))
|
|
35
|
+
return undefined;
|
|
36
|
+
if ((entry.scope === 'user' || entry.scope === 'global' || inProject) && NOTES_CONVENTION_CATEGORIES.includes(category)) {
|
|
37
|
+
return 'conventions';
|
|
38
|
+
}
|
|
39
|
+
if ((entry.scope === 'global' || inProject) && NOTES_PITFALL_CATEGORIES.includes(category)) {
|
|
40
|
+
return 'pitfalls';
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/notes/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,2BAA2B,GAA8B,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;AAElG,8EAA8E;AAC9E,MAAM,CAAC,MAAM,wBAAwB,GAA8B,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AAQzG;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,KAAsB,EAAE,WAA+B;IACrF,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;IAC/B,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAA;IAC3C,IAAI,SAAS,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,KAAK,WAAW,CAAC;QAAE,OAAO,SAAS,CAAA;IACnG,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,2BAA2B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxH,OAAO,aAAa,CAAA;IACtB,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,wBAAwB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3F,OAAO,UAAU,CAAA;IACnB,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defaults and the read-side view for the notes keys of the `memory` settings
|
|
3
|
+
* namespace. Both consumers pull from here so defaults cannot drift:
|
|
4
|
+
* `memory-context`'s Config schema (schema `.default()` values → settings UI
|
|
5
|
+
* ownership) and the `memory-notes` plugin (defensive reads of the raw
|
|
6
|
+
* namespace value via `ctx.settings.get`).
|
|
7
|
+
*
|
|
8
|
+
* @module @chenhw7/dsh-memory/notes/settings
|
|
9
|
+
*/
|
|
10
|
+
/** Whether notes export + injection are enabled. */
|
|
11
|
+
export declare const DEFAULT_NOTES_ENABLED = true;
|
|
12
|
+
/** Repo-relative directory holding the generated notes files. */
|
|
13
|
+
export declare const DEFAULT_NOTES_DIR = "docs/agent-memory";
|
|
14
|
+
/** Total character budget for the injected notes section. */
|
|
15
|
+
export declare const DEFAULT_NOTES_CHAR_LIMIT = 4000;
|
|
16
|
+
/** Whether the AGENTS.md pointer block is maintained. */
|
|
17
|
+
export declare const DEFAULT_NOTES_AGENTS_POINTER = true;
|
|
18
|
+
/** Max entries per generated file (oldest by updatedAt are truncated). */
|
|
19
|
+
export declare const DEFAULT_NOTES_MAX_ENTRIES_PER_FILE = 100;
|
|
20
|
+
/** The notes slice of the `memory` settings namespace, fully resolved. */
|
|
21
|
+
export interface NotesSettings {
|
|
22
|
+
readonly notesEnabled: boolean;
|
|
23
|
+
readonly notesDir: string;
|
|
24
|
+
readonly notesCharLimit: number;
|
|
25
|
+
readonly notesAgentsPointer: boolean;
|
|
26
|
+
readonly notesMaxEntriesPerFile: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the notes settings from an untyped namespace value (defaults for
|
|
30
|
+
* anything absent or mistyped).
|
|
31
|
+
* @param value - the raw `memory` namespace value (`ctx.settings.get` returns `unknown`).
|
|
32
|
+
* @returns the fully-resolved notes settings.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveNotesSettings(value: unknown): NotesSettings;
|
|
35
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/notes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,OAAO,CAAA;AACzC,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AACpD,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAC5C,yDAAyD;AACzD,eAAO,MAAM,4BAA4B,OAAO,CAAA;AAChD,0EAA0E;AAC1E,eAAO,MAAM,kCAAkC,MAAM,CAAA;AAErD,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;IACpC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAA;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CASlE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defaults and the read-side view for the notes keys of the `memory` settings
|
|
3
|
+
* namespace. Both consumers pull from here so defaults cannot drift:
|
|
4
|
+
* `memory-context`'s Config schema (schema `.default()` values → settings UI
|
|
5
|
+
* ownership) and the `memory-notes` plugin (defensive reads of the raw
|
|
6
|
+
* namespace value via `ctx.settings.get`).
|
|
7
|
+
*
|
|
8
|
+
* @module @chenhw7/dsh-memory/notes/settings
|
|
9
|
+
*/
|
|
10
|
+
/** Whether notes export + injection are enabled. */
|
|
11
|
+
export const DEFAULT_NOTES_ENABLED = true;
|
|
12
|
+
/** Repo-relative directory holding the generated notes files. */
|
|
13
|
+
export const DEFAULT_NOTES_DIR = 'docs/agent-memory';
|
|
14
|
+
/** Total character budget for the injected notes section. */
|
|
15
|
+
export const DEFAULT_NOTES_CHAR_LIMIT = 4000;
|
|
16
|
+
/** Whether the AGENTS.md pointer block is maintained. */
|
|
17
|
+
export const DEFAULT_NOTES_AGENTS_POINTER = true;
|
|
18
|
+
/** Max entries per generated file (oldest by updatedAt are truncated). */
|
|
19
|
+
export const DEFAULT_NOTES_MAX_ENTRIES_PER_FILE = 100;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the notes settings from an untyped namespace value (defaults for
|
|
22
|
+
* anything absent or mistyped).
|
|
23
|
+
* @param value - the raw `memory` namespace value (`ctx.settings.get` returns `unknown`).
|
|
24
|
+
* @returns the fully-resolved notes settings.
|
|
25
|
+
*/
|
|
26
|
+
export function resolveNotesSettings(value) {
|
|
27
|
+
const v = (typeof value === 'object' && value !== null ? value : {});
|
|
28
|
+
return {
|
|
29
|
+
notesEnabled: typeof v.notesEnabled === 'boolean' ? v.notesEnabled : DEFAULT_NOTES_ENABLED,
|
|
30
|
+
notesDir: typeof v.notesDir === 'string' && v.notesDir.trim().length > 0 ? v.notesDir.trim() : DEFAULT_NOTES_DIR,
|
|
31
|
+
notesCharLimit: typeof v.notesCharLimit === 'number' && v.notesCharLimit >= 0 ? Math.trunc(v.notesCharLimit) : DEFAULT_NOTES_CHAR_LIMIT,
|
|
32
|
+
notesAgentsPointer: typeof v.notesAgentsPointer === 'boolean' ? v.notesAgentsPointer : DEFAULT_NOTES_AGENTS_POINTER,
|
|
33
|
+
notesMaxEntriesPerFile: typeof v.notesMaxEntriesPerFile === 'number' && v.notesMaxEntriesPerFile >= 0 ? Math.trunc(v.notesMaxEntriesPerFile) : DEFAULT_NOTES_MAX_ENTRIES_PER_FILE,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/notes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAA;AACzC,iEAAiE;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAA;AACpD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAA;AAC5C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
2
|
+
* Filesystem writes for project notes: atomic file replacement and the
|
|
3
|
+
* AGENTS.md pointer-block maintenance. The exporter is the single writer of
|
|
4
|
+
* the managed regions, so no locking is needed; atomic rename keeps readers
|
|
5
|
+
* (and concurrent sessions rendering the same truth) from ever seeing a torn
|
|
6
|
+
* file.
|
|
7
|
+
*
|
|
8
|
+
* @module @chenhw7/dsh-memory/notes/writer
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Write a file atomically: write to a sibling temp file, then rename.
|
|
12
|
+
* Parent directories are created on demand.
|
|
13
|
+
* @param filePath - the target file path.
|
|
14
|
+
* @param content - the full file content.
|
|
15
|
+
*/
|
|
16
|
+
export declare function writeFileAtomic(filePath: string, content: string): Promise<void>;
|
|
17
|
+
/** Marker opening the managed pointer block in AGENTS.md. */
|
|
18
|
+
export declare const AGENTS_POINTER_BEGIN = "<!-- dsh-memory:begin -->";
|
|
19
|
+
/** Marker closing the managed pointer block in AGENTS.md. */
|
|
20
|
+
export declare const AGENTS_POINTER_END = "<!-- dsh-memory:end -->";
|
|
21
|
+
/** The managed pointer block text for a given notes directory (repo-relative). */
|
|
22
|
+
export declare function agentsPointerBlock(notesDir: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Ensure the AGENTS.md pointer block exists. Creates a pointer-only AGENTS.md
|
|
25
|
+
* when absent; replaces an existing managed block in place (idempotent:
|
|
26
|
+
* rewrites only when the block text actually changed); appends the block when
|
|
27
|
+
* the file exists without one. Everything outside the markers is untouched.
|
|
28
|
+
* @param agentsPath - absolute path of the repository's AGENTS.md.
|
|
29
|
+
* @param notesDir - repo-relative notes directory named in the pointer.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ensureAgentsPointer(agentsPath: string, notesDir: string): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtF;AAED,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,4BAA4B,CAAA;AAE3D,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB7F"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filesystem writes for project notes: atomic file replacement and the
|
|
3
|
+
* AGENTS.md pointer-block maintenance. The exporter is the single writer of
|
|
4
|
+
* the managed regions, so no locking is needed; atomic rename keeps readers
|
|
5
|
+
* (and concurrent sessions rendering the same truth) from ever seeing a torn
|
|
6
|
+
* file.
|
|
7
|
+
*
|
|
8
|
+
* @module @chenhw7/dsh-memory/notes/writer
|
|
9
|
+
*/
|
|
10
|
+
import { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
/**
|
|
13
|
+
* Write a file atomically: write to a sibling temp file, then rename.
|
|
14
|
+
* Parent directories are created on demand.
|
|
15
|
+
* @param filePath - the target file path.
|
|
16
|
+
* @param content - the full file content.
|
|
17
|
+
*/
|
|
18
|
+
export async function writeFileAtomic(filePath, content) {
|
|
19
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
20
|
+
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
21
|
+
try {
|
|
22
|
+
await writeFile(tmp, content, 'utf8');
|
|
23
|
+
await rename(tmp, filePath);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
await unlink(tmp).catch(() => { });
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Marker opening the managed pointer block in AGENTS.md. */
|
|
31
|
+
export const AGENTS_POINTER_BEGIN = '<!-- dsh-memory:begin -->';
|
|
32
|
+
/** Marker closing the managed pointer block in AGENTS.md. */
|
|
33
|
+
export const AGENTS_POINTER_END = '<!-- dsh-memory:end -->';
|
|
34
|
+
/** The managed pointer block text for a given notes directory (repo-relative). */
|
|
35
|
+
export function agentsPointerBlock(notesDir) {
|
|
36
|
+
return `${AGENTS_POINTER_BEGIN}\n> Agent-maintained project notes live in \`${notesDir}/\` (auto-generated by dsh-memory — do not edit those files by hand).\n${AGENTS_POINTER_END}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Ensure the AGENTS.md pointer block exists. Creates a pointer-only AGENTS.md
|
|
40
|
+
* when absent; replaces an existing managed block in place (idempotent:
|
|
41
|
+
* rewrites only when the block text actually changed); appends the block when
|
|
42
|
+
* the file exists without one. Everything outside the markers is untouched.
|
|
43
|
+
* @param agentsPath - absolute path of the repository's AGENTS.md.
|
|
44
|
+
* @param notesDir - repo-relative notes directory named in the pointer.
|
|
45
|
+
*/
|
|
46
|
+
export async function ensureAgentsPointer(agentsPath, notesDir) {
|
|
47
|
+
const block = agentsPointerBlock(notesDir);
|
|
48
|
+
let existing;
|
|
49
|
+
try {
|
|
50
|
+
existing = await readFile(agentsPath, 'utf8');
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error.code !== 'ENOENT')
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
if (existing === undefined) {
|
|
57
|
+
await writeFileAtomic(agentsPath, `${block}\n`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const beginIdx = existing.indexOf(AGENTS_POINTER_BEGIN);
|
|
61
|
+
const endIdx = existing.indexOf(AGENTS_POINTER_END);
|
|
62
|
+
if (beginIdx >= 0 && endIdx > beginIdx) {
|
|
63
|
+
const next = existing.slice(0, beginIdx) + block + existing.slice(endIdx + AGENTS_POINTER_END.length);
|
|
64
|
+
if (next !== existing)
|
|
65
|
+
await writeFileAtomic(agentsPath, next);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const separator = existing.endsWith('\n') ? '\n' : '\n\n';
|
|
69
|
+
await writeFileAtomic(agentsPath, existing + separator + block + '\n');
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,OAAe;IACrE,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACxD,MAAM,GAAG,GAAG,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,CAAA;IAC1D,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACjC,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC;AAED,6DAA6D;AAC7D,MAAM,C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AAC;IACD,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;IACzD,MAAM,eAAe,CAAC,UAAU,EAAE,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,CAAA;AACxE,CAAC"}
|
package/lib/remote/index.d.ts
CHANGED
|
@@ -6,9 +6,18 @@
|
|
|
6
6
|
* write-serialized through the existing store contract. The service delegates to
|
|
7
7
|
* `ctx.memory` — it does not duplicate the store.
|
|
8
8
|
*
|
|
9
|
-
* Host integration: the `./remote` subpath
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Host integration: the `./remote-service` subpath is mounted as the
|
|
10
|
+
* `memory-remote` composition entry (cordis.patch.yml); the browser half mounts
|
|
11
|
+
* the matching client contribution itself (`src/typert.remote-client.js`).
|
|
12
|
+
*
|
|
13
|
+
* Deployment security (verified against the harness sources, 2026-08): there is
|
|
14
|
+
* NO per-method `PRIVILEGED_METHODS` registry — the trust fence is transport
|
|
15
|
+
* level. Every `/api` request passes `api-request-trust`
|
|
16
|
+
* (`packages/client/connection/src/api-request-trust.ts`), which admits
|
|
17
|
+
* loopback / deployment-derived LAN literals / declared `trustedHosts` hosts
|
|
18
|
+
* and rejects DNS-rebinding and cross-site requests before any RPC runs. So a
|
|
19
|
+
* non-loopback caller cannot reach `add`/`update`/`remove` at all; nothing to
|
|
20
|
+
* pin per method.
|
|
12
21
|
*
|
|
13
22
|
* @module @chenhw7/dsh-memory/remote
|
|
14
23
|
*/
|
|
@@ -42,6 +51,7 @@ export interface MemoryEntryJson {
|
|
|
42
51
|
readonly updatedAt: number;
|
|
43
52
|
readonly pinned?: boolean;
|
|
44
53
|
readonly lastRecalledAt?: number;
|
|
54
|
+
readonly staleSince?: number;
|
|
45
55
|
}
|
|
46
56
|
export interface MemoryListRequest {
|
|
47
57
|
readonly scope?: 'global' | 'project' | 'user';
|
|
@@ -110,9 +120,14 @@ export interface MemoryHealthResult {
|
|
|
110
120
|
};
|
|
111
121
|
pinned: number;
|
|
112
122
|
auditRecords: number;
|
|
123
|
+
stale?: number;
|
|
113
124
|
lastActivityTs?: number;
|
|
114
125
|
lastExtractionTs?: number;
|
|
115
126
|
}
|
|
127
|
+
/** Distinct `projectName` values across all `project`-scoped entries. */
|
|
128
|
+
export interface MemoryProjectsResult {
|
|
129
|
+
readonly projects: readonly string[];
|
|
130
|
+
}
|
|
116
131
|
export interface MemoryAuditRequest {
|
|
117
132
|
readonly limit?: number;
|
|
118
133
|
}
|
|
@@ -137,9 +152,21 @@ export declare class MemoryRemoteService extends TypertRemoteService {
|
|
|
137
152
|
get(request: MemoryGetRequest): MemoryGetResult;
|
|
138
153
|
add(request: MemoryAddRequest): Promise<MemoryAddResult>;
|
|
139
154
|
update(request: MemoryUpdateRequest): Promise<MemoryUpdateResult>;
|
|
140
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Delete one entry. Named `removeEntry` rather than `remove`: the gateway's
|
|
157
|
+
* client-side namespace service reserves a handful of member names
|
|
158
|
+
* (`remove` among them — its internal uninstall method), and a contribution
|
|
159
|
+
* descriptor carrying one of those names fails validation at mount time.
|
|
160
|
+
*/
|
|
161
|
+
removeEntry(request: MemoryRemoveRequest): Promise<MemoryRemoveResult>;
|
|
141
162
|
pin(request: MemoryPinRequest): Promise<MemoryPinResult>;
|
|
142
163
|
health(): MemoryHealthResult;
|
|
164
|
+
/**
|
|
165
|
+
* Distinct project names across all `project`-scoped entries — the data
|
|
166
|
+
* source for the management UI's workspace selector. Aggregated here from
|
|
167
|
+
* `store.list('project')` so the store contract stays untouched.
|
|
168
|
+
*/
|
|
169
|
+
projects(): MemoryProjectsResult;
|
|
143
170
|
auditLog(request: MemoryAuditRequest): MemoryAuditResult;
|
|
144
171
|
}
|
|
145
172
|
export type * from './types.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","s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MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;CACxC;AAID;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,mBAAmB;IAC1D,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B,YAAY,GAAG,EAAE,OAAO,EAGvB;IAED,OAAO,CAAC,MAAM;IAKd,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAWjD;IAGD,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG;QAAE,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAM3F;IAGD,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAM9C;IAGK,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAgB7D;IAGK,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAetE;IAED;;;;;OAKG;IAEG,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAK3E;IAGK,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAQ7D;IAGD,MAAM,IAAI,kBAAkB,CAgB3B;IAED;;;;OAIG;IAEH,QAAQ,IAAI,oBAAoB,CAQ/B;IAGD,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,CAOvD;CACF;AAED,mBAAmB,YAAY,CAAA"}
|
package/lib/remote/index.js
CHANGED
|
@@ -6,9 +6,18 @@
|
|
|
6
6
|
* write-serialized through the existing store contract. The service delegates to
|
|
7
7
|
* `ctx.memory` — it does not duplicate the store.
|
|
8
8
|
*
|
|
9
|
-
* Host integration: the `./remote` subpath
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Host integration: the `./remote-service` subpath is mounted as the
|
|
10
|
+
* `memory-remote` composition entry (cordis.patch.yml); the browser half mounts
|
|
11
|
+
* the matching client contribution itself (`src/typert.remote-client.js`).
|
|
12
|
+
*
|
|
13
|
+
* Deployment security (verified against the harness sources, 2026-08): there is
|
|
14
|
+
* NO per-method `PRIVILEGED_METHODS` registry — the trust fence is transport
|
|
15
|
+
* level. Every `/api` request passes `api-request-trust`
|
|
16
|
+
* (`packages/client/connection/src/api-request-trust.ts`), which admits
|
|
17
|
+
* loopback / deployment-derived LAN literals / declared `trustedHosts` hosts
|
|
18
|
+
* and rejects DNS-rebinding and cross-site requests before any RPC runs. So a
|
|
19
|
+
* non-loopback caller cannot reach `add`/`update`/`remove` at all; nothing to
|
|
20
|
+
* pin per method.
|
|
12
21
|
*
|
|
13
22
|
* @module @chenhw7/dsh-memory/remote
|
|
14
23
|
*/
|
|
@@ -71,6 +80,7 @@ function toEntryJson(entry) {
|
|
|
71
80
|
...entry.projectName !== undefined ? { projectName: entry.projectName } : {},
|
|
72
81
|
...entry.pinned !== undefined ? { pinned: entry.pinned } : {},
|
|
73
82
|
...entry.lastRecalledAt !== undefined ? { lastRecalledAt: entry.lastRecalledAt } : {},
|
|
83
|
+
...entry.staleSince !== undefined ? { staleSince: entry.staleSince } : {},
|
|
74
84
|
};
|
|
75
85
|
}
|
|
76
86
|
// ─── Service class ──────────────────────────────────────────────────────────
|
|
@@ -87,9 +97,10 @@ let MemoryRemoteService = (() => {
|
|
|
87
97
|
let _get_decorators;
|
|
88
98
|
let _add_decorators;
|
|
89
99
|
let _update_decorators;
|
|
90
|
-
let
|
|
100
|
+
let _removeEntry_decorators;
|
|
91
101
|
let _pin_decorators;
|
|
92
102
|
let _health_decorators;
|
|
103
|
+
let _projects_decorators;
|
|
93
104
|
let _auditLog_decorators;
|
|
94
105
|
return class MemoryRemoteService extends _classSuper {
|
|
95
106
|
static {
|
|
@@ -99,18 +110,20 @@ let MemoryRemoteService = (() => {
|
|
|
99
110
|
_get_decorators = [Remote('get')];
|
|
100
111
|
_add_decorators = [Remote('add')];
|
|
101
112
|
_update_decorators = [Remote('update')];
|
|
102
|
-
|
|
113
|
+
_removeEntry_decorators = [Remote('removeEntry')];
|
|
103
114
|
_pin_decorators = [Remote('pin')];
|
|
104
115
|
_health_decorators = [Remote('health')];
|
|
116
|
+
_projects_decorators = [Remote('projects')];
|
|
105
117
|
_auditLog_decorators = [Remote('auditLog')];
|
|
106
118
|
__esDecorate(this, null, _list_decorators, { kind: "method", name: "list", static: false, private: false, access: { has: obj => "list" in obj, get: obj => obj.list }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
107
119
|
__esDecorate(this, null, _search_decorators, { kind: "method", name: "search", static: false, private: false, access: { has: obj => "search" in obj, get: obj => obj.search }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
108
120
|
__esDecorate(this, null, _get_decorators, { kind: "method", name: "get", static: false, private: false, access: { has: obj => "get" in obj, get: obj => obj.get }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
109
121
|
__esDecorate(this, null, _add_decorators, { kind: "method", name: "add", static: false, private: false, access: { has: obj => "add" in obj, get: obj => obj.add }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
110
122
|
__esDecorate(this, null, _update_decorators, { kind: "method", name: "update", static: false, private: false, access: { has: obj => "update" in obj, get: obj => obj.update }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
111
|
-
__esDecorate(this, null,
|
|
123
|
+
__esDecorate(this, null, _removeEntry_decorators, { kind: "method", name: "removeEntry", static: false, private: false, access: { has: obj => "removeEntry" in obj, get: obj => obj.removeEntry }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
112
124
|
__esDecorate(this, null, _pin_decorators, { kind: "method", name: "pin", static: false, private: false, access: { has: obj => "pin" in obj, get: obj => obj.pin }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
113
125
|
__esDecorate(this, null, _health_decorators, { kind: "method", name: "health", static: false, private: false, access: { has: obj => "health" in obj, get: obj => obj.health }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
126
|
+
__esDecorate(this, null, _projects_decorators, { kind: "method", name: "projects", static: false, private: false, access: { has: obj => "projects" in obj, get: obj => obj.projects }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
114
127
|
__esDecorate(this, null, _auditLog_decorators, { kind: "method", name: "auditLog", static: false, private: false, access: { has: obj => "auditLog" in obj, get: obj => obj.auditLog }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
115
128
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
116
129
|
}
|
|
@@ -191,7 +204,13 @@ let MemoryRemoteService = (() => {
|
|
|
191
204
|
return { found: false, error: e instanceof Error ? e.message : 'update failed' };
|
|
192
205
|
}
|
|
193
206
|
}
|
|
194
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Delete one entry. Named `removeEntry` rather than `remove`: the gateway's
|
|
209
|
+
* client-side namespace service reserves a handful of member names
|
|
210
|
+
* (`remove` among them — its internal uninstall method), and a contribution
|
|
211
|
+
* descriptor carrying one of those names fails validation at mount time.
|
|
212
|
+
*/
|
|
213
|
+
async removeEntry(request) {
|
|
195
214
|
const store = this.memory();
|
|
196
215
|
if (store === undefined)
|
|
197
216
|
return { removed: false };
|
|
@@ -221,12 +240,30 @@ let MemoryRemoteService = (() => {
|
|
|
221
240
|
pinned: h.pinned,
|
|
222
241
|
auditRecords: h.auditRecords,
|
|
223
242
|
};
|
|
243
|
+
if (h.stale !== undefined)
|
|
244
|
+
result.stale = h.stale;
|
|
224
245
|
if (h.lastActivityTs !== undefined)
|
|
225
246
|
result.lastActivityTs = h.lastActivityTs;
|
|
226
247
|
if (h.lastExtractionTs !== undefined)
|
|
227
248
|
result.lastExtractionTs = h.lastExtractionTs;
|
|
228
249
|
return result;
|
|
229
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Distinct project names across all `project`-scoped entries — the data
|
|
253
|
+
* source for the management UI's workspace selector. Aggregated here from
|
|
254
|
+
* `store.list('project')` so the store contract stays untouched.
|
|
255
|
+
*/
|
|
256
|
+
projects() {
|
|
257
|
+
const store = this.memory();
|
|
258
|
+
if (store === undefined)
|
|
259
|
+
return { projects: [] };
|
|
260
|
+
const names = new Set();
|
|
261
|
+
for (const entry of store.list('project')) {
|
|
262
|
+
if (entry.projectName !== undefined)
|
|
263
|
+
names.add(entry.projectName);
|
|
264
|
+
}
|
|
265
|
+
return { projects: [...names].sort() };
|
|
266
|
+
}
|
|
230
267
|
auditLog(request) {
|
|
231
268
|
const store = this.memory();
|
|
232
269
|
if (store === undefined)
|
package/lib/remote/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/remote/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/remote/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAY9E,0BAA0B;AAC1B,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAA;AAEnC,sCAAsC;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,CAAC,CAAA;AAQhC;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,GAAY;IAChC,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC;AAkBD,SAAS,WAAW,CAAC,KAAkB;IACrC,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAY;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,KAAK,CAAC,QAAQ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emoryEntryJson {
|
|
|
14
14
|
updatedAt: number
|
|
15
15
|
pinned?: boolean
|
|
16
16
|
lastRecalledAt?: number
|
|
17
|
+
staleSince?: number
|
|
17
18
|
}
|
|
18
19
|
export interface MemoryListResult { entries: readonly MemoryEntryJson[]; total: number }
|
|
19
20
|
export interface MemorySearchResult { entries: readonly MemoryEntryJson[]; total: number }
|
|
@@ -27,9 +28,11 @@ export interface MemoryHealthResult {
|
|
|
27
28
|
byScope: { global: number; project: number; user: number }
|
|
28
29
|
pinned: number
|
|
29
30
|
auditRecords: number
|
|
31
|
+
stale?: number
|
|
30
32
|
lastActivityTs?: number
|
|
31
33
|
lastExtractionTs?: number
|
|
32
34
|
}
|
|
35
|
+
export interface MemoryProjectsResult { projects: readonly string[] }
|
|
33
36
|
export interface AuditEntryJson {
|
|
34
37
|
id: string
|
|
35
38
|
op: 'add' | 'update' | 'remove'
|
|
@@ -50,9 +53,10 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
50
53
|
get: (request: { id: string }) => Promise<RemoteResult<MemoryGetResult>>
|
|
51
54
|
add: (request: { scope: string; content: string; category?: string; projectName?: string }) => Promise<RemoteResult<MemoryAddResult>>
|
|
52
55
|
update: (request: { id: string; content?: string; category?: string }) => Promise<RemoteResult<MemoryUpdateResult>>
|
|
53
|
-
|
|
56
|
+
removeEntry: (request: { id: string }) => Promise<RemoteResult<MemoryRemoveResult>>
|
|
54
57
|
pin: (request: { id: string; pinned: boolean }) => Promise<RemoteResult<MemoryPinResult>>
|
|
55
58
|
health: () => Promise<RemoteResult<MemoryHealthResult>>
|
|
59
|
+
projects: () => Promise<RemoteResult<MemoryProjectsResult>>
|
|
56
60
|
auditLog: (request: { limit?: number }) => Promise<RemoteResult<MemoryAuditResult>>
|
|
57
61
|
}
|
|
58
62
|
interface TypertRemoteMap {
|
|
@@ -61,9 +65,10 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
61
65
|
'memoryRemote/get': (request: { id: string }) => Promise<RemoteResult<MemoryGetResult>>
|
|
62
66
|
'memoryRemote/add': (request: { scope: string; content: string; category?: string; projectName?: string }) => Promise<RemoteResult<MemoryAddResult>>
|
|
63
67
|
'memoryRemote/update': (request: { id: string; content?: string; category?: string }) => Promise<RemoteResult<MemoryUpdateResult>>
|
|
64
|
-
'memoryRemote/
|
|
68
|
+
'memoryRemote/removeEntry': (request: { id: string }) => Promise<RemoteResult<MemoryRemoveResult>>
|
|
65
69
|
'memoryRemote/pin': (request: { id: string; pinned: boolean }) => Promise<RemoteResult<MemoryPinResult>>
|
|
66
70
|
'memoryRemote/health': () => Promise<RemoteResult<MemoryHealthResult>>
|
|
71
|
+
'memoryRemote/projects': () => Promise<RemoteResult<MemoryProjectsResult>>
|
|
67
72
|
'memoryRemote/auditLog': (request: { limit?: number }) => Promise<RemoteResult<MemoryAuditResult>>
|
|
68
73
|
}
|
|
69
74
|
interface TypertRemoteNamespaceMap {
|
|
@@ -31,8 +31,9 @@ const _remove_param = z.object({}).passthrough()
|
|
|
31
31
|
const _remove_result = z.object({}).passthrough()
|
|
32
32
|
const _pin_param = z.object({}).passthrough()
|
|
33
33
|
const _pin_result = z.object({}).passthrough()
|
|
34
|
-
// health()
|
|
34
|
+
// health() and projects() take no request parameter — no schema needed for them.
|
|
35
35
|
const _health_result = z.object({}).passthrough()
|
|
36
|
+
const _projects_result = z.object({}).passthrough()
|
|
36
37
|
const _auditLog_param = z.object({}).passthrough()
|
|
37
38
|
const _auditLog_result = z.object({}).passthrough()
|
|
38
39
|
|
|
@@ -60,7 +61,7 @@ const descriptors = [
|
|
|
60
61
|
parameters: [{ name: 'request', wire: 'request', source: 'json', codec: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryUpdateRequest`, schema: _update_param } }],
|
|
61
62
|
result: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryUpdateResult`, schema: _update_result },
|
|
62
63
|
sourceLocation: { file: 'src/remote/index.ts', line: 0, column: 0 } },
|
|
63
|
-
{ id: `${pkg}#${ns}/
|
|
64
|
+
{ id: `${pkg}#${ns}/removeEntry`, service: ns, namespace: ns, method: 'removeEntry', invocation: { kind: 'direct' },
|
|
64
65
|
parameters: [{ name: 'request', wire: 'request', source: 'json', codec: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryRemoveRequest`, schema: _remove_param } }],
|
|
65
66
|
result: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryRemoveResult`, schema: _remove_result },
|
|
66
67
|
sourceLocation: { file: 'src/remote/index.ts', line: 0, column: 0 } },
|
|
@@ -75,6 +76,11 @@ const descriptors = [
|
|
|
75
76
|
parameters: [],
|
|
76
77
|
result: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryHealthResult`, schema: _health_result },
|
|
77
78
|
sourceLocation: { file: 'src/remote/index.ts', line: 0, column: 0 } },
|
|
79
|
+
{ id: `${pkg}#${ns}/projects`, service: ns, namespace: ns, method: 'projects', invocation: { kind: 'direct' },
|
|
80
|
+
// Same no-parameter shape as health(): projects() takes no request object.
|
|
81
|
+
parameters: [],
|
|
82
|
+
result: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryProjectsResult`, schema: _projects_result },
|
|
83
|
+
sourceLocation: { file: 'src/remote/index.ts', line: 0, column: 0 } },
|
|
78
84
|
{ id: `${pkg}#${ns}/auditLog`, service: ns, namespace: ns, method: 'auditLog', invocation: { kind: 'direct' },
|
|
79
85
|
parameters: [{ name: 'request', wire: 'request', source: 'json', codec: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryAuditRequest`, schema: _auditLog_param } }],
|
|
80
86
|
result: { mode: 'strict', typeSymbol: `${pkg}/remote/types#MemoryAuditResult`, schema: _auditLog_result },
|