@ouro.bot/cli 0.1.0-alpha.1061 → 0.1.0-alpha.1062

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1062",
6
+ "changes": [
7
+ "Vault unlock: a sealed-file store for headless hosts without a keychain"
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1061",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1061",
2
+ "runtimeVersion": "0.1.0-alpha.1062",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1061</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1062</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -354,8 +354,8 @@ function usage() {
354
354
  " ouro vault create [--agent <name>] --email <email> [--server <url>] [--store <store>]",
355
355
  " ouro vault replace [--agent <name>] [--email <email>] [--server <url>] [--store <store>]",
356
356
  " ouro vault recover [--agent <name>] --from <json> [--from <json>] [--email <email>] [--server <url>] [--store <store>]",
357
- " ouro vault unlock [--agent <name>] [--store auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file]",
358
- " ouro vault status [--agent <name>] [--store auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file]",
357
+ " ouro vault unlock [--agent <name>] [--store auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file|sealed-file]",
358
+ " ouro vault status [--agent <name>] [--store auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file|sealed-file]",
359
359
  " ouro vault config set [--agent <name>] --key <path> [--value <value> | --value-file <path>] [--scope agent|machine]",
360
360
  " ouro vault config status [--agent <name>] [--scope agent|machine|all]",
361
361
  " ouro vault item set [--agent <name>] --item <path> --secret-field <name> [--public-field <key=value>] [--note <text>]",
@@ -991,7 +991,7 @@ function parseAuthCommand(args) {
991
991
  };
992
992
  }
993
993
  function isVaultUnlockStoreKind(value) {
994
- return value === "auto" || value === "macos-keychain" || value === "windows-dpapi" || value === "linux-secret-service" || value === "plaintext-file";
994
+ return value === "auto" || value === "macos-keychain" || value === "windows-dpapi" || value === "linux-secret-service" || value === "plaintext-file" || value === "sealed-file";
995
995
  }
996
996
  function parseVaultCommand(args) {
997
997
  const sub = args[0];
@@ -1023,7 +1023,7 @@ function parseVaultCommand(args) {
1023
1023
  if (token === "--store") {
1024
1024
  const value = rest[i + 1];
1025
1025
  if (!isVaultUnlockStoreKind(value)) {
1026
- throw new Error("vault --store must be auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file");
1026
+ throw new Error("vault --store must be auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file|sealed-file");
1027
1027
  }
1028
1028
  store = value;
1029
1029
  i += 1;
@@ -62,7 +62,9 @@ const VAULT_UNLOCK_SERVICE = "ouro.vault";
62
62
  const CREDENTIAL_VAULT_NOT_CONFIGURED_PREFIX = "credential vault is not configured in ";
63
63
  const PLAINTEXT_UNLOCK_DIR = path.join(".ouro-cli", "vault-unlock");
64
64
  const WINDOWS_DPAPI_UNLOCK_DIR = path.join(".ouro-cli", "vault-unlock-dpapi");
65
- const SUPPORTED_STORES = ["auto", "macos-keychain", "windows-dpapi", "linux-secret-service", "plaintext-file"];
65
+ const SEALED_UNLOCK_DIR = path.join(".ouro-cli", "vault-unlock-sealed");
66
+ const SUPPORTED_STORES = ["auto", "macos-keychain", "windows-dpapi", "linux-secret-service", "plaintext-file", "sealed-file"];
67
+ const STORE_NAMES = SUPPORTED_STORES.join("|");
66
68
  function platform(deps) {
67
69
  return deps.platform ?? process.platform;
68
70
  }
@@ -101,6 +103,48 @@ function plaintextUnlockPath(config, deps) {
101
103
  const digest = crypto.createHash("sha256").update(vaultKey(config)).digest("hex").slice(0, 24);
102
104
  return path.join(homeDir(deps), PLAINTEXT_UNLOCK_DIR, `${digest}.secret`);
103
105
  }
106
+ function sealedUnlockPath(config, deps) {
107
+ const digest = crypto.createHash("sha256").update(vaultKey(config)).digest("hex").slice(0, 24);
108
+ return path.join(homeDir(deps), SEALED_UNLOCK_DIR, `${digest}.sealed`);
109
+ }
110
+ const MACHINE_IDENTITY_SOURCES = {
111
+ // A device-tree serial or DMI UUID is burned into the hardware; machine-id files can be regenerated at boot on a
112
+ // read-only root filesystem, so they come last.
113
+ linux: ["device-tree-serial", "dmi-product-uuid", "machine-id", "dbus-machine-id"],
114
+ darwin: ["io-platform-uuid"],
115
+ };
116
+ const MACHINE_IDENTITY_FILES = {
117
+ "device-tree-serial": "/proc/device-tree/serial-number",
118
+ "dmi-product-uuid": "/sys/class/dmi/id/product_uuid",
119
+ "machine-id": "/etc/machine-id",
120
+ "dbus-machine-id": "/var/lib/dbus/machine-id",
121
+ };
122
+ /* v8 ignore start -- real hardware reads; tests inject readMachineIdentity @preserve */
123
+ function readMachineIdentityFromHost(source, deps) {
124
+ if (source === "io-platform-uuid") {
125
+ const result = spawnSync(deps)("ioreg", ["-rd1", "-c", "IOPlatformExpertDevice"], { encoding: "utf8" });
126
+ const match = typeof result.stdout === "string" ? /"IOPlatformUUID"\s*=\s*"([^"]+)"/.exec(result.stdout) : null;
127
+ return match ? match[1] : null;
128
+ }
129
+ try {
130
+ return fs.readFileSync(MACHINE_IDENTITY_FILES[source], "utf8").replace(/\0/g, "").trim() || null;
131
+ }
132
+ catch {
133
+ return null;
134
+ }
135
+ }
136
+ /* v8 ignore stop */
137
+ function machineIdentity(source, deps) {
138
+ /* v8 ignore next -- tests inject readMachineIdentity; the host reader is hardware wiring @preserve */
139
+ const value = (deps.readMachineIdentity ?? ((candidate) => readMachineIdentityFromHost(candidate, deps)))(source);
140
+ return value && value.trim() ? value.trim() : null;
141
+ }
142
+ /** The key a sealed-file secret is encrypted under: this machine's identity, this user and this vault. */
143
+ function sealedKey(config, identity) {
144
+ /* v8 ignore next -- process.getuid exists on every platform sealed-file runs on (Linux, macOS) @preserve */
145
+ const uid = typeof process.getuid === "function" ? process.getuid() : 0;
146
+ return Buffer.from(crypto.hkdfSync("sha256", identity, "ouro.vault.sealed-file.v1", `${vaultKey(config)}\0${uid}`, 32));
147
+ }
104
148
  function windowsDpapiUnlockPath(config, deps) {
105
149
  const digest = crypto.createHash("sha256").update(vaultKey(config)).digest("hex").slice(0, 24);
106
150
  const localAppData = process.env.LOCALAPPDATA;
@@ -203,7 +247,7 @@ function lockedMessage(config, store) {
203
247
  }
204
248
  function validateStoreKind(requested) {
205
249
  if (!SUPPORTED_STORES.includes(requested)) {
206
- throw new Error(`unknown vault unlock store '${requested}'. Use auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file.`);
250
+ throw new Error(`unknown vault unlock store '${requested}'. Use ${STORE_NAMES}.`);
207
251
  }
208
252
  return requested;
209
253
  }
@@ -214,7 +258,7 @@ function requestedStoreKind(deps) {
214
258
  if (!fromEnv)
215
259
  return "auto";
216
260
  if (!SUPPORTED_STORES.includes(fromEnv)) {
217
- throw new Error(`${exports.VAULT_UNLOCK_STORE_ENV}='${fromEnv}' is not a vault unlock store. Use auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file.`);
261
+ throw new Error(`${exports.VAULT_UNLOCK_STORE_ENV}='${fromEnv}' is not a vault unlock store. Use ${STORE_NAMES}.`);
218
262
  }
219
263
  return fromEnv;
220
264
  }
@@ -246,6 +290,12 @@ function resolveVaultUnlockStore(config, deps = {}) {
246
290
  if (requested === "plaintext-file") {
247
291
  return { kind: "plaintext-file", secure: false, location: plaintextUnlockPath(canonicalConfig, deps) };
248
292
  }
293
+ if (requested === "sealed-file") {
294
+ if (currentPlatform !== "linux" && currentPlatform !== "darwin") {
295
+ throw new Error(`sealed-file unlock store is available on Linux and macOS; this machine is ${currentPlatform}. Use windows-dpapi.`);
296
+ }
297
+ return { kind: "sealed-file", secure: false, location: sealedUnlockPath(canonicalConfig, deps) };
298
+ }
249
299
  if (currentPlatform === "darwin") {
250
300
  return { kind: "macos-keychain", secure: true, location: "macOS Keychain" };
251
301
  }
@@ -456,6 +506,64 @@ function writeToPlaintextFile(config, secret, deps) {
456
506
  fs.chmodSync(filePath, 0o600);
457
507
  }
458
508
  }
509
+ function readFromSealedFileExact(config, deps) {
510
+ const filePath = sealedUnlockPath(config, deps);
511
+ if (!fs.existsSync(filePath))
512
+ return null;
513
+ const mode = fs.statSync(filePath).mode & 0o777;
514
+ if ((mode & 0o077) !== 0) {
515
+ throw new Error(`refusing to read sealed vault unlock file at ${filePath} because permissions are too broad; run chmod 600 ${filePath}`);
516
+ }
517
+ let sealed;
518
+ try {
519
+ sealed = JSON.parse(fs.readFileSync(filePath, "utf8"));
520
+ }
521
+ catch {
522
+ throw new Error(`sealed vault unlock file at ${filePath} is not readable JSON; run \`ouro vault unlock --store sealed-file\` again`);
523
+ }
524
+ const knownSource = sealed.source === "io-platform-uuid" || Object.hasOwn(MACHINE_IDENTITY_FILES, sealed.source);
525
+ const identity = sealed.schemaVersion === 1 && knownSource ? machineIdentity(sealed.source, deps) : null;
526
+ try {
527
+ if (!identity)
528
+ throw new Error("machine identity unavailable");
529
+ const decipher = crypto.createDecipheriv("aes-256-gcm", sealedKey(config, identity), Buffer.from(sealed.iv, "base64"));
530
+ decipher.setAuthTag(Buffer.from(sealed.tag, "base64"));
531
+ return Buffer.concat([decipher.update(Buffer.from(sealed.ciphertext, "base64")), decipher.final()]).toString("utf8");
532
+ }
533
+ catch {
534
+ throw new Error(`sealed vault unlock file at ${filePath} was sealed on another machine (or this machine's ${sealed.source ?? "identity"} changed); run \`ouro vault unlock --store sealed-file\` on this machine`);
535
+ }
536
+ }
537
+ function readFromSealedFile(config, deps) {
538
+ for (const candidate of vaultConfigCandidates(config)) {
539
+ const secret = readFromSealedFileExact(candidate, deps);
540
+ if (secret)
541
+ return { secret, source: exactVaultConfig(candidate) };
542
+ }
543
+ return null;
544
+ }
545
+ function writeToSealedFile(config, secret, deps) {
546
+ const sources = MACHINE_IDENTITY_SOURCES[platform(deps) === "darwin" ? "darwin" : "linux"];
547
+ const source = sources.find((candidate) => machineIdentity(candidate, deps) !== null);
548
+ if (!source) {
549
+ throw new Error(`sealed-file unlock store needs a machine identity (${sources.join(", ")}) and none is readable here; use plaintext-file`);
550
+ }
551
+ const iv = crypto.randomBytes(12);
552
+ const cipher = crypto.createCipheriv("aes-256-gcm", sealedKey(config, machineIdentity(source, deps)), iv);
553
+ const ciphertext = Buffer.concat([cipher.update(secret, "utf8"), cipher.final()]);
554
+ const sealed = { schemaVersion: 1, source, iv: iv.toString("base64"), tag: cipher.getAuthTag().toString("base64"), ciphertext: ciphertext.toString("base64") };
555
+ const filePath = sealedUnlockPath(config, deps);
556
+ fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 0o700 });
557
+ fs.writeFileSync(filePath, `${JSON.stringify(sealed)}\n`, { encoding: "utf8", mode: 0o600 });
558
+ fs.chmodSync(path.dirname(filePath), 0o700);
559
+ fs.chmodSync(filePath, 0o600);
560
+ }
561
+ function deleteFromSealedFileExact(config, deps) {
562
+ const filePath = sealedUnlockPath(config, deps);
563
+ const existed = fs.existsSync(filePath);
564
+ fs.rmSync(filePath, { force: true });
565
+ return existed;
566
+ }
459
567
  function readFromStore(config, store, deps) {
460
568
  if (store.kind === "macos-keychain")
461
569
  return readFromMacosKeychain(config, deps);
@@ -463,6 +571,8 @@ function readFromStore(config, store, deps) {
463
571
  return readFromWindowsDpapi(config, deps);
464
572
  if (store.kind === "linux-secret-service")
465
573
  return readFromLinuxSecretService(config, deps);
574
+ if (store.kind === "sealed-file")
575
+ return readFromSealedFile(config, deps);
466
576
  return readFromPlaintextFile(config, deps);
467
577
  }
468
578
  function writeToStore(config, store, secret, deps) {
@@ -478,6 +588,10 @@ function writeToStore(config, store, secret, deps) {
478
588
  writeToWindowsDpapi(config, secret, deps);
479
589
  return;
480
590
  }
591
+ if (store.kind === "sealed-file") {
592
+ writeToSealedFile(config, secret, deps);
593
+ return;
594
+ }
481
595
  writeToPlaintextFile(config, secret, deps);
482
596
  }
483
597
  function deleteFromMacosKeychainExact(config, deps) {
@@ -533,6 +647,8 @@ function deleteFromStoreExact(config, store, deps) {
533
647
  return deleteFromLinuxSecretServiceExact(config, deps);
534
648
  if (store.kind === "windows-dpapi")
535
649
  return deleteFromWindowsDpapiExact(config, deps);
650
+ if (store.kind === "sealed-file")
651
+ return deleteFromSealedFileExact(config, deps);
536
652
  return deleteFromPlaintextFileExact(config, deps);
537
653
  }
538
654
  function readFromAutoPlaintextFallback(config, deps) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1061",
3
+ "version": "0.1.0-alpha.1062",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1061",
9
+ "version": "0.1.0-alpha.1062",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@ouro.bot/friends": "0.1.0-alpha.18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1061",
3
+ "version": "0.1.0-alpha.1062",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },