motebit 0.6.6 → 0.6.9

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.
Files changed (2) hide show
  1. package/dist/index.js +36 -95
  2. package/package.json +1 -1
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.6" : "0.0.0-dev";
5318
+ VERSION = true ? "0.6.9" : "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,101 +29229,34 @@ 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
- }
29246
- if (config.provider === "anthropic") {
29247
- const key = process.env["ANTHROPIC_API_KEY"];
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
- }
29255
- console.log();
29256
- console.log(` ${cyan("https://console.anthropic.com/settings/keys")}`);
29232
+ if (config.provider === "anthropic" || config.provider === "openai") {
29233
+ const keyEnvName = config.provider === "openai" ? "OPENAI_API_KEY" : "ANTHROPIC_API_KEY";
29234
+ const keyUrl = config.provider === "openai" ? "https://platform.openai.com/api-keys" : "https://console.anthropic.com/settings/keys";
29235
+ const apiKey = process.env[keyEnvName];
29236
+ if (!apiKey) {
29257
29237
  console.log();
29258
- console.log(` ${dim("Then add it to your shell:")}`);
29238
+ console.log(` ${bold(keyEnvName)} ${dim("not set")}`);
29259
29239
  console.log();
29260
- console.log(` ${dim("echo 'export ANTHROPIC_API_KEY=sk-ant-...' >> ~/.zshrc")}`);
29261
- console.log(` ${dim("source ~/.zshrc")}`);
29240
+ console.log(` ${dim("export")} ${keyEnvName}=${dim("sk-...")}`);
29262
29241
  console.log();
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")}`);
29272
- console.log();
29273
- return;
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
- }
29289
- } else if (config.provider === "openai") {
29290
- const key = process.env["OPENAI_API_KEY"];
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
- }
29298
- console.log();
29299
- console.log(` ${cyan("https://platform.openai.com/api-keys")}`);
29300
- console.log();
29301
- console.log(` ${dim("Then add it to your shell:")}`);
29302
- console.log();
29303
- console.log(` ${dim("echo 'export OPENAI_API_KEY=sk-...' >> ~/.zshrc")}`);
29304
- console.log(` ${dim("source ~/.zshrc")}`);
29305
- console.log();
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
- }
29242
+ console.log(
29243
+ ` ${dim("To persist:")} ${dim(`echo 'export ${keyEnvName}=sk-...' >> ~/.zshrc`)}`
29244
+ );
29313
29245
  console.log();
29314
- console.log(` ${dim("Or run locally without a key:")} ${bold("motebit --provider ollama")}`);
29246
+ console.log(` ${dim("Get a key:")} ${cyan(keyUrl)}`);
29247
+ console.log(` ${dim("Or run local:")} ${bold("motebit --provider ollama")}`);
29315
29248
  console.log();
29316
29249
  return;
29317
29250
  }
29318
29251
  try {
29319
- const resp = await fetch("https://api.openai.com/v1/models", {
29320
- headers: { Authorization: `Bearer ${key}` }
29321
- });
29252
+ const validateUrl = config.provider === "openai" ? "https://api.openai.com/v1/models" : "https://api.anthropic.com/v1/models";
29253
+ const validateHeaders = config.provider === "openai" ? { Authorization: `Bearer ${apiKey}` } : { "x-api-key": apiKey, "anthropic-version": "2023-06-01" };
29254
+ const resp = await fetch(validateUrl, { headers: validateHeaders });
29322
29255
  if (!resp.ok) {
29323
29256
  console.log();
29324
- console.log(` ${dim("That key didn't work. Check it here:")}`);
29257
+ console.log(` ${bold(keyEnvName)} ${dim("is set but invalid")}`);
29325
29258
  console.log();
29326
- console.log(` ${cyan("https://platform.openai.com/api-keys")}`);
29259
+ console.log(` ${dim("Check your key:")} ${cyan(keyUrl)}`);
29327
29260
  console.log();
29328
29261
  return;
29329
29262
  }
@@ -29338,15 +29271,14 @@ async function main() {
29338
29271
  await decryptPrivateKey(fullConfig.cli_encrypted_key, passphrase);
29339
29272
  } catch {
29340
29273
  console.log();
29341
- console.log(` ${dim("That wasn't right. Try again, or start fresh:")}`);
29274
+ console.log(` ${dim("Incorrect. Try again, or start fresh:")}`);
29342
29275
  console.log();
29343
- console.log(` ${dim("rm ~/.motebit/config.json")}`);
29344
- console.log(` ${dim("motebit")}`);
29276
+ console.log(` ${dim("rm ~/.motebit/config.json && motebit")}`);
29345
29277
  console.log();
29346
29278
  process.exit(1);
29347
29279
  }
29348
29280
  } else if (fullConfig.cli_private_key != null && fullConfig.cli_private_key !== "") {
29349
- console.log(dim(" Migrating your key to encrypted storage..."));
29281
+ console.log(dim(" Migrating private key to encrypted storage..."));
29350
29282
  passphrase = envPassphrase ?? await promptPassphrase(" Set a passphrase: ");
29351
29283
  if (passphrase === "") {
29352
29284
  console.error(" Passphrase cannot be empty.");
@@ -29356,10 +29288,21 @@ async function main() {
29356
29288
  delete fullConfig.cli_private_key;
29357
29289
  const { saveFullConfig: saveFullConfig2 } = await Promise.resolve().then(() => (init_config2(), config_exports));
29358
29290
  saveFullConfig2(fullConfig);
29359
- console.log(dim(" Done \u2014 plaintext key removed."));
29291
+ console.log(dim(" Encrypted. Plaintext removed."));
29360
29292
  } else {
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.")}`);
29293
+ console.log();
29294
+ console.log(dim(" ."));
29295
+ console.log(dim(" .:::."));
29296
+ console.log(dim(" .:::::."));
29297
+ console.log(dim(" :::::::"));
29298
+ console.log(dim(" ':::::' "));
29299
+ console.log(dim(" '''"));
29300
+ console.log();
29301
+ console.log(` ${dim("Your mote gets its own Ed25519 keypair \u2014 a cryptographic")}`);
29302
+ console.log(` ${dim("identity that signs everything it does.")}`);
29303
+ console.log();
29304
+ console.log(` ${dim("The passphrase encrypts this key on disk.")}`);
29305
+ console.log(` ${dim("You'll need it each session.")}`);
29363
29306
  console.log();
29364
29307
  passphrase = envPassphrase ?? await promptPassphrase(" Set a passphrase: ");
29365
29308
  if (!passphrase) {
@@ -29370,9 +29313,7 @@ async function main() {
29370
29313
  const confirm = await promptPassphrase(" Confirm: ");
29371
29314
  if (confirm !== passphrase) {
29372
29315
  console.log();
29373
- console.log(
29374
- ` ${dim("Those didn't match. Run")} ${bold("motebit")} ${dim("to try again.")}`
29375
- );
29316
+ console.log(` ${dim("Didn't match. Run")} ${bold("motebit")} ${dim("to try again.")}`);
29376
29317
  console.log();
29377
29318
  process.exit(1);
29378
29319
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motebit",
3
- "version": "0.6.6",
3
+ "version": "0.6.9",
4
4
  "type": "module",
5
5
  "description": "Sovereign AI agent — persistent identity, accumulated trust, governance at the boundary",
6
6
  "main": "./dist/index.js",