motebit 0.6.3 → 0.6.5
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/dist/index.js +101 -28
- package/package.json +1 -3
package/dist/index.js
CHANGED
|
@@ -5315,7 +5315,7 @@ var init_config2 = __esm({
|
|
|
5315
5315
|
"src/config.ts"() {
|
|
5316
5316
|
"use strict";
|
|
5317
5317
|
init_esm_shims();
|
|
5318
|
-
VERSION = true ? "0.6.
|
|
5318
|
+
VERSION = true ? "0.6.5" : "0.0.0-dev";
|
|
5319
5319
|
CONFIG_DIR = path2.join(os.homedir(), ".motebit");
|
|
5320
5320
|
CONFIG_PATH = path2.join(CONFIG_DIR, "config.json");
|
|
5321
5321
|
}
|
|
@@ -29229,40 +29229,106 @@ async function main() {
|
|
|
29229
29229
|
if (fullConfig.max_tokens != null && !process.argv.includes("--max-tokens")) {
|
|
29230
29230
|
config.maxTokens = fullConfig.max_tokens;
|
|
29231
29231
|
}
|
|
29232
|
+
const isFirstLaunchFlow = !fullConfig.cli_encrypted_key && (fullConfig.cli_private_key == null || fullConfig.cli_private_key === "");
|
|
29233
|
+
if (isFirstLaunchFlow) {
|
|
29234
|
+
console.log();
|
|
29235
|
+
console.log(dim(" ."));
|
|
29236
|
+
console.log(dim(" .:::."));
|
|
29237
|
+
console.log(dim(" .:::::."));
|
|
29238
|
+
console.log(dim(" :::::::"));
|
|
29239
|
+
console.log(dim(" ':::::' "));
|
|
29240
|
+
console.log(dim(" '''"));
|
|
29241
|
+
console.log();
|
|
29242
|
+
console.log(` ${dim("Hello. I'm your mote \u2014 a small, curious being.")}`);
|
|
29243
|
+
console.log(` ${dim("Let me get set up so I can think.")}`);
|
|
29244
|
+
console.log();
|
|
29245
|
+
}
|
|
29232
29246
|
if (config.provider === "anthropic") {
|
|
29233
29247
|
const key = process.env["ANTHROPIC_API_KEY"];
|
|
29234
29248
|
if (key == null || key === "") {
|
|
29249
|
+
if (isFirstLaunchFlow) {
|
|
29250
|
+
console.log(` ${dim("I need an API key to think. You can get one here:")}`);
|
|
29251
|
+
} else {
|
|
29252
|
+
console.log();
|
|
29253
|
+
console.log(` ${dim("\u2500")} ${bold("motebit")}${dim(" needs an API key to think")}`);
|
|
29254
|
+
}
|
|
29235
29255
|
console.log();
|
|
29236
|
-
console.log(`
|
|
29256
|
+
console.log(` ${cyan("https://console.anthropic.com/settings/keys")}`);
|
|
29237
29257
|
console.log();
|
|
29238
|
-
console.log(
|
|
29239
|
-
` ${dim("1.")} Get a key from ${cyan("https://console.anthropic.com/settings/keys")}`
|
|
29240
|
-
);
|
|
29241
|
-
console.log(` ${dim("2.")} Add it to your shell:`);
|
|
29258
|
+
console.log(` ${dim("Then add it to your shell:")}`);
|
|
29242
29259
|
console.log();
|
|
29243
29260
|
console.log(` ${dim("echo 'export ANTHROPIC_API_KEY=sk-ant-...' >> ~/.zshrc")}`);
|
|
29244
29261
|
console.log(` ${dim("source ~/.zshrc")}`);
|
|
29245
29262
|
console.log();
|
|
29246
|
-
|
|
29263
|
+
if (isFirstLaunchFlow) {
|
|
29264
|
+
console.log(
|
|
29265
|
+
` ${dim("Run")} ${bold("motebit")} ${dim("when you're ready. I'll be here.")}`
|
|
29266
|
+
);
|
|
29267
|
+
} else {
|
|
29268
|
+
console.log(` ${dim("Run")} ${bold("motebit")} ${dim("again.")}`);
|
|
29269
|
+
}
|
|
29270
|
+
console.log();
|
|
29271
|
+
console.log(` ${dim("Or run locally without a key:")} ${bold("motebit --provider ollama")}`);
|
|
29247
29272
|
console.log();
|
|
29248
29273
|
return;
|
|
29249
29274
|
}
|
|
29275
|
+
try {
|
|
29276
|
+
const resp = await fetch("https://api.anthropic.com/v1/models", {
|
|
29277
|
+
headers: { "x-api-key": key, "anthropic-version": "2023-06-01" }
|
|
29278
|
+
});
|
|
29279
|
+
if (!resp.ok) {
|
|
29280
|
+
console.log();
|
|
29281
|
+
console.log(` ${dim("That key didn't work. Check it here:")}`);
|
|
29282
|
+
console.log();
|
|
29283
|
+
console.log(` ${cyan("https://console.anthropic.com/settings/keys")}`);
|
|
29284
|
+
console.log();
|
|
29285
|
+
return;
|
|
29286
|
+
}
|
|
29287
|
+
} catch {
|
|
29288
|
+
}
|
|
29250
29289
|
} else if (config.provider === "openai") {
|
|
29251
29290
|
const key = process.env["OPENAI_API_KEY"];
|
|
29252
29291
|
if (key == null || key === "") {
|
|
29292
|
+
if (isFirstLaunchFlow) {
|
|
29293
|
+
console.log(` ${dim("I need an API key to think. You can get one here:")}`);
|
|
29294
|
+
} else {
|
|
29295
|
+
console.log();
|
|
29296
|
+
console.log(` ${dim("\u2500")} ${bold("motebit")}${dim(" needs an API key to think")}`);
|
|
29297
|
+
}
|
|
29253
29298
|
console.log();
|
|
29254
|
-
console.log(`
|
|
29299
|
+
console.log(` ${cyan("https://platform.openai.com/api-keys")}`);
|
|
29255
29300
|
console.log();
|
|
29256
|
-
console.log(` ${dim("
|
|
29257
|
-
console.log(` ${dim("2.")} Add it to your shell:`);
|
|
29301
|
+
console.log(` ${dim("Then add it to your shell:")}`);
|
|
29258
29302
|
console.log();
|
|
29259
29303
|
console.log(` ${dim("echo 'export OPENAI_API_KEY=sk-...' >> ~/.zshrc")}`);
|
|
29260
29304
|
console.log(` ${dim("source ~/.zshrc")}`);
|
|
29261
29305
|
console.log();
|
|
29262
|
-
|
|
29306
|
+
if (isFirstLaunchFlow) {
|
|
29307
|
+
console.log(
|
|
29308
|
+
` ${dim("Run")} ${bold("motebit")} ${dim("when you're ready. I'll be here.")}`
|
|
29309
|
+
);
|
|
29310
|
+
} else {
|
|
29311
|
+
console.log(` ${dim("Run")} ${bold("motebit")} ${dim("again.")}`);
|
|
29312
|
+
}
|
|
29313
|
+
console.log();
|
|
29314
|
+
console.log(` ${dim("Or run locally without a key:")} ${bold("motebit --provider ollama")}`);
|
|
29263
29315
|
console.log();
|
|
29264
29316
|
return;
|
|
29265
29317
|
}
|
|
29318
|
+
try {
|
|
29319
|
+
const resp = await fetch("https://api.openai.com/v1/models", {
|
|
29320
|
+
headers: { Authorization: `Bearer ${key}` }
|
|
29321
|
+
});
|
|
29322
|
+
if (!resp.ok) {
|
|
29323
|
+
console.log();
|
|
29324
|
+
console.log(` ${dim("That key didn't work. Check it here:")}`);
|
|
29325
|
+
console.log();
|
|
29326
|
+
console.log(` ${cyan("https://platform.openai.com/api-keys")}`);
|
|
29327
|
+
console.log();
|
|
29328
|
+
return;
|
|
29329
|
+
}
|
|
29330
|
+
} catch {
|
|
29331
|
+
}
|
|
29266
29332
|
}
|
|
29267
29333
|
const envPassphrase = process.env["MOTEBIT_PASSPHRASE"];
|
|
29268
29334
|
let passphrase;
|
|
@@ -29272,9 +29338,7 @@ async function main() {
|
|
|
29272
29338
|
await decryptPrivateKey(fullConfig.cli_encrypted_key, passphrase);
|
|
29273
29339
|
} catch {
|
|
29274
29340
|
console.log();
|
|
29275
|
-
console.log(` ${dim("
|
|
29276
|
-
console.log();
|
|
29277
|
-
console.log(` ${dim("Try again, or reset your identity:")}`);
|
|
29341
|
+
console.log(` ${dim("That wasn't right. Try again, or start fresh:")}`);
|
|
29278
29342
|
console.log();
|
|
29279
29343
|
console.log(` ${dim("rm ~/.motebit/config.json")}`);
|
|
29280
29344
|
console.log(` ${dim("motebit")}`);
|
|
@@ -29282,30 +29346,37 @@ async function main() {
|
|
|
29282
29346
|
process.exit(1);
|
|
29283
29347
|
}
|
|
29284
29348
|
} else if (fullConfig.cli_private_key != null && fullConfig.cli_private_key !== "") {
|
|
29285
|
-
console.log("Migrating
|
|
29286
|
-
passphrase = envPassphrase ?? await promptPassphrase("Set a passphrase
|
|
29349
|
+
console.log(dim(" Migrating your key to encrypted storage..."));
|
|
29350
|
+
passphrase = envPassphrase ?? await promptPassphrase(" Set a passphrase: ");
|
|
29287
29351
|
if (passphrase === "") {
|
|
29288
|
-
console.error("
|
|
29352
|
+
console.error(" Passphrase cannot be empty.");
|
|
29289
29353
|
process.exit(1);
|
|
29290
29354
|
}
|
|
29291
29355
|
fullConfig.cli_encrypted_key = await encryptPrivateKey(fullConfig.cli_private_key, passphrase);
|
|
29292
29356
|
delete fullConfig.cli_private_key;
|
|
29293
29357
|
const { saveFullConfig: saveFullConfig2 } = await Promise.resolve().then(() => (init_config2(), config_exports));
|
|
29294
29358
|
saveFullConfig2(fullConfig);
|
|
29295
|
-
console.log("
|
|
29359
|
+
console.log(dim(" Done \u2014 plaintext key removed."));
|
|
29296
29360
|
} else {
|
|
29297
|
-
console.log();
|
|
29298
|
-
console.log(` ${dim("\
|
|
29299
|
-
console.log();
|
|
29300
|
-
console.log(` ${dim("Your mote gets its own Ed25519 keypair \u2014 a cryptographic")}`);
|
|
29301
|
-
console.log(` ${dim("identity that signs everything it does. The passphrase")}`);
|
|
29302
|
-
console.log(` ${dim("encrypts this key on disk. You'll need it each session.")}`);
|
|
29361
|
+
console.log(` ${dim("I need a passphrase to protect my keypair.")}`);
|
|
29362
|
+
console.log(` ${dim("This is my identity \u2014 I'll ask for it each session.")}`);
|
|
29303
29363
|
console.log();
|
|
29304
29364
|
passphrase = envPassphrase ?? await promptPassphrase(" Set a passphrase: ");
|
|
29305
29365
|
if (!passphrase) {
|
|
29306
|
-
console.error("
|
|
29366
|
+
console.error(" Passphrase cannot be empty.");
|
|
29307
29367
|
process.exit(1);
|
|
29308
29368
|
}
|
|
29369
|
+
if (!envPassphrase) {
|
|
29370
|
+
const confirm = await promptPassphrase(" Confirm: ");
|
|
29371
|
+
if (confirm !== passphrase) {
|
|
29372
|
+
console.log();
|
|
29373
|
+
console.log(
|
|
29374
|
+
` ${dim("Those didn't match. Run")} ${bold("motebit")} ${dim("to try again.")}`
|
|
29375
|
+
);
|
|
29376
|
+
console.log();
|
|
29377
|
+
process.exit(1);
|
|
29378
|
+
}
|
|
29379
|
+
}
|
|
29309
29380
|
}
|
|
29310
29381
|
enableBracketedPaste();
|
|
29311
29382
|
let rl = null;
|
|
@@ -29324,9 +29395,11 @@ async function main() {
|
|
|
29324
29395
|
const { motebitId, isFirstLaunch } = await bootstrapIdentity2(tempDb, fullConfig, passphrase);
|
|
29325
29396
|
tempDb.close();
|
|
29326
29397
|
if (isFirstLaunch) {
|
|
29327
|
-
console.log(
|
|
29328
|
-
|
|
29329
|
-
|
|
29398
|
+
console.log();
|
|
29399
|
+
console.log(
|
|
29400
|
+
` ${dim("I'm")} ${cyan(motebitId.slice(0, 8))}${dim(". My keypair is stored in ~/.motebit/")}`
|
|
29401
|
+
);
|
|
29402
|
+
console.log();
|
|
29330
29403
|
}
|
|
29331
29404
|
const reloadedConfig = loadFullConfig();
|
|
29332
29405
|
let syncEncKey;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motebit",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Sovereign AI agent — persistent identity, accumulated trust, governance at the boundary",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"ws": "^8.18.0"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"better-sqlite3": "^11.0.0",
|
|
61
60
|
"@xenova/transformers": "^2.17.2"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
@@ -79,7 +78,6 @@
|
|
|
79
78
|
"@motebit/crypto": "workspace:*",
|
|
80
79
|
"@motebit/core-identity": "workspace:*",
|
|
81
80
|
"@motebit/identity-file": "workspace:*",
|
|
82
|
-
"@types/better-sqlite3": "^7.6.0",
|
|
83
81
|
"@types/node": "^22.0.0",
|
|
84
82
|
"tsup": "^8.0.0",
|
|
85
83
|
"tsx": "^4.19.0",
|