vault-go 0.21.0 → 0.22.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 +38 -8
- package/dist/awareness-tools.d.ts +4 -0
- package/dist/awareness-tools.js +38 -0
- package/dist/backup.d.ts +41 -0
- package/dist/backup.js +117 -0
- package/dist/capabilities.d.ts +218 -25
- package/dist/capabilities.js +46 -16
- package/dist/capture-privacy.d.ts +1 -0
- package/dist/capture-privacy.js +19 -0
- package/dist/ccs-align.d.ts +122 -0
- package/dist/ccs-align.js +376 -0
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +52 -0
- package/dist/cloud.d.ts +15 -2
- package/dist/cloud.js +62 -4
- package/dist/context-chain.d.ts +37 -0
- package/dist/context-chain.js +98 -0
- package/dist/context-engines.d.ts +6 -0
- package/dist/context-engines.js +28 -8
- package/dist/crystal-tools.d.ts +9 -0
- package/dist/crystal-tools.js +106 -0
- package/dist/custom-modes.d.ts +59 -0
- package/dist/custom-modes.js +249 -0
- package/dist/deployment-verification.d.ts +19 -0
- package/dist/deployment-verification.js +171 -0
- package/dist/grok-awareness.d.ts +51 -0
- package/dist/grok-awareness.js +244 -0
- package/dist/hook-queue.d.ts +6 -2
- package/dist/hook-queue.js +23 -4
- package/dist/hooks.d.ts +4 -3
- package/dist/hooks.js +18 -23
- package/dist/index.js +9 -1
- package/dist/knowledge-agent.d.ts +39 -0
- package/dist/knowledge-agent.js +143 -0
- package/dist/knowledge-tools.d.ts +3 -0
- package/dist/knowledge-tools.js +19 -0
- package/dist/local-service.js +6 -1
- package/dist/mode-integrations.d.ts +9 -0
- package/dist/mode-integrations.js +149 -0
- package/dist/modes.js +2 -2
- package/dist/parity-tools.js +4 -4
- package/dist/server.js +56 -8
- package/dist/smart-code.d.ts +12 -16
- package/dist/smart-code.js +143 -28
- package/dist/telegram.d.ts +39 -0
- package/dist/telegram.js +138 -0
- package/dist/transcript-config.d.ts +41 -0
- package/dist/transcript-config.js +97 -0
- package/dist/transcript-parser.d.ts +24 -0
- package/dist/transcript-parser.js +118 -0
- package/dist/transcript-tools.d.ts +3 -0
- package/dist/transcript-tools.js +21 -0
- package/dist/transcript-watchers.d.ts +13 -0
- package/dist/transcript-watchers.js +311 -0
- package/docs/ast-and-awareness.md +72 -0
- package/docs/mode-integrations.md +74 -0
- package/docs/parity-deployment-review.md +60 -0
- package/docs/transcripts-and-context.md +75 -0
- package/grammars/scss/NOTICE +3 -0
- package/grammars/scss/prebuilds/darwin-arm64/tree-sitter-scss.node +0 -0
- package/grammars/scss/prebuilds/darwin-x64/tree-sitter-scss.node +0 -0
- package/grammars/scss/prebuilds/linux-x64/tree-sitter-scss.node +0 -0
- package/grammars/scss/prebuilds/win32-x64/tree-sitter-scss.node +0 -0
- package/package.json +60 -2
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Para trocar a conta: `bunx --bun vault-go@latest login --force`. Para chave de A
|
|
|
6
6
|
|
|
7
7
|
# vault-go
|
|
8
8
|
|
|
9
|
+
[Idiomas AST e awareness local do Grok](docs/ast-and-awareness.md): catálogo de disponibilidade real das grammars, configuração opt-in, filtros e limites do writer mensal.
|
|
10
|
+
|
|
9
11
|
Servidor MCP em Bun para pesquisar, contextualizar e registrar memória na
|
|
10
12
|
plataforma Vault. A persistência fica no PostgreSQL do serviço Rust executado
|
|
11
13
|
no EasyPanel; o painel local mantém um cache privado das consultas recentes.
|
|
@@ -92,6 +94,13 @@ Clientes suportados:
|
|
|
92
94
|
- Roo Code;
|
|
93
95
|
- OpenCode.
|
|
94
96
|
|
|
97
|
+
O Crystal do Vault Desktop usa este mesmo servidor MCP. Ative **Crystal → MCP →
|
|
98
|
+
Ativar no Vault MCP** no Desktop atualizado e reconecte o cliente MCP. As ferramentas
|
|
99
|
+
`vault_go_crystal_list`, `read`, `search`, `write`, `delete`, `sync` e `status` ficam
|
|
100
|
+
disponíveis junto às ferramentas de memória. O Desktop deve permanecer aberto no
|
|
101
|
+
mesmo computador; a conexão local é configurada automaticamente, sem copiar um
|
|
102
|
+
segredo ou cadastrar um segundo servidor. Desativar a integração revoga essa conexão.
|
|
103
|
+
|
|
95
104
|
Comandos explícitos:
|
|
96
105
|
|
|
97
106
|
```sh
|
|
@@ -183,6 +192,8 @@ O seletor oferece Codex (Terra, Luna ou Sol pela assinatura ChatGPT), Claude (CL
|
|
|
183
192
|
|
|
184
193
|
Na instalação, o Vault Go registra hooks no Claude Code, no Codex, no Grok, no Agy e no Gemini CLI. Eles carregam contexto e capturam os eventos oferecidos pelo cliente; o serviço local (`http://localhost:38850`) gera memórias com o motor escolhido, persistindo no Vault. No OpenCode 1.x, um plugin acrescenta contexto ao sistema antes das chamadas do modelo; esse adaptador não adiciona captura automática.
|
|
185
194
|
|
|
195
|
+
Também há [captura persistente opt-in de transcripts Claude/Codex e contexto entre projetos](docs/transcripts-and-context.md), com comandos CLI e MCP, checkpoints privados e consentimento por workspace/conta. Ativar esses recursos preserva o motor/modelo escolhido.
|
|
196
|
+
|
|
186
197
|
O recurso `vault-go://status` fornece o resumo sanitizado em JSON.
|
|
187
198
|
|
|
188
199
|
Para reduzir o uso de contexto, prefira a recuperação em três camadas:
|
|
@@ -396,7 +407,10 @@ reiniciar o serviço; a atualização automática espera o processamento termina
|
|
|
396
407
|
A comparação usa o código do claude-mem 13.25.2, commit
|
|
397
408
|
`adce0fdfaf1cd46646bbd0b22ae74cbd460ed787`. A matriz acessível em
|
|
398
409
|
`vault_go_capabilities` e no recurso `vault-go://capabilities` distingue funções
|
|
399
|
-
implementadas
|
|
410
|
+
implementadas e suas dependências. `deploymentVerified` resulta de consultas aos
|
|
411
|
+
contratos da API/engine conectados, com cache privado de cinco minutos por conta;
|
|
412
|
+
não presume autenticação dos provedores nem entrega de notificações. O recurso
|
|
413
|
+
MCP lê somente o cache; a ferramenta verifica por padrão.
|
|
400
414
|
|
|
401
415
|
Além das ferramentas acima, o MCP inclui:
|
|
402
416
|
|
|
@@ -413,10 +427,22 @@ Além das ferramentas acima, o MCP inclui:
|
|
|
413
427
|
`filePattern` é glob. As ferramentas informam linguagens suportadas e truncamento,
|
|
414
428
|
limitam leitura ao workspace e bloqueiam caminhos privados e escapes por symlink.
|
|
415
429
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
430
|
+
A busca aceita `query` opcional, `offset` e `orderBy`. A timeline também pode
|
|
431
|
+
localizar a âncora por consulta. `vault_go_job` consulta um job individual.
|
|
432
|
+
`vault_go_prime_corpus`, `vault_go_query_corpus` e `vault_go_reprime_corpus`
|
|
433
|
+
respondem com o modelo escolhido, citações e histórico local cifrado de até 12 turnos.
|
|
434
|
+
|
|
435
|
+
`vault_go_backup_create` salva todas as páginas de um snapshot consistente em
|
|
436
|
+
arquivo privado, com SHA-256 e cobertura declarada. `vault_go_backup_restore`
|
|
437
|
+
valida hash e proprietário antes de alterar preferências ou dados. Snapshots têm
|
|
438
|
+
TTL de uma hora e limite explícito de 100 mil registros; exceder limites retorna
|
|
439
|
+
erro, sem apresentar um backup truncado como completo. O formato é próprio do
|
|
440
|
+
Vault; não equivale ao SQLite upstream nem a uma réplica offline.
|
|
441
|
+
|
|
442
|
+
Telegram, CCS Align e taxonomias herdadas têm integrações locais próprias; veja
|
|
443
|
+
[integrações de modos](docs/mode-integrations.md). Watchers de Claude/Codex e
|
|
444
|
+
contexto entre projetos são configuráveis com consentimento; veja
|
|
445
|
+
[transcripts e contexto](docs/transcripts-and-context.md). O [scan completo](docs/claude-mem-upstream-scan.md)
|
|
420
446
|
registra os contratos upstream; a matriz MCP descreve a implementação atual.
|
|
421
447
|
|
|
422
448
|
|
|
@@ -440,6 +466,10 @@ pathfinder, design-is, what-the, version-bump, oh-my-issues, cloud-sync,
|
|
|
440
466
|
mode-creator, ccs-align e wowerpoint.
|
|
441
467
|
|
|
442
468
|
Babysit exige acesso do cliente ao GitHub por `gh` ou conector e acompanha o PR
|
|
443
|
-
enquanto a solicitação está ativa.
|
|
444
|
-
|
|
445
|
-
|
|
469
|
+
enquanto a solicitação está ativa. `mode-creator` instala taxonomias herdadas e
|
|
470
|
+
`ccs-align` mantém cache, exclusões e relatório de regras por viewer. Wowerpoint
|
|
471
|
+
ainda depende de um renderer de apresentação do cliente, e cmem.ai continua sendo
|
|
472
|
+
um serviço distinto. Ações externas seguem a autorização da tarefa; carregar um
|
|
473
|
+
prompt não envia mensagens, publica versões ou faz merge.
|
|
474
|
+
|
|
475
|
+
A validação e as diferenças de arquitetura estão na [revisão de implantação](docs/parity-deployment-review.md).
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { VaultMemoryApi } from './cloud.js';
|
|
3
|
+
export declare function registerAwarenessTools(server: McpServer, home: string, cloud: VaultMemoryApi): void;
|
|
4
|
+
export declare function registerSmartLanguageTool(server: McpServer): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { run } from './mcp-result.js';
|
|
3
|
+
import { awarenessAccountBinding, awarenessStatus, configureAwareness, pushAwareness } from './grok-awareness.js';
|
|
4
|
+
export function registerAwarenessTools(server, home, cloud) {
|
|
5
|
+
server.registerTool('vault_go_grok_awareness_status', { description: 'Estado do push local opt-in de fatos para agents/<UUID>/memory/log/YYYY-MM.md. Usa allowlist, filtros e a conta atual; não envia Telegram.', inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: false } }, () => run(async () => awarenessStatus(home)));
|
|
6
|
+
server.registerTool('vault_go_grok_awareness_configure', {
|
|
7
|
+
description: 'Configura escrita mensal local de awareness para agentes Grok explicitamente permitidos. Ativar exige consent=true, raiz absoluta existente e filtros; não altera profile.md. Jobs novos com agentId correspondente usam a mesma configuração.',
|
|
8
|
+
inputSchema: { enabled: z.boolean(), consent: z.boolean().default(false), agentDataRoot: z.string().min(1).max(2000).optional(), agentIds: z.array(z.string().uuid()).min(1).max(50).optional(), triggerTypes: z.array(z.string().min(1).max(100)).max(50).optional(), triggerConcepts: z.array(z.string().min(1).max(100)).max(50).optional() },
|
|
9
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
10
|
+
}, ({ enabled, consent, agentDataRoot, agentIds, triggerTypes, triggerConcepts }) => run(async () => configureAwareness(home, { enabled, consent, ...(agentDataRoot ? { agentDataRoot } : {}), ...(agentIds ? { agentIds } : {}), ...(triggerTypes ? { triggerTypes } : {}), ...(triggerConcepts ? { triggerConcepts } : {}) })));
|
|
11
|
+
server.registerTool('vault_go_grok_awareness_push', {
|
|
12
|
+
description: 'Lê memórias da conta por UUID e publica somente fatos que correspondem aos filtros para o agente permitido indicado. Exige configuração/consentimento prévio; mantém idempotência por corpo da linha no mês.',
|
|
13
|
+
inputSchema: { agentId: z.string().uuid(), memoryIds: z.array(z.string().uuid()).min(1).max(100) },
|
|
14
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
15
|
+
}, ({ agentId, memoryIds }) => run(async () => {
|
|
16
|
+
const config = awarenessStatus(home);
|
|
17
|
+
if (!config.enabled || !config.agentIds.includes(agentId))
|
|
18
|
+
throw new Error('Awareness não habilitado para este agente.');
|
|
19
|
+
const binding = awarenessAccountBinding(home), records = await cloud.observations(memoryIds);
|
|
20
|
+
if (awarenessAccountBinding(home) !== binding)
|
|
21
|
+
throw new Error('Conta alterada durante leitura das memórias.');
|
|
22
|
+
if (!Array.isArray(records))
|
|
23
|
+
throw new Error('Resposta de memórias inválida.');
|
|
24
|
+
const strings = (value) => Array.isArray(value) ? value.filter((v) => typeof v === 'string').slice(0, 100) : [];
|
|
25
|
+
const observations = records.filter(r => r && typeof r === 'object' && typeof r.id === 'string' && memoryIds.includes(r.id)).map(r => ({
|
|
26
|
+
type: typeof r.memoryType === 'string' ? r.memoryType : typeof r.type === 'string' ? r.type : 'discovery',
|
|
27
|
+
title: typeof r.title === 'string' ? r.title : '', subtitle: typeof r.subtitle === 'string' ? r.subtitle : '', facts: strings(r.facts), concepts: strings(r.concepts),
|
|
28
|
+
private: r.private === true || r.isPrivate === true || r.is_private === true || /<(private|vault-private)\b/i.test(typeof r.content === 'string' ? r.content : ''),
|
|
29
|
+
}));
|
|
30
|
+
const result = await pushAwareness(home, { agentId, observations });
|
|
31
|
+
if (result.error)
|
|
32
|
+
throw new Error(result.error);
|
|
33
|
+
return result;
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
export function registerSmartLanguageTool(server) {
|
|
37
|
+
server.registerTool('vault_go_smart_languages', { description: 'Lista idiomas/extensões AST, pacote da grammar e disponibilidade real neste sistema. Indisponibilidade nunca usa regex como fallback.', inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: false } }, () => run(async () => (await import('./smart-code.js')).smartLanguageStatus()));
|
|
38
|
+
}
|
package/dist/backup.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { VaultMemoryApi } from './cloud.js';
|
|
2
|
+
interface EngineBackupPage {
|
|
3
|
+
version: number;
|
|
4
|
+
sourceOwnerId: string;
|
|
5
|
+
snapshotEpoch: number;
|
|
6
|
+
manifest: Record<string, unknown>;
|
|
7
|
+
records: unknown[];
|
|
8
|
+
nextCursor?: string | null;
|
|
9
|
+
hasMore: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface LocalBackupV2 {
|
|
12
|
+
format: 'vault-go-private-backup-v2';
|
|
13
|
+
createdAtEpoch: number;
|
|
14
|
+
coverage: {
|
|
15
|
+
included: string[];
|
|
16
|
+
omitted: string[];
|
|
17
|
+
customTypes: string;
|
|
18
|
+
consistency: string;
|
|
19
|
+
snapshotLimits: string;
|
|
20
|
+
upstreamCompatible: false;
|
|
21
|
+
};
|
|
22
|
+
preferences: unknown;
|
|
23
|
+
pages: EngineBackupPage[];
|
|
24
|
+
}
|
|
25
|
+
export interface BackupFileResult {
|
|
26
|
+
backupId: string;
|
|
27
|
+
path: string;
|
|
28
|
+
sha256: string;
|
|
29
|
+
bytes: number;
|
|
30
|
+
pages: number;
|
|
31
|
+
records: number;
|
|
32
|
+
coverage: LocalBackupV2['coverage'];
|
|
33
|
+
}
|
|
34
|
+
export declare function createPrivateBackup(cloud: VaultMemoryApi, home?: string): Promise<BackupFileResult>;
|
|
35
|
+
export declare function restorePrivateBackup(cloud: VaultMemoryApi, backupId: string, expectedSha256?: string, home?: string): Promise<{
|
|
36
|
+
backupId: string;
|
|
37
|
+
sha256: string;
|
|
38
|
+
pages: number;
|
|
39
|
+
records: number;
|
|
40
|
+
}>;
|
|
41
|
+
export {};
|
package/dist/backup.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { chmodSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { basename, dirname, join } from 'node:path';
|
|
4
|
+
import { captureCredential, captureOwner } from './transcript-config.js';
|
|
5
|
+
import { vaultHome } from './config.js';
|
|
6
|
+
function accountGuard(home) {
|
|
7
|
+
const owner = captureOwner(home), credential = captureCredential(home);
|
|
8
|
+
return () => { if (captureOwner(home) !== owner || captureCredential(home) !== credential)
|
|
9
|
+
throw new Error('A conta mudou durante o backup; operação interrompida.'); };
|
|
10
|
+
}
|
|
11
|
+
function backupDirectory(home) {
|
|
12
|
+
return join(home, 'backups');
|
|
13
|
+
}
|
|
14
|
+
function atomicPrivateWrite(path, value) {
|
|
15
|
+
const directory = dirname(path);
|
|
16
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
17
|
+
chmodSync(directory, 0o700);
|
|
18
|
+
const temporary = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
19
|
+
writeFileSync(temporary, `${JSON.stringify(value)}\n`, { mode: 0o600 });
|
|
20
|
+
renameSync(temporary, path);
|
|
21
|
+
chmodSync(path, 0o600);
|
|
22
|
+
}
|
|
23
|
+
function parsePage(value) {
|
|
24
|
+
if (!value || typeof value !== 'object')
|
|
25
|
+
throw new Error('Resposta de backup inválida.');
|
|
26
|
+
const page = value;
|
|
27
|
+
if (page.version !== 2 || !Array.isArray(page.records) || typeof page.hasMore !== 'boolean' || typeof page.sourceOwnerId !== 'string' || typeof page.snapshotEpoch !== 'number') {
|
|
28
|
+
throw new Error('Resposta de backup v2 inválida.');
|
|
29
|
+
}
|
|
30
|
+
return page;
|
|
31
|
+
}
|
|
32
|
+
export async function createPrivateBackup(cloud, home = vaultHome()) {
|
|
33
|
+
if (!cloud.preferences || !cloud.exportBackupPage)
|
|
34
|
+
throw new Error('A API não oferece backup completo.');
|
|
35
|
+
// Fetch gateway-owned preferences first. Failure stops before any archive is claimed complete.
|
|
36
|
+
const assertAccount = accountGuard(home);
|
|
37
|
+
const preferences = await cloud.preferences();
|
|
38
|
+
assertAccount();
|
|
39
|
+
const pages = [];
|
|
40
|
+
let cursor;
|
|
41
|
+
let sourceOwnerId;
|
|
42
|
+
let snapshotEpoch;
|
|
43
|
+
for (let count = 0; count < 100_000; count += 1) {
|
|
44
|
+
assertAccount();
|
|
45
|
+
const page = parsePage(await cloud.exportBackupPage({ limit: 50, ...(cursor ? { cursor } : {}) }));
|
|
46
|
+
assertAccount();
|
|
47
|
+
if (sourceOwnerId !== undefined && page.sourceOwnerId !== sourceOwnerId)
|
|
48
|
+
throw new Error('O proprietário mudou durante o backup.');
|
|
49
|
+
if (snapshotEpoch !== undefined && page.snapshotEpoch !== snapshotEpoch)
|
|
50
|
+
throw new Error('O snapshot mudou durante o backup.');
|
|
51
|
+
sourceOwnerId = page.sourceOwnerId;
|
|
52
|
+
snapshotEpoch = page.snapshotEpoch;
|
|
53
|
+
pages.push(page);
|
|
54
|
+
if (!page.hasMore)
|
|
55
|
+
break;
|
|
56
|
+
if (!page.nextCursor || page.nextCursor === cursor)
|
|
57
|
+
throw new Error('A paginação do backup não avançou.');
|
|
58
|
+
cursor = page.nextCursor;
|
|
59
|
+
if (count === 99_999)
|
|
60
|
+
throw new Error('O backup excedeu o limite de páginas.');
|
|
61
|
+
}
|
|
62
|
+
const coverage = {
|
|
63
|
+
included: ['preferences', 'projects', 'sessions', 'events', 'memories', 'graphLinks', 'graphPresets', 'knowledgeBases', 'knowledgeItems'],
|
|
64
|
+
omitted: ['embeddings (regenerable)', 'generationJobs (transient)', 'credentials', 'auditLogs', 'binaryBlobs'],
|
|
65
|
+
customTypes: 'Preserved inline through each memory kind and memory_type; no separate taxonomy table exists.',
|
|
66
|
+
consistency: 'Every engine page is read from one server-materialized tenant snapshot.',
|
|
67
|
+
snapshotLimits: 'The engine manifest declares snapshot TTL, maximum records, and active snapshots.',
|
|
68
|
+
upstreamCompatible: false,
|
|
69
|
+
};
|
|
70
|
+
const archive = { format: 'vault-go-private-backup-v2', createdAtEpoch: Date.now(), coverage, preferences, pages };
|
|
71
|
+
const directory = backupDirectory(home);
|
|
72
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
73
|
+
chmodSync(directory, 0o700);
|
|
74
|
+
const backupId = `vault-go-backup-${new Date().toISOString().replace(/[:.]/gu, '-')}-${randomUUID()}.json`;
|
|
75
|
+
const path = join(directory, backupId);
|
|
76
|
+
atomicPrivateWrite(path, archive);
|
|
77
|
+
const bytes = readFileSync(path);
|
|
78
|
+
return { backupId, path, sha256: createHash('sha256').update(bytes).digest('hex'), bytes: statSync(path).size, pages: pages.length, records: pages.reduce((sum, page) => sum + page.records.length, 0), coverage };
|
|
79
|
+
}
|
|
80
|
+
export async function restorePrivateBackup(cloud, backupId, expectedSha256, home = vaultHome()) {
|
|
81
|
+
if (basename(backupId) !== backupId || !backupId.endsWith('.json'))
|
|
82
|
+
throw new Error('Identificador de backup inválido.');
|
|
83
|
+
if (!cloud.updatePreferences || !cloud.importBackupPage || !cloud.backupStatus)
|
|
84
|
+
throw new Error('A API não oferece restauração completa.');
|
|
85
|
+
const path = join(backupDirectory(home), backupId);
|
|
86
|
+
const bytes = readFileSync(path);
|
|
87
|
+
const sha256 = createHash('sha256').update(bytes).digest('hex');
|
|
88
|
+
if (expectedSha256 && expectedSha256.toLowerCase() !== sha256)
|
|
89
|
+
throw new Error('O hash SHA-256 do backup não confere.');
|
|
90
|
+
const archive = JSON.parse(bytes.toString('utf8'));
|
|
91
|
+
if (archive.format !== 'vault-go-private-backup-v2' || !Array.isArray(archive.pages) || archive.preferences === undefined)
|
|
92
|
+
throw new Error('Arquivo de backup v2 inválido.');
|
|
93
|
+
const assertAccount = accountGuard(home);
|
|
94
|
+
const status = await cloud.backupStatus();
|
|
95
|
+
assertAccount();
|
|
96
|
+
const pages = archive.pages.map(parsePage);
|
|
97
|
+
if (status?.version !== 2 || !status.ownerId || !pages.length || pages.some(page => page.sourceOwnerId !== status.ownerId))
|
|
98
|
+
throw new Error('O backup pertence a outra conta ou o serviço não confirmou o proprietário.');
|
|
99
|
+
if (pages.at(-1).hasMore || pages.some(page => page.snapshotEpoch !== pages[0].snapshotEpoch))
|
|
100
|
+
throw new Error('O arquivo não contém um snapshot completo e consistente.');
|
|
101
|
+
// Validate every page and the authenticated owner before the first mutation.
|
|
102
|
+
const preferenceKeys = ['captureMode', 'language', 'automaticCapture', 'includeToolResults', 'summaryMode', 'summaryMaxChars', 'contextItems', 'contextMaxChars'];
|
|
103
|
+
if (!archive.preferences || typeof archive.preferences !== 'object' || Array.isArray(archive.preferences))
|
|
104
|
+
throw new Error('Preferências inválidas no backup.');
|
|
105
|
+
const preferences = Object.fromEntries(Object.entries(archive.preferences).filter(([key]) => preferenceKeys.includes(key)));
|
|
106
|
+
if (!Object.keys(preferences).length)
|
|
107
|
+
throw new Error('O backup não contém preferências restauráveis.');
|
|
108
|
+
await cloud.updatePreferences(preferences);
|
|
109
|
+
let records = 0;
|
|
110
|
+
for (const page of pages) {
|
|
111
|
+
assertAccount();
|
|
112
|
+
await cloud.importBackupPage({ version: 2, sourceOwnerId: page.sourceOwnerId, records: page.records });
|
|
113
|
+
assertAccount();
|
|
114
|
+
records += page.records.length;
|
|
115
|
+
}
|
|
116
|
+
return { backupId, sha256, pages: archive.pages.length, records };
|
|
117
|
+
}
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,32 +1,225 @@
|
|
|
1
|
+
import type { VaultMemoryApi } from './cloud.js';
|
|
2
|
+
import { type DeploymentVerification } from './deployment-verification.js';
|
|
1
3
|
/** Audited against source, not the upstream README's stale tool count. */
|
|
2
4
|
export declare const CAPABILITIES: {
|
|
3
|
-
reference: {
|
|
4
|
-
repository:
|
|
5
|
-
version:
|
|
6
|
-
commit:
|
|
7
|
-
auditedAt:
|
|
5
|
+
readonly reference: {
|
|
6
|
+
readonly repository: "https://github.com/thedotmack/claude-mem";
|
|
7
|
+
readonly version: "13.25.2";
|
|
8
|
+
readonly commit: "adce0fdfaf1cd46646bbd0b22ae74cbd460ed787";
|
|
9
|
+
readonly auditedAt: "2026-09-20";
|
|
8
10
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
readonly verification: {
|
|
12
|
+
readonly capabilityVersion: "2026-09-20.1";
|
|
13
|
+
readonly cacheTtlMs: number;
|
|
14
|
+
readonly scope: "Authenticated Vault API and memory-engine contracts only. Provider logins, model quality, Telegram delivery and local watcher configuration are separate runtime dependencies.";
|
|
15
|
+
readonly interpretation: "A passing check confirms that the authenticated route and response contract were available at probe time; it does not certify full behavior or external-service configuration.";
|
|
16
|
+
};
|
|
17
|
+
readonly capabilities: readonly [{
|
|
18
|
+
readonly upstream: readonly ["important_workflow"];
|
|
19
|
+
readonly status: "available";
|
|
20
|
+
readonly tools: readonly ["vault_go_workflow"];
|
|
21
|
+
}, {
|
|
22
|
+
readonly upstream: readonly ["search", "get_observations", "timeline"];
|
|
23
|
+
readonly status: "available";
|
|
24
|
+
readonly tools: readonly ["vault_go_search_index", "vault_go_observations", "vault_go_timeline", "vault_go_feed"];
|
|
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 ["get_tool_uses"];
|
|
28
|
+
readonly status: "available";
|
|
29
|
+
readonly tools: readonly ["vault_go_tool_uses"];
|
|
30
|
+
readonly requires: "Verified POST /memory/events/batch contract. Historical output exists only when captured; private fields and secrets are redacted from retrieval.";
|
|
31
|
+
}, {
|
|
32
|
+
readonly upstream: readonly ["session_start_context", "multi-project context"];
|
|
33
|
+
readonly status: "available";
|
|
34
|
+
readonly tools: readonly ["vault_go_session_start_context", "vault_go_context", "vault_go_file_context", "vault_go_context_chain", "vault_go_context_chain_configure"];
|
|
35
|
+
readonly 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.";
|
|
36
|
+
}, {
|
|
37
|
+
readonly upstream: readonly ["smart_search", "smart_outline", "smart_unfold"];
|
|
38
|
+
readonly status: "available";
|
|
39
|
+
readonly tools: readonly ["vault_go_smart_search", "vault_go_smart_outline", "vault_go_smart_unfold", "vault_go_smart_languages"];
|
|
40
|
+
readonly 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.";
|
|
41
|
+
}, {
|
|
42
|
+
readonly upstream: readonly ["observation_add", "observation_record_event", "observation_search", "observation_context"];
|
|
43
|
+
readonly status: "available";
|
|
44
|
+
readonly tools: readonly ["vault_go_remember", "vault_go_event", "vault_go_search", "vault_go_context"];
|
|
45
|
+
readonly requires: "generate:false prevents duplicate server processing on an updated engine. summaryMode=off preserves captured text without model extraction.";
|
|
46
|
+
}, {
|
|
47
|
+
readonly upstream: readonly ["automatic updates"];
|
|
48
|
+
readonly status: "available";
|
|
49
|
+
readonly tools: readonly ["vault_go_update_status", "vault_go_update_check", "vault_go_update_install", "vault_go_update_configure"];
|
|
50
|
+
readonly requires: "Local worker running, npm installed and official registry reachable. Activation waits for idle state and rolls back failed runtimes.";
|
|
51
|
+
}, {
|
|
52
|
+
readonly upstream: readonly ["observation_generation_status"];
|
|
53
|
+
readonly status: "available";
|
|
54
|
+
readonly tools: readonly ["vault_go_jobs", "vault_go_job", "vault_go_processing_status"];
|
|
55
|
+
readonly difference: "Cloud generation jobs and the local selected-model queue are intentionally reported as separate queues.";
|
|
56
|
+
}, {
|
|
57
|
+
readonly upstream: readonly ["build_corpus", "list_corpora", "rebuild_corpus"];
|
|
58
|
+
readonly status: "available";
|
|
59
|
+
readonly tools: readonly ["vault_go_knowledge_build", "vault_go_knowledge_bases", "vault_go_knowledge_rebuild"];
|
|
60
|
+
}, {
|
|
61
|
+
readonly upstream: readonly ["prime_corpus", "query_corpus", "reprime_corpus"];
|
|
62
|
+
readonly status: "available";
|
|
63
|
+
readonly tools: readonly ["vault_go_prime_corpus", "vault_go_query_corpus", "vault_go_reprime_corpus"];
|
|
64
|
+
readonly requires: "Uses the selected authenticated model. Conversation history is encrypted locally, isolated by account and corpus, bounded to 12 turns, and factual answers must cite retrieved memory IDs. Corpus loading is limited to an 8 MiB HTTP response; selected source JSON is limited to 16,000 characters.";
|
|
65
|
+
}, {
|
|
66
|
+
readonly upstream: readonly ["provider selection", "automatic observation processing"];
|
|
67
|
+
readonly status: "available";
|
|
68
|
+
readonly tools: readonly ["vault_go_engines", "vault_go_engine_select", "vault_go_generate_context", "vault_go_processing_status"];
|
|
69
|
+
readonly requires: "Local worker running and the selected provider authenticated. Model availability and subscription or API billing are not covered by deployment verification.";
|
|
70
|
+
}, {
|
|
71
|
+
readonly upstream: readonly ["privacy", "capture modes", "context settings"];
|
|
72
|
+
readonly status: "available";
|
|
73
|
+
readonly tools: readonly ["vault_go_preferences", "vault_go_preferences_update", "vault_go_custom_modes", "vault_go_custom_mode_get", "vault_go_custom_mode_save", "vault_go_custom_mode_select", "vault_go_custom_mode_delete"];
|
|
74
|
+
readonly requires: "Private-tag redaction and inherited custom taxonomies apply to future local processing. Preference updates require session authentication.";
|
|
75
|
+
}, {
|
|
76
|
+
readonly upstream: readonly ["import", "export"];
|
|
77
|
+
readonly status: "available";
|
|
78
|
+
readonly tools: readonly ["vault_go_import", "vault_go_export", "vault_go_backup_create", "vault_go_backup_restore"];
|
|
79
|
+
readonly difference: "Legacy bounded batches remain available. Backup v2 creates a complete, paginated, server-materialized same-owner memory-data snapshot with declared limits, local 0600 file and SHA-256. It is not the upstream SQLite format and is not an offline replica; embeddings, transient jobs, credentials, audit logs and blobs are intentionally omitted.";
|
|
80
|
+
}, {
|
|
81
|
+
readonly upstream: readonly ["cloud sync"];
|
|
82
|
+
readonly status: "partial";
|
|
83
|
+
readonly tools: readonly [];
|
|
84
|
+
readonly difference: "Vault stores authoritative memories in its authenticated cloud and persists local processing queues. This does not implement cmem.ai Pro synchronization or a complete offline SQLite replica.";
|
|
85
|
+
}, {
|
|
86
|
+
readonly upstream: readonly ["Telegram"];
|
|
87
|
+
readonly status: "available";
|
|
88
|
+
readonly tools: readonly ["vault_go_telegram_status", "vault_go_telegram_configure", "vault_go_telegram_disable", "vault_go_telegram_test"];
|
|
89
|
+
readonly requires: "Explicit configuration, private bot credential environment and user-authorized test delivery. Deployment verification does not contact Telegram.";
|
|
90
|
+
}, {
|
|
91
|
+
readonly upstream: readonly ["CCS Align"];
|
|
92
|
+
readonly status: "available";
|
|
93
|
+
readonly tools: readonly ["vault_go_ccs_align_health", "vault_go_ccs_align_cycle", "vault_go_ccs_align_exclude", "vault_go_ccs_align_restore", "vault_go_ccs_align_rules_check"];
|
|
94
|
+
readonly requires: "Local private middle cache and explicit cycle execution; rule checks report conflicts without modifying source rules.";
|
|
95
|
+
}, {
|
|
96
|
+
readonly upstream: readonly ["transcript watchers"];
|
|
97
|
+
readonly status: "available";
|
|
98
|
+
readonly tools: readonly ["vault_go_transcripts_status", "vault_go_transcripts_configure", "vault_go_transcripts_poll"];
|
|
99
|
+
readonly difference: "Persistent, consented and resumable watchers are implemented for Claude and Codex transcripts. Other client transcript formats are not claimed.";
|
|
100
|
+
}, {
|
|
101
|
+
readonly upstream: readonly ["Grok awareness push"];
|
|
102
|
+
readonly status: "available";
|
|
103
|
+
readonly tools: readonly ["vault_go_grok_awareness_status", "vault_go_grok_awareness_configure", "vault_go_grok_awareness_push"];
|
|
104
|
+
readonly requires: "Explicit consent, an allowlisted agent UUID and a local agent-data root. Monthly awareness logs are bounded, private and separate from Telegram.";
|
|
105
|
+
}, {
|
|
106
|
+
readonly upstream: readonly ["development/report/presentation skills", "babysit"];
|
|
107
|
+
readonly status: "available";
|
|
108
|
+
readonly tools: readonly ["vault_go_modes", "vault_go_mode"];
|
|
109
|
+
readonly difference: "Vault workflow prompts expose requirements and runtime dependencies. Loading a mode does not itself start agents, publish, message or perform external actions.";
|
|
110
|
+
}];
|
|
29
111
|
};
|
|
112
|
+
/** API tools verify by default. Resources pass verify=false and never perform network I/O. */
|
|
113
|
+
export declare function getCapabilities(home: string, cloud: VaultMemoryApi, verify?: boolean): Promise<{
|
|
114
|
+
deploymentVerified: boolean;
|
|
115
|
+
deploymentVerification: DeploymentVerification;
|
|
116
|
+
reference: {
|
|
117
|
+
readonly repository: "https://github.com/thedotmack/claude-mem";
|
|
118
|
+
readonly version: "13.25.2";
|
|
119
|
+
readonly commit: "adce0fdfaf1cd46646bbd0b22ae74cbd460ed787";
|
|
120
|
+
readonly auditedAt: "2026-09-20";
|
|
121
|
+
};
|
|
122
|
+
verification: {
|
|
123
|
+
readonly capabilityVersion: "2026-09-20.1";
|
|
124
|
+
readonly cacheTtlMs: number;
|
|
125
|
+
readonly scope: "Authenticated Vault API and memory-engine contracts only. Provider logins, model quality, Telegram delivery and local watcher configuration are separate runtime dependencies.";
|
|
126
|
+
readonly interpretation: "A passing check confirms that the authenticated route and response contract were available at probe time; it does not certify full behavior or external-service configuration.";
|
|
127
|
+
};
|
|
128
|
+
capabilities: readonly [{
|
|
129
|
+
readonly upstream: readonly ["important_workflow"];
|
|
130
|
+
readonly status: "available";
|
|
131
|
+
readonly tools: readonly ["vault_go_workflow"];
|
|
132
|
+
}, {
|
|
133
|
+
readonly upstream: readonly ["search", "get_observations", "timeline"];
|
|
134
|
+
readonly status: "available";
|
|
135
|
+
readonly tools: readonly ["vault_go_search_index", "vault_go_observations", "vault_go_timeline", "vault_go_feed"];
|
|
136
|
+
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.";
|
|
137
|
+
}, {
|
|
138
|
+
readonly upstream: readonly ["get_tool_uses"];
|
|
139
|
+
readonly status: "available";
|
|
140
|
+
readonly tools: readonly ["vault_go_tool_uses"];
|
|
141
|
+
readonly requires: "Verified POST /memory/events/batch contract. Historical output exists only when captured; private fields and secrets are redacted from retrieval.";
|
|
142
|
+
}, {
|
|
143
|
+
readonly upstream: readonly ["session_start_context", "multi-project context"];
|
|
144
|
+
readonly status: "available";
|
|
145
|
+
readonly tools: readonly ["vault_go_session_start_context", "vault_go_context", "vault_go_file_context", "vault_go_context_chain", "vault_go_context_chain_configure"];
|
|
146
|
+
readonly 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.";
|
|
147
|
+
}, {
|
|
148
|
+
readonly upstream: readonly ["smart_search", "smart_outline", "smart_unfold"];
|
|
149
|
+
readonly status: "available";
|
|
150
|
+
readonly tools: readonly ["vault_go_smart_search", "vault_go_smart_outline", "vault_go_smart_unfold", "vault_go_smart_languages"];
|
|
151
|
+
readonly 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.";
|
|
152
|
+
}, {
|
|
153
|
+
readonly upstream: readonly ["observation_add", "observation_record_event", "observation_search", "observation_context"];
|
|
154
|
+
readonly status: "available";
|
|
155
|
+
readonly tools: readonly ["vault_go_remember", "vault_go_event", "vault_go_search", "vault_go_context"];
|
|
156
|
+
readonly requires: "generate:false prevents duplicate server processing on an updated engine. summaryMode=off preserves captured text without model extraction.";
|
|
157
|
+
}, {
|
|
158
|
+
readonly upstream: readonly ["automatic updates"];
|
|
159
|
+
readonly status: "available";
|
|
160
|
+
readonly tools: readonly ["vault_go_update_status", "vault_go_update_check", "vault_go_update_install", "vault_go_update_configure"];
|
|
161
|
+
readonly requires: "Local worker running, npm installed and official registry reachable. Activation waits for idle state and rolls back failed runtimes.";
|
|
162
|
+
}, {
|
|
163
|
+
readonly upstream: readonly ["observation_generation_status"];
|
|
164
|
+
readonly status: "available";
|
|
165
|
+
readonly tools: readonly ["vault_go_jobs", "vault_go_job", "vault_go_processing_status"];
|
|
166
|
+
readonly difference: "Cloud generation jobs and the local selected-model queue are intentionally reported as separate queues.";
|
|
167
|
+
}, {
|
|
168
|
+
readonly upstream: readonly ["build_corpus", "list_corpora", "rebuild_corpus"];
|
|
169
|
+
readonly status: "available";
|
|
170
|
+
readonly tools: readonly ["vault_go_knowledge_build", "vault_go_knowledge_bases", "vault_go_knowledge_rebuild"];
|
|
171
|
+
}, {
|
|
172
|
+
readonly upstream: readonly ["prime_corpus", "query_corpus", "reprime_corpus"];
|
|
173
|
+
readonly status: "available";
|
|
174
|
+
readonly tools: readonly ["vault_go_prime_corpus", "vault_go_query_corpus", "vault_go_reprime_corpus"];
|
|
175
|
+
readonly requires: "Uses the selected authenticated model. Conversation history is encrypted locally, isolated by account and corpus, bounded to 12 turns, and factual answers must cite retrieved memory IDs. Corpus loading is limited to an 8 MiB HTTP response; selected source JSON is limited to 16,000 characters.";
|
|
176
|
+
}, {
|
|
177
|
+
readonly upstream: readonly ["provider selection", "automatic observation processing"];
|
|
178
|
+
readonly status: "available";
|
|
179
|
+
readonly tools: readonly ["vault_go_engines", "vault_go_engine_select", "vault_go_generate_context", "vault_go_processing_status"];
|
|
180
|
+
readonly requires: "Local worker running and the selected provider authenticated. Model availability and subscription or API billing are not covered by deployment verification.";
|
|
181
|
+
}, {
|
|
182
|
+
readonly upstream: readonly ["privacy", "capture modes", "context settings"];
|
|
183
|
+
readonly status: "available";
|
|
184
|
+
readonly tools: readonly ["vault_go_preferences", "vault_go_preferences_update", "vault_go_custom_modes", "vault_go_custom_mode_get", "vault_go_custom_mode_save", "vault_go_custom_mode_select", "vault_go_custom_mode_delete"];
|
|
185
|
+
readonly requires: "Private-tag redaction and inherited custom taxonomies apply to future local processing. Preference updates require session authentication.";
|
|
186
|
+
}, {
|
|
187
|
+
readonly upstream: readonly ["import", "export"];
|
|
188
|
+
readonly status: "available";
|
|
189
|
+
readonly tools: readonly ["vault_go_import", "vault_go_export", "vault_go_backup_create", "vault_go_backup_restore"];
|
|
190
|
+
readonly difference: "Legacy bounded batches remain available. Backup v2 creates a complete, paginated, server-materialized same-owner memory-data snapshot with declared limits, local 0600 file and SHA-256. It is not the upstream SQLite format and is not an offline replica; embeddings, transient jobs, credentials, audit logs and blobs are intentionally omitted.";
|
|
191
|
+
}, {
|
|
192
|
+
readonly upstream: readonly ["cloud sync"];
|
|
193
|
+
readonly status: "partial";
|
|
194
|
+
readonly tools: readonly [];
|
|
195
|
+
readonly difference: "Vault stores authoritative memories in its authenticated cloud and persists local processing queues. This does not implement cmem.ai Pro synchronization or a complete offline SQLite replica.";
|
|
196
|
+
}, {
|
|
197
|
+
readonly upstream: readonly ["Telegram"];
|
|
198
|
+
readonly status: "available";
|
|
199
|
+
readonly tools: readonly ["vault_go_telegram_status", "vault_go_telegram_configure", "vault_go_telegram_disable", "vault_go_telegram_test"];
|
|
200
|
+
readonly requires: "Explicit configuration, private bot credential environment and user-authorized test delivery. Deployment verification does not contact Telegram.";
|
|
201
|
+
}, {
|
|
202
|
+
readonly upstream: readonly ["CCS Align"];
|
|
203
|
+
readonly status: "available";
|
|
204
|
+
readonly tools: readonly ["vault_go_ccs_align_health", "vault_go_ccs_align_cycle", "vault_go_ccs_align_exclude", "vault_go_ccs_align_restore", "vault_go_ccs_align_rules_check"];
|
|
205
|
+
readonly requires: "Local private middle cache and explicit cycle execution; rule checks report conflicts without modifying source rules.";
|
|
206
|
+
}, {
|
|
207
|
+
readonly upstream: readonly ["transcript watchers"];
|
|
208
|
+
readonly status: "available";
|
|
209
|
+
readonly tools: readonly ["vault_go_transcripts_status", "vault_go_transcripts_configure", "vault_go_transcripts_poll"];
|
|
210
|
+
readonly difference: "Persistent, consented and resumable watchers are implemented for Claude and Codex transcripts. Other client transcript formats are not claimed.";
|
|
211
|
+
}, {
|
|
212
|
+
readonly upstream: readonly ["Grok awareness push"];
|
|
213
|
+
readonly status: "available";
|
|
214
|
+
readonly tools: readonly ["vault_go_grok_awareness_status", "vault_go_grok_awareness_configure", "vault_go_grok_awareness_push"];
|
|
215
|
+
readonly requires: "Explicit consent, an allowlisted agent UUID and a local agent-data root. Monthly awareness logs are bounded, private and separate from Telegram.";
|
|
216
|
+
}, {
|
|
217
|
+
readonly upstream: readonly ["development/report/presentation skills", "babysit"];
|
|
218
|
+
readonly status: "available";
|
|
219
|
+
readonly tools: readonly ["vault_go_modes", "vault_go_mode"];
|
|
220
|
+
readonly difference: "Vault workflow prompts expose requirements and runtime dependencies. Loading a mode does not itself start agents, publish, message or perform external actions.";
|
|
221
|
+
}];
|
|
222
|
+
}>;
|
|
30
223
|
export declare const WORKFLOW: {
|
|
31
224
|
steps: string[];
|
|
32
225
|
guidance: string;
|