@ouro.bot/cli 0.1.0-alpha.1018 → 0.1.0-alpha.1019
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 +0 -7
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/daemon/cli-exec.js +0 -3
- package/dist/heart/hatch/hatch-flow.js +1 -3
- package/dist/heart/hatch/specialist-tools.js +0 -8
- package/dist/repertoire/vault-setup.js +30 -82
- package/dist/repertoire/vault-unlock.js +4 -18
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
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.1018",
|
|
6
|
-
"changes": [
|
|
7
|
-
"Hatch and ouro vault create register vault accounts with Vaultwarden's current two-step flow (send-verification-email, then register/finish), falling back to the old /identity/accounts/register only on servers that lack it. When a server has signups closed, the error says to have its admin invite the agent's email.",
|
|
8
|
-
"OURO_VAULT_UNLOCK_STORE (for example plaintext-file on a headless appliance without secret-tool) picks the local vault unlock store for every ouro command when no --store is given. Hatch (interactive and --answers) and ouro vault create/replace/recover check for a usable unlock store before creating the vault account, so a missing store no longer leaves an orphaned account behind."
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
4
|
{
|
|
12
5
|
"version": "0.1.0-alpha.1019",
|
|
13
6
|
"changes": [
|
|
@@ -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.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1019</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -1857,7 +1857,6 @@ function rejectGeneratedVaultUnlockSecret(action) {
|
|
|
1857
1857
|
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.`);
|
|
1858
1858
|
}
|
|
1859
1859
|
async function createRepairVaultForAgent(input) {
|
|
1860
|
-
(0, vault_unlock_1.resolveVaultUnlockStore)({ agentName: input.agentName, email: input.email, serverUrl: input.serverUrl }, { homeDir: input.deps.homeDir, store: input.store });
|
|
1861
1860
|
const result = await runCommandProgressPhase(input.progress, "creating vault account", () => (0, vault_setup_1.createVaultAccount)("Ouro credential vault", input.serverUrl, input.email, input.unlockSecret), (created) => created.success ? "created" : "failed");
|
|
1862
1861
|
if (!result.success) {
|
|
1863
1862
|
const message = [
|
|
@@ -1948,8 +1947,6 @@ async function executeVaultCreate(command, deps) {
|
|
|
1948
1947
|
const email = command.email ?? config.vault?.email ?? configuredVault.email;
|
|
1949
1948
|
const promptSecret = ensureVaultSecretPrompt(deps.promptSecret, "create", command.secretFile);
|
|
1950
1949
|
const serverUrl = command.serverUrl ?? config.vault?.serverUrl ?? configuredVault.serverUrl;
|
|
1951
|
-
// Fail before creating the account when this machine has nowhere to keep the unlock secret.
|
|
1952
|
-
(0, vault_unlock_1.resolveVaultUnlockStore)({ agentName: command.agent, email, serverUrl }, { homeDir: deps.homeDir, store: command.store });
|
|
1953
1950
|
const unlockSecret = await (0, vault_unlock_1.promptConfirmedVaultUnlockSecret)({
|
|
1954
1951
|
promptSecret,
|
|
1955
1952
|
question: `Choose Ouro vault unlock secret for ${email}: `,
|
|
@@ -51,9 +51,7 @@ const hatch_specialist_1 = require("./hatch-specialist");
|
|
|
51
51
|
async function createHatchlingVault(agentName, unlockSecret) {
|
|
52
52
|
const vault = (0, identity_1.resolveVaultConfig)(agentName);
|
|
53
53
|
const { createVaultAccount } = await Promise.resolve().then(() => __importStar(require("../../repertoire/vault-setup")));
|
|
54
|
-
const {
|
|
55
|
-
// Fail before creating the account when this machine has nowhere to keep the unlock secret.
|
|
56
|
-
resolveVaultUnlockStore({ agentName, email: vault.email, serverUrl: vault.serverUrl });
|
|
54
|
+
const { storeVaultUnlockSecret } = await Promise.resolve().then(() => __importStar(require("../../repertoire/vault-unlock")));
|
|
57
55
|
const created = await createVaultAccount(agentName, vault.serverUrl, vault.email, unlockSecret);
|
|
58
56
|
if (!created.success)
|
|
59
57
|
throw new Error(`failed to create the vault for ${agentName}: ${created.error}`);
|
|
@@ -182,14 +182,6 @@ async function execCompleteAdoption(args, deps) {
|
|
|
182
182
|
return "error: complete_adoption requires an interactive vault unlock secret prompt. Re-run `ouro hatch` in a terminal so the human can enter a hatchling vault unlock secret without echoing it.";
|
|
183
183
|
}
|
|
184
184
|
const vault = (0, identity_1.resolveVaultConfig)(name);
|
|
185
|
-
// Resolve the local unlock store before creating the vault account, so a machine without one
|
|
186
|
-
// fails here instead of leaving an orphaned account that a re-run can't register again.
|
|
187
|
-
try {
|
|
188
|
-
(0, vault_unlock_1.resolveVaultUnlockStore)({ agentName: name, email: vault.email, serverUrl: vault.serverUrl });
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
return `error: no local store for the vault unlock secret, so no vault was created. ${error instanceof Error ? error.message : /* v8 ignore next -- defensive: non-Error catch branch @preserve */ String(error)}`;
|
|
192
|
-
}
|
|
193
185
|
let vaultUnlockSecret;
|
|
194
186
|
try {
|
|
195
187
|
vaultUnlockSecret = await (0, vault_unlock_1.promptConfirmedVaultUnlockSecret)({
|
|
@@ -161,71 +161,7 @@ function generateRsaKeypair() {
|
|
|
161
161
|
// ---------------------------------------------------------------------------
|
|
162
162
|
const KDF_PBKDF2 = 0;
|
|
163
163
|
const KDF_ITERATIONS = 600000;
|
|
164
|
-
const
|
|
165
|
-
const REGISTER_FINISH_PATH = "/identity/accounts/register/finish";
|
|
166
|
-
const LEGACY_REGISTER_ACCOUNT_PATH = "/identity/accounts/register";
|
|
167
|
-
const JSON_HEADERS = { "Content-Type": "application/json", Accept: "application/json" };
|
|
168
|
-
async function postJson(url, body) {
|
|
169
|
-
return fetch(url, { method: "POST", headers: JSON_HEADERS, body: JSON.stringify(body) });
|
|
170
|
-
}
|
|
171
|
-
async function readErrorDetail(res) {
|
|
172
|
-
try {
|
|
173
|
-
const body = await res.json();
|
|
174
|
-
return body.message ?? `HTTP ${res.status} ${res.statusText}`;
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
return `HTTP ${res.status} ${res.statusText}`;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function describeRegistrationFailure(detail, url, email) {
|
|
181
|
-
if (/registration not allowed/i.test(detail)) {
|
|
182
|
-
return `the vault server doesn't allow signups for ${email}; ask its admin to invite it (Vaultwarden admin → Invite User), then re-run. (${detail} from ${url})`;
|
|
183
|
-
}
|
|
184
|
-
return `${detail} from ${url}. Check --server; Ouro expects a Bitwarden/Vaultwarden identity API.`;
|
|
185
|
-
}
|
|
186
|
-
/** Vaultwarden returns the token as a JSON string when asked for JSON, or as plain text otherwise. */
|
|
187
|
-
async function readVerificationToken(res) {
|
|
188
|
-
const text = (await res.text()).trim();
|
|
189
|
-
try {
|
|
190
|
-
const parsed = JSON.parse(text);
|
|
191
|
-
return typeof parsed === "string" ? parsed : "";
|
|
192
|
-
}
|
|
193
|
-
catch {
|
|
194
|
-
return text;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Current Bitwarden/Vaultwarden registration: request a verification token, then finish
|
|
199
|
-
* registration with it. Servers that predate this flow (404 on send-verification-email)
|
|
200
|
-
* get the legacy single-step `/identity/accounts/register`.
|
|
201
|
-
*/
|
|
202
|
-
async function registerAccount(serverUrl, agentName, email, payload) {
|
|
203
|
-
const verifyUrl = `${serverUrl}${SEND_VERIFICATION_EMAIL_PATH}`;
|
|
204
|
-
const verifyRes = await postJson(verifyUrl, { email, name: agentName, receiveMarketingEmails: false });
|
|
205
|
-
if (verifyRes.status === 404) {
|
|
206
|
-
const legacyUrl = `${serverUrl}${LEGACY_REGISTER_ACCOUNT_PATH}`;
|
|
207
|
-
const legacyRes = await postJson(legacyUrl, payload);
|
|
208
|
-
if (!legacyRes.ok)
|
|
209
|
-
return { ok: false, url: legacyUrl, error: describeRegistrationFailure(await readErrorDetail(legacyRes), legacyUrl, email) };
|
|
210
|
-
return { ok: true, url: legacyUrl };
|
|
211
|
-
}
|
|
212
|
-
if (!verifyRes.ok) {
|
|
213
|
-
return { ok: false, url: verifyUrl, error: describeRegistrationFailure(await readErrorDetail(verifyRes), verifyUrl, email) };
|
|
214
|
-
}
|
|
215
|
-
const token = verifyRes.status === 204 ? "" : await readVerificationToken(verifyRes);
|
|
216
|
-
if (!token) {
|
|
217
|
-
return {
|
|
218
|
-
ok: false,
|
|
219
|
-
url: verifyUrl,
|
|
220
|
-
error: `the vault server at ${serverUrl} requires email verification for new accounts and sent a link to ${email}; Ouro can't finish that unattended. Ask its admin to create or invite the account with verification off, or finish signup from that email, then re-run.`,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
const finishUrl = `${serverUrl}${REGISTER_FINISH_PATH}`;
|
|
224
|
-
const finishRes = await postJson(finishUrl, { ...payload, emailVerificationToken: token });
|
|
225
|
-
if (!finishRes.ok)
|
|
226
|
-
return { ok: false, url: finishUrl, error: describeRegistrationFailure(await readErrorDetail(finishRes), finishUrl, email) };
|
|
227
|
-
return { ok: true, url: finishUrl };
|
|
228
|
-
}
|
|
164
|
+
const REGISTER_ACCOUNT_PATH = "/identity/accounts/register";
|
|
229
165
|
/**
|
|
230
166
|
* Create a Bitwarden account on the configured Vaultwarden server.
|
|
231
167
|
* Uses the Bitwarden registration API with standard KDF implementation.
|
|
@@ -248,23 +184,35 @@ async function createVaultAccount(agentName, serverUrl, email, masterPassword) {
|
|
|
248
184
|
// Step 3: Generate RSA keypair, encrypt private key with the symmetric key
|
|
249
185
|
const { publicKeyB64, privateKeyDer } = generateRsaKeypair();
|
|
250
186
|
const encryptedPrivateKey = encryptWithStretchedKey(privateKeyDer, symKey);
|
|
251
|
-
// Step 4:
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
187
|
+
// Step 4: POST registration
|
|
188
|
+
const registrationUrl = `${serverUrl}${REGISTER_ACCOUNT_PATH}`;
|
|
189
|
+
const res = await fetch(registrationUrl, {
|
|
190
|
+
method: "POST",
|
|
191
|
+
headers: { "Content-Type": "application/json" },
|
|
192
|
+
body: JSON.stringify({
|
|
193
|
+
name: agentName,
|
|
194
|
+
email,
|
|
195
|
+
masterPasswordHash,
|
|
196
|
+
masterPasswordHint: null,
|
|
197
|
+
key: protectedSymKey,
|
|
198
|
+
kdf: KDF_PBKDF2,
|
|
199
|
+
kdfIterations: KDF_ITERATIONS,
|
|
200
|
+
keys: {
|
|
201
|
+
publicKey: publicKeyB64,
|
|
202
|
+
encryptedPrivateKey,
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
264
205
|
});
|
|
265
|
-
if (!
|
|
266
|
-
|
|
267
|
-
|
|
206
|
+
if (!res.ok) {
|
|
207
|
+
let errorDetail;
|
|
208
|
+
try {
|
|
209
|
+
const body = await res.json();
|
|
210
|
+
errorDetail = body.message ?? `HTTP ${res.status} ${res.statusText}`;
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
errorDetail = `HTTP ${res.status} ${res.statusText}`;
|
|
214
|
+
}
|
|
215
|
+
const endpointAwareError = `${errorDetail} from ${registrationUrl}. Check --server; Ouro expects a Bitwarden/Vaultwarden identity API.`;
|
|
268
216
|
(0, runtime_1.emitNervesEvent)({
|
|
269
217
|
level: "error",
|
|
270
218
|
event: "repertoire.vault_setup_error",
|
|
@@ -284,7 +232,7 @@ async function createVaultAccount(agentName, serverUrl, email, masterPassword) {
|
|
|
284
232
|
}
|
|
285
233
|
catch (err) {
|
|
286
234
|
const reason = err instanceof Error ? err.message : String(err);
|
|
287
|
-
const registrationUrl = `${serverUrl}${
|
|
235
|
+
const registrationUrl = `${serverUrl}${REGISTER_ACCOUNT_PATH}`;
|
|
288
236
|
const endpointAwareError = `cannot reach vault registration endpoint ${registrationUrl}: ${reason}. Check network, DNS/TLS, and --server.`;
|
|
289
237
|
(0, runtime_1.emitNervesEvent)({
|
|
290
238
|
level: "error",
|
|
@@ -33,7 +33,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.VAULT_UNLOCK_STORE_ENV = void 0;
|
|
37
36
|
exports.vaultUnlockReplaceRecoverFix = vaultUnlockReplaceRecoverFix;
|
|
38
37
|
exports.credentialVaultNotConfiguredError = credentialVaultNotConfiguredError;
|
|
39
38
|
exports.isCredentialVaultNotConfiguredError = isCredentialVaultNotConfiguredError;
|
|
@@ -56,8 +55,6 @@ const os = __importStar(require("node:os"));
|
|
|
56
55
|
const path = __importStar(require("node:path"));
|
|
57
56
|
const runtime_1 = require("../nerves/runtime");
|
|
58
57
|
const identity_1 = require("../heart/identity");
|
|
59
|
-
/** Machine-level unlock store choice used when no explicit `--store` is given. */
|
|
60
|
-
exports.VAULT_UNLOCK_STORE_ENV = "OURO_VAULT_UNLOCK_STORE";
|
|
61
58
|
const VAULT_UNLOCK_SERVICE = "ouro.vault";
|
|
62
59
|
const CREDENTIAL_VAULT_NOT_CONFIGURED_PREFIX = "credential vault is not configured in ";
|
|
63
60
|
const PLAINTEXT_UNLOCK_DIR = path.join(".ouro-cli", "vault-unlock");
|
|
@@ -124,7 +121,6 @@ function missingSecureStoreMessage(config) {
|
|
|
124
121
|
"On macOS, Ouro uses Keychain automatically.",
|
|
125
122
|
"On Windows, Ouro uses a CurrentUser DPAPI-encrypted local file automatically.",
|
|
126
123
|
"On Linux/WSL, install and configure Secret Service/libsecret, or choose the explicit plaintext fallback on a trusted machine.",
|
|
127
|
-
`On a headless appliance, set ${exports.VAULT_UNLOCK_STORE_ENV}=plaintext-file for the ouro service and every ouro command (hatch, vault, up) so they all use the plaintext fallback.`,
|
|
128
124
|
"",
|
|
129
125
|
config.agentName
|
|
130
126
|
? `Run \`ouro vault unlock --agent ${config.agentName} --store plaintext-file\` to store the vault unlock secret in a chmod 0600 local file.`
|
|
@@ -201,26 +197,16 @@ function lockedMessage(config, store) {
|
|
|
201
197
|
lostUnlockSecretGuidance(config),
|
|
202
198
|
].join("\n");
|
|
203
199
|
}
|
|
204
|
-
function validateStoreKind(
|
|
200
|
+
function validateStoreKind(store) {
|
|
201
|
+
const requested = store ?? "auto";
|
|
205
202
|
if (!SUPPORTED_STORES.includes(requested)) {
|
|
206
203
|
throw new Error(`unknown vault unlock store '${requested}'. Use auto|macos-keychain|windows-dpapi|linux-secret-service|plaintext-file.`);
|
|
207
204
|
}
|
|
208
205
|
return requested;
|
|
209
206
|
}
|
|
210
|
-
function requestedStoreKind(deps) {
|
|
211
|
-
if (deps.store !== undefined)
|
|
212
|
-
return validateStoreKind(deps.store);
|
|
213
|
-
const fromEnv = (deps.env ?? process.env)[exports.VAULT_UNLOCK_STORE_ENV]?.trim();
|
|
214
|
-
if (!fromEnv)
|
|
215
|
-
return "auto";
|
|
216
|
-
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.`);
|
|
218
|
-
}
|
|
219
|
-
return fromEnv;
|
|
220
|
-
}
|
|
221
207
|
function resolveVaultUnlockStore(config, deps = {}) {
|
|
222
208
|
const canonicalConfig = canonicalizeVaultUnlockConfig(config);
|
|
223
|
-
const requested =
|
|
209
|
+
const requested = validateStoreKind(deps.store);
|
|
224
210
|
const currentPlatform = platform(deps);
|
|
225
211
|
if (requested === "macos-keychain") {
|
|
226
212
|
if (currentPlatform !== "darwin") {
|
|
@@ -536,7 +522,7 @@ function deleteFromStoreExact(config, store, deps) {
|
|
|
536
522
|
return deleteFromPlaintextFileExact(config, deps);
|
|
537
523
|
}
|
|
538
524
|
function readFromAutoPlaintextFallback(config, deps) {
|
|
539
|
-
if (
|
|
525
|
+
if (deps.store !== undefined && deps.store !== "auto")
|
|
540
526
|
return null;
|
|
541
527
|
const store = resolveVaultUnlockStore(config, { ...deps, store: "plaintext-file" });
|
|
542
528
|
const loaded = readFromStore(config, store, deps);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1019",
|
|
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.
|
|
9
|
+
"version": "0.1.0-alpha.1019",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@ouro.bot/friends": "0.1.0-alpha.17",
|