vault-go 0.25.1 → 0.26.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 +3 -1
- package/dist/capabilities.d.ts +10 -0
- package/dist/capabilities.js +1 -0
- package/dist/cloud.d.ts +4 -0
- package/dist/cloud.js +48 -2
- package/dist/hook-queue.js +20 -4
- package/dist/server.js +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,7 +146,9 @@ Account and health: `vault_go_status`, `vault_go_cloud_health`, `vault_go_prefer
|
|
|
146
146
|
|
|
147
147
|
Projects and sessions: `vault_go_projects`, `vault_go_project_create`, `vault_go_session_start`, `vault_go_session_end`, `vault_go_session_start_context`.
|
|
148
148
|
|
|
149
|
-
Capture and recall: `vault_go_event`, `vault_go_remember`, `vault_go_forget`, `vault_go_search`, `vault_go_search_index`, `vault_go_observations`, `vault_go_timeline`, `vault_go_context`, `vault_go_file_context`, `vault_go_feed`, `vault_go_memory`, `vault_go_tool_uses`, `vault_go_stats`.
|
|
149
|
+
Capture and recall: `vault_go_event`, `vault_go_remember`, `vault_go_forget`, `vault_go_search`, `vault_go_search_index`, `vault_go_retrieve`, `vault_go_observations`, `vault_go_timeline`, `vault_go_context`, `vault_go_file_context`, `vault_go_feed`, `vault_go_memory`, `vault_go_tool_uses`, `vault_go_stats`.
|
|
150
|
+
|
|
151
|
+
`vault_go_retrieve` lets the central memory engine choose a bounded retrieval path while every explicit retrieval tool remains available. `vault_go_decision_status` reports sanitized rollout/circuit state. Jev and its credential remain in the engine; a healthy deployment does not by itself prove provider availability or decision quality.
|
|
150
152
|
|
|
151
153
|
Knowledge bases: `vault_go_knowledge_bases`, `vault_go_knowledge_base`, `vault_go_knowledge_build`, `vault_go_knowledge_rebuild`, `vault_go_knowledge_query`, `vault_go_knowledge_delete`, `vault_go_prime_corpus`, `vault_go_query_corpus`, `vault_go_reprime_corpus`.
|
|
152
154
|
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export declare const CAPABILITIES: {
|
|
|
23
23
|
readonly status: "available";
|
|
24
24
|
readonly tools: readonly ["vault_go_search_index", "vault_go_observations", "vault_go_timeline", "vault_go_feed"];
|
|
25
25
|
readonly difference: "Vault uses UUID identifiers. Search accepts an optional query, offset and date ordering; timeline accepts an explicit UUID or resolves an anchor from a query; feed uses stable cursor pagination.";
|
|
26
|
+
}, {
|
|
27
|
+
readonly upstream: readonly ["automatic retrieval routing", "typed memory decisions"];
|
|
28
|
+
readonly status: "available";
|
|
29
|
+
readonly tools: readonly ["vault_go_retrieve", "vault_go_decision_status"];
|
|
30
|
+
readonly requires: "Jev runs only in the central memory engine. Status is sanitized; deployment availability does not prove provider health or decision quality. Explicit retrieval tools remain available.";
|
|
26
31
|
}, {
|
|
27
32
|
readonly upstream: readonly ["get_tool_uses"];
|
|
28
33
|
readonly status: "available";
|
|
@@ -134,6 +139,11 @@ export declare function getCapabilities(home: string, cloud: VaultMemoryApi, ver
|
|
|
134
139
|
readonly status: "available";
|
|
135
140
|
readonly tools: readonly ["vault_go_search_index", "vault_go_observations", "vault_go_timeline", "vault_go_feed"];
|
|
136
141
|
readonly difference: "Vault uses UUID identifiers. Search accepts an optional query, offset and date ordering; timeline accepts an explicit UUID or resolves an anchor from a query; feed uses stable cursor pagination.";
|
|
142
|
+
}, {
|
|
143
|
+
readonly upstream: readonly ["automatic retrieval routing", "typed memory decisions"];
|
|
144
|
+
readonly status: "available";
|
|
145
|
+
readonly tools: readonly ["vault_go_retrieve", "vault_go_decision_status"];
|
|
146
|
+
readonly requires: "Jev runs only in the central memory engine. Status is sanitized; deployment availability does not prove provider health or decision quality. Explicit retrieval tools remain available.";
|
|
137
147
|
}, {
|
|
138
148
|
readonly upstream: readonly ["get_tool_uses"];
|
|
139
149
|
readonly status: "available";
|
package/dist/capabilities.js
CHANGED
|
@@ -11,6 +11,7 @@ export const CAPABILITIES = {
|
|
|
11
11
|
capabilities: [
|
|
12
12
|
{ upstream: ['important_workflow'], status: 'available', tools: ['vault_go_workflow'] },
|
|
13
13
|
{ upstream: ['search', 'get_observations', 'timeline'], status: 'available', tools: ['vault_go_search_index', 'vault_go_observations', 'vault_go_timeline', 'vault_go_feed'], difference: 'Vault uses UUID identifiers. Search accepts an optional query, offset and date ordering; timeline accepts an explicit UUID or resolves an anchor from a query; feed uses stable cursor pagination.' },
|
|
14
|
+
{ upstream: ['automatic retrieval routing', 'typed memory decisions'], status: 'available', tools: ['vault_go_retrieve', 'vault_go_decision_status'], requires: 'Jev runs only in the central memory engine. Status is sanitized; deployment availability does not prove provider health or decision quality. Explicit retrieval tools remain available.' },
|
|
14
15
|
{ upstream: ['get_tool_uses'], status: 'available', tools: ['vault_go_tool_uses'], requires: 'Verified POST /memory/events/batch contract. Historical output exists only when captured; private fields and secrets are redacted from retrieval.' },
|
|
15
16
|
{ upstream: ['session_start_context', 'multi-project context'], status: 'available', tools: ['vault_go_session_start_context', 'vault_go_context', 'vault_go_file_context', 'vault_go_context_chain', 'vault_go_context_chain_configure'], requires: 'Context chains require explicit local configuration and share one bounded character budget. Native hooks cover Claude, Codex, Grok, Agy and Gemini; OpenCode 1.x remains context-only.' },
|
|
16
17
|
{ upstream: ['smart_search', 'smart_outline', 'smart_unfold'], status: 'available', tools: ['vault_go_smart_search', 'vault_go_smart_outline', 'vault_go_smart_unfold', 'vault_go_smart_languages'], requires: 'Real grammars for all 24 upstream languages plus HTML. Availability is reported per running platform; SCSS has no Linux ARM64 prebuild. Workspace reads and results are bounded.' },
|
package/dist/cloud.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface VaultMemoryApi {
|
|
|
24
24
|
remember(input: Record<string, unknown>): Promise<unknown>;
|
|
25
25
|
forget(id: string): Promise<unknown>;
|
|
26
26
|
search(input: Record<string, unknown>): Promise<unknown>;
|
|
27
|
+
retrieve?(input: Record<string, unknown>): Promise<unknown>;
|
|
28
|
+
decisionStatus?(): Promise<unknown>;
|
|
27
29
|
searchIndex(input: Record<string, unknown>): Promise<unknown>;
|
|
28
30
|
observations(ids: string[]): Promise<unknown>;
|
|
29
31
|
timeline(input: Record<string, unknown>): Promise<unknown>;
|
|
@@ -69,6 +71,8 @@ export declare class VaultCloudClient implements VaultMemoryApi {
|
|
|
69
71
|
remember(input: Record<string, unknown>): Promise<unknown>;
|
|
70
72
|
forget(id: string): Promise<unknown>;
|
|
71
73
|
search(input: Record<string, unknown>): Promise<unknown>;
|
|
74
|
+
retrieve(input: Record<string, unknown>): Promise<unknown>;
|
|
75
|
+
decisionStatus(): Promise<unknown>;
|
|
72
76
|
searchIndex(input: Record<string, unknown>): Promise<unknown>;
|
|
73
77
|
observations(ids: string[]): Promise<unknown>;
|
|
74
78
|
timeline(input: Record<string, unknown>): Promise<unknown>;
|
package/dist/cloud.js
CHANGED
|
@@ -2,6 +2,46 @@ import { recordActivity } from './activity.js';
|
|
|
2
2
|
import { loadConfig, loadTokens, saveTokens, validateApiUrl, vaultHome, } from './config.js';
|
|
3
3
|
const KNOWLEDGE_BASE_RESPONSE_MAX_BYTES = 8 * 1024 * 1024;
|
|
4
4
|
const KNOWLEDGE_BASE_RESPONSE_LIMIT_ERROR = 'A base de conhecimento excede o limite de resposta de 8 MiB.';
|
|
5
|
+
const observationTypes = new Set(['decision', 'discovery', 'fix', 'feature', 'refactor', 'other']);
|
|
6
|
+
const retentionClasses = new Set(['transient', 'supporting', 'durable', 'critical']);
|
|
7
|
+
const actionableBands = new Set(['low', 'medium', 'high']);
|
|
8
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
9
|
+
const record = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
10
|
+
const probability = (value) => value === undefined || (typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= 1);
|
|
11
|
+
function validSignals(value) {
|
|
12
|
+
return record(value) && observationTypes.has(String(value.observationType)) && retentionClasses.has(String(value.retentionClass)) && actionableBands.has(String(value.actionableBand)) && typeof value.decisionId === 'string' && uuidPattern.test(value.decisionId);
|
|
13
|
+
}
|
|
14
|
+
function validDecision(value) {
|
|
15
|
+
return record(value) && ['applied', 'fallback'].includes(String(value.status)) && observationTypes.has(String(value.observationType)) && retentionClasses.has(String(value.retention)) && value.persist === true && probability(value.novelInformation) && probability(value.actionable);
|
|
16
|
+
}
|
|
17
|
+
function authoritativeDecisionResponse(value) {
|
|
18
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
19
|
+
return value;
|
|
20
|
+
const result = { ...value };
|
|
21
|
+
if ('decision' in result) {
|
|
22
|
+
if (!validDecision(result.decision))
|
|
23
|
+
delete result.decision;
|
|
24
|
+
}
|
|
25
|
+
if ('decisionSignals' in result) {
|
|
26
|
+
if (!validSignals(result.decisionSignals))
|
|
27
|
+
delete result.decisionSignals;
|
|
28
|
+
}
|
|
29
|
+
if (result.decisions && typeof result.decisions === 'object' && !Array.isArray(result.decisions)) {
|
|
30
|
+
result.decisions = Object.fromEntries(Object.entries(result.decisions).filter(([, decision]) => validDecision(decision)));
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
function withoutClientDecisions(input) {
|
|
35
|
+
const { decision: _decision, decisions: _decisions, decisionSignals: _signals, decision_signals: _snakeSignals, ...safe } = input;
|
|
36
|
+
if (!Array.isArray(safe.records))
|
|
37
|
+
return safe;
|
|
38
|
+
return { ...safe, records: safe.records.map(record => {
|
|
39
|
+
if (!record || typeof record !== 'object' || Array.isArray(record))
|
|
40
|
+
return record;
|
|
41
|
+
const { decision: _recordDecision, decisions: _recordDecisions, decisionSignals: _recordSignals, decision_signals: _recordSnakeSignals, ...safeRecord } = record;
|
|
42
|
+
return safeRecord;
|
|
43
|
+
}) };
|
|
44
|
+
}
|
|
5
45
|
export class VaultCloudClient {
|
|
6
46
|
home;
|
|
7
47
|
cloudFetch;
|
|
@@ -53,7 +93,7 @@ export class VaultCloudClient {
|
|
|
53
93
|
return this.request('/memory/events', { method: 'POST', body: input });
|
|
54
94
|
}
|
|
55
95
|
async remember(input) {
|
|
56
|
-
return this.request('/memory/memories', { method: 'POST', body: input });
|
|
96
|
+
return authoritativeDecisionResponse(await this.request('/memory/memories', { method: 'POST', body: withoutClientDecisions(input) }));
|
|
57
97
|
}
|
|
58
98
|
async forget(id) {
|
|
59
99
|
await this.request(`/memory/memories/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
@@ -62,6 +102,12 @@ export class VaultCloudClient {
|
|
|
62
102
|
async search(input) {
|
|
63
103
|
return this.request('/memory/search', { method: 'POST', body: input });
|
|
64
104
|
}
|
|
105
|
+
async retrieve(input) {
|
|
106
|
+
return this.request('/memory/retrieve', { method: 'POST', body: input });
|
|
107
|
+
}
|
|
108
|
+
async decisionStatus() {
|
|
109
|
+
return this.request('/memory/decisions/status');
|
|
110
|
+
}
|
|
65
111
|
async searchIndex(input) {
|
|
66
112
|
return this.request('/memory/search/index', { method: 'POST', body: input });
|
|
67
113
|
}
|
|
@@ -107,7 +153,7 @@ export class VaultCloudClient {
|
|
|
107
153
|
return this.request(`/memory/export?${query.toString()}`);
|
|
108
154
|
}
|
|
109
155
|
async importMemories(input) {
|
|
110
|
-
return this.request('/memory/import', { method: 'POST', body: input });
|
|
156
|
+
return authoritativeDecisionResponse(await this.request('/memory/import', { method: 'POST', body: withoutClientDecisions(input) }));
|
|
111
157
|
}
|
|
112
158
|
async backupStatus() { return this.request('/memory/backup/status'); }
|
|
113
159
|
async exportBackupPage(input) {
|
package/dist/hook-queue.js
CHANGED
|
@@ -101,6 +101,20 @@ function generationFailureCode(error) {
|
|
|
101
101
|
return 'awareness_failed';
|
|
102
102
|
return 'generation_or_persistence_failed';
|
|
103
103
|
}
|
|
104
|
+
function appliedObservationType(result, sourceId, fallback) {
|
|
105
|
+
if (!result || typeof result !== 'object' || Array.isArray(result))
|
|
106
|
+
return fallback;
|
|
107
|
+
const decisions = result.decisions;
|
|
108
|
+
if (!decisions || typeof decisions !== 'object' || Array.isArray(decisions))
|
|
109
|
+
return fallback;
|
|
110
|
+
const decision = decisions[sourceId];
|
|
111
|
+
if (!decision || typeof decision !== 'object' || Array.isArray(decision))
|
|
112
|
+
return fallback;
|
|
113
|
+
const observationType = decision.observationType;
|
|
114
|
+
return typeof observationType === 'string' && ['decision', 'discovery', 'fix', 'feature', 'refactor', 'other'].includes(observationType)
|
|
115
|
+
? observationType
|
|
116
|
+
: fallback;
|
|
117
|
+
}
|
|
104
118
|
export async function enqueueGeneration(home, job) {
|
|
105
119
|
if (isUnusableGenerationText(job.text) || job.text.length > 16_000)
|
|
106
120
|
return;
|
|
@@ -147,8 +161,9 @@ export async function processGenerationQueue(home = vaultHome(), cloud = new Vau
|
|
|
147
161
|
// Cache successful generation before persistence, so a network retry does not pay for the model twice.
|
|
148
162
|
await mutate(home, jobs => jobs.map(item => item.id === job.id ? { ...item, result } : item));
|
|
149
163
|
const memoryType = result.type ?? 'discovery';
|
|
150
|
-
|
|
151
|
-
|
|
164
|
+
const sourceId = `vault-go:event:${job.id}`;
|
|
165
|
+
const importResult = await cloud.importMemories({ projectId: job.projectId, records: [{
|
|
166
|
+
sourceId,
|
|
152
167
|
...(job.sessionId ? { sessionId: job.sessionId } : {}),
|
|
153
168
|
kind: job.kind,
|
|
154
169
|
memoryType,
|
|
@@ -157,9 +172,10 @@ export async function processGenerationQueue(home = vaultHome(), cloud = new Vau
|
|
|
157
172
|
facts: result.facts, concepts: result.concepts,
|
|
158
173
|
filesRead: job.filesRead ?? [], filesModified: job.filesModified ?? [],
|
|
159
174
|
}] });
|
|
175
|
+
const awarenessType = appliedObservationType(importResult, sourceId, memoryType);
|
|
160
176
|
if (owner !== ownerKey(home))
|
|
161
177
|
throw new Error('Account changed.');
|
|
162
|
-
const awareness = await pushAwareness(home, { ...(job.agentId ? { agentId: job.agentId } : {}), observations: [{ type:
|
|
178
|
+
const awareness = await pushAwareness(home, { ...(job.agentId ? { agentId: job.agentId } : {}), observations: [{ type: awarenessType, title: result.title || job.title || 'Memória', facts: result.facts, concepts: result.concepts }] });
|
|
163
179
|
if (awareness.error)
|
|
164
180
|
throw new Error('Awareness delivery failed; retry with cached generation.');
|
|
165
181
|
await mirrorCrystalMemory({ home, cloud, job, result });
|
|
@@ -168,7 +184,7 @@ export async function processGenerationQueue(home = vaultHome(), cloud = new Vau
|
|
|
168
184
|
try {
|
|
169
185
|
await (options.notifyObservation ?? ((observation) => notifyTelegramObservation(home, observation)))({
|
|
170
186
|
id: job.id,
|
|
171
|
-
type:
|
|
187
|
+
type: awarenessType,
|
|
172
188
|
title: result.title,
|
|
173
189
|
concepts: result.concepts,
|
|
174
190
|
});
|
package/dist/server.js
CHANGED
|
@@ -191,6 +191,33 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
|
|
|
191
191
|
},
|
|
192
192
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
193
193
|
}, async (input) => run(() => cloud.search(input)));
|
|
194
|
+
server.registerTool('vault_go_retrieve', {
|
|
195
|
+
title: 'Recuperação automática do Vault',
|
|
196
|
+
description: 'Delega ao motor central a escolha tipada entre busca, contexto de arquivo, linha do tempo, base de conhecimento, grafo ou nenhum resultado. Falhas usam busca determinística.',
|
|
197
|
+
inputSchema: {
|
|
198
|
+
query: z.string().trim().min(1).max(1_000),
|
|
199
|
+
projectId: uuid.optional(),
|
|
200
|
+
files: z.array(z.string().trim().min(1).max(2_000)).max(50).default([]),
|
|
201
|
+
knowledgeBaseId: uuid.optional(),
|
|
202
|
+
limit: z.number().int().min(1).max(200).default(20),
|
|
203
|
+
maxChars: z.number().int().min(1_000).max(100_000).optional(),
|
|
204
|
+
},
|
|
205
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
206
|
+
}, async (input) => run(() => {
|
|
207
|
+
if (!cloud.retrieve)
|
|
208
|
+
throw new Error('Native retrieval is unavailable on this deployment.');
|
|
209
|
+
return cloud.retrieve(input);
|
|
210
|
+
}));
|
|
211
|
+
server.registerTool('vault_go_decision_status', {
|
|
212
|
+
title: 'Status da camada de decisão',
|
|
213
|
+
description: 'Retorna somente o status operacional sanitizado do Jev central. Configuração não comprova saúde do provedor nem qualidade das decisões.',
|
|
214
|
+
inputSchema: {},
|
|
215
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
216
|
+
}, async () => run(() => {
|
|
217
|
+
if (!cloud.decisionStatus)
|
|
218
|
+
throw new Error('Decision status is unavailable on this deployment.');
|
|
219
|
+
return cloud.decisionStatus();
|
|
220
|
+
}));
|
|
194
221
|
server.registerTool('vault_go_search_index', {
|
|
195
222
|
title: 'Pesquisar índice compacto',
|
|
196
223
|
description: 'Primeira camada de recuperação: retorna metadados, trechos e custo estimado sem carregar o conteúdo completo.',
|