motebit 0.6.5 → 0.6.8

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