vault-go 0.31.2 → 0.33.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 +9 -1
- package/dist/capture-privacy.d.ts +2 -0
- package/dist/capture-privacy.js +22 -2
- package/dist/cli.js +2 -2
- package/dist/client-prompts.d.ts +2 -0
- package/dist/client-prompts.js +34 -0
- package/dist/context-chain.d.ts +2 -0
- package/dist/context-chain.js +12 -4
- package/dist/context-engines.d.ts +6 -0
- package/dist/context-engines.js +55 -3
- package/dist/hook-install.js +5 -2
- package/dist/hook-queue.d.ts +2 -2
- package/dist/hook-queue.js +4 -2
- package/dist/hooks.js +40 -3
- package/dist/installer.d.ts +1 -1
- package/dist/installer.js +44 -2
- package/dist/local-dashboard.js +62 -8
- package/dist/mcp-clients.js +27 -2
- package/dist/mcp-result.d.ts +1 -0
- package/dist/mcp-result.js +20 -3
- package/dist/project-scope.js +5 -1
- package/dist/read-gate.d.ts +25 -0
- package/dist/read-gate.js +121 -0
- package/dist/server.js +22 -2
- package/dist/transcript-tools.js +2 -2
- package/dist/yaml-entry.d.ts +6 -0
- package/dist/yaml-entry.js +113 -0
- package/package.json +7 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Line edits for one named entry inside a top-level YAML mapping, such as
|
|
2
|
+
// Goose's `extensions.vault-go` or Hermes's `mcp_servers.vault-go`. Users keep
|
|
3
|
+
// comments in these files, so they are edited line by line instead of parsed
|
|
4
|
+
// and re-dumped: every line vault-go does not own stays byte for byte. A shape
|
|
5
|
+
// these edits cannot follow throws and the file is left untouched.
|
|
6
|
+
const TOP_LEVEL_KEY = /^(["']?)([A-Za-z_][\w-]*)\1(\s*):(.*)$/;
|
|
7
|
+
function isContent(line) {
|
|
8
|
+
const trimmed = line.trim();
|
|
9
|
+
return trimmed !== "" && !trimmed.startsWith("#");
|
|
10
|
+
}
|
|
11
|
+
function indentOf(line) {
|
|
12
|
+
return line.length - line.trimStart().length;
|
|
13
|
+
}
|
|
14
|
+
function stripComment(value) {
|
|
15
|
+
const match = /(^|\s)#/.exec(value);
|
|
16
|
+
return (match ? value.slice(0, match.index) : value).trim();
|
|
17
|
+
}
|
|
18
|
+
function render(fields, indent) {
|
|
19
|
+
const lines = [];
|
|
20
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
lines.push(`${indent}${key}:`, ...value.map(item => `${indent} - ${JSON.stringify(item)}`));
|
|
23
|
+
}
|
|
24
|
+
else if (value && typeof value === "object") {
|
|
25
|
+
const entries = Object.entries(value);
|
|
26
|
+
if (!entries.length)
|
|
27
|
+
lines.push(`${indent}${key}: {}`);
|
|
28
|
+
else
|
|
29
|
+
lines.push(`${indent}${key}:`, ...entries.map(([name, item]) => `${indent} ${name}: ${JSON.stringify(item)}`));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
lines.push(`${indent}${key}: ${typeof value === "string" ? JSON.stringify(value) : String(value)}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return lines;
|
|
36
|
+
}
|
|
37
|
+
/** `text` with `<topKey>.<name>` set to `fields`, replacing an entry of that name. */
|
|
38
|
+
export function upsertYamlEntry(text, topKey, name, fields) {
|
|
39
|
+
// Windows editors save a byte order mark; it is not part of the first key and is kept.
|
|
40
|
+
const bom = text.startsWith("") ? "" : "";
|
|
41
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
42
|
+
const lines = text.slice(bom.length).split(/\r?\n/);
|
|
43
|
+
if (lines.length && lines[lines.length - 1] === "")
|
|
44
|
+
lines.pop();
|
|
45
|
+
const firstContent = lines.find(line => isContent(line) && !/^(---(\s|$)|%)/.test(line));
|
|
46
|
+
if (firstContent !== undefined && indentOf(firstContent) > 0)
|
|
47
|
+
throw new Error("O nível superior do YAML está indentado; o arquivo não foi alterado.");
|
|
48
|
+
const headers = lines.flatMap((line, index) => TOP_LEVEL_KEY.exec(line)?.[2] === topKey ? [index] : []);
|
|
49
|
+
if (headers.length > 1)
|
|
50
|
+
throw new Error(`Chave ${topKey} duplicada no YAML; o arquivo não foi alterado.`);
|
|
51
|
+
if (!headers.length) {
|
|
52
|
+
while (lines.length && !lines[lines.length - 1].trim())
|
|
53
|
+
lines.pop();
|
|
54
|
+
const documentEnd = lines.findIndex(line => /^\.\.\.(\s|$)/.test(line));
|
|
55
|
+
const block = [`${topKey}:`, ` ${name}:`, ...render(fields, " ")];
|
|
56
|
+
if (documentEnd === -1)
|
|
57
|
+
lines.push(...block);
|
|
58
|
+
else
|
|
59
|
+
lines.splice(documentEnd, 0, ...block);
|
|
60
|
+
return bom + lines.join(eol) + eol;
|
|
61
|
+
}
|
|
62
|
+
const header = headers[0];
|
|
63
|
+
const match = TOP_LEVEL_KEY.exec(lines[header]);
|
|
64
|
+
const inline = stripComment(match[4]);
|
|
65
|
+
if (inline !== "" && inline !== "{}" && inline !== "null" && inline !== "~") {
|
|
66
|
+
throw new Error(`${topKey} usa valor inline no YAML; escreva como mapeamento em bloco. O arquivo não foi alterado.`);
|
|
67
|
+
}
|
|
68
|
+
if (inline)
|
|
69
|
+
lines[header] = lines[header].replace(/:[ \t]*(?:\{\}|null|~)/, ":");
|
|
70
|
+
let end = header + 1;
|
|
71
|
+
while (end < lines.length && !(isContent(lines[end]) && indentOf(lines[end]) === 0))
|
|
72
|
+
end++;
|
|
73
|
+
while (end > header + 1 && !isContent(lines[end - 1]))
|
|
74
|
+
end--;
|
|
75
|
+
const firstChild = lines.slice(header + 1, end).find(isContent);
|
|
76
|
+
if (firstChild?.startsWith("\t"))
|
|
77
|
+
throw new Error(`${topKey} está indentado com tabs; o arquivo não foi alterado.`);
|
|
78
|
+
const indent = " ".repeat(firstChild ? indentOf(firstChild) : 2);
|
|
79
|
+
const entry = [`${indent}${name}:`, ...render(fields, indent + " ")];
|
|
80
|
+
const existing = lines.findIndex((line, index) => index > header && index < end && indentOf(line) === indent.length && new RegExp(`^(["']?)${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\1\\s*:`).test(line.trimStart()));
|
|
81
|
+
if (existing === -1) {
|
|
82
|
+
lines.splice(header + 1, 0, ...entry);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
let entryEnd = existing + 1;
|
|
86
|
+
while (entryEnd < end && !(isContent(lines[entryEnd]) && indentOf(lines[entryEnd]) <= indent.length))
|
|
87
|
+
entryEnd++;
|
|
88
|
+
while (entryEnd > existing + 1 && !isContent(lines[entryEnd - 1]))
|
|
89
|
+
entryEnd--;
|
|
90
|
+
lines.splice(existing, entryEnd - existing, ...entry);
|
|
91
|
+
}
|
|
92
|
+
return bom + lines.join(eol) + eol;
|
|
93
|
+
}
|
|
94
|
+
/** Whether `<topKey>.<name>` exists as a block entry. */
|
|
95
|
+
export function hasYamlEntry(text, topKey, name) {
|
|
96
|
+
const lines = text.replace(/^/, "").split(/\r?\n/);
|
|
97
|
+
const header = lines.findIndex(line => TOP_LEVEL_KEY.exec(line)?.[2] === topKey);
|
|
98
|
+
if (header === -1)
|
|
99
|
+
return false;
|
|
100
|
+
let childIndent = -1;
|
|
101
|
+
for (let index = header + 1; index < lines.length; index++) {
|
|
102
|
+
const line = lines[index];
|
|
103
|
+
if (!isContent(line))
|
|
104
|
+
continue;
|
|
105
|
+
if (indentOf(line) === 0)
|
|
106
|
+
break;
|
|
107
|
+
if (childIndent === -1)
|
|
108
|
+
childIndent = indentOf(line);
|
|
109
|
+
if (indentOf(line) === childIndent && new RegExp(`^(["']?)${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\1\\s*:`).test(line.trimStart()))
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vault-go",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "MCP server and installer for Vault Memory: search, capture, and use account memory across AI clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -139,6 +139,12 @@
|
|
|
139
139
|
"dist/context-chain.d.ts",
|
|
140
140
|
"dist/capture-privacy.js",
|
|
141
141
|
"dist/capture-privacy.d.ts",
|
|
142
|
+
"dist/client-prompts.js",
|
|
143
|
+
"dist/read-gate.js",
|
|
144
|
+
"dist/yaml-entry.js",
|
|
145
|
+
"dist/yaml-entry.d.ts",
|
|
146
|
+
"dist/read-gate.d.ts",
|
|
147
|
+
"dist/client-prompts.d.ts",
|
|
142
148
|
"dist/deployment-verification.js",
|
|
143
149
|
"dist/deployment-verification.d.ts",
|
|
144
150
|
"dist/grok-awareness.js",
|