@ouro.bot/cli 0.1.0-alpha.394 → 0.1.0-alpha.395

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,16 @@
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.395",
6
+ "changes": [
7
+ "`ouro vault replace` and `ouro vault recover` now default to the stable agent vault email, `<agent>@ouro.bot`, instead of timestamped `+replaced` or `+recovered` addresses.",
8
+ "Vault repair now treats previously generated repair emails as stale defaults and repairs back to the stable agent email unless the human explicitly supplies `--email <email>`.",
9
+ "Existing-account repair guidance now tells operators to unlock the stable vault when possible and use `--email` only when intentionally moving an agent to a different vault account.",
10
+ "Auth/provider docs and CLI help now describe stable vault identity repair for old auth-style agents without implying that Ouro can recover a forgotten unlock secret.",
11
+ "`@ouro.bot/cli` and the `ouro.bot` wrapper are version-synced for the stable vault identity repair release."
12
+ ]
13
+ },
4
14
  {
5
15
  "version": "0.1.0-alpha.394",
6
16
  "changes": [
@@ -686,19 +686,22 @@ function readVaultRecoverSource(sourcePath) {
686
686
  runtimeConfig: recoverRuntimeConfig(parsed),
687
687
  };
688
688
  }
689
- function defaultReplacementVaultEmail(agentName, now, action) {
689
+ function defaultStableVaultEmail(agentName) {
690
690
  const local = agentName
691
691
  .toLowerCase()
692
692
  .replace(/[^a-z0-9._-]+/g, "-")
693
693
  .replace(/^-+|-+$/g, "") || "agent";
694
- const stamp = now.toISOString().replace(/[-:.TZ]/g, "").slice(0, 14);
695
- return `${local}+${action}-${stamp}@ouro.bot`;
694
+ return `${local}@ouro.bot`;
696
695
  }
697
- function defaultRecoveredVaultEmail(agentName, now) {
698
- return defaultReplacementVaultEmail(agentName, now, "recovered");
696
+ function isGeneratedRepairVaultEmail(email) {
697
+ const [local, domain] = email.trim().split("@");
698
+ return domain?.toLowerCase() === "ouro.bot" && /\+(?:replaced|recovered)-\d{14}(?:$|\+)/i.test(local);
699
699
  }
700
- function defaultReplacedVaultEmail(agentName, now) {
701
- return defaultReplacementVaultEmail(agentName, now, "replaced");
700
+ function defaultRepairVaultEmail(agentName, config) {
701
+ const configuredEmail = config.vault?.email?.trim();
702
+ if (configuredEmail && !isGeneratedRepairVaultEmail(configuredEmail))
703
+ return configuredEmail;
704
+ return defaultStableVaultEmail(agentName);
702
705
  }
703
706
  function ensureVaultSecretPrompt(promptSecret, action) {
704
707
  if (promptSecret)
@@ -708,13 +711,17 @@ function ensureVaultSecretPrompt(promptSecret, action) {
708
711
  function rejectGeneratedVaultUnlockSecret(action) {
709
712
  throw new Error(`vault ${action} no longer supports --generate-unlock-secret. Re-run without that flag and enter a human-chosen unlock secret; Ouro will not print vault unlock secrets.`);
710
713
  }
711
- async function createReplacementVaultForAgent(input) {
714
+ async function createRepairVaultForAgent(input) {
712
715
  const result = await (0, vault_setup_1.createVaultAccount)("Ouro credential vault", input.serverUrl, input.email, input.unlockSecret);
713
716
  if (!result.success) {
714
717
  const message = [
715
718
  `vault ${input.action} failed for ${input.agentName}: ${result.error}`,
716
719
  "",
717
- "This creates a replacement vault. If that vault account already exists, retry with a fresh --email value.",
720
+ "Could not create the selected vault account.",
721
+ "If this is the existing vault, run:",
722
+ ` ouro vault unlock --agent ${input.agentName}`,
723
+ "If the unlock secret is lost and you intentionally need a different vault account, rerun with --email <email>.",
724
+ "If this looks like a server or network issue, check --server and retry.",
718
725
  ].join("\n");
719
726
  input.deps.writeStdout(message);
720
727
  return { ok: false, message };
@@ -807,16 +814,15 @@ async function executeVaultReplace(command, deps) {
807
814
  if (command.generateUnlockSecret)
808
815
  rejectGeneratedVaultUnlockSecret("replace");
809
816
  const promptSecret = ensureVaultSecretPrompt(deps.promptSecret, "replace");
810
- const now = providerCliNow(deps);
811
817
  const { configPath, config } = (0, auth_flow_1.readAgentConfigForAgent)(command.agent, deps.bundlesRoot);
812
818
  const configuredVault = (0, identity_1.resolveVaultConfig)(command.agent, config.vault);
813
- const email = command.email ?? defaultReplacedVaultEmail(command.agent, now);
819
+ const email = command.email ?? defaultRepairVaultEmail(command.agent, config);
814
820
  const serverUrl = command.serverUrl ?? config.vault?.serverUrl ?? configuredVault.serverUrl;
815
- const unlockSecret = (await promptSecret(`Choose replacement Ouro vault unlock secret for ${email}: `)).trim();
821
+ const unlockSecret = (await promptSecret(`Choose Ouro vault unlock secret for ${email}: `)).trim();
816
822
  if (!unlockSecret) {
817
- throw new Error("vault replace requires a replacement unlock secret. Re-run in an interactive terminal and enter a human-chosen unlock secret.");
823
+ throw new Error("vault replace requires an unlock secret. Re-run in an interactive terminal and enter a human-chosen unlock secret.");
818
824
  }
819
- const replacement = await createReplacementVaultForAgent({
825
+ const repair = await createRepairVaultForAgent({
820
826
  action: "replace",
821
827
  agentName: command.agent,
822
828
  email,
@@ -827,12 +833,12 @@ async function executeVaultReplace(command, deps) {
827
833
  configPath,
828
834
  config,
829
835
  });
830
- if (!replacement.ok)
831
- return replacement.message;
836
+ if (!repair.ok)
837
+ return repair.message;
832
838
  const message = [
833
839
  `vault replaced for ${command.agent}`,
834
840
  `vault: ${email} at ${serverUrl}`,
835
- `local unlock store: ${replacement.store.kind}${replacement.store.secure ? "" : " (explicit plaintext fallback)"}`,
841
+ `local unlock store: ${repair.store.kind}${repair.store.secure ? "" : " (explicit plaintext fallback)"}`,
836
842
  "credentials imported: none",
837
843
  "This is the no-export path for agents that predate vault auth or lost an unsaved unlock secret.",
838
844
  "Re-auth/re-enter the credentials this agent should use:",
@@ -840,7 +846,7 @@ async function executeVaultReplace(command, deps) {
840
846
  ` ouro vault config set --agent ${command.agent} --key <field>`,
841
847
  ` ouro provider refresh --agent ${command.agent}`,
842
848
  ` ouro auth verify --agent ${command.agent}`,
843
- "Keep the replacement vault unlock secret saved outside Ouro. Another machine will need it once.",
849
+ "Keep the vault unlock secret saved outside Ouro. Another machine will need it once.",
844
850
  ].join("\n");
845
851
  deps.writeStdout(message);
846
852
  return message;
@@ -856,13 +862,13 @@ async function executeVaultRecover(command, deps) {
856
862
  const now = providerCliNow(deps);
857
863
  const { configPath, config } = (0, auth_flow_1.readAgentConfigForAgent)(command.agent, deps.bundlesRoot);
858
864
  const configuredVault = (0, identity_1.resolveVaultConfig)(command.agent, config.vault);
859
- const email = command.email ?? defaultRecoveredVaultEmail(command.agent, now);
865
+ const email = command.email ?? defaultRepairVaultEmail(command.agent, config);
860
866
  const serverUrl = command.serverUrl ?? config.vault?.serverUrl ?? configuredVault.serverUrl;
861
- const unlockSecret = (await promptSecret(`Choose replacement Ouro vault unlock secret for ${email}: `)).trim();
867
+ const unlockSecret = (await promptSecret(`Choose Ouro vault unlock secret for ${email}: `)).trim();
862
868
  if (!unlockSecret) {
863
- throw new Error("vault recover requires a replacement unlock secret. Re-run in an interactive terminal and enter a human-chosen unlock secret.");
869
+ throw new Error("vault recover requires an unlock secret. Re-run in an interactive terminal and enter a human-chosen unlock secret.");
864
870
  }
865
- const replacement = await createReplacementVaultForAgent({
871
+ const repair = await createRepairVaultForAgent({
866
872
  action: "recover",
867
873
  agentName: command.agent,
868
874
  email,
@@ -873,8 +879,8 @@ async function executeVaultRecover(command, deps) {
873
879
  configPath,
874
880
  config,
875
881
  });
876
- if (!replacement.ok)
877
- return replacement.message;
882
+ if (!repair.ok)
883
+ return repair.message;
878
884
  const importedProviders = new Set();
879
885
  let mergedRuntimeConfig = {};
880
886
  for (const source of sourceImports) {
@@ -899,12 +905,12 @@ async function executeVaultRecover(command, deps) {
899
905
  const message = [
900
906
  `vault recovered for ${command.agent}`,
901
907
  `vault: ${email} at ${serverUrl}`,
902
- `local unlock store: ${replacement.store.kind}${replacement.store.secure ? "" : " (explicit plaintext fallback)"}`,
908
+ `local unlock store: ${repair.store.kind}${repair.store.secure ? "" : " (explicit plaintext fallback)"}`,
903
909
  `sources imported: ${sourceImports.length}`,
904
910
  `provider credentials imported: ${providerList.length === 0 ? "none" : providerList.join(", ")}`,
905
911
  `runtime credentials imported: ${runtimeFields.length === 0 ? "none" : runtimeFields.join(", ")}`,
906
912
  "credential values were not printed",
907
- "Keep the replacement vault unlock secret saved outside Ouro. Another machine will need it once.",
913
+ "Keep the vault unlock secret saved outside Ouro. Another machine will need it once.",
908
914
  ].join("\n");
909
915
  deps.writeStdout(message);
910
916
  return message;
@@ -270,12 +270,12 @@ const SUBCOMMAND_HELP = {
270
270
  example: "ouro vault create --agent ouroboros --email ouroboros@ouro.bot",
271
271
  },
272
272
  "vault replace": {
273
- description: "Create an empty replacement agent vault when no unlock secret or JSON export exists",
273
+ description: "Create an empty agent vault at the stable agent email when no unlock secret or JSON export exists",
274
274
  usage: "ouro vault replace --agent <name> [--email <email>] [--server <url>] [--store <store>]",
275
275
  example: "ouro vault replace --agent ouroboros",
276
276
  },
277
277
  "vault recover": {
278
- description: "Create a replacement agent vault and import local JSON credential exports",
278
+ description: "Create an agent vault at the stable agent email and import local JSON credential exports",
279
279
  usage: "ouro vault recover --agent <name> --from <json> [--from <json>] [--email <email>] [--server <url>] [--store <store>]",
280
280
  example: "ouro vault recover --agent ouroboros --from ./credentials.json",
281
281
  },
@@ -100,7 +100,7 @@ function vaultUnlockReplaceRecoverFix(agentName, nextStep = "Then run 'ouro up'
100
100
  return [
101
101
  `Run 'ouro vault unlock --agent ${agentName}' if you have the saved vault unlock secret.`,
102
102
  `If this agent predates vault auth or nobody saved the unlock secret, run 'ouro vault replace --agent ${agentName}' to create a new empty vault, then re-auth/re-enter credentials.`,
103
- `If you do have a local JSON credential export, run 'ouro vault recover --agent ${agentName} --from <json>' to create a replacement vault and import it.`,
103
+ `If you do have a local JSON credential export, run 'ouro vault recover --agent ${agentName} --from <json>' to create the agent vault and import it.`,
104
104
  nextStep,
105
105
  ].join(" ");
106
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.394",
3
+ "version": "0.1.0-alpha.395",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",