@hoilab/ada-cli 0.84.16 โ†’ 0.84.18

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.
@@ -2423,6 +2423,12 @@ export class InteractiveMode {
2423
2423
  void this.handleMemoryAuditCommand();
2424
2424
  return;
2425
2425
  }
2426
+ if (text === "/vault" || text.startsWith("/vault ")) {
2427
+ const args = text.startsWith("/vault ") ? text.slice(7).trim() : "";
2428
+ this.editor.setText("");
2429
+ void this.handleVaultCommand(args);
2430
+ return;
2431
+ }
2426
2432
  if (text === "/changelog") {
2427
2433
  this.handleChangelogCommand();
2428
2434
  this.editor.setText("");
@@ -5305,6 +5311,118 @@ export class InteractiveMode {
5305
5311
  this.chatContainer.addChild(new Text(lines.join("\n"), 1, 0));
5306
5312
  this.ui.requestRender();
5307
5313
  }
5314
+ async handleVaultCommand(args) {
5315
+ const vault = this.session.resourceLoader.getVaultManager();
5316
+ if (!vault) {
5317
+ this.chatContainer.addChild(new Spacer(1));
5318
+ this.chatContainer.addChild(new Text("Vault unavailable.", 1, 0));
5319
+ this.ui.requestRender();
5320
+ return;
5321
+ }
5322
+ const [action, ...rest] = args.split(/\s+/).filter(Boolean);
5323
+ const name = rest[0] ?? "";
5324
+ const show = (lines) => {
5325
+ this.chatContainer.addChild(new Spacer(1));
5326
+ this.chatContainer.addChild(new Text(lines.join("\n"), 1, 0));
5327
+ this.ui.requestRender();
5328
+ };
5329
+ switch (action ?? "status") {
5330
+ case "unlock": {
5331
+ const passphrase = await this.showExtensionInput("๐Ÿ”“ Vault passphrase (no se guarda en disco)", "โ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ข");
5332
+ if (!passphrase) {
5333
+ show(["Unlock cancelled."]);
5334
+ return;
5335
+ }
5336
+ const ok = await vault.unlock(passphrase);
5337
+ show(ok
5338
+ ? ["๐Ÿ”“ Vault unlocked.", ` Path: ${vault.vaultPath}`, ` Secrets: ${vault.list().length}`]
5339
+ : ["โŒ Wrong passphrase or corrupted vault."]);
5340
+ return;
5341
+ }
5342
+ case "lock":
5343
+ vault.lock();
5344
+ show(["๐Ÿ”’ Vault locked."]);
5345
+ return;
5346
+ case "add": {
5347
+ if (!vault.isUnlocked) {
5348
+ show(["๐Ÿ”’ Unlock first: /vault unlock"]);
5349
+ return;
5350
+ }
5351
+ if (!name) {
5352
+ show(["Usage: /vault add <name>"]);
5353
+ return;
5354
+ }
5355
+ const value = await this.showExtensionInput(`Value for '${name}'`, "");
5356
+ if (!value) {
5357
+ show(["Cancelled."]);
5358
+ return;
5359
+ }
5360
+ vault.add(name, value);
5361
+ show([`โœ… '${name}' saved to the project vault (encrypted).`, " Use @vault:" + name + " in a message to pass it to the agent."]);
5362
+ return;
5363
+ }
5364
+ case "session": {
5365
+ if (!name) {
5366
+ show(["Usage: /vault session add <name> | /vault session remove <name>"]);
5367
+ return;
5368
+ }
5369
+ const sub = rest[0] ?? "";
5370
+ if (sub === "add" && rest[1]) {
5371
+ const value = await this.showExtensionInput(`Session value for '${rest[1]}'`, "");
5372
+ if (!value) {
5373
+ show(["Cancelled."]);
5374
+ return;
5375
+ }
5376
+ vault.sessionAdd(rest[1], value);
5377
+ show([`โœ… '${rest[1]}' saved to the SESSION vault (memory only).`]);
5378
+ return;
5379
+ }
5380
+ if (sub === "remove" && rest[1]) {
5381
+ vault.sessionRemove(rest[1]);
5382
+ show([`Session secret '${rest[1]}' removed.`]);
5383
+ return;
5384
+ }
5385
+ show(["Usage: /vault session add <name> | /vault session remove <name>"]);
5386
+ return;
5387
+ }
5388
+ case "remove": {
5389
+ if (!vault.isUnlocked) {
5390
+ show(["๐Ÿ”’ Unlock first: /vault unlock"]);
5391
+ return;
5392
+ }
5393
+ if (!name) {
5394
+ show(["Usage: /vault remove <name>"]);
5395
+ return;
5396
+ }
5397
+ vault.remove(name);
5398
+ show([`๐Ÿ—‘๏ธ '${name}' removed from the project vault.`]);
5399
+ return;
5400
+ }
5401
+ case "list":
5402
+ case "status":
5403
+ default: {
5404
+ const status = vault.status();
5405
+ const entries = vault.list();
5406
+ const lines = [
5407
+ `${theme.bold("๐Ÿ” Ada Vault")}`,
5408
+ `${theme.fg("dim", "Unlocked:")} ${status.unlocked ? "yes" : "no"} ยท ${theme.fg("dim", "File:")} ${status.vaultPath}`,
5409
+ ];
5410
+ if (entries.length === 0) {
5411
+ lines.push(theme.fg("dim", "No secrets yet. Use /vault unlock then /vault add <name>."));
5412
+ }
5413
+ else {
5414
+ lines.push("");
5415
+ for (const entry of entries) {
5416
+ const scope = entry.source === "session" ? theme.fg("dim", "[session]") : theme.fg("dim", "[project]");
5417
+ lines.push(` ${scope} ${entry.name}${entry.note ? ` โ€” ${entry.note}` : ""}`);
5418
+ }
5419
+ }
5420
+ lines.push("", "Use @vault:<name> in a message to pass a secret to the agent (never persisted).");
5421
+ show(lines);
5422
+ return;
5423
+ }
5424
+ }
5425
+ }
5308
5426
  handleChangelogCommand() {
5309
5427
  const changelogPath = getChangelogPath();
5310
5428
  const allEntries = parseChangelog(changelogPath);