vault-go 0.13.0 → 0.14.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 CHANGED
@@ -87,6 +87,7 @@ Comandos explícitos:
87
87
  ```sh
88
88
  bunx --bun vault-go@latest setup
89
89
  bunx --bun vault-go@latest setup --clients codex,claude,copilot
90
+ bunx --bun vault-go@latest setup --engine openrouter
90
91
  bunx --bun vault-go@latest login --force
91
92
  bunx --bun vault-go@latest serve
92
93
  bunx --bun vault-go@latest engine list
package/dist/cli.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { type McpClient } from './installer.js';
2
+ import { type ContextEngineId } from './context-engines.js';
2
3
  export type CliMode = 'help' | 'version' | 'setup' | 'login' | 'serve' | 'local' | 'engine' | 'invalid';
3
4
  export declare function resolveCliMode(argument: string | undefined, stdinIsTTY: boolean, stderrIsTTY: boolean): CliMode;
5
+ export declare function parseEngineChoice(value: string): ContextEngineId;
4
6
  export declare function parseNumberedClients(value: string): McpClient[];
5
7
  export declare function cliArguments(args: string[]): {
6
8
  argument: string | undefined;
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@ import { authenticateWithApiKey, authenticateWithBrowser, validateExistingAuthen
2
2
  import { vaultHome } from './config.js';
3
3
  import { detectMcpClients, installMcpClient, MCP_CLIENTS, parseClientSelection, } from './installer.js';
4
4
  import { promptSecret, promptText } from './prompt.js';
5
- import { CONTEXT_ENGINE_IDS, isApiEngine, listContextEngines, saveEngineKey, selectContextEngine, } from './context-engines.js';
5
+ import { CONTEXT_ENGINE_IDS, ENGINE_NAMES, isApiEngine, listContextEngines, loadEngineKey, saveEngineKey, selectContextEngine, } from './context-engines.js';
6
6
  import { VaultCloudClient } from './cloud.js';
7
7
  import { copy, resolveLocale } from './locale.js';
8
8
  import { installLocal, localStatus, localUrl, openLocal, startLocal, stopLocal, uninstallLocal } from './local-install.js';
@@ -56,6 +56,30 @@ function defaultClients() {
56
56
  return detected.map((item) => item.client);
57
57
  return ['codex', 'claude', 'cursor', 'vscode', 'copilot'];
58
58
  }
59
+ const ENGINE_ALIASES = {
60
+ '1': 'vault-ai-resume',
61
+ '2': 'claude-subscription',
62
+ '3': 'openai-subscription',
63
+ '4': 'openrouter',
64
+ '5': 'gemini',
65
+ vault: 'vault-ai-resume',
66
+ 'vault-ai': 'vault-ai-resume',
67
+ 'vault-ai-resume': 'vault-ai-resume',
68
+ claude: 'claude-subscription',
69
+ 'claude-subscription': 'claude-subscription',
70
+ openai: 'openai-subscription',
71
+ chatgpt: 'openai-subscription',
72
+ codex: 'openai-subscription',
73
+ 'openai-subscription': 'openai-subscription',
74
+ openrouter: 'openrouter',
75
+ gemini: 'gemini',
76
+ };
77
+ export function parseEngineChoice(value) {
78
+ const engine = ENGINE_ALIASES[value.trim().toLowerCase()];
79
+ if (!engine)
80
+ throw new Error(`Motor inválido: ${value}`);
81
+ return engine;
82
+ }
59
83
  export function parseNumberedClients(value) {
60
84
  return parseClientSelection(value.split(',').map(item => {
61
85
  const trimmed = item.trim();
@@ -80,6 +104,47 @@ async function chooseClients(args, locale) {
80
104
  const answer = await promptText(`${t.choose} [${defaults.join(',')}]: `);
81
105
  return answer ? parseNumberedClients(answer) : defaults;
82
106
  }
107
+ async function chooseEngine(args, locale, home) {
108
+ const t = copy[locale];
109
+ const configured = optionValue(args, '--engine');
110
+ const engine = configured ? parseEngineChoice(configured) : await promptEngine(home, locale);
111
+ selectContextEngine(home, engine);
112
+ process.stderr.write(` ✓ ${t.engineSaved}: ${ENGINE_NAMES[engine]}\n`);
113
+ if (isApiEngine(engine) && !loadEngineKey(home, engine)) {
114
+ try {
115
+ const key = await promptSecret(` ${t.engineKey} (${ENGINE_NAMES[engine]}): `);
116
+ if (key.trim()) {
117
+ saveEngineKey(home, engine, key);
118
+ process.stderr.write(` ✓ ${t.engineKeySaved}\n`);
119
+ }
120
+ else {
121
+ process.stderr.write(` ○ ${t.engineKeyLater} vault-go engine key ${engine}\n`);
122
+ }
123
+ }
124
+ catch {
125
+ process.stderr.write(` ○ ${t.engineKeyLater} vault-go engine key ${engine}\n`);
126
+ }
127
+ }
128
+ return engine;
129
+ }
130
+ async function promptEngine(home, locale) {
131
+ const t = copy[locale];
132
+ process.stderr.write(` ${t.engineHelp}\n`);
133
+ try {
134
+ const listed = await listContextEngines(home, await managedStatus(home));
135
+ for (const [index, engine] of listed.engines.entries()) {
136
+ const mark = engine.available ? `● ${t.detected}` : `○ ${t.available}`;
137
+ process.stderr.write(` ${index + 1}. ${ENGINE_NAMES[engine.id].padEnd(18)} ${mark}\n`);
138
+ }
139
+ }
140
+ catch {
141
+ for (const [index, id] of CONTEXT_ENGINE_IDS.entries()) {
142
+ process.stderr.write(` ${index + 1}. ${ENGINE_NAMES[id]}\n`);
143
+ }
144
+ }
145
+ const answer = await promptText(`${t.choose} [1. ${ENGINE_NAMES['vault-ai-resume']}]: `);
146
+ return answer ? parseEngineChoice(answer) : 'vault-ai-resume';
147
+ }
83
148
  export function cliArguments(args) {
84
149
  const remaining = [...args];
85
150
  for (let i = 0; i < remaining.length; i++) {
@@ -170,13 +235,15 @@ export async function runSetup(args) {
170
235
  const t = copy[locale];
171
236
  const local = localCopy[locale];
172
237
  process.env['VAULT_GO_LANG'] = locale;
173
- process.stderr.write(` ${t.subtitle}\n\n [1/4] ${t.auth}\n`);
238
+ process.stderr.write(` ${t.subtitle}\n\n [1/5] ${t.auth}\n`);
174
239
  await ensureAuthentication(vaultHome(), args.includes('--reauth'), args.includes('--api-key'), locale);
175
- process.stderr.write(`\n [2/4] ${t.clients}\n`);
240
+ process.stderr.write(`\n [2/5] ${t.clients}\n`);
176
241
  const clients = await chooseClients(args, locale);
177
242
  if (clients.length === 0)
178
243
  throw new Error(t.none);
179
- process.stderr.write(`\n [3/4] ${t.install}\n`);
244
+ process.stderr.write(`\n [3/5] ${t.engine}\n`);
245
+ await chooseEngine(args, locale, vaultHome());
246
+ process.stderr.write(`\n [4/5] ${t.install}\n`);
180
247
  let failures = 0;
181
248
  for (const client of clients) {
182
249
  try {
@@ -190,7 +257,7 @@ export async function runSetup(args) {
190
257
  process.stderr.write(` ✗ ${t.failed} ${client}: ${message}\n`);
191
258
  }
192
259
  }
193
- process.stderr.write(`\n [4/4] ${local.step}\n`);
260
+ process.stderr.write(`\n [5/5] ${local.step}\n`);
194
261
  try {
195
262
  const result = await installLocal();
196
263
  process.stderr.write(` ✓ ${result.startup ? local.startup : local.manual}\n`);
@@ -213,8 +280,9 @@ Uso:
213
280
  bunx --bun vault-go@latest
214
281
  Abre o login Vault no navegador e instala nos clientes detectados.
215
282
 
216
- bunx --bun vault-go@latest setup [--clients lista] [--reauth]
217
- Executa o assistente de autenticação e instalação.
283
+ bunx --bun vault-go@latest setup [--clients lista] [--engine motor] [--reauth]
284
+ Executa o assistente de autenticação e instalação. Pergunta o motor
285
+ (Vault AI, Claude, OpenRouter, Gemini ou ChatGPT/Codex).
218
286
 
219
287
  bunx --bun vault-go@latest login [--force] [--api-key]
220
288
  Autentica sem alterar clientes MCP.
@@ -2,6 +2,7 @@ export declare const CONTEXT_ENGINE_IDS: readonly ["vault-ai-resume", "claude-su
2
2
  export declare const API_ENGINE_IDS: readonly ["openrouter", "gemini"];
3
3
  export type ContextEngineId = (typeof CONTEXT_ENGINE_IDS)[number];
4
4
  export type ApiEngineId = (typeof API_ENGINE_IDS)[number];
5
+ export declare const ENGINE_NAMES: Record<ContextEngineId, string>;
5
6
  export interface ContextResult {
6
7
  title: string;
7
8
  content: string;
@@ -10,7 +10,7 @@ export const CONTEXT_ENGINE_IDS = [
10
10
  "gemini",
11
11
  ];
12
12
  export const API_ENGINE_IDS = ["openrouter", "gemini"];
13
- const ENGINE_NAMES = {
13
+ export const ENGINE_NAMES = {
14
14
  "vault-ai-resume": "Vault AI Resume",
15
15
  "claude-subscription": "Claude",
16
16
  "openai-subscription": "ChatGPT / Codex",
package/dist/locale.d.ts CHANGED
@@ -11,6 +11,12 @@ export declare const copy: {
11
11
  openFailed: string;
12
12
  connected: string;
13
13
  key: string;
14
+ engine: string;
15
+ engineHelp: string;
16
+ engineSaved: string;
17
+ engineKey: string;
18
+ engineKeySaved: string;
19
+ engineKeyLater: string;
14
20
  choose: string;
15
21
  detected: string;
16
22
  available: string;
@@ -42,6 +48,12 @@ export declare const copy: {
42
48
  openFailed: string;
43
49
  connected: string;
44
50
  key: string;
51
+ engine: string;
52
+ engineHelp: string;
53
+ engineSaved: string;
54
+ engineKey: string;
55
+ engineKeySaved: string;
56
+ engineKeyLater: string;
45
57
  choose: string;
46
58
  detected: string;
47
59
  available: string;
@@ -73,6 +85,12 @@ export declare const copy: {
73
85
  openFailed: string;
74
86
  connected: string;
75
87
  key: string;
88
+ engine: string;
89
+ engineHelp: string;
90
+ engineSaved: string;
91
+ engineKey: string;
92
+ engineKeySaved: string;
93
+ engineKeyLater: string;
76
94
  choose: string;
77
95
  detected: string;
78
96
  available: string;
package/dist/locale.js CHANGED
@@ -20,6 +20,12 @@ export const copy = {
20
20
  openFailed: "Não foi possível abrir automaticamente. Use o endereço acima.",
21
21
  connected: "Conta conectada",
22
22
  key: "Chave de API",
23
+ engine: "Escolher motor de contexto",
24
+ engineHelp: "Como o Vault prepara memórias: Claude, OpenRouter, Gemini ou Vault AI.",
25
+ engineSaved: "Motor selecionado",
26
+ engineKey: "Cole a chave (não será exibida). Enter para pular",
27
+ engineKeySaved: "Chave gravada com permissão privada.",
28
+ engineKeyLater: "Sem chave ainda. Depois execute:",
23
29
  choose: "Números ou nomes, separados por vírgula",
24
30
  detected: "detectado",
25
31
  available: "disponível",
@@ -51,6 +57,12 @@ export const copy = {
51
57
  openFailed: "Could not open automatically. Use the address above.",
52
58
  connected: "Account connected",
53
59
  key: "API key",
60
+ engine: "Choose context engine",
61
+ engineHelp: "How Vault prepares memories: Claude, OpenRouter, Gemini, or Vault AI.",
62
+ engineSaved: "Engine selected",
63
+ engineKey: "Paste the API key (it will not be shown). Enter to skip",
64
+ engineKeySaved: "Key stored with private file permissions.",
65
+ engineKeyLater: "No key yet. Later run:",
54
66
  choose: "Numbers or names, separated by commas",
55
67
  detected: "detected",
56
68
  available: "available",
@@ -82,6 +94,12 @@ export const copy = {
82
94
  openFailed: "No se pudo abrir automáticamente. Usa la dirección anterior.",
83
95
  connected: "Cuenta conectada",
84
96
  key: "Clave de API",
97
+ engine: "Elegir motor de contexto",
98
+ engineHelp: "Cómo Vault prepara memorias: Claude, OpenRouter, Gemini o Vault AI.",
99
+ engineSaved: "Motor seleccionado",
100
+ engineKey: "Pega la clave (no se mostrará). Enter para omitir",
101
+ engineKeySaved: "Clave guardada con permisos privados.",
102
+ engineKeyLater: "Aún no hay clave. Después ejecuta:",
85
103
  choose: "Números o nombres, separados por comas",
86
104
  detected: "detectado",
87
105
  available: "disponible",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vault-go",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Servidor MCP universal com autenticação e instalação multi-cliente para a plataforma Vault.",
5
5
  "type": "module",
6
6
  "bin": {