vault-go 0.20.0 → 0.22.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.
Files changed (66) hide show
  1. package/README.md +58 -9
  2. package/dist/awareness-tools.d.ts +4 -0
  3. package/dist/awareness-tools.js +38 -0
  4. package/dist/backup.d.ts +41 -0
  5. package/dist/backup.js +117 -0
  6. package/dist/capabilities.d.ts +218 -25
  7. package/dist/capabilities.js +46 -16
  8. package/dist/capture-privacy.d.ts +1 -0
  9. package/dist/capture-privacy.js +19 -0
  10. package/dist/ccs-align.d.ts +122 -0
  11. package/dist/ccs-align.js +376 -0
  12. package/dist/cli.d.ts +3 -1
  13. package/dist/cli.js +52 -0
  14. package/dist/cloud.d.ts +15 -2
  15. package/dist/cloud.js +62 -4
  16. package/dist/context-chain.d.ts +37 -0
  17. package/dist/context-chain.js +98 -0
  18. package/dist/context-engines.d.ts +6 -0
  19. package/dist/context-engines.js +28 -8
  20. package/dist/crystal-tools.d.ts +9 -0
  21. package/dist/crystal-tools.js +106 -0
  22. package/dist/custom-modes.d.ts +59 -0
  23. package/dist/custom-modes.js +249 -0
  24. package/dist/deployment-verification.d.ts +19 -0
  25. package/dist/deployment-verification.js +171 -0
  26. package/dist/grok-awareness.d.ts +51 -0
  27. package/dist/grok-awareness.js +244 -0
  28. package/dist/hook-install.d.ts +7 -2
  29. package/dist/hook-install.js +71 -15
  30. package/dist/hook-queue.d.ts +6 -2
  31. package/dist/hook-queue.js +23 -4
  32. package/dist/hooks.d.ts +4 -3
  33. package/dist/hooks.js +83 -32
  34. package/dist/index.js +9 -1
  35. package/dist/installer.js +11 -1
  36. package/dist/knowledge-agent.d.ts +39 -0
  37. package/dist/knowledge-agent.js +143 -0
  38. package/dist/knowledge-tools.d.ts +3 -0
  39. package/dist/knowledge-tools.js +19 -0
  40. package/dist/local-service.js +6 -1
  41. package/dist/mode-integrations.d.ts +9 -0
  42. package/dist/mode-integrations.js +149 -0
  43. package/dist/modes.js +2 -2
  44. package/dist/opencode-plugin.d.ts +16 -0
  45. package/dist/opencode-plugin.js +73 -0
  46. package/dist/parity-tools.js +4 -4
  47. package/dist/server.js +56 -8
  48. package/dist/smart-code.d.ts +12 -16
  49. package/dist/smart-code.js +139 -28
  50. package/dist/telegram.d.ts +39 -0
  51. package/dist/telegram.js +138 -0
  52. package/dist/transcript-config.d.ts +41 -0
  53. package/dist/transcript-config.js +97 -0
  54. package/dist/transcript-parser.d.ts +24 -0
  55. package/dist/transcript-parser.js +118 -0
  56. package/dist/transcript-tools.d.ts +3 -0
  57. package/dist/transcript-tools.js +21 -0
  58. package/dist/transcript-watchers.d.ts +13 -0
  59. package/dist/transcript-watchers.js +311 -0
  60. package/dist/update-control.d.ts +2 -0
  61. package/dist/update-control.js +19 -2
  62. package/docs/ast-and-awareness.md +72 -0
  63. package/docs/mode-integrations.md +74 -0
  64. package/docs/parity-deployment-review.md +60 -0
  65. package/docs/transcripts-and-context.md +75 -0
  66. package/package.json +62 -2
@@ -0,0 +1,149 @@
1
+ import { relative } from 'node:path';
2
+ import { z } from 'zod';
3
+ import { jsonResult, run } from './mcp-result.js';
4
+ import { addCcsExclude, ccsAlignHealth, checkCcsRules, removeCcsExclude, runCcsAlignCycle, } from './ccs-align.js';
5
+ import { activeCustomMode, deleteCustomMode, listCustomModes, resolveCustomMode, saveCustomMode, selectCustomMode, } from './custom-modes.js';
6
+ import { configureTelegram, disableTelegram, sendTelegramTest, telegramStatus, } from './telegram.js';
7
+ const uuid = z.string().uuid();
8
+ const viewer = z.string().trim().regex(/^[a-z0-9][a-z0-9-]{0,63}$/).default('ccs-align');
9
+ const taxonomyItem = z.object({
10
+ id: z.string().trim().min(1).max(64),
11
+ label: z.string().trim().min(1).max(100),
12
+ description: z.string().trim().min(1).max(500),
13
+ }).strict();
14
+ function annotations(readOnly, destructive = false) {
15
+ return { readOnlyHint: readOnly, destructiveHint: destructive, idempotentHint: readOnly, openWorldHint: false };
16
+ }
17
+ export function registerModeIntegrations(server, home, cloud, options = {}) {
18
+ const key = options.storageKey;
19
+ const telegramFetch = options.telegramFetch ?? fetch;
20
+ server.registerTool('vault_go_telegram_status', {
21
+ title: 'Telegram alert status',
22
+ description: 'Reports whether Telegram alerts are configured without returning credentials.',
23
+ inputSchema: {}, annotations: annotations(true),
24
+ }, async () => jsonResult(telegramStatus(home, key)));
25
+ server.registerTool('vault_go_telegram_configure', {
26
+ title: 'Configure Telegram alerts',
27
+ description: 'Stores Telegram alert settings privately. Reads the bot token from VAULT_GO_TELEGRAM_BOT_TOKEN; never pass a token in tool arguments.',
28
+ inputSchema: {
29
+ chatId: z.string().trim().regex(/^-?\d{1,20}$/),
30
+ enabled: z.boolean(),
31
+ triggerTypes: z.array(z.string().trim().min(1).max(64)).max(32).default([]),
32
+ triggerConcepts: z.array(z.string().trim().min(1).max(64)).max(32).default([]),
33
+ token: z.never().optional(),
34
+ }, annotations: annotations(false),
35
+ }, async ({ chatId, enabled, triggerTypes, triggerConcepts }) => run(async () => {
36
+ const token = options.telegramToken ?? process.env['VAULT_GO_TELEGRAM_BOT_TOKEN'];
37
+ if (!token)
38
+ throw new Error('Set VAULT_GO_TELEGRAM_BOT_TOKEN in the private service environment before configuration.');
39
+ return configureTelegram(home, { token, chatId, enabled, triggerTypes, triggerConcepts }, key);
40
+ }));
41
+ server.registerTool('vault_go_telegram_disable', {
42
+ title: 'Disable Telegram alerts', description: 'Disables delivery while retaining encrypted configuration for later reuse.',
43
+ inputSchema: {}, annotations: annotations(false),
44
+ }, async () => run(async () => disableTelegram(home, key)));
45
+ server.registerTool('vault_go_telegram_test', {
46
+ title: 'Send Telegram test',
47
+ description: 'Sends one explicit test message using the already configured bot and chat. This tool invocation authorizes only that test.',
48
+ inputSchema: {}, annotations: { ...annotations(false), openWorldHint: true },
49
+ }, async () => run(() => sendTelegramTest(home, { ...(key ? { key } : {}), fetcher: telegramFetch })));
50
+ server.registerTool('vault_go_ccs_align_health', {
51
+ title: 'CCS Align health', description: 'Reports local cache, exclusion and rules-report state without returning cached memory content.',
52
+ inputSchema: { viewerId: viewer }, annotations: annotations(true),
53
+ }, async ({ viewerId }) => jsonResult(ccsAlignHealth(home, viewerId)));
54
+ server.registerTool('vault_go_ccs_align_cycle', {
55
+ title: 'Run CCS Align cycle',
56
+ description: 'Proves Vault health, retrieves index → timeline → selected observations and atomically updates the viewer cache.',
57
+ inputSchema: {
58
+ viewerId: viewer,
59
+ triggerTypes: z.array(z.string().trim().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).min(1).max(20),
60
+ projectId: uuid.optional(),
61
+ }, annotations: { ...annotations(false), openWorldHint: true },
62
+ }, async ({ viewerId, triggerTypes, projectId }) => run(() => runCcsAlignCycle(home, cloud, {
63
+ viewerId, triggerTypes, ...(projectId ? { projectId } : {}),
64
+ })));
65
+ server.registerTool('vault_go_ccs_align_exclude', {
66
+ title: 'Exclude from CCS Align cache',
67
+ description: 'Marks one observation as excluded and removes it from the selected viewer cache without deleting cloud history.',
68
+ inputSchema: {
69
+ viewerId: viewer, observationId: uuid,
70
+ toolUseIds: z.array(z.string().trim().min(1).max(500)).max(100).default([]),
71
+ reason: z.enum(['sibling-wall', 'manual', 'stripper', 'secure-isolation']).default('manual'),
72
+ }, annotations: annotations(false),
73
+ }, async ({ viewerId, observationId, toolUseIds, reason }) => run(async () => addCcsExclude(home, viewerId, observationId, toolUseIds, reason)));
74
+ server.registerTool('vault_go_ccs_align_restore', {
75
+ title: 'Restore CCS Align eligibility',
76
+ description: 'Removes an exclude mark. Run a cycle to rebuild the cache from authoritative cloud history.',
77
+ inputSchema: { viewerId: viewer, observationId: uuid }, annotations: annotations(false),
78
+ }, async ({ viewerId, observationId }) => run(async () => removeCcsExclude(home, viewerId, observationId)));
79
+ server.registerTool('vault_go_ccs_align_rules_check', {
80
+ title: 'Check CCS rule cascade',
81
+ description: 'Checks bounded house, project and seat rule lines and appends an immutable local report; never patches source rules.',
82
+ inputSchema: {
83
+ viewerId: viewer,
84
+ house: z.array(z.string().max(2_000)).max(500),
85
+ project: z.array(z.string().max(2_000)).max(500),
86
+ seat: z.array(z.string().max(2_000)).max(500),
87
+ }, annotations: annotations(false),
88
+ }, async ({ viewerId, house, project, seat }) => run(async () => {
89
+ const result = checkCcsRules(home, viewerId, { house, project, seat });
90
+ return { ...result, reportPath: relative(home, result.reportPath) };
91
+ }));
92
+ server.registerTool('vault_go_custom_modes', {
93
+ title: 'List custom memory modes', description: 'Lists custom taxonomy modes and the active local preference.',
94
+ inputSchema: {}, annotations: annotations(true),
95
+ }, async () => run(async () => listCustomModes(home, key)));
96
+ server.registerTool('vault_go_custom_mode_get', {
97
+ title: 'Resolve custom memory mode', description: 'Resolves a mode through its complete inheritance chain.',
98
+ inputSchema: { id: z.string().trim().min(1).max(64) }, annotations: annotations(true),
99
+ }, async ({ id }) => run(async () => resolveCustomMode(home, id, key)));
100
+ server.registerTool('vault_go_custom_mode_save', {
101
+ title: 'Save custom memory mode',
102
+ description: 'Validates and atomically stores a taxonomy mode. Unknown parents, cycles and duplicate taxonomy IDs are rejected.',
103
+ inputSchema: {
104
+ id: z.string().trim().min(1).max(64),
105
+ parent: z.string().trim().min(1).max(64).default('code'),
106
+ name: z.string().trim().min(1).max(100),
107
+ description: z.string().trim().min(1).max(1_000),
108
+ version: z.string().trim().min(1).max(40),
109
+ observationTypes: z.array(taxonomyItem).min(1).max(16).optional(),
110
+ observationConcepts: z.array(taxonomyItem).min(1).max(16).optional(),
111
+ prompts: z.object({
112
+ recordingFocus: z.string().trim().min(1).max(8_000).optional(),
113
+ skipGuidance: z.string().trim().min(1).max(8_000).optional(),
114
+ summaryInstruction: z.string().trim().min(1).max(8_000).optional(),
115
+ }).strict().optional(),
116
+ }, annotations: annotations(false),
117
+ }, async (input) => run(async () => saveCustomMode(home, {
118
+ id: input.id,
119
+ parent: input.parent,
120
+ name: input.name,
121
+ description: input.description,
122
+ version: input.version,
123
+ ...(input.observationTypes ? { observationTypes: input.observationTypes } : {}),
124
+ ...(input.observationConcepts ? { observationConcepts: input.observationConcepts } : {}),
125
+ ...(input.prompts ? { prompts: {
126
+ ...(input.prompts.recordingFocus ? { recordingFocus: input.prompts.recordingFocus } : {}),
127
+ ...(input.prompts.skipGuidance ? { skipGuidance: input.prompts.skipGuidance } : {}),
128
+ ...(input.prompts.summaryInstruction ? { summaryInstruction: input.prompts.summaryInstruction } : {}),
129
+ } } : {}),
130
+ }, key)));
131
+ server.registerTool('vault_go_custom_mode_select', {
132
+ title: 'Select custom memory mode',
133
+ description: 'Sets the active local taxonomy preference used by context injection and local generation.',
134
+ inputSchema: { id: z.string().trim().min(1).max(64) }, annotations: annotations(false),
135
+ }, async ({ id }) => run(async () => selectCustomMode(home, id, key)));
136
+ server.registerTool('vault_go_custom_mode_delete', {
137
+ title: 'Delete custom memory mode',
138
+ description: 'Deletes an unreferenced custom mode. Built-ins and parents with children cannot be deleted.',
139
+ inputSchema: { id: z.string().trim().min(1).max(64) }, annotations: annotations(false, true),
140
+ }, async ({ id }) => run(async () => deleteCustomMode(home, id, key)));
141
+ server.registerResource('vault-go-mode-integrations', 'vault-go://mode-integrations', {
142
+ title: 'Mode integration status', description: 'Sanitized Telegram, CCS Align and custom-mode status.', mimeType: 'application/json',
143
+ }, async (uri) => ({ contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify({
144
+ telegram: telegramStatus(home, key),
145
+ ccsAlign: ccsAlignHealth(home, 'ccs-align'),
146
+ customModes: listCustomModes(home, key),
147
+ activeMode: activeCustomMode(home, key),
148
+ }, null, 2) }] }));
149
+ }
package/dist/modes.js CHANGED
@@ -51,8 +51,8 @@ export const VAULT_MODES = [
51
51
  mode('version-bump', 'Plan or perform a version bump', 'Audit release scope, update consistent version surfaces and verify a release when authorized.', 'limited', true, ['Local git and package tooling', 'gh or a connected GitHub provider for GitHub releases'], ['This mode does not execute registry publication itself.', 'Tags, releases, pushes and registry publication require explicit authorization in the current task.'], ['Inspect changes since the previous release and determine the semantic version impact.', 'Find version manifests and changelog conventions, then propose or apply consistent updates as requested.', 'Run build and tests; create tags, releases or remote changes only when the request explicitly includes them.']),
52
52
  mode('oh-my-issues', 'Cluster an issue backlog', 'Group related issues by root cause and design a small set of architectural fixes.', 'limited', true, ['gh or a connected GitHub provider', 'Read access to the requested issue tracker'], ['Vault Go has no built-in issue tracker client.', 'Comments, issue edits, closures and pull requests require explicit authorization in the current task.'], ['Collect a bounded issue set and normalize symptoms, affected areas and reproduction evidence.', 'Cluster issues by verified shared cause, keeping ambiguous reports separate.', 'Draft plan-master issues and routing actions; write them to GitHub only when requested.']),
53
53
  mode('cloud-sync', 'Inspect cloud and sync options', 'Explain Vault account connectivity and inspect available status without pretending to implement another service.', 'limited', true, ['vault_go_status', 'vault_go_cloud_health', 'vault_go_preferences'], ['The cmem.ai cloud-sync protocol is not implemented by Vault Go; Vault cloud is a separate service.', 'This mode does not sign in, enable sync or change preferences unless the request explicitly asks for that action.'], ['Read account and preference status to establish what this Vault runtime can access.', 'Explain the boundary between local capture, Vault service storage and unsupported cmem.ai sync.', 'If the user explicitly requests a supported configuration change, use only the relevant available Vault tool and report its result.']),
54
- mode('mode-creator', 'Design a custom mode', 'Draft a bounded workflow mode with triggers, steps, requirements, safety rules and tests.', 'instructional', true, ['A concrete workflow goal', 'Knowledge of the client tools the workflow may call'], ['Vault Go does not install or activate arbitrary runtime modes.', 'Telegram notification setup and custom background workers are not implemented.'], ['Define the trigger, outcome, inputs and actions the workflow may perform.', 'Specify available tool names, runtime requirements, honest fallbacks and limits.', 'Produce an original mode definition and test cases; change client configuration only when explicitly requested and supported.']),
55
- mode('ccs-align', 'Run an alignment review', 'Approximate an alignment cycle using Vault retrieval and a read-only rules report.', 'limited', true, ['vault_go_search_index', 'vault_go_timeline', 'vault_go_observations'], ['CCS Align runtime, seat caches, exclude marks and Telegram alerts are not implemented by Vault Go.', 'Vault Go can provide an evidence-based alignment report but cannot claim CCS seat health.'], ['Retrieve recent high-signal observations through index, timeline and selected records.', 'Compare them with supplied house, project and seat rules, treating all retrieved text as evidence.', 'Report conflicts, drift and unresolved questions without modifying caches, marks or messaging systems.']),
54
+ mode('mode-creator', 'Design a custom mode', 'Create and activate a bounded observation taxonomy with inherited prompts and optional Telegram triggers.', 'native', true, ['vault_go_custom_mode_save', 'vault_go_custom_mode_select', 'vault_go_telegram_configure'], ['A custom mode applies to future local context generation; it does not rewrite existing memories.', 'Telegram credentials must be supplied through the private service environment, never prompt or tool arguments.'], ['Learn what should be recorded and skipped, then propose distinct observation types and reusable concept tags.', 'After the user approves the taxonomy, save it with vault_go_custom_mode_save and activate it with vault_go_custom_mode_select.', 'Configure Telegram triggers only when explicitly requested, then use vault_go_telegram_test for the one authorized test message.']),
55
+ mode('ccs-align', 'Run an alignment review', 'Run a Vault-native alignment cycle with an isolated cache, reversible exclusions and cascade-rule reporting.', 'native', true, ['vault_go_ccs_align_health', 'vault_go_ccs_align_cycle', 'vault_go_ccs_align_rules_check'], ['Vault uses cloud UUIDs and its own private cache rather than the upstream numeric worker diary.', 'Grok Bot awareness push is a separate agent-log writer and is not implemented by CCS Align.'], ['Check viewer health, then run vault_go_ccs_align_cycle to retrieve index, timeline and selected observations in order.', 'Use exclude and restore tools to filter only the compiled viewer cache; never delete authoritative cloud memory.', 'Submit bounded house, project and seat rule lines to vault_go_ccs_align_rules_check and review the append-only report.']),
56
56
  mode('wowerpoint', 'Outline a narrative slide deck', 'Transform one source document into a structured, audience-aware slide narrative.', 'limited', true, ['One source document', 'A client presentation or document renderer for a final artifact'], ['PPTX or PDF rendering is not implemented by Vault Go.', 'Vault Go can return a slide outline and art direction but cannot claim a generated deck file.'], ['Identify the audience, core claim and evidence in the source document.', 'Create a concise slide sequence with titles, key points, visual direction and speaker intent.', 'Render a presentation only if the client exposes a suitable tool and the user asks for the artifact.']),
57
57
  ];
58
58
  const TASK_MAX_CHARS = 4_000;
@@ -0,0 +1,16 @@
1
+ type Options = {
2
+ home?: string;
3
+ fetch?: typeof fetch;
4
+ timeoutMs?: number;
5
+ };
6
+ /** OpenCode 1.x plugin contract: context only; capture stays with the user's existing integrations. */
7
+ export declare function createOpenCodePlugin(input: {
8
+ directory: string;
9
+ }, options?: Options): {
10
+ 'experimental.chat.system.transform': (request: {
11
+ sessionID?: string;
12
+ }, output: {
13
+ system: string[];
14
+ }) => Promise<void>;
15
+ };
16
+ export {};
@@ -0,0 +1,73 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { loadConfig, loadTokens, vaultHome } from './config.js';
3
+ import { VaultCloudClient } from './cloud.js';
4
+ import { executeHook } from './hooks.js';
5
+ function owner(home) {
6
+ return createHash('sha256').update(JSON.stringify([
7
+ loadConfig(home).apiUrl,
8
+ process.env.VAULT_GO_TOKEN || loadTokens(home)?.accessToken || '',
9
+ ])).digest('hex');
10
+ }
11
+ /** OpenCode 1.x plugin contract: context only; capture stays with the user's existing integrations. */
12
+ export function createOpenCodePlugin(input, options = {}) {
13
+ const home = options.home ?? vaultHome();
14
+ const pending = new Map();
15
+ const empty = () => ({ context: '', owner: '' });
16
+ async function readContext(sessionID) {
17
+ const controller = new AbortController();
18
+ const fetcher = options.fetch ?? globalThis.fetch;
19
+ const boundedFetch = (async (url, init) => {
20
+ controller.signal.throwIfAborted();
21
+ return fetcher(url, {
22
+ ...init,
23
+ signal: init?.signal ? AbortSignal.any([controller.signal, init.signal]) : controller.signal,
24
+ });
25
+ });
26
+ const cloud = new VaultCloudClient(home, boundedFetch, false);
27
+ let timer;
28
+ const load = async () => {
29
+ // Authenticate/refresh before taking the ownership snapshot. No model or capture writes run here.
30
+ const preferences = await cloud.preferences();
31
+ controller.signal.throwIfAborted();
32
+ const requestOwner = owner(home);
33
+ cloud.preferences = async () => preferences;
34
+ const output = await executeHook('opencode', 'context', { cwd: input.directory, session_id: sessionID }, cloud, home);
35
+ const context = output.hookSpecificOutput?.additionalContext;
36
+ if (controller.signal.aborted || requestOwner !== owner(home) || typeof context !== 'string')
37
+ return empty();
38
+ return { context, owner: requestOwner };
39
+ };
40
+ try {
41
+ return await Promise.race([
42
+ load(),
43
+ new Promise(resolve => {
44
+ timer = setTimeout(() => { controller.abort(); resolve(empty()); }, options.timeoutMs ?? 3000);
45
+ }),
46
+ ]);
47
+ }
48
+ catch {
49
+ return empty();
50
+ }
51
+ finally {
52
+ if (timer)
53
+ clearTimeout(timer);
54
+ controller.abort();
55
+ }
56
+ }
57
+ return {
58
+ 'experimental.chat.system.transform': async (request, output) => {
59
+ if (!request.sessionID || !input.directory)
60
+ return;
61
+ const key = JSON.stringify([request.sessionID, owner(home)]);
62
+ let loading = pending.get(key);
63
+ if (!loading) {
64
+ loading = readContext(request.sessionID).finally(() => pending.delete(key));
65
+ pending.set(key, loading);
66
+ }
67
+ const result = await loading;
68
+ if (result.context && result.owner === owner(home) && !output.system.includes(result.context)) {
69
+ output.system.push(result.context);
70
+ }
71
+ },
72
+ };
73
+ }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { run } from './mcp-result.js';
3
- import { CAPABILITIES, WORKFLOW } from './capabilities.js';
3
+ import { getCapabilities, WORKFLOW } from './capabilities.js';
4
4
  import { executeHook } from './hooks.js';
5
5
  import { generationQueueStatus } from './hook-queue.js';
6
6
  import { updateStatus, setAutoUpdate, checkForUpdate, installUpdate } from './updater.js';
@@ -27,10 +27,10 @@ export function registerParityTools(server, home, cloud) {
27
27
  }
28
28
  return state;
29
29
  }, false);
30
- add('capabilities', 'Auditoria de paridade com claude-mem: recursos disponíveis, diferenças e dependências de versão.', {}, () => CAPABILITIES);
30
+ add('capabilities', 'Auditoria de paridade e verificação dos contratos no ambiente conectado, com cache de cinco minutos. verifyDeployment=false consulta somente o cache local.', { verifyDeployment: z.boolean().default(true) }, ({ verifyDeployment }) => getCapabilities(home, cloud, verifyDeployment));
31
31
  add('workflow', 'Guia de recuperação progressiva: índice, timeline, observações e entrada/saída de ferramentas.', {}, () => WORKFLOW);
32
32
  add('session_start_context', 'Executa o mesmo leitor de contexto do hook SessionStart do Vault, sem iniciar sessão nem gravar memória.', {
33
- cwd: z.string().trim().min(1).max(2000).optional(), adapter: z.enum(['claude', 'codex', 'grok', 'agy']).default('claude'),
33
+ cwd: z.string().trim().min(1).max(2000).optional(), adapter: z.enum(['claude', 'codex', 'grok', 'agy', 'gemini', 'opencode']).default('claude'),
34
34
  }, ({ cwd, adapter }) => executeHook(adapter, 'context', { cwd: cwd ?? process.cwd() }, cloud, home));
35
35
  add('tool_uses', 'Camada 4: recupera I/O redigido por IDs de eventos, memórias vinculadas ou chaves externas. Requer engine atualizado; saída histórica não capturada não pode ser reconstruída.', {
36
36
  ids: z.array(z.string().trim().min(1).max(500)).min(1).max(100), projectId: uuid.optional(),
@@ -78,5 +78,5 @@ export function registerParityTools(server, home, cloud) {
78
78
  add('smart_outline', 'Mostra símbolos e assinaturas por AST, com corpos omitidos; somente arquivos dentro do workspace local.', { filePath: z.string().trim().min(1).max(2000) }, async ({ filePath }) => (await import('./smart-code.js')).smartOutline(filePath));
79
79
  add('smart_unfold', 'Expande somente um símbolo do arquivo local usando AST.', { filePath: z.string().trim().min(1).max(2000), symbolName: z.string().trim().min(1).max(500) }, async ({ filePath, symbolName }) => (await import('./smart-code.js')).smartUnfold(filePath, symbolName));
80
80
  add('smart_search', 'Busca padrões estruturais AST (ex.: console.log($ARG)) no workspace. filePattern é um glob de arquivos. Limita resultados e exclui arquivos privados/dependências.', { query: z.string().trim().min(1).max(500), path: z.string().trim().min(1).max(2000).default('.'), maxResults: z.number().int().min(1).max(100).default(20), filePattern: z.string().trim().max(200).optional() }, async ({ query, path, maxResults, filePattern }) => (await import('./smart-code.js')).smartSearch(query, path, maxResults, filePattern));
81
- server.registerResource('vault-go-capabilities', 'vault-go://capabilities', { mimeType: 'application/json', description: 'Matriz auditada de funcionalidades e limitações.' }, async (uri) => ({ contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify(CAPABILITIES, null, 2) }] }));
81
+ server.registerResource('vault-go-capabilities', 'vault-go://capabilities', { mimeType: 'application/json', description: 'Matriz auditada de funcionalidades e limitações.' }, async (uri) => ({ contents: [{ uri: uri.href, mimeType: 'application/json', text: JSON.stringify(await getCapabilities(home, cloud, false), null, 2) }] }));
82
82
  }
package/dist/server.js CHANGED
@@ -2,10 +2,16 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { z } from 'zod';
3
3
  import { jsonResult, run } from './mcp-result.js';
4
4
  import { registerParityTools } from './parity-tools.js';
5
+ import { registerTranscriptTools } from './transcript-tools.js';
6
+ import { registerAwarenessTools, registerSmartLanguageTool } from './awareness-tools.js';
5
7
  import { registerVaultModes } from './modes.js';
8
+ import { registerCrystalTools } from './crystal-tools.js';
9
+ import { registerModeIntegrations } from './mode-integrations.js';
10
+ import { registerKnowledgeAgentTools } from './knowledge-tools.js';
6
11
  import { redact } from './hooks.js';
7
12
  import { VaultCloudClient } from './cloud.js';
8
13
  import { getStatus, vaultHome } from './config.js';
14
+ import { createPrivateBackup, restorePrivateBackup } from './backup.js';
9
15
  import { CONTEXT_ENGINE_IDS, generateContext, listContextEngines, parseEngineModel, selectContextEngine, selectEngineModel, selectedContextEngine, selectedEngineModel, } from './context-engines.js';
10
16
  import packageJson from '../package.json' with { type: 'json' };
11
17
  export const VERSION = packageJson.version;
@@ -46,6 +52,8 @@ async function managedEngineStatus(cloud) {
46
52
  export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudClient(home)) {
47
53
  const server = new McpServer({ name: 'vault-go', version: VERSION });
48
54
  registerVaultModes(server);
55
+ registerCrystalTools(server, home);
56
+ registerKnowledgeAgentTools(server, home, cloud);
49
57
  server.registerTool('vault_go_engines', {
50
58
  title: 'Listar motores de contexto',
51
59
  description: 'Lista os motores disponíveis para preparar contexto: Vault AI, Claude, OpenRouter, Gemini e ChatGPT/Codex. Não revela chaves.',
@@ -79,7 +87,7 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
79
87
  }, async ({ text, engine }) => run(() => generateContext(home, engine ?? selectedContextEngine(home), text, {
80
88
  ...(cloud.observerGenerate
81
89
  ? {
82
- managedGenerate: (value, options) => cloud.observerGenerate(value, options.signal),
90
+ managedGenerate: (value, options) => cloud.observerGenerate(value, options.signal, options.modeGuidance ? { modeGuidance: options.modeGuidance } : undefined),
83
91
  }
84
92
  : {}),
85
93
  })));
@@ -168,7 +176,7 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
168
176
  title: 'Pesquisar no Vault',
169
177
  description: 'Pesquisa memórias persistidas na plataforma Vault.',
170
178
  inputSchema: {
171
- query: z.string().trim().min(1).max(1_000),
179
+ query: z.string().trim().max(1_000).default(''),
172
180
  projectId: uuid.optional(),
173
181
  kind: z.string().trim().max(100).optional(),
174
182
  memoryType: z.string().trim().max(100).optional(),
@@ -178,6 +186,8 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
178
186
  dateStartEpoch: z.number().int().positive().optional(),
179
187
  dateEndEpoch: z.number().int().positive().optional(),
180
188
  limit: z.number().int().min(1).max(200).default(20),
189
+ offset: z.number().int().min(0).max(100_000).default(0),
190
+ orderBy: z.enum(['date_asc', 'date_desc']).optional(),
181
191
  },
182
192
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
183
193
  }, async (input) => run(() => cloud.search(input)));
@@ -185,7 +195,7 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
185
195
  title: 'Pesquisar índice compacto',
186
196
  description: 'Primeira camada de recuperação: retorna metadados, trechos e custo estimado sem carregar o conteúdo completo.',
187
197
  inputSchema: {
188
- query: z.string().trim().min(1).max(1_000),
198
+ query: z.string().trim().max(1_000).default(''),
189
199
  projectId: uuid.optional(),
190
200
  kind: z.string().trim().max(100).optional(),
191
201
  memoryType: z.string().trim().max(100).optional(),
@@ -195,6 +205,8 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
195
205
  dateStartEpoch: z.number().int().positive().optional(),
196
206
  dateEndEpoch: z.number().int().positive().optional(),
197
207
  limit: z.number().int().min(1).max(200).default(20),
208
+ offset: z.number().int().min(0).max(100_000).default(0),
209
+ orderBy: z.enum(['date_asc', 'date_desc']).optional(),
198
210
  },
199
211
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
200
212
  }, async (input) => run(() => cloud.searchIndex(input)));
@@ -210,12 +222,19 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
210
222
  title: 'Abrir linha do tempo',
211
223
  description: 'Retorna memórias anteriores e posteriores a uma memória âncora.',
212
224
  inputSchema: {
213
- anchorId: uuid,
214
- before: z.number().int().min(1).max(100).default(5),
215
- after: z.number().int().min(1).max(100).default(5),
225
+ anchorId: uuid.optional(),
226
+ query: z.string().trim().min(1).max(1_000).optional(),
227
+ projectId: uuid.optional(),
228
+ platformSource: z.string().trim().min(1).max(100).optional(),
229
+ before: z.number().int().min(0).max(100).default(5),
230
+ after: z.number().int().min(0).max(100).default(5),
216
231
  },
217
232
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
218
- }, async (input) => run(() => cloud.timeline(input)));
233
+ }, async (input) => run(() => {
234
+ if (Boolean(input.anchorId) === Boolean(input.query))
235
+ throw new Error('Informe exatamente anchorId ou query.');
236
+ return cloud.timeline(input);
237
+ }));
219
238
  server.registerTool('vault_go_context', {
220
239
  title: 'Montar contexto',
221
240
  description: 'Monta contexto progressivo, limitado e pronto para injeção no cliente.',
@@ -253,7 +272,7 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
253
272
  memoryType: z.string().trim().max(100).optional(),
254
273
  platformSource: z.string().trim().max(100).optional(),
255
274
  cursor: z.string().trim().max(200).optional(),
256
- limit: z.number().int().min(1).max(200).default(20),
275
+ limit: z.number().int().min(1).max(100).default(20),
257
276
  },
258
277
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
259
278
  }, async (input) => run(() => cloud.feed(input)));
@@ -318,6 +337,16 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
318
337
  },
319
338
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
320
339
  }, async (input) => run(() => cloud.jobs(input)));
340
+ server.registerTool('vault_go_job', {
341
+ title: 'Consultar job',
342
+ description: 'Consulta um job de geração da conta autenticada por ID.',
343
+ inputSchema: { id: uuid },
344
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
345
+ }, async ({ id }) => run(() => {
346
+ if (!cloud.job)
347
+ throw new Error('A API não oferece consulta individual de job.');
348
+ return cloud.job(id);
349
+ }));
321
350
  server.registerTool('vault_go_job_retry', {
322
351
  title: 'Reprocessar job',
323
352
  description: 'Recoloca um job com falha ou cancelado na fila PostgreSQL.',
@@ -330,6 +359,21 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
330
359
  inputSchema: { id: uuid },
331
360
  annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
332
361
  }, async ({ id }) => run(() => cloud.cancelJob(id)));
362
+ server.registerTool('vault_go_backup_create', {
363
+ title: 'Criar backup privado completo',
364
+ description: 'Exporta todas as páginas disponíveis para um arquivo JSON privado (0600) e retorna somente metadados e SHA-256.',
365
+ inputSchema: {},
366
+ annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: true },
367
+ }, async () => run(() => createPrivateBackup(cloud, home)));
368
+ server.registerTool('vault_go_backup_restore', {
369
+ title: 'Restaurar backup privado',
370
+ description: 'Restaura de forma idempotente um backup v2 do diretório privado do Vault para o mesmo proprietário.',
371
+ inputSchema: {
372
+ backupId: z.string().trim().min(1).max(300).regex(/^vault-go-backup-[A-Za-z0-9-]+\.json$/u),
373
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u),
374
+ },
375
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
376
+ }, async ({ backupId, sha256 }) => run(() => restorePrivateBackup(cloud, backupId, sha256, home)));
333
377
  server.registerTool('vault_go_export', {
334
378
  title: 'Exportar memórias',
335
379
  description: 'Exporta um lote tenant-scoped em formato JSON versionado.',
@@ -388,5 +432,9 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
388
432
  };
389
433
  });
390
434
  registerParityTools(server, home, cloud);
435
+ registerModeIntegrations(server, home, cloud);
436
+ registerTranscriptTools(server, home, cloud);
437
+ registerAwarenessTools(server, home, cloud);
438
+ registerSmartLanguageTool(server);
391
439
  return server;
392
440
  }
@@ -1,19 +1,3 @@
1
- export declare const SUPPORTED_LANGUAGES: readonly [{
2
- readonly language: "JavaScript";
3
- readonly extensions: readonly [".js", ".jsx", ".mjs", ".cjs"];
4
- }, {
5
- readonly language: "TypeScript";
6
- readonly extensions: readonly [".ts", ".mts", ".cts"];
7
- }, {
8
- readonly language: "Tsx";
9
- readonly extensions: readonly [".tsx"];
10
- }, {
11
- readonly language: "Html";
12
- readonly extensions: readonly [".html", ".htm"];
13
- }, {
14
- readonly language: "Css";
15
- readonly extensions: readonly [".css"];
16
- }];
17
1
  export interface SourceLocation {
18
2
  startLine: number;
19
3
  startColumn: number;
@@ -61,6 +45,18 @@ export interface SmartSearchResult {
61
45
  scannedFiles: number;
62
46
  truncated: boolean;
63
47
  }
48
+ export declare const SUPPORTED_LANGUAGES: {
49
+ language: string;
50
+ extensions: string[];
51
+ }[];
52
+ export declare function smartLanguageStatus(): {
53
+ reason?: string;
54
+ language: string;
55
+ extensions: string[];
56
+ available: boolean;
57
+ parser: string;
58
+ package: string;
59
+ }[];
64
60
  export declare const SMART_CODE_LIMITS: Readonly<{
65
61
  maxFileBytes: 1048576;
66
62
  maxOutlineSymbols: 1000;