motebit 1.0.1 → 1.1.1

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 +122 -94
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -11948,8 +11948,8 @@ var init_config2 = __esm({
11948
11948
  "src/config.ts"() {
11949
11949
  "use strict";
11950
11950
  init_esm_shims();
11951
- VERSION = true ? "1.0.1" : "0.0.0-dev";
11952
- CONFIG_DIR = path2.join(os.homedir(), ".motebit");
11951
+ VERSION = true ? "1.1.1" : "0.0.0-dev";
11952
+ CONFIG_DIR = process.env["MOTEBIT_CONFIG_DIR"] ?? path2.join(os.homedir(), ".motebit");
11953
11953
  CONFIG_PATH = path2.join(CONFIG_DIR, "config.json");
11954
11954
  RELAY_DIR = path2.join(CONFIG_DIR, "relay");
11955
11955
  RELAY_DB_PATH = path2.join(RELAY_DIR, "relay.db");
@@ -23250,7 +23250,7 @@ A motebit is a droplet of intelligence under surface tension \u2014 body passive
23250
23250
  id: "README.md#versioning",
23251
23251
  source: "README.md",
23252
23252
  title: "Versioning",
23253
- content: "12 packages publish to npm \u2014 11 Apache-2.0 (the permissive floor) and 1 BSL-1.1 (the `motebit` reference runtime, with the CLI as its primary surface). All 12 are at `1.0.0`. Breaking changes to any of their public surfaces require a major bump.\n\nThe 51 workspace-private packages \u2014 `@motebit/runtime`, `@motebit/api`, `@motebit/ai-core`, `@motebit/memory-graph`, `@motebit/policy`, `@motebit/sync-engine`, and the rest of the interior machinery \u2014 exist for source organization and do not publish independently. They carry a sentinel version `0.0.0-private` so the absence of a semver claim is explicit at the source: the only stability promises this repo makes live on the 12 published packages above.\n\n**The public promise of `motebit@1.0` is its bundled operator-facing surface \u2014 subcommands, flags, exit codes, `~/.motebit/` layout, relay HTTP routes, MCP server tool list \u2014 not the internal workspace package graph.** The Apache-2.0 protocol packages (`@motebit/protocol`, `@motebit/sdk`, `@motebit/crypto`) promise wire-format and type stability independently, gated by `check-api-surface`.",
23253
+ content: "12 packages publish to npm \u2014 11 Apache-2.0 (the permissive floor) and 1 BSL-1.1 (the `motebit` reference runtime, with the CLI as its primary surface). All 12 are at `1.0.0`. Breaking changes to any of their public surfaces require a major bump.\n\nThe 51 workspace-private packages \u2014 `@motebit/runtime`, `@motebit/relay`, `@motebit/ai-core`, `@motebit/memory-graph`, `@motebit/policy`, `@motebit/sync-engine`, and the rest of the interior machinery \u2014 exist for source organization and do not publish independently. They carry a sentinel version `0.0.0-private` so the absence of a semver claim is explicit at the source: the only stability promises this repo makes live on the 12 published packages above.\n\n**The public promise of `motebit@1.0` is its bundled operator-facing surface \u2014 subcommands, flags, exit codes, `~/.motebit/` layout, relay HTTP routes, MCP server tool list \u2014 not the internal workspace package graph.** The Apache-2.0 protocol packages (`@motebit/protocol`, `@motebit/sdk`, `@motebit/crypto`) promise wire-format and type stability independently, gated by `check-api-surface`.",
23254
23254
  termFrequencies: {
23255
23255
  "0": 8,
23256
23256
  "1": 5,
@@ -56457,6 +56457,7 @@ function createProvider(config, personalityConfig) {
56457
56457
  }
56458
56458
  function buildToolRegistry(config, runtimeRef, motebitId) {
56459
56459
  const registry = new InMemoryToolRegistry();
56460
+ if (config.direct) return registry;
56460
56461
  registry.register(readFileDefinition, createReadFileHandler(config.allowedPaths));
56461
56462
  const braveKey = process.env["BRAVE_SEARCH_API_KEY"];
56462
56463
  let searchProvider;
@@ -57014,7 +57015,7 @@ var init_dist32 = __esm({
57014
57015
  }
57015
57016
  });
57016
57017
 
57017
- // ../../services/api/dist/request-context.js
57018
+ // ../../services/relay/dist/request-context.js
57018
57019
  import { AsyncLocalStorage } from "async_hooks";
57019
57020
  function getRequestContext() {
57020
57021
  return requestContext.getStore();
@@ -57030,14 +57031,14 @@ function enrichRequestContext(fields) {
57030
57031
  }
57031
57032
  var requestContext;
57032
57033
  var init_request_context = __esm({
57033
- "../../services/api/dist/request-context.js"() {
57034
+ "../../services/relay/dist/request-context.js"() {
57034
57035
  "use strict";
57035
57036
  init_esm_shims();
57036
57037
  requestContext = new AsyncLocalStorage();
57037
57038
  }
57038
57039
  });
57039
57040
 
57040
- // ../../services/api/dist/logger.js
57041
+ // ../../services/relay/dist/logger.js
57041
57042
  function emit(entry) {
57042
57043
  if (LOG_LEVELS[entry.level] < LOG_LEVELS[minLevel])
57043
57044
  return;
@@ -57069,7 +57070,7 @@ function createLogger(context = {}) {
57069
57070
  }
57070
57071
  var LOG_LEVELS, minLevel;
57071
57072
  var init_logger = __esm({
57072
- "../../services/api/dist/logger.js"() {
57073
+ "../../services/relay/dist/logger.js"() {
57073
57074
  "use strict";
57074
57075
  init_esm_shims();
57075
57076
  init_request_context();
@@ -57078,10 +57079,10 @@ var init_logger = __esm({
57078
57079
  }
57079
57080
  });
57080
57081
 
57081
- // ../../services/api/dist/errors.js
57082
+ // ../../services/relay/dist/errors.js
57082
57083
  var RelayError, AuthenticationError, AuthorizationError, InsufficientFundsError, SettlementError, AllocationError, RateLimitError, FederationError, TaskError;
57083
57084
  var init_errors2 = __esm({
57084
- "../../services/api/dist/errors.js"() {
57085
+ "../../services/relay/dist/errors.js"() {
57085
57086
  "use strict";
57086
57087
  init_esm_shims();
57087
57088
  RelayError = class extends Error {
@@ -57147,10 +57148,10 @@ var init_errors2 = __esm({
57147
57148
  }
57148
57149
  });
57149
57150
 
57150
- // ../../services/api/dist/rate-limiter.js
57151
+ // ../../services/relay/dist/rate-limiter.js
57151
57152
  var FixedWindowLimiter;
57152
57153
  var init_rate_limiter = __esm({
57153
- "../../services/api/dist/rate-limiter.js"() {
57154
+ "../../services/relay/dist/rate-limiter.js"() {
57154
57155
  "use strict";
57155
57156
  init_esm_shims();
57156
57157
  FixedWindowLimiter = class {
@@ -57211,7 +57212,7 @@ var init_rate_limiter = __esm({
57211
57212
  }
57212
57213
  });
57213
57214
 
57214
- // ../../services/api/dist/anchoring.js
57215
+ // ../../services/relay/dist/anchoring.js
57215
57216
  function createAnchoringTables(db) {
57216
57217
  db.exec(`
57217
57218
  CREATE TABLE IF NOT EXISTS relay_anchor_batches (
@@ -57666,7 +57667,7 @@ async function getAgentSettlementProof(db, settlementId) {
57666
57667
  }
57667
57668
  var AGENT_SETTLEMENT_ANCHOR_SUITE, logger, DEFAULT_BATCH_MAX_SIZE, DEFAULT_BATCH_INTERVAL_MS, EvmContractSubmitter, ANCHOR_SELECTOR;
57668
57669
  var init_anchoring = __esm({
57669
- "../../services/api/dist/anchoring.js"() {
57670
+ "../../services/relay/dist/anchoring.js"() {
57670
57671
  "use strict";
57671
57672
  init_esm_shims();
57672
57673
  init_dist6();
@@ -57723,7 +57724,7 @@ var init_anchoring = __esm({
57723
57724
  }
57724
57725
  });
57725
57726
 
57726
- // ../../services/api/dist/credential-anchoring.js
57727
+ // ../../services/relay/dist/credential-anchoring.js
57727
57728
  function createCredentialAnchoringTables(db) {
57728
57729
  db.exec(`
57729
57730
  CREATE TABLE IF NOT EXISTS relay_credential_anchor_batches (
@@ -58006,7 +58007,7 @@ function getCredentialAnchorBatch(db, batchId) {
58006
58007
  }
58007
58008
  var logger2, DEFAULT_BATCH_MAX_SIZE2, DEFAULT_BATCH_INTERVAL_MS2;
58008
58009
  var init_credential_anchoring = __esm({
58009
- "../../services/api/dist/credential-anchoring.js"() {
58010
+ "../../services/relay/dist/credential-anchoring.js"() {
58010
58011
  "use strict";
58011
58012
  init_esm_shims();
58012
58013
  init_dist6();
@@ -58017,7 +58018,7 @@ var init_credential_anchoring = __esm({
58017
58018
  }
58018
58019
  });
58019
58020
 
58020
- // ../../services/api/dist/retry-policy.js
58021
+ // ../../services/relay/dist/retry-policy.js
58021
58022
  function nextRetryDelay(attempt, policy = DEFAULT_RETRY_POLICY, random = Math.random()) {
58022
58023
  const exponential = Math.min(policy.baseDelayMs * Math.pow(2, attempt), policy.maxDelayMs);
58023
58024
  const jitter = exponential * policy.jitterFraction * (random * 2 - 1);
@@ -58025,7 +58026,7 @@ function nextRetryDelay(attempt, policy = DEFAULT_RETRY_POLICY, random = Math.ra
58025
58026
  }
58026
58027
  var DEFAULT_RETRY_POLICY;
58027
58028
  var init_retry_policy = __esm({
58028
- "../../services/api/dist/retry-policy.js"() {
58029
+ "../../services/relay/dist/retry-policy.js"() {
58029
58030
  "use strict";
58030
58031
  init_esm_shims();
58031
58032
  DEFAULT_RETRY_POLICY = {
@@ -58962,7 +58963,7 @@ var init_dist33 = __esm({
58962
58963
  }
58963
58964
  });
58964
58965
 
58965
- // ../../services/api/dist/federation.js
58966
+ // ../../services/relay/dist/federation.js
58966
58967
  var federation_exports = {};
58967
58968
  __export(federation_exports, {
58968
58969
  PeerRateLimiter: () => FixedWindowLimiter,
@@ -59808,7 +59809,7 @@ function registerFederationRoutes(deps) {
59808
59809
  }
59809
59810
  var FEDERATION_SUITE, logger3, REVOCATION_TTL_MS, revocationAnchorSubmitter, PBKDF2_ITERATIONS, AUTH_TAG_BYTES, FEDERATION_QUERY_TTL_MS, HEARTBEAT_SUSPEND_THRESHOLD, HEARTBEAT_REMOVE_THRESHOLD, FEDERATION_TIMESTAMP_DRIFT_MS;
59810
59811
  var init_federation = __esm({
59811
- "../../services/api/dist/federation.js"() {
59812
+ "../../services/relay/dist/federation.js"() {
59812
59813
  "use strict";
59813
59814
  init_esm_shims();
59814
59815
  init_dist6();
@@ -59993,7 +59994,7 @@ var init_dist34 = __esm({
59993
59994
  }
59994
59995
  });
59995
59996
 
59996
- // ../../services/api/dist/account-store-sqlite.js
59997
+ // ../../services/relay/dist/account-store-sqlite.js
59997
59998
  function createAccountTables(db) {
59998
59999
  db.exec(`
59999
60000
  CREATE TABLE IF NOT EXISTS relay_accounts (
@@ -60076,7 +60077,7 @@ function sqliteAccountStoreFor(db) {
60076
60077
  }
60077
60078
  var SqliteAccountStore, stores;
60078
60079
  var init_account_store_sqlite = __esm({
60079
- "../../services/api/dist/account-store-sqlite.js"() {
60080
+ "../../services/relay/dist/account-store-sqlite.js"() {
60080
60081
  "use strict";
60081
60082
  init_esm_shims();
60082
60083
  init_dist34();
@@ -60256,7 +60257,7 @@ var init_account_store_sqlite = __esm({
60256
60257
  }
60257
60258
  });
60258
60259
 
60259
- // ../../services/api/dist/settlement-proofs.js
60260
+ // ../../services/relay/dist/settlement-proofs.js
60260
60261
  function createProofTable(db) {
60261
60262
  db.exec(`
60262
60263
  CREATE TABLE IF NOT EXISTS relay_settlement_proofs (
@@ -60279,13 +60280,13 @@ function storeSettlementProof(db, settlementId, proof, railName) {
60279
60280
  VALUES (?, ?, ?, ?, ?, ?, ?)`).run(settlementId, proof.reference, proof.railType, railName, proof.network ?? null, proof.confirmedAt, Date.now());
60280
60281
  }
60281
60282
  var init_settlement_proofs = __esm({
60282
- "../../services/api/dist/settlement-proofs.js"() {
60283
+ "../../services/relay/dist/settlement-proofs.js"() {
60283
60284
  "use strict";
60284
60285
  init_esm_shims();
60285
60286
  }
60286
60287
  });
60287
60288
 
60288
- // ../../services/api/dist/reconciliation.js
60289
+ // ../../services/relay/dist/reconciliation.js
60289
60290
  function reconcileLedger(db) {
60290
60291
  const errors = [];
60291
60292
  const txnSum = db.prepare("SELECT COALESCE(SUM(amount), 0) as net FROM relay_transactions").get();
@@ -60325,14 +60326,14 @@ function reconcileLedger(db) {
60325
60326
  return { consistent: errors.length === 0, errors };
60326
60327
  }
60327
60328
  var init_reconciliation = __esm({
60328
- "../../services/api/dist/reconciliation.js"() {
60329
+ "../../services/relay/dist/reconciliation.js"() {
60329
60330
  "use strict";
60330
60331
  init_esm_shims();
60331
60332
  init_dist34();
60332
60333
  }
60333
60334
  });
60334
60335
 
60335
- // ../../services/api/dist/stripe-credit.js
60336
+ // ../../services/relay/dist/stripe-credit.js
60336
60337
  function processStripeCheckout(db, sessionId, motebitId, amount, paymentIntent) {
60337
60338
  if (amount <= 0)
60338
60339
  return false;
@@ -60352,7 +60353,7 @@ function processStripeCheckout(db, sessionId, motebitId, amount, paymentIntent)
60352
60353
  }
60353
60354
  var logger11;
60354
60355
  var init_stripe_credit = __esm({
60355
- "../../services/api/dist/stripe-credit.js"() {
60356
+ "../../services/relay/dist/stripe-credit.js"() {
60356
60357
  "use strict";
60357
60358
  init_esm_shims();
60358
60359
  init_dist34();
@@ -60362,7 +60363,7 @@ var init_stripe_credit = __esm({
60362
60363
  }
60363
60364
  });
60364
60365
 
60365
- // ../../services/api/dist/accounts.js
60366
+ // ../../services/relay/dist/accounts.js
60366
60367
  function getOrCreateAccount(db, motebitId) {
60367
60368
  return sqliteAccountStoreFor(db).getOrCreateAccount(motebitId);
60368
60369
  }
@@ -60441,7 +60442,7 @@ function getPendingWithdrawals(db) {
60441
60442
  }
60442
60443
  var logger12;
60443
60444
  var init_accounts = __esm({
60444
- "../../services/api/dist/accounts.js"() {
60445
+ "../../services/relay/dist/accounts.js"() {
60445
60446
  "use strict";
60446
60447
  init_esm_shims();
60447
60448
  init_dist34();
@@ -60456,14 +60457,14 @@ var init_accounts = __esm({
60456
60457
  }
60457
60458
  });
60458
60459
 
60459
- // ../../services/api/dist/webhooks/stripe-webhook-adapter.js
60460
+ // ../../services/relay/dist/webhooks/stripe-webhook-adapter.js
60460
60461
  var stripe_webhook_adapter_exports = {};
60461
60462
  __export(stripe_webhook_adapter_exports, {
60462
60463
  StripeSubscriptionEventAdapter: () => StripeSubscriptionEventAdapter
60463
60464
  });
60464
60465
  var logger13, StripeSubscriptionEventAdapter;
60465
60466
  var init_stripe_webhook_adapter = __esm({
60466
- "../../services/api/dist/webhooks/stripe-webhook-adapter.js"() {
60467
+ "../../services/relay/dist/webhooks/stripe-webhook-adapter.js"() {
60467
60468
  "use strict";
60468
60469
  init_esm_shims();
60469
60470
  init_logger();
@@ -60548,7 +60549,7 @@ var init_stripe_webhook_adapter = __esm({
60548
60549
  }
60549
60550
  });
60550
60551
 
60551
- // ../../services/api/dist/discovery.js
60552
+ // ../../services/relay/dist/discovery.js
60552
60553
  var discovery_exports = {};
60553
60554
  __export(discovery_exports, {
60554
60555
  registerDiscoveryRoutes: () => registerDiscoveryRoutes
@@ -60701,7 +60702,7 @@ async function resolveAgent(db, relayIdentity, federationConfig, motebitId, hops
60701
60702
  }
60702
60703
  var logger25, DEFAULT_MAX_HOPS, POSITIVE_CACHE_TTL, NEGATIVE_CACHE_TTL, METADATA_CACHE_MAX_AGE, resolutionCache;
60703
60704
  var init_discovery2 = __esm({
60704
- "../../services/api/dist/discovery.js"() {
60705
+ "../../services/relay/dist/discovery.js"() {
60705
60706
  "use strict";
60706
60707
  init_esm_shims();
60707
60708
  init_dist6();
@@ -60715,7 +60716,7 @@ var init_discovery2 = __esm({
60715
60716
  }
60716
60717
  });
60717
60718
 
60718
- // ../../services/api/dist/migration.js
60719
+ // ../../services/relay/dist/migration.js
60719
60720
  var migration_exports = {};
60720
60721
  __export(migration_exports, {
60721
60722
  createMigrationTables: () => createMigrationTables,
@@ -61079,7 +61080,7 @@ function registerMigrationRoutes(deps) {
61079
61080
  }
61080
61081
  var logger26, DEFAULT_TOKEN_EXPIRY_MS;
61081
61082
  var init_migration2 = __esm({
61082
- "../../services/api/dist/migration.js"() {
61083
+ "../../services/relay/dist/migration.js"() {
61083
61084
  "use strict";
61084
61085
  init_esm_shims();
61085
61086
  init_dist6();
@@ -61093,7 +61094,7 @@ var init_migration2 = __esm({
61093
61094
  }
61094
61095
  });
61095
61096
 
61096
- // ../../services/api/dist/disputes.js
61097
+ // ../../services/relay/dist/disputes.js
61097
61098
  var disputes_exports = {};
61098
61099
  __export(disputes_exports, {
61099
61100
  createDisputeTables: () => createDisputeTables,
@@ -61489,7 +61490,7 @@ function executeFundAction(db, dispute, fundAction, splitRatio) {
61489
61490
  }
61490
61491
  var logger27, EVIDENCE_WINDOW_MS, APPEAL_WINDOW_MS, MAX_EVIDENCE_PER_PARTY, MAX_ACTIVE_DISPUTES_PER_AGENT, OPENED_EXPIRE_MS, FILING_FEE_RATE;
61491
61492
  var init_disputes = __esm({
61492
- "../../services/api/dist/disputes.js"() {
61493
+ "../../services/relay/dist/disputes.js"() {
61493
61494
  "use strict";
61494
61495
  init_esm_shims();
61495
61496
  init_dist6();
@@ -61506,7 +61507,7 @@ var init_disputes = __esm({
61506
61507
  }
61507
61508
  });
61508
61509
 
61509
- // ../../services/api/dist/transparency.js
61510
+ // ../../services/relay/dist/transparency.js
61510
61511
  var transparency_exports = {};
61511
61512
  __export(transparency_exports, {
61512
61513
  DECLARATION_CONTENT: () => DECLARATION_CONTENT,
@@ -61540,7 +61541,7 @@ function renderMarkdown() {
61540
61541
  const lines = [];
61541
61542
  lines.push("# Privacy and operator transparency");
61542
61543
  lines.push("");
61543
- lines.push("This document is the human-readable form of relay.motebit.com's transparency declaration. The signed, machine-verifiable JSON form is served at `/.well-known/motebit-transparency.json`. Both are derived from `services/api/src/transparency.ts` \u2014 the file is the single source of truth.");
61544
+ lines.push("This document is the human-readable form of relay.motebit.com's transparency declaration. The signed, machine-verifiable JSON form is served at `/.well-known/motebit-transparency.json`. Both are derived from `services/relay/src/transparency.ts` \u2014 the file is the single source of truth.");
61544
61545
  lines.push("");
61545
61546
  lines.push("Doctrine: [`docs/doctrine/operator-transparency.md`](../../docs/doctrine/operator-transparency.md).");
61546
61547
  lines.push("");
@@ -61655,7 +61656,7 @@ async function registerTransparencyRoutes(deps) {
61655
61656
  }
61656
61657
  var SPEC_DRAFT_ID, SIGNATURE_SUITE, DECLARATION_CONTENT;
61657
61658
  var init_transparency = __esm({
61658
- "../../services/api/dist/transparency.js"() {
61659
+ "../../services/relay/dist/transparency.js"() {
61659
61660
  "use strict";
61660
61661
  init_esm_shims();
61661
61662
  init_dist6();
@@ -61839,7 +61840,7 @@ var init_transparency = __esm({
61839
61840
  }
61840
61841
  });
61841
61842
 
61842
- // ../../services/api/dist/p2p-verifier.js
61843
+ // ../../services/relay/dist/p2p-verifier.js
61843
61844
  var p2p_verifier_exports = {};
61844
61845
  __export(p2p_verifier_exports, {
61845
61846
  getRecentP2pSettlements: () => getRecentP2pSettlements,
@@ -61989,7 +61990,7 @@ function getRecentP2pSettlements(db, limit = 50) {
61989
61990
  }
61990
61991
  var logger28, VERIFY_INTERVAL_MS, MAX_VERIFY_PER_CYCLE, READ_ONLY_SEED;
61991
61992
  var init_p2p_verifier = __esm({
61992
- "../../services/api/dist/p2p-verifier.js"() {
61993
+ "../../services/relay/dist/p2p-verifier.js"() {
61993
61994
  "use strict";
61994
61995
  init_esm_shims();
61995
61996
  init_dist19();
@@ -69311,7 +69312,7 @@ init_esm_shims();
69311
69312
  import * as fs13 from "fs";
69312
69313
  import { serve } from "@hono/node-server";
69313
69314
 
69314
- // ../../services/api/dist/index.js
69315
+ // ../../services/relay/dist/index.js
69315
69316
  init_esm_shims();
69316
69317
  init_dist8();
69317
69318
  init_dist9();
@@ -69320,7 +69321,7 @@ init_logger();
69320
69321
  import { createNodeWebSocket } from "@hono/node-ws";
69321
69322
  import { Hono } from "hono";
69322
69323
 
69323
- // ../../services/api/dist/env.js
69324
+ // ../../services/relay/dist/env.js
69324
69325
  init_esm_shims();
69325
69326
  function parseBoolEnv(name, defaultValue) {
69326
69327
  const raw = process.env[name];
@@ -69343,11 +69344,11 @@ function parseFloatEnv(name, defaultValue) {
69343
69344
  return Number.isFinite(parsed) ? parsed : defaultValue;
69344
69345
  }
69345
69346
 
69346
- // ../../services/api/dist/schema.js
69347
+ // ../../services/relay/dist/schema.js
69347
69348
  init_esm_shims();
69348
69349
  init_federation();
69349
69350
 
69350
- // ../../services/api/dist/migrations.js
69351
+ // ../../services/relay/dist/migrations.js
69351
69352
  init_esm_shims();
69352
69353
  init_logger();
69353
69354
  var logger4 = createLogger({ service: "migrations" });
@@ -69839,7 +69840,7 @@ var relayMigrations = [
69839
69840
  }
69840
69841
  ];
69841
69842
 
69842
- // ../../services/api/dist/schema.js
69843
+ // ../../services/relay/dist/schema.js
69843
69844
  function createRelaySchema(db) {
69844
69845
  runMigrations(db, relayMigrations);
69845
69846
  db.prepare("DELETE FROM relay_token_blacklist WHERE expires_at < ?").run(Date.now());
@@ -69855,7 +69856,7 @@ function createRelaySchema(db) {
69855
69856
  return { isTokenBlacklisted, isAgentRevoked };
69856
69857
  }
69857
69858
 
69858
- // ../../services/api/dist/freeze.js
69859
+ // ../../services/relay/dist/freeze.js
69859
69860
  init_esm_shims();
69860
69861
  init_logger();
69861
69862
  var logger5 = createLogger({ service: "freeze" });
@@ -69897,7 +69898,7 @@ function persistFreeze(db, cache, frozen, reason) {
69897
69898
  cache.reason = reason;
69898
69899
  }
69899
69900
 
69900
- // ../../services/api/dist/auth.js
69901
+ // ../../services/relay/dist/auth.js
69901
69902
  init_esm_shims();
69902
69903
  init_dist6();
69903
69904
  init_logger();
@@ -69986,7 +69987,7 @@ async function verifySignedTokenForDevice(token, motebitId, identityManager, exp
69986
69987
  return true;
69987
69988
  }
69988
69989
 
69989
- // ../../services/api/dist/middleware.js
69990
+ // ../../services/relay/dist/middleware.js
69990
69991
  init_esm_shims();
69991
69992
  init_rate_limiter();
69992
69993
  init_logger();
@@ -70215,7 +70216,7 @@ function registerMiddleware(deps) {
70215
70216
  // request's signature IS the auth (spec/device-self-registration-v1.md).
70216
70217
  // The handler verifies the signature against the public key carried
70217
70218
  // in the request body itself.
70218
- c3.req.path === "/api/v1/devices/register-self" || c3.req.path.startsWith("/api/v1/credentials/verify") || c3.req.path.startsWith("/api/v1/credentials/batch-status") || c3.req.path.match(/\/api\/v1\/credentials\/[^/]+\/status/) || // Anchor proof endpoints are public protocol artifacts (services/api
70219
+ c3.req.path === "/api/v1/devices/register-self" || c3.req.path.startsWith("/api/v1/credentials/verify") || c3.req.path.startsWith("/api/v1/credentials/batch-status") || c3.req.path.match(/\/api\/v1\/credentials\/[^/]+\/status/) || // Anchor proof endpoints are public protocol artifacts (services/relay
70219
70220
  // CLAUDE.md rule 6 — every truth the relay asserts is independently
70220
70221
  // verifiable onchain without relay contact). An external auditor
70221
70222
  // will not hold a relay-issued bearer token.
@@ -70361,11 +70362,11 @@ function registerAuthMiddleware(deps) {
70361
70362
  app.use("/api/v1/admin/pending-withdrawals", bearerAuth({ token: apiToken }));
70362
70363
  }
70363
70364
 
70364
- // ../../services/api/dist/websocket.js
70365
+ // ../../services/relay/dist/websocket.js
70365
70366
  init_esm_shims();
70366
70367
  init_dist2();
70367
70368
 
70368
- // ../../services/api/dist/data-sync.js
70369
+ // ../../services/relay/dist/data-sync.js
70369
70370
  init_esm_shims();
70370
70371
  init_dist2();
70371
70372
  import { HTTPException as HTTPException3 } from "hono/http-exception";
@@ -70633,7 +70634,7 @@ function registerDataSyncRoutes(deps) {
70633
70634
  });
70634
70635
  }
70635
70636
 
70636
- // ../../services/api/dist/websocket.js
70637
+ // ../../services/relay/dist/websocket.js
70637
70638
  function registerWebSocketRoutes(deps) {
70638
70639
  const { app, upgradeWebSocket, connections, taskQueue, eventStore, identityManager, db, apiToken, enableDeviceAuth, wsLimiter, isTokenBlacklisted, isAgentRevoked, verifySignedTokenForDevice: verifySignedTokenForDevice2, logger: logger29 } = deps;
70639
70640
  app.get("/ws/sync/:motebitId", upgradeWebSocket((c3) => {
@@ -70898,7 +70899,7 @@ function registerWebSocketRoutes(deps) {
70898
70899
  }));
70899
70900
  }
70900
70901
 
70901
- // ../../services/api/dist/sync-routes.js
70902
+ // ../../services/relay/dist/sync-routes.js
70902
70903
  init_esm_shims();
70903
70904
  init_dist2();
70904
70905
  init_dist6();
@@ -71158,7 +71159,7 @@ function registerSyncRoutes(deps) {
71158
71159
  });
71159
71160
  }
71160
71161
 
71161
- // ../../services/api/dist/idempotency.js
71162
+ // ../../services/relay/dist/idempotency.js
71162
71163
  init_esm_shims();
71163
71164
  init_logger();
71164
71165
  var logger9 = createLogger({ service: "idempotency" });
@@ -71208,12 +71209,12 @@ function cleanupIdempotencyKeys(db) {
71208
71209
  return info.changes;
71209
71210
  }
71210
71211
 
71211
- // ../../services/api/dist/index.js
71212
+ // ../../services/relay/dist/index.js
71212
71213
  init_federation();
71213
71214
  init_anchoring();
71214
71215
  init_credential_anchoring();
71215
71216
 
71216
- // ../../services/api/dist/deposit-detector.js
71217
+ // ../../services/relay/dist/deposit-detector.js
71217
71218
  init_esm_shims();
71218
71219
 
71219
71220
  // ../../packages/deposit-detector/dist/index.js
@@ -71399,7 +71400,7 @@ var HttpJsonRpcEvmAdapter = class {
71399
71400
  }
71400
71401
  };
71401
71402
 
71402
- // ../../services/api/dist/deposit-detector.js
71403
+ // ../../services/relay/dist/deposit-detector.js
71403
71404
  init_account_store_sqlite();
71404
71405
  init_logger();
71405
71406
  var logger10 = createLogger({ service: "deposit-detector" });
@@ -71534,7 +71535,7 @@ function startDepositDetector(config) {
71534
71535
  return setInterval(() => void tick(), intervalMs);
71535
71536
  }
71536
71537
 
71537
- // ../../services/api/dist/credentials.js
71538
+ // ../../services/relay/dist/credentials.js
71538
71539
  init_esm_shims();
71539
71540
  init_dist6();
71540
71541
  init_dist2();
@@ -72118,7 +72119,7 @@ init_esm_shims();
72118
72119
  // ../../packages/market/dist/index.js
72119
72120
  init_dist13();
72120
72121
 
72121
- // ../../services/api/dist/credentials.js
72122
+ // ../../services/relay/dist/credentials.js
72122
72123
  init_federation();
72123
72124
  function getRelayKeypair(relayIdentity) {
72124
72125
  return {
@@ -72369,7 +72370,7 @@ function registerCredentialRoutes(deps) {
72369
72370
  });
72370
72371
  }
72371
72372
 
72372
- // ../../services/api/dist/subscriptions.js
72373
+ // ../../services/relay/dist/subscriptions.js
72373
72374
  init_esm_shims();
72374
72375
  init_dist6();
72375
72376
  init_logger();
@@ -72735,10 +72736,10 @@ function registerProxyTokenRoutes(app, db, relayIdentity, subscriptionEventAdapt
72735
72736
  });
72736
72737
  }
72737
72738
 
72738
- // ../../services/api/dist/index.js
72739
+ // ../../services/relay/dist/index.js
72739
72740
  init_stripe_webhook_adapter();
72740
72741
 
72741
- // ../../services/api/dist/a2a-bridge.js
72742
+ // ../../services/relay/dist/a2a-bridge.js
72742
72743
  init_esm_shims();
72743
72744
  init_dist6();
72744
72745
  function registerA2ARoutes(app, db, config) {
@@ -73007,7 +73008,7 @@ function registerA2ARoutes(app, db, config) {
73007
73008
  });
73008
73009
  }
73009
73010
 
73010
- // ../../services/api/dist/receipt-exchange.js
73011
+ // ../../services/relay/dist/receipt-exchange.js
73011
73012
  init_esm_shims();
73012
73013
  function registerReceiptExchangeRoutes(app, config = {}) {
73013
73014
  const exchangeTimeoutMs = config.exchangeTimeoutMs ?? 3e4;
@@ -73155,7 +73156,7 @@ function registerReceiptExchangeRoutes(app, config = {}) {
73155
73156
  };
73156
73157
  }
73157
73158
 
73158
- // ../../services/api/dist/receipts-store.js
73159
+ // ../../services/relay/dist/receipts-store.js
73159
73160
  init_esm_shims();
73160
73161
  init_dist6();
73161
73162
  init_logger();
@@ -73194,11 +73195,11 @@ function getStoredReceiptJson(db, motebitId, taskId) {
73194
73195
  return row?.receipt_json ?? null;
73195
73196
  }
73196
73197
 
73197
- // ../../services/api/dist/onramp.js
73198
+ // ../../services/relay/dist/onramp.js
73198
73199
  init_esm_shims();
73199
73200
  import { HTTPException as HTTPException6 } from "hono/http-exception";
73200
73201
 
73201
- // ../../services/api/dist/onramp/stripe-crypto-adapter.js
73202
+ // ../../services/relay/dist/onramp/stripe-crypto-adapter.js
73202
73203
  init_esm_shims();
73203
73204
  var StripeCryptoOnrampAdapter = class {
73204
73205
  provider = "stripe-crypto-onramp";
@@ -73224,7 +73225,7 @@ var StripeCryptoOnrampAdapter = class {
73224
73225
  }
73225
73226
  };
73226
73227
 
73227
- // ../../services/api/dist/onramp/stripe-crypto-client.js
73228
+ // ../../services/relay/dist/onramp/stripe-crypto-client.js
73228
73229
  init_esm_shims();
73229
73230
  var HttpStripeCryptoClient = class {
73230
73231
  secretKey;
@@ -73279,7 +73280,7 @@ var HttpStripeCryptoClient = class {
73279
73280
  }
73280
73281
  };
73281
73282
 
73282
- // ../../services/api/dist/onramp.js
73283
+ // ../../services/relay/dist/onramp.js
73283
73284
  var MIN_GAS_LAMPORTS = 5e6;
73284
73285
  var DEFAULT_RPC = "https://api.mainnet-beta.solana.com";
73285
73286
  async function hasGas(address, rpcUrl = DEFAULT_RPC) {
@@ -73351,7 +73352,7 @@ function registerOnrampRoutes(app, adapter, solanaRpcUrl) {
73351
73352
  });
73352
73353
  }
73353
73354
 
73354
- // ../../services/api/dist/offramp.js
73355
+ // ../../services/relay/dist/offramp.js
73355
73356
  init_esm_shims();
73356
73357
  import { HTTPException as HTTPException7 } from "hono/http-exception";
73357
73358
  var BridgeOfframpAdapter = class {
@@ -73469,7 +73470,7 @@ function registerOfframpRoutes(app, adapter) {
73469
73470
  });
73470
73471
  }
73471
73472
 
73472
- // ../../services/api/dist/task-routing.js
73473
+ // ../../services/relay/dist/task-routing.js
73473
73474
  init_esm_shims();
73474
73475
  init_dist2();
73475
73476
  init_dist6();
@@ -73626,7 +73627,7 @@ var CircuitBreaker = class {
73626
73627
  }
73627
73628
  };
73628
73629
 
73629
- // ../../services/api/dist/task-routing.js
73630
+ // ../../services/relay/dist/task-routing.js
73630
73631
  init_logger();
73631
73632
  var logger16 = createLogger({ service: "relay", module: "task-routing" });
73632
73633
  var circuitBreakerLogger = createLogger({ service: "relay", module: "circuit-breaker" });
@@ -74230,10 +74231,10 @@ function evaluateSettlementEligibility(db, delegatorId, workerId) {
74230
74231
  };
74231
74232
  }
74232
74233
 
74233
- // ../../services/api/dist/index.js
74234
+ // ../../services/relay/dist/index.js
74234
74235
  init_accounts();
74235
74236
 
74236
- // ../../services/api/dist/pairing.js
74237
+ // ../../services/relay/dist/pairing.js
74237
74238
  init_esm_shims();
74238
74239
  import { HTTPException as HTTPException8 } from "hono/http-exception";
74239
74240
  var PAIRING_ALPHABET = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
@@ -74473,7 +74474,7 @@ function registerPairingRoutes(deps) {
74473
74474
  });
74474
74475
  }
74475
74476
 
74476
- // ../../services/api/dist/state-export.js
74477
+ // ../../services/relay/dist/state-export.js
74477
74478
  init_esm_shims();
74478
74479
  init_dist2();
74479
74480
  init_dist6();
@@ -74781,7 +74782,7 @@ function registerStateExportRoutes(deps) {
74781
74782
  });
74782
74783
  }
74783
74784
 
74784
- // ../../services/api/dist/trust-graph.js
74785
+ // ../../services/relay/dist/trust-graph.js
74785
74786
  init_esm_shims();
74786
74787
  init_dist2();
74787
74788
  import { HTTPException as HTTPException10 } from "hono/http-exception";
@@ -74839,7 +74840,7 @@ function registerTrustGraphRoutes(deps) {
74839
74840
  });
74840
74841
  }
74841
74842
 
74842
- // ../../services/api/dist/listings.js
74843
+ // ../../services/relay/dist/listings.js
74843
74844
  init_esm_shims();
74844
74845
  init_dist2();
74845
74846
  import { HTTPException as HTTPException11 } from "hono/http-exception";
@@ -74949,7 +74950,7 @@ function registerListingsRoutes(deps) {
74949
74950
  });
74950
74951
  }
74951
74952
 
74952
- // ../../services/api/dist/proposals.js
74953
+ // ../../services/relay/dist/proposals.js
74953
74954
  init_esm_shims();
74954
74955
  import { HTTPException as HTTPException12 } from "hono/http-exception";
74955
74956
  function registerProposalRoutes(deps) {
@@ -75161,7 +75162,7 @@ function registerProposalRoutes(deps) {
75161
75162
  });
75162
75163
  }
75163
75164
 
75164
- // ../../services/api/dist/key-rotation.js
75165
+ // ../../services/relay/dist/key-rotation.js
75165
75166
  init_esm_shims();
75166
75167
  init_dist6();
75167
75168
  init_federation();
@@ -75422,7 +75423,7 @@ function registerKeyRotationRoutes(deps) {
75422
75423
  });
75423
75424
  }
75424
75425
 
75425
- // ../../services/api/dist/budget.js
75426
+ // ../../services/relay/dist/budget.js
75426
75427
  init_esm_shims();
75427
75428
  init_dist6();
75428
75429
  init_logger();
@@ -76061,11 +76062,11 @@ function registerBudgetRoutes(deps) {
76061
76062
  });
76062
76063
  }
76063
76064
 
76064
- // ../../services/api/dist/sweep.js
76065
+ // ../../services/relay/dist/sweep.js
76065
76066
  init_esm_shims();
76066
76067
  init_accounts();
76067
76068
 
76068
- // ../../services/api/dist/batch-withdrawals.js
76069
+ // ../../services/relay/dist/batch-withdrawals.js
76069
76070
  init_esm_shims();
76070
76071
  init_dist2();
76071
76072
  init_accounts();
@@ -76315,7 +76316,7 @@ function startBatchWithdrawalLoop(db, rails, config = {}, isFrozen) {
76315
76316
  }, intervalMs);
76316
76317
  }
76317
76318
 
76318
- // ../../services/api/dist/sweep.js
76319
+ // ../../services/relay/dist/sweep.js
76319
76320
  init_logger();
76320
76321
  var logger20 = createLogger({ service: "relay", module: "sweep" });
76321
76322
  var MIN_SWEEP_AMOUNT = 1e6;
@@ -76408,7 +76409,7 @@ function startSweepLoop(db, config = {}, isFrozen) {
76408
76409
  }, intervalMs);
76409
76410
  }
76410
76411
 
76411
- // ../../services/api/dist/agents.js
76412
+ // ../../services/relay/dist/agents.js
76412
76413
  init_esm_shims();
76413
76414
  init_dist2();
76414
76415
  init_federation();
@@ -77090,7 +77091,7 @@ function registerAgentRoutes(deps) {
77090
77091
  });
77091
77092
  }
77092
77093
 
77093
- // ../../services/api/dist/federation-callbacks.js
77094
+ // ../../services/relay/dist/federation-callbacks.js
77094
77095
  init_esm_shims();
77095
77096
  init_dist2();
77096
77097
  import { HTTPException as HTTPException16 } from "hono/http-exception";
@@ -77288,14 +77289,14 @@ function createFederationCallbacks(deps) {
77288
77289
  };
77289
77290
  }
77290
77291
 
77291
- // ../../services/api/dist/tasks.js
77292
+ // ../../services/relay/dist/tasks.js
77292
77293
  init_esm_shims();
77293
77294
  init_dist2();
77294
77295
  import { HTTPException as HTTPException17 } from "hono/http-exception";
77295
77296
  init_dist6();
77296
77297
  init_accounts();
77297
77298
 
77298
- // ../../services/api/dist/push-adapter.js
77299
+ // ../../services/relay/dist/push-adapter.js
77299
77300
  init_esm_shims();
77300
77301
  init_logger();
77301
77302
  var logger23 = createLogger({ service: "push-adapter" });
@@ -77331,7 +77332,7 @@ async function attemptPushWake(motebitId, deps) {
77331
77332
  return results.some((r2) => r2.status === "fulfilled" && r2.value.delivered);
77332
77333
  }
77333
77334
 
77334
- // ../../services/api/dist/tasks.js
77335
+ // ../../services/relay/dist/tasks.js
77335
77336
  init_logger();
77336
77337
  init_dist33();
77337
77338
  init_errors2();
@@ -78554,7 +78555,7 @@ async function registerTaskRoutes(deps) {
78554
78555
  });
78555
78556
  }
78556
78557
 
78557
- // ../../services/api/dist/task-queue.js
78558
+ // ../../services/relay/dist/task-queue.js
78558
78559
  init_esm_shims();
78559
78560
  init_dist2();
78560
78561
  var TaskQueue = class {
@@ -78781,7 +78782,7 @@ var TaskQueue = class {
78781
78782
  }
78782
78783
  };
78783
78784
 
78784
- // ../../services/api/dist/command-route.js
78785
+ // ../../services/relay/dist/command-route.js
78785
78786
  init_esm_shims();
78786
78787
  import { HTTPException as HTTPException18 } from "hono/http-exception";
78787
78788
  var RELAY_SIDE_COMMANDS = /* @__PURE__ */ new Set(["balance", "deposits", "discover", "proposals"]);
@@ -78944,7 +78945,7 @@ function executeRelaySideCommand(db, motebitId, command2) {
78944
78945
  }
78945
78946
  }
78946
78947
 
78947
- // ../../services/api/dist/index.js
78948
+ // ../../services/relay/dist/index.js
78948
78949
  import Stripe2 from "stripe";
78949
78950
 
78950
78951
  // ../../packages/settlement-rails/dist/index.js
@@ -79359,7 +79360,7 @@ var SettlementRailRegistry = class {
79359
79360
  }
79360
79361
  };
79361
79362
 
79362
- // ../../services/api/dist/index.js
79363
+ // ../../services/relay/dist/index.js
79363
79364
  async function createSyncRelay(config) {
79364
79365
  const {
79365
79366
  dbPath = ":memory:",
@@ -82727,7 +82728,34 @@ async function handleServe(config) {
82727
82728
  try {
82728
82729
  const toolNames = runtime.getToolRegistry().list().map((t3) => t3.name);
82729
82730
  const regHeaders = { "Content-Type": "application/json" };
82730
- if (masterToken) regHeaders["Authorization"] = `Bearer ${masterToken}`;
82731
+ if (masterToken) {
82732
+ regHeaders["Authorization"] = `Bearer ${masterToken}`;
82733
+ } else if (servePrivateKey && fullConfigForServe.device_id && publicKeyHex) {
82734
+ try {
82735
+ await fetch(`${syncUrl}/api/v1/agents/bootstrap`, {
82736
+ method: "POST",
82737
+ headers: { "Content-Type": "application/json" },
82738
+ body: JSON.stringify({
82739
+ motebit_id: motebitId,
82740
+ device_id: fullConfigForServe.device_id,
82741
+ public_key: publicKeyHex
82742
+ })
82743
+ });
82744
+ } catch {
82745
+ }
82746
+ const signedToken = await createSignedToken(
82747
+ {
82748
+ mid: motebitId,
82749
+ did: fullConfigForServe.device_id,
82750
+ iat: Date.now(),
82751
+ exp: Date.now() + 24 * 60 * 60 * 1e3,
82752
+ jti: crypto.randomUUID(),
82753
+ aud: "admin:query"
82754
+ },
82755
+ servePrivateKey
82756
+ );
82757
+ regHeaders["Authorization"] = `Bearer ${signedToken}`;
82758
+ }
82731
82759
  const endpointUrl = `http://localhost:${port}`;
82732
82760
  const serveRegBody = {
82733
82761
  motebit_id: motebitId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motebit",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "Reference runtime and operator console for sovereign AI agents — REPL, daemon, delegation, MCP server. Persistent Ed25519 identity, signed execution receipts, governance at the boundary.",
6
6
  "main": "./dist/index.js",
@@ -73,32 +73,32 @@
73
73
  "tsx": "^4.19.0",
74
74
  "typescript": "^5.6.0",
75
75
  "vitest": "^2.1.0",
76
- "@motebit/ai-core": "0.0.0-private",
77
- "@motebit/api": "0.0.0-private",
78
76
  "@motebit/behavior-engine": "0.0.0-private",
77
+ "@motebit/ai-core": "0.0.0-private",
79
78
  "@motebit/core-identity": "0.0.0-private",
80
79
  "@motebit/crypto": "1.1.0",
81
80
  "@motebit/encryption": "0.0.0-private",
82
81
  "@motebit/event-log": "0.0.0-private",
83
- "@motebit/gradient": "0.0.0-private",
84
- "@motebit/identity-file": "0.0.0-private",
85
82
  "@motebit/mcp-client": "0.0.0-private",
83
+ "@motebit/identity-file": "0.0.0-private",
84
+ "@motebit/gradient": "0.0.0-private",
86
85
  "@motebit/mcp-server": "0.0.0-private",
87
86
  "@motebit/memory-graph": "0.0.0-private",
88
- "@motebit/persistence": "0.0.0-private",
89
- "@motebit/planner": "0.0.0-private",
90
87
  "@motebit/policy": "0.0.0-private",
88
+ "@motebit/persistence": "0.0.0-private",
91
89
  "@motebit/privacy-layer": "0.0.0-private",
90
+ "@motebit/relay": "0.0.0-private",
91
+ "@motebit/planner": "0.0.0-private",
92
92
  "@motebit/runtime": "0.0.0-private",
93
93
  "@motebit/sdk": "1.0.1",
94
94
  "@motebit/self-knowledge": "0.0.0-private",
95
95
  "@motebit/state-vector": "0.0.0-private",
96
96
  "@motebit/sync-engine": "0.0.0-private",
97
- "@motebit/tools": "0.0.0-private",
98
97
  "@motebit/verify": "1.1.0",
99
98
  "@motebit/voice": "0.0.0-private",
100
- "@motebit/wallet-solana": "0.0.0-private",
101
- "@motebit/wire-schemas": "0.0.0-private"
99
+ "@motebit/tools": "0.0.0-private",
100
+ "@motebit/wire-schemas": "0.0.0-private",
101
+ "@motebit/wallet-solana": "0.0.0-private"
102
102
  },
103
103
  "scripts": {
104
104
  "start": "tsx src/index.ts",