motebit 0.6.4 → 0.6.6
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 +68 -49
- package/package.json +1 -4
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.6" : "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,21 +29229,44 @@ 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
|
+
}
|
|
29247
29270
|
console.log();
|
|
29248
29271
|
console.log(` ${dim("Or run locally without a key:")} ${bold("motebit --provider ollama")}`);
|
|
29249
29272
|
console.log();
|
|
@@ -29251,19 +29274,13 @@ async function main() {
|
|
|
29251
29274
|
}
|
|
29252
29275
|
try {
|
|
29253
29276
|
const resp = await fetch("https://api.anthropic.com/v1/models", {
|
|
29254
|
-
headers: {
|
|
29255
|
-
"x-api-key": key,
|
|
29256
|
-
"anthropic-version": "2023-06-01"
|
|
29257
|
-
}
|
|
29277
|
+
headers: { "x-api-key": key, "anthropic-version": "2023-06-01" }
|
|
29258
29278
|
});
|
|
29259
29279
|
if (!resp.ok) {
|
|
29260
29280
|
console.log();
|
|
29261
|
-
console.log(` ${dim("
|
|
29281
|
+
console.log(` ${dim("That key didn't work. Check it here:")}`);
|
|
29262
29282
|
console.log();
|
|
29263
|
-
console.log(
|
|
29264
|
-
` Check that your key is valid at ${cyan("https://console.anthropic.com/settings/keys")}`
|
|
29265
|
-
);
|
|
29266
|
-
console.log(` Then run ${bold("motebit")} again.`);
|
|
29283
|
+
console.log(` ${cyan("https://console.anthropic.com/settings/keys")}`);
|
|
29267
29284
|
console.log();
|
|
29268
29285
|
return;
|
|
29269
29286
|
}
|
|
@@ -29272,16 +29289,27 @@ async function main() {
|
|
|
29272
29289
|
} else if (config.provider === "openai") {
|
|
29273
29290
|
const key = process.env["OPENAI_API_KEY"];
|
|
29274
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
|
+
}
|
|
29275
29298
|
console.log();
|
|
29276
|
-
console.log(`
|
|
29299
|
+
console.log(` ${cyan("https://platform.openai.com/api-keys")}`);
|
|
29277
29300
|
console.log();
|
|
29278
|
-
console.log(` ${dim("
|
|
29279
|
-
console.log(` ${dim("2.")} Add it to your shell:`);
|
|
29301
|
+
console.log(` ${dim("Then add it to your shell:")}`);
|
|
29280
29302
|
console.log();
|
|
29281
29303
|
console.log(` ${dim("echo 'export OPENAI_API_KEY=sk-...' >> ~/.zshrc")}`);
|
|
29282
29304
|
console.log(` ${dim("source ~/.zshrc")}`);
|
|
29283
29305
|
console.log();
|
|
29284
|
-
|
|
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
|
+
}
|
|
29285
29313
|
console.log();
|
|
29286
29314
|
console.log(` ${dim("Or run locally without a key:")} ${bold("motebit --provider ollama")}`);
|
|
29287
29315
|
console.log();
|
|
@@ -29289,18 +29317,13 @@ async function main() {
|
|
|
29289
29317
|
}
|
|
29290
29318
|
try {
|
|
29291
29319
|
const resp = await fetch("https://api.openai.com/v1/models", {
|
|
29292
|
-
headers: {
|
|
29293
|
-
Authorization: `Bearer ${key}`
|
|
29294
|
-
}
|
|
29320
|
+
headers: { Authorization: `Bearer ${key}` }
|
|
29295
29321
|
});
|
|
29296
29322
|
if (!resp.ok) {
|
|
29297
29323
|
console.log();
|
|
29298
|
-
console.log(` ${dim("
|
|
29324
|
+
console.log(` ${dim("That key didn't work. Check it here:")}`);
|
|
29299
29325
|
console.log();
|
|
29300
|
-
console.log(
|
|
29301
|
-
` Check that your key is valid at ${cyan("https://platform.openai.com/api-keys")}`
|
|
29302
|
-
);
|
|
29303
|
-
console.log(` Then run ${bold("motebit")} again.`);
|
|
29326
|
+
console.log(` ${cyan("https://platform.openai.com/api-keys")}`);
|
|
29304
29327
|
console.log();
|
|
29305
29328
|
return;
|
|
29306
29329
|
}
|
|
@@ -29315,9 +29338,7 @@ async function main() {
|
|
|
29315
29338
|
await decryptPrivateKey(fullConfig.cli_encrypted_key, passphrase);
|
|
29316
29339
|
} catch {
|
|
29317
29340
|
console.log();
|
|
29318
|
-
console.log(` ${dim("
|
|
29319
|
-
console.log();
|
|
29320
|
-
console.log(` ${dim("Try again, or reset your identity:")}`);
|
|
29341
|
+
console.log(` ${dim("That wasn't right. Try again, or start fresh:")}`);
|
|
29321
29342
|
console.log();
|
|
29322
29343
|
console.log(` ${dim("rm ~/.motebit/config.json")}`);
|
|
29323
29344
|
console.log(` ${dim("motebit")}`);
|
|
@@ -29325,37 +29346,33 @@ async function main() {
|
|
|
29325
29346
|
process.exit(1);
|
|
29326
29347
|
}
|
|
29327
29348
|
} else if (fullConfig.cli_private_key != null && fullConfig.cli_private_key !== "") {
|
|
29328
|
-
console.log("Migrating
|
|
29329
|
-
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: ");
|
|
29330
29351
|
if (passphrase === "") {
|
|
29331
|
-
console.error("
|
|
29352
|
+
console.error(" Passphrase cannot be empty.");
|
|
29332
29353
|
process.exit(1);
|
|
29333
29354
|
}
|
|
29334
29355
|
fullConfig.cli_encrypted_key = await encryptPrivateKey(fullConfig.cli_private_key, passphrase);
|
|
29335
29356
|
delete fullConfig.cli_private_key;
|
|
29336
29357
|
const { saveFullConfig: saveFullConfig2 } = await Promise.resolve().then(() => (init_config2(), config_exports));
|
|
29337
29358
|
saveFullConfig2(fullConfig);
|
|
29338
|
-
console.log("
|
|
29359
|
+
console.log(dim(" Done \u2014 plaintext key removed."));
|
|
29339
29360
|
} else {
|
|
29340
|
-
console.log();
|
|
29341
|
-
console.log(` ${dim("\
|
|
29342
|
-
console.log();
|
|
29343
|
-
console.log(` ${dim("Your mote gets its own Ed25519 keypair \u2014 a cryptographic")}`);
|
|
29344
|
-
console.log(` ${dim("identity that signs everything it does. The passphrase")}`);
|
|
29345
|
-
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.")}`);
|
|
29346
29363
|
console.log();
|
|
29347
29364
|
passphrase = envPassphrase ?? await promptPassphrase(" Set a passphrase: ");
|
|
29348
29365
|
if (!passphrase) {
|
|
29349
|
-
console.error("
|
|
29366
|
+
console.error(" Passphrase cannot be empty.");
|
|
29350
29367
|
process.exit(1);
|
|
29351
29368
|
}
|
|
29352
29369
|
if (!envPassphrase) {
|
|
29353
|
-
const confirm = await promptPassphrase(" Confirm
|
|
29370
|
+
const confirm = await promptPassphrase(" Confirm: ");
|
|
29354
29371
|
if (confirm !== passphrase) {
|
|
29355
29372
|
console.log();
|
|
29356
|
-
console.log(
|
|
29357
|
-
|
|
29358
|
-
|
|
29373
|
+
console.log(
|
|
29374
|
+
` ${dim("Those didn't match. Run")} ${bold("motebit")} ${dim("to try again.")}`
|
|
29375
|
+
);
|
|
29359
29376
|
console.log();
|
|
29360
29377
|
process.exit(1);
|
|
29361
29378
|
}
|
|
@@ -29378,9 +29395,11 @@ async function main() {
|
|
|
29378
29395
|
const { motebitId, isFirstLaunch } = await bootstrapIdentity2(tempDb, fullConfig, passphrase);
|
|
29379
29396
|
tempDb.close();
|
|
29380
29397
|
if (isFirstLaunch) {
|
|
29381
|
-
console.log(
|
|
29382
|
-
|
|
29383
|
-
|
|
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();
|
|
29384
29403
|
}
|
|
29385
29404
|
const reloadedConfig = loadFullConfig();
|
|
29386
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.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Sovereign AI agent — persistent identity, accumulated trust, governance at the boundary",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,9 +56,6 @@
|
|
|
56
56
|
"sql.js": "^1.11.0",
|
|
57
57
|
"ws": "^8.18.0"
|
|
58
58
|
},
|
|
59
|
-
"optionalDependencies": {
|
|
60
|
-
"@xenova/transformers": "^2.17.2"
|
|
61
|
-
},
|
|
62
59
|
"devDependencies": {
|
|
63
60
|
"@motebit/runtime": "workspace:*",
|
|
64
61
|
"@motebit/ai-core": "workspace:*",
|