@glyphteck/veyl 0.56.0 → 0.58.0

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/cli.js CHANGED
@@ -47,26 +47,6 @@ var __export = (target, all) => {
47
47
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
48
48
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
49
49
 
50
- // ../../core/agreement.js
51
- function hasCurrentAgreement(user) {
52
- const agreement = user?.agreement;
53
- return agreement?.termsVersion === CURRENT_AGREEMENT.termsVersion && agreement?.communityRulesVersion === CURRENT_AGREEMENT.communityRulesVersion && !!agreement?.acceptedAt;
54
- }
55
- function requireCurrentTermsVersion(value) {
56
- const version = typeof value === "string" ? value.trim() : "";
57
- if (version !== TERMS_VERSION) {
58
- throw new Error(`Current Terms version ${TERMS_VERSION} must be accepted.`);
59
- }
60
- return version;
61
- }
62
- var TERMS_VERSION = "2026-07-15", COMMUNITY_RULES_VERSION = "2026-05-11.1", CURRENT_AGREEMENT;
63
- var init_agreement = __esm(() => {
64
- CURRENT_AGREEMENT = Object.freeze({
65
- termsVersion: TERMS_VERSION,
66
- communityRulesVersion: COMMUNITY_RULES_VERSION
67
- });
68
- });
69
-
70
50
  // ../../node_modules/.bun/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js
71
51
  function isBytes(a) {
72
52
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
@@ -8778,6 +8758,19 @@ var init_avatar = __esm(() => {
8778
8758
  AVATAR_VERSION_RE = /^[0-9a-f]{64}$/;
8779
8759
  });
8780
8760
 
8761
+ // ../../core/agreement.js
8762
+ function hasCurrentAgreement(user) {
8763
+ const agreement = user?.agreement;
8764
+ return agreement?.termsVersion === CURRENT_AGREEMENT.termsVersion && agreement?.communityRulesVersion === CURRENT_AGREEMENT.communityRulesVersion && !!agreement?.acceptedAt;
8765
+ }
8766
+ var TERMS_VERSION = "2026-07-15", COMMUNITY_RULES_VERSION = "2026-05-11.1", CURRENT_AGREEMENT;
8767
+ var init_agreement = __esm(() => {
8768
+ CURRENT_AGREEMENT = Object.freeze({
8769
+ termsVersion: TERMS_VERSION,
8770
+ communityRulesVersion: COMMUNITY_RULES_VERSION
8771
+ });
8772
+ });
8773
+
8781
8774
  // ../../core/utils/time.js
8782
8775
  function timestampMs(value, fallback = null, options = {}) {
8783
8776
  let ms = null;
@@ -32454,9 +32447,9 @@ function stopped(signal) {
32454
32447
  }
32455
32448
  async function listenAccount(client, options = {}) {
32456
32449
  const messageSource = nextListenerSource();
32457
- const compact2 = options.compact === true || options.agent === true;
32458
- const incomingOnly = options.incomingOnly === false ? false : options.incomingOnly === true || options.incoming === true || options.agent === true;
32459
- const transientChats = options.agent === true && options.persistentChats !== true;
32450
+ const compact2 = options.compact !== false;
32451
+ const incomingOnly = options.incomingOnly !== false;
32452
+ const transientChats = options.persistentChats !== true;
32460
32453
  const chatCount = cleanCount(options.chatCount || options.chats, DEFAULT_CHAT_COUNT, 500);
32461
32454
  const messageCount = cleanCount(options.messageCount || options.messages, DEFAULT_MESSAGE_COUNT);
32462
32455
  const replayMessageLimit = cleanCount(options.replayMessageLimit, DEFAULT_REPLAY_MESSAGE_LIMIT, DEFAULT_REPLAY_MESSAGE_LIMIT);
@@ -32615,7 +32608,7 @@ async function listenAccount(client, options = {}) {
32615
32608
  }
32616
32609
  page.release?.();
32617
32610
  if (count >= replayMessageLimit) {
32618
- throw new Error(`agent replay checkpoint not found: ${chat.id}`);
32611
+ throw new Error(`listener replay checkpoint not found: ${chat.id}`);
32619
32612
  }
32620
32613
  count = Math.min(replayMessageLimit, count * 2);
32621
32614
  }
@@ -41132,7 +41125,7 @@ var package_default;
41132
41125
  var init_package = __esm(() => {
41133
41126
  package_default = {
41134
41127
  name: "veyl",
41135
- version: "0.56.0",
41128
+ version: "0.58.0",
41136
41129
  private: true,
41137
41130
  license: "UNLICENSED",
41138
41131
  workspaces: {
@@ -41249,15 +41242,13 @@ function cleanOptionalUsername(value) {
41249
41242
  }
41250
41243
  function agreementSummary(user) {
41251
41244
  const agreement = user?.agreement || null;
41252
- const acceptedAt = timestampMs(agreement?.acceptedAt);
41253
41245
  return {
41254
- current: { ...CURRENT_AGREEMENT },
41255
- accepted: agreement ? {
41256
- termsVersion: agreement.termsVersion || null,
41257
- communityRulesVersion: agreement.communityRulesVersion || null,
41258
- acceptedAt
41259
- } : null,
41260
- currentAccepted: hasCurrentAgreement(user)
41246
+ links: {
41247
+ terms: links.terms,
41248
+ communityRules: links.communityRules
41249
+ },
41250
+ accepted: hasCurrentAgreement(user),
41251
+ acceptedAt: timestampMs(agreement?.acceptedAt)
41261
41252
  };
41262
41253
  }
41263
41254
  function cleanTargetValue(value) {
@@ -41531,10 +41522,10 @@ class AccountRuntime {
41531
41522
  uid: profile.uid,
41532
41523
  username: profile.username,
41533
41524
  profile: profile.profile,
41534
- credentialId: profile.credentialId,
41535
41525
  network: this.session?.network || profile.network || this.network,
41526
+ hasAccountKey: !!(profile.privateKeyPem || this.options.accountKey || this.options.credential?.privateKeyPem),
41536
41527
  hasVault: profile.hasVault === true,
41537
- hasVaultSecret: !!(profile.vaultSecret || this.options.vaultSecret),
41528
+ hasVaultKey: !!(profile.vaultSecret || this.options.vaultKey),
41538
41529
  walletPK: profile.walletPK || null,
41539
41530
  chatPK: profile.chatPK || null,
41540
41531
  notificationPK: profile.notificationPK || null,
@@ -41560,7 +41551,6 @@ class AccountRuntime {
41560
41551
  const username = cleanUsername3(options.username);
41561
41552
  const profileName = this.store.profile || username;
41562
41553
  const network = String(options.network || this.network).toUpperCase();
41563
- const termsVersion = requireCurrentTermsVersion(options.termsVersion);
41564
41554
  const machine = options.credential || this.options.credential || this.ports.createCredential();
41565
41555
  const namespaceKeyPath = options.namespaceKeyPath || this.options.namespaceKeyPath;
41566
41556
  const namespaceClaim = options.namespaceClaim || (namespaceKeyPath ? await this.ports.signNamespaceClaim({
@@ -41572,7 +41562,7 @@ class AccountRuntime {
41572
41562
  const start = await this.callAccountEndpoint("/account/create/start", {
41573
41563
  username,
41574
41564
  publicKeyPem: machine.publicKeyPem,
41575
- termsVersion,
41565
+ termsVersion: TERMS_VERSION,
41576
41566
  ...namespaceClaim ? { namespaceClaim } : {}
41577
41567
  });
41578
41568
  const finish = await this.callAccountEndpoint("/account/create/finish", {
@@ -41581,33 +41571,30 @@ class AccountRuntime {
41581
41571
  });
41582
41572
  await this.ports.signIn(this.auth, finish.token);
41583
41573
  this.autoLogin = true;
41584
- const profile = await this.saveProfile({
41574
+ await this.saveProfile({
41585
41575
  profile: profileName,
41586
41576
  username,
41587
41577
  uid: finish.uid,
41588
41578
  network,
41589
41579
  credentialId: finish.credentialId || machine.credentialId,
41590
41580
  publicKeyPem: machine.publicKeyPem,
41591
- privateKeyPem: options.saveCredential === false ? null : machine.privateKeyPem,
41581
+ privateKeyPem: options.saveKey === false ? null : machine.privateKeyPem,
41592
41582
  auth: "machine",
41593
41583
  bot: finish.bot === BOT_PROFILE_MARKER ? BOT_PROFILE_MARKER : null,
41594
41584
  createdAt: Date.now(),
41595
41585
  hasVault: false
41596
41586
  });
41597
- return {
41598
- ...this.accountSummary(profile),
41599
- publicKeyPem: machine.publicKeyPem,
41600
- privateKeyPem: machine.privateKeyPem
41601
- };
41587
+ return machine.privateKeyPem;
41602
41588
  }
41603
41589
  async loginAccount(options = {}) {
41604
41590
  const username = cleanOptionalUsername(options.username);
41605
41591
  const profile = await this.loadProfile(this.store.profile || username);
41606
- const credential = options.credential || this.options.credential;
41607
- const credentialId = options.credentialId || credential?.credentialId || profile.credentialId;
41608
- const privateKeyPem = options.privateKeyPem || credential?.privateKeyPem || profile.privateKeyPem;
41592
+ const key = String(options.key || this.options.accountKey || this.ports.env?.VEYL_ACCOUNT_KEY || "").trim();
41593
+ const credential = options.credential || this.options.credential || (key ? this.ports.readCredential(key) : null);
41594
+ const credentialId = credential?.credentialId || profile.credentialId;
41595
+ const privateKeyPem = credential?.privateKeyPem || profile.privateKeyPem;
41609
41596
  if (!credentialId || !privateKeyPem) {
41610
- throw new Error("machine credential required");
41597
+ throw new Error("account key required");
41611
41598
  }
41612
41599
  const namespaceKeyPath = options.namespaceKeyPath || this.options.namespaceKeyPath;
41613
41600
  const namespaceClaim = options.namespaceClaim || (namespaceKeyPath ? await this.ports.signNamespaceClaim({
@@ -41631,6 +41618,8 @@ class AccountRuntime {
41631
41618
  uid: finish.uid || profile.uid,
41632
41619
  username: finish.username || profile.username,
41633
41620
  credentialId,
41621
+ publicKeyPem: credential?.publicKeyPem || profile.publicKeyPem,
41622
+ privateKeyPem: options.saveKey === false ? profile.privateKeyPem || null : privateKeyPem,
41634
41623
  bot: finish.bot === BOT_PROFILE_MARKER ? BOT_PROFILE_MARKER : null,
41635
41624
  lastLoginAt: Date.now()
41636
41625
  });
@@ -41654,38 +41643,32 @@ class AccountRuntime {
41654
41643
  const username = cleanUsername3(options.username);
41655
41644
  const profileName = this.store.profile || username;
41656
41645
  const network = String(options.network || this.network).toUpperCase();
41657
- const termsVersion = requireCurrentTermsVersion(options.termsVersion);
41658
41646
  const flow = await this.ports.runPasskeyFlow({
41659
41647
  mode: "create",
41660
41648
  label: options.label || username,
41661
41649
  webUrl: options.webUrl,
41662
41650
  timeoutMs: options.timeoutMs,
41663
41651
  onUrl: options.onPasskeyUrl,
41664
- termsVersion
41652
+ termsVersion: TERMS_VERSION
41665
41653
  });
41666
41654
  const user = await this.ports.signIn(this.auth, flow.token);
41667
41655
  this.autoLogin = true;
41668
41656
  await this.accountOwner.profile.setUsername(username);
41669
41657
  const machine = options.credential || this.ports.createCredential();
41670
41658
  const credential = machine ? await this.addMachineCredential(machine) : null;
41671
- const profile = await this.saveProfile({
41659
+ await this.saveProfile({
41672
41660
  profile: profileName,
41673
41661
  username,
41674
41662
  uid: user.uid,
41675
41663
  network,
41676
41664
  credentialId: credential?.credentialId || machine?.credentialId || null,
41677
41665
  publicKeyPem: machine?.publicKeyPem || null,
41678
- privateKeyPem: options.saveCredential === false ? null : machine?.privateKeyPem || null,
41666
+ privateKeyPem: options.saveKey === false ? null : machine?.privateKeyPem || null,
41679
41667
  auth: "passkey",
41680
41668
  createdAt: Date.now(),
41681
41669
  hasVault: false
41682
41670
  });
41683
- return {
41684
- ...this.accountSummary(profile),
41685
- passkey: true,
41686
- publicKeyPem: machine?.publicKeyPem || null,
41687
- privateKeyPem: machine?.privateKeyPem || null
41688
- };
41671
+ return machine.privateKeyPem;
41689
41672
  }
41690
41673
  async loginPasskeyAccount(options = {}) {
41691
41674
  const requested = cleanOptionalUsername(options.username);
@@ -41701,7 +41684,7 @@ class AccountRuntime {
41701
41684
  this.autoLogin = true;
41702
41685
  const username = await this.readUsername(user.uid, stored?.username || requested);
41703
41686
  const hasSavedCredential = !!(stored?.credentialId && stored?.privateKeyPem);
41704
- const machine = hasSavedCredential ? null : options.credential || this.ports.createCredential();
41687
+ const machine = hasSavedCredential ? null : options.credential || (options.saveKey === false ? null : this.ports.createCredential());
41705
41688
  const credential = machine ? await this.addMachineCredential(machine) : null;
41706
41689
  const profile = await this.saveProfile({
41707
41690
  ...stored || {},
@@ -41711,17 +41694,12 @@ class AccountRuntime {
41711
41694
  network: String(stored?.network || options.network || this.network).toUpperCase(),
41712
41695
  credentialId: credential?.credentialId || stored?.credentialId || machine?.credentialId || null,
41713
41696
  publicKeyPem: machine?.publicKeyPem || stored?.publicKeyPem || null,
41714
- privateKeyPem: options.saveCredential === false ? stored?.privateKeyPem || null : machine?.privateKeyPem || stored?.privateKeyPem || null,
41697
+ privateKeyPem: options.saveKey === false ? stored?.privateKeyPem || null : machine?.privateKeyPem || stored?.privateKeyPem || null,
41715
41698
  auth: "passkey",
41716
41699
  bot: null,
41717
41700
  lastLoginAt: Date.now()
41718
41701
  });
41719
- return {
41720
- ...this.accountSummary(profile),
41721
- passkey: true,
41722
- publicKeyPem: machine?.publicKeyPem || null,
41723
- privateKeyPem: machine?.privateKeyPem || null
41724
- };
41702
+ return this.accountSummary(profile);
41725
41703
  }
41726
41704
  async me() {
41727
41705
  const profile = await this.store.load();
@@ -41757,7 +41735,7 @@ class AccountRuntime {
41757
41735
  throw new Error("account login required");
41758
41736
  }
41759
41737
  if (profile.auth === "passkey" && (!profile.credentialId || !profile.privateKeyPem)) {
41760
- await this.loginPasskeyAccount({ username: profile.profile, saveCredential: false });
41738
+ await this.loginPasskeyAccount({ username: profile.profile, saveKey: false });
41761
41739
  return this.profileData;
41762
41740
  }
41763
41741
  await this.loginAccount({
@@ -41784,7 +41762,6 @@ class AccountRuntime {
41784
41762
  return agreementSummary(await this.readyAccountUser(options));
41785
41763
  }
41786
41764
  async acceptAccountTerms(options = {}) {
41787
- requireCurrentTermsVersion(options.termsVersion);
41788
41765
  const user = await this.readyAccountUser(options);
41789
41766
  if (!hasCurrentAgreement(user)) {
41790
41767
  await user.acceptAgreement();
@@ -41872,9 +41849,9 @@ class AccountRuntime {
41872
41849
  if (await this.cloud.user.vault.exists(profile.uid)) {
41873
41850
  throw new Error("vault already exists");
41874
41851
  }
41875
- const vaultSecret = String(options.secret || this.options.vaultSecret || this.ports.env?.VEYL_VAULT_SECRET || this.ports.randomSecret()).trim();
41852
+ const vaultSecret = String(options.key || this.options.vaultKey || this.ports.env?.VEYL_VAULT_KEY || this.ports.randomSecret()).trim();
41876
41853
  if (!vaultSecret) {
41877
- throw new Error("vault secret required");
41854
+ throw new Error("vault key required");
41878
41855
  }
41879
41856
  const encrypted = options.masterSeed ? await this.ports.vaultCrypto.encryptMasterSeed(options.masterSeed, vaultSecret, { registry: options.registry }) : await this.ports.vaultCrypto.encryptSeed(vaultSecret, { registry: options.registry });
41880
41857
  const vault = packSeedData(encrypted);
@@ -41883,7 +41860,7 @@ class AccountRuntime {
41883
41860
  const next = await this.saveProfile({
41884
41861
  ...profile,
41885
41862
  hasVault: true,
41886
- vaultSecret: options.saveSecret === false ? null : vaultSecret,
41863
+ vaultSecret: options.saveKey === false ? null : vaultSecret,
41887
41864
  network: session.network,
41888
41865
  walletPK: session.walletPK,
41889
41866
  chatPK: session.chatPK,
@@ -41892,16 +41869,13 @@ class AccountRuntime {
41892
41869
  });
41893
41870
  this.session.account = this.accountSummary(next);
41894
41871
  this.trackWalletIdentity(session);
41895
- return {
41896
- ...this.accountSummary(next),
41897
- vaultSecret
41898
- };
41872
+ return vaultSecret;
41899
41873
  }
41900
41874
  async exportWallet(options = {}) {
41901
41875
  const profile = await this.ensureAuth();
41902
- const vaultSecret = String(options.secret || this.options.vaultSecret || this.ports.env?.VEYL_VAULT_SECRET || profile.vaultSecret || "").trim();
41876
+ const vaultSecret = String(options.key || this.options.vaultKey || this.ports.env?.VEYL_VAULT_KEY || profile.vaultSecret || "").trim();
41903
41877
  if (!vaultSecret) {
41904
- throw new Error("vault secret required");
41878
+ throw new Error("vault key required");
41905
41879
  }
41906
41880
  const vault = await this.cloud.user.vault.read(profile.uid);
41907
41881
  if (!vault) {
@@ -41917,9 +41891,9 @@ class AccountRuntime {
41917
41891
  if (this.session) {
41918
41892
  return this.accountSummary(profile);
41919
41893
  }
41920
- const vaultSecret = String(options.secret || this.options.vaultSecret || this.ports.env?.VEYL_VAULT_SECRET || profile.vaultSecret || "").trim();
41894
+ const vaultSecret = String(options.key || this.options.vaultKey || this.ports.env?.VEYL_VAULT_KEY || profile.vaultSecret || "").trim();
41921
41895
  if (!vaultSecret) {
41922
- throw new Error("vault secret required");
41896
+ throw new Error("vault key required");
41923
41897
  }
41924
41898
  const vault = await this.cloud.user.vault.read(profile.uid);
41925
41899
  if (!vault) {
@@ -41929,7 +41903,7 @@ class AccountRuntime {
41929
41903
  const next = await this.saveProfile({
41930
41904
  ...profile,
41931
41905
  hasVault: true,
41932
- vaultSecret: options.saveSecret === false ? profile.vaultSecret || null : profile.vaultSecret || vaultSecret,
41906
+ vaultSecret: options.saveKey === false ? profile.vaultSecret || null : profile.vaultSecret || vaultSecret,
41933
41907
  network: session.network,
41934
41908
  walletPK: session.walletPK || profile.walletPK || null,
41935
41909
  chatPK: session.chatPK,
@@ -42164,7 +42138,7 @@ class AccountRuntime {
42164
42138
  }
42165
42139
  }
42166
42140
  }
42167
- var API_VERSION = 3, REQUIRED_FUNCTION_PORTS;
42141
+ var API_VERSION = 4, REQUIRED_FUNCTION_PORTS;
42168
42142
  var init_client = __esm(() => {
42169
42143
  init_values();
42170
42144
  init_pack();
@@ -42175,6 +42149,7 @@ var init_client = __esm(() => {
42175
42149
  init_username();
42176
42150
  init_time();
42177
42151
  init_vault();
42152
+ init_links();
42178
42153
  init_account();
42179
42154
  init_auth();
42180
42155
  init_listen();
@@ -42185,6 +42160,7 @@ var init_client = __esm(() => {
42185
42160
  "openLocalCache",
42186
42161
  "runPasskeyFlow",
42187
42162
  "createCredential",
42163
+ "readCredential",
42188
42164
  "signChallenge",
42189
42165
  "signNamespaceClaim",
42190
42166
  "signIn",
@@ -177109,6 +177085,16 @@ function credentialIdForPublicKey(publicKeyPem) {
177109
177085
  }
177110
177086
  return createHash3("sha256").update(key).digest("base64url");
177111
177087
  }
177088
+ function machineCredential(privateKey, publicKey) {
177089
+ const publicKeyPem = publicKey.export({ type: "spki", format: "pem" });
177090
+ const privateKeyPem = privateKey.export({ type: "pkcs8", format: "pem" });
177091
+ return {
177092
+ type: "ed25519",
177093
+ credentialId: credentialIdForPublicKey(publicKeyPem),
177094
+ publicKeyPem,
177095
+ privateKeyPem
177096
+ };
177097
+ }
177112
177098
  function createMachineCredential(options2 = {}) {
177113
177099
  let privateKey;
177114
177100
  let publicKey;
@@ -177133,15 +177119,11 @@ function createMachineCredential(options2 = {}) {
177133
177119
  } else {
177134
177120
  ({ privateKey, publicKey } = generateKeyPairSync("ed25519"));
177135
177121
  }
177136
- const publicKeyPem = publicKey.export({ type: "spki", format: "pem" });
177137
- const privateKeyPem = privateKey.export({ type: "pkcs8", format: "pem" });
177138
- const credentialId = credentialIdForPublicKey(publicKeyPem);
177139
- return {
177140
- type: "ed25519",
177141
- credentialId,
177142
- publicKeyPem,
177143
- privateKeyPem
177144
- };
177122
+ return machineCredential(privateKey, publicKey);
177123
+ }
177124
+ function readMachineCredential(key) {
177125
+ const privateKey = createPrivateKey(String(key ?? ""));
177126
+ return machineCredential(privateKey, createPublicKey(privateKey));
177145
177127
  }
177146
177128
  function signMachineChallenge(privateKeyPem, challenge2) {
177147
177129
  const key = createPrivateKey(String(privateKeyPem ?? ""));
@@ -177651,6 +177633,7 @@ function createNodePorts(options2 = {}) {
177651
177633
  })),
177652
177634
  runPasskeyFlow: options2.runPasskeyFlow || runPasskeyBrowserFlow,
177653
177635
  createCredential: options2.createCredential || createMachineCredential,
177636
+ readCredential: options2.readCredential || readMachineCredential,
177654
177637
  signChallenge: options2.signChallenge || signMachineChallenge,
177655
177638
  signNamespaceClaim: options2.signNamespaceClaim || signNamespaceClaim,
177656
177639
  signIn: options2.signIn || signInRuntime,
@@ -177958,7 +177941,6 @@ class Fleet {
177958
177941
  }) || (() => {});
177959
177942
  const accountEventOptions = typeof this.eventOptions === "function" ? await this.eventOptions(profile) : this.eventOptions;
177960
177943
  record.listenTask = record.client.listen({
177961
- ...DEFAULT_EVENT_OPTIONS,
177962
177944
  ...accountEventOptions || {},
177963
177945
  signal: controller.signal,
177964
177946
  onEvent: (event2) => {
@@ -178252,13 +178234,9 @@ class Fleet {
178252
178234
  function createFleet(options2 = {}) {
178253
178235
  return new Fleet(options2);
178254
178236
  }
178255
- var DEFAULT_BOOT_CONCURRENCY = 4, DEFAULT_EVENT_BACKLOG = 1000, DEFAULT_START_TIMEOUT_MS = 30000, DEFAULT_EVENT_OPTIONS;
178237
+ var DEFAULT_BOOT_CONCURRENCY = 4, DEFAULT_EVENT_BACKLOG = 1000, DEFAULT_START_TIMEOUT_MS = 30000;
178256
178238
  var init_fleet = __esm(() => {
178257
178239
  init_node();
178258
- DEFAULT_EVENT_OPTIONS = Object.freeze({
178259
- agent: true,
178260
- replay: false
178261
- });
178262
178240
  });
178263
178241
 
178264
178242
  // src/fleet-journal.js
@@ -179131,7 +179109,7 @@ class FleetOwner {
179131
179109
  homeDir: this.homeDir,
179132
179110
  activate: false,
179133
179111
  credential: material.credential,
179134
- vaultSecret: material.vaultSecret,
179112
+ vaultKey: material.vaultSecret,
179135
179113
  namespaceKeyPath: this.options.namespaceKeyPath,
179136
179114
  getVaultMasterSeed: () => {
179137
179115
  const derived = deriveFleetAccount(this.seed, accountIndex);
@@ -179265,7 +179243,6 @@ class FleetOwner {
179265
179243
  throw new Error("stop the fleet owner before provisioning an account");
179266
179244
  }
179267
179245
  return this.withStoppedOwnerLock(async () => {
179268
- requireCurrentTermsVersion(input.termsVersion);
179269
179246
  const record = accountRecord(input, this.manifest.nextAccountIndex);
179270
179247
  if (this.slot(record.profile)) {
179271
179248
  throw new Error(`fleet profile exists: ${record.profile}`);
@@ -179274,30 +179251,23 @@ class FleetOwner {
179274
179251
  throw new Error(`fleet username exists: ${record.username}`);
179275
179252
  }
179276
179253
  await this.saveProfiles([...this.manifest.profiles, record], record.accountIndex + 1);
179277
- return this.finishProvision(record, {
179278
- create: true,
179279
- termsVersion: input.termsVersion
179280
- });
179254
+ return this.finishProvision(record, { create: true });
179281
179255
  });
179282
179256
  });
179283
179257
  }
179284
- resume(profile, options2 = {}) {
179258
+ resume(profile) {
179285
179259
  return this.mutate(async () => {
179286
179260
  if (this.fleet) {
179287
179261
  throw new Error("stop the fleet owner before resuming provisioning");
179288
179262
  }
179289
179263
  return this.withStoppedOwnerLock(async () => {
179290
- requireCurrentTermsVersion(options2.termsVersion);
179291
179264
  const record = this.slot(profile);
179292
179265
  if (!record)
179293
179266
  throw new Error("fleet profile not found");
179294
179267
  if (record.state !== "provisioning") {
179295
179268
  throw new Error("fleet profile is already provisioned");
179296
179269
  }
179297
- return this.finishProvision(record, {
179298
- create: false,
179299
- termsVersion: options2.termsVersion
179300
- });
179270
+ return this.finishProvision(record, { create: false });
179301
179271
  });
179302
179272
  });
179303
179273
  }
@@ -179329,7 +179299,7 @@ class FleetOwner {
179329
179299
  homeDir: this.homeDir,
179330
179300
  activate: false,
179331
179301
  credential: material.credential,
179332
- vaultSecret: material.vaultSecret,
179302
+ vaultKey: material.vaultSecret,
179333
179303
  namespaceKeyPath: this.options.namespaceKeyPath,
179334
179304
  namespaceKeyOptional: true
179335
179305
  }, record);
@@ -179337,13 +179307,13 @@ class FleetOwner {
179337
179307
  let account = await client2.account.me();
179338
179308
  if (!account?.uid) {
179339
179309
  if (options2.create) {
179340
- account = await client2.account.create({
179310
+ await client2.account.create({
179341
179311
  username: record.username,
179342
179312
  network: record.network,
179343
- termsVersion: options2.termsVersion,
179344
179313
  credential: material.credential,
179345
- saveCredential: false
179314
+ saveKey: false
179346
179315
  });
179316
+ account = await client2.account.me();
179347
179317
  } else {
179348
179318
  try {
179349
179319
  account = await client2.account.login({
@@ -179352,13 +179322,13 @@ class FleetOwner {
179352
179322
  } catch (error) {
179353
179323
  if (error?.code !== "not-found")
179354
179324
  throw error;
179355
- account = await client2.account.create({
179325
+ await client2.account.create({
179356
179326
  username: record.username,
179357
179327
  network: record.network,
179358
- termsVersion: options2.termsVersion,
179359
179328
  credential: material.credential,
179360
- saveCredential: false
179329
+ saveKey: false
179361
179330
  });
179331
+ account = await client2.account.me();
179362
179332
  }
179363
179333
  }
179364
179334
  } else {
@@ -179367,12 +179337,13 @@ class FleetOwner {
179367
179337
  });
179368
179338
  }
179369
179339
  if (account.hasVault !== true) {
179370
- account = await client2.vault.create({
179371
- secret: material.vaultSecret,
179340
+ await client2.vault.create({
179341
+ key: material.vaultSecret,
179372
179342
  masterSeed: material.masterSeed,
179373
179343
  registry: material.registry,
179374
- saveSecret: false
179344
+ saveKey: false
179375
179345
  });
179346
+ account = await client2.account.me();
179376
179347
  } else {
179377
179348
  await client2.ensureUnlocked();
179378
179349
  account = await client2.account.me();
@@ -179417,7 +179388,6 @@ async function openFleetOwner(options2 = {}) {
179417
179388
  });
179418
179389
  }
179419
179390
  var init_fleet_owner = __esm(() => {
179420
- init_agreement();
179421
179391
  init_username();
179422
179392
  init_node();
179423
179393
  init_fleet_manifest();
@@ -179674,7 +179644,6 @@ __export(exports_src, {
179674
179644
  cleanProfileName: () => cleanProfileName,
179675
179645
  callFleetControl: () => callFleetControl,
179676
179646
  VERSION: () => VERSION,
179677
- TERMS_VERSION: () => TERMS_VERSION,
179678
179647
  SdkError: () => SdkError,
179679
179648
  ProfileStore: () => ProfileStore,
179680
179649
  OPERATION_OUTCOME_UNKNOWN_CODE: () => OPERATION_OUTCOME_UNKNOWN_CODE,
@@ -179691,7 +179660,6 @@ __export(exports_src, {
179691
179660
  API_VERSION: () => API_VERSION
179692
179661
  });
179693
179662
  var init_src = __esm(() => {
179694
- init_agreement();
179695
179663
  init_account();
179696
179664
  init_auth();
179697
179665
  init_client();
@@ -179709,9 +179677,6 @@ var init_src = __esm(() => {
179709
179677
  });
179710
179678
 
179711
179679
  // src/cli.js
179712
- init_links();
179713
- init_agreement();
179714
- import { createInterface as createInterface2 } from "node:readline/promises";
179715
179680
  import process11 from "node:process";
179716
179681
 
179717
179682
  // src/commands.js
@@ -179821,22 +179786,35 @@ var inviteLinkInput = (args, context) => ({ ...context.commandOptions, kind: arg
179821
179786
  function peerList(value) {
179822
179787
  return [...new Set((Array.isArray(value) ? value : [value]).flatMap((item) => String(item || "").split(",")).map((item) => item.trim()).filter(Boolean))];
179823
179788
  }
179824
- function accountInput(args, context) {
179789
+ function accountCreateInput(args, context) {
179825
179790
  return {
179826
179791
  username: args[0],
179827
179792
  network: context.options.network,
179828
179793
  webUrl: context.options.webUrl,
179829
- termsVersion: context.options.termsVersion,
179830
- saveCredential: context.options.saveCredential,
179794
+ saveKey: context.options.saveKey,
179831
179795
  passkey: context.options.passkey === true,
179832
179796
  reserved: context.options.reserved === true,
179833
179797
  onPasskeyUrl: context.onPasskeyUrl
179834
179798
  };
179835
179799
  }
179836
- function vaultInput(_args, context) {
179800
+ function accountLoginInput(args, context) {
179837
179801
  return {
179838
- secret: context.options.secret,
179839
- saveSecret: context.options.saveSecret
179802
+ username: args[0],
179803
+ network: context.options.network,
179804
+ webUrl: context.options.webUrl,
179805
+ key: context.options.key,
179806
+ saveKey: context.options.saveKey,
179807
+ passkey: context.options.passkey === true,
179808
+ onPasskeyUrl: context.onPasskeyUrl
179809
+ };
179810
+ }
179811
+ function vaultKeyInput(_args, context) {
179812
+ return { key: context.options.key };
179813
+ }
179814
+ function vaultStoredKeyInput(_args, context) {
179815
+ return {
179816
+ key: context.options.key,
179817
+ saveKey: context.options.saveKey
179840
179818
  };
179841
179819
  }
179842
179820
  function invoiceCreateInput(args, context) {
@@ -179935,19 +179913,18 @@ var CLI_COMMANDS = Object.freeze([
179935
179913
  apiName: "create",
179936
179914
  clientMethods: ["create", "createPasskey"],
179937
179915
  description: "Create a Veyl account.",
179938
- properties: { username: stringProp, network: stringProp, termsVersion: stringProp, passkey: booleanProp },
179939
- required: ["username", "termsVersion"],
179916
+ properties: { username: stringProp, network: stringProp, saveKey: booleanProp, passkey: booleanProp },
179917
+ required: ["username"],
179940
179918
  usage: "account create @name",
179941
- cliInput: accountInput,
179919
+ cliInput: accountCreateInput,
179942
179920
  access: "write",
179943
179921
  secret: true,
179944
179922
  invoke: (client2, input) => input.passkey ? client2.account.createPasskey(input) : client2.account.create(input),
179945
- invokeCli: async (client2, input, context) => {
179923
+ invokeCli: (client2, input) => {
179946
179924
  if (input.passkey && input.reserved) {
179947
179925
  throw new Error("reserved username claims require a machine account");
179948
179926
  }
179949
- const termsVersion = await context.acceptTerms(input.termsVersion);
179950
- return input.passkey ? client2.account.createPasskey({ ...input, termsVersion }) : client2.account.create({ ...input, termsVersion });
179927
+ return input.passkey ? client2.account.createPasskey(input) : client2.account.create(input);
179951
179928
  }
179952
179929
  }),
179953
179930
  command({
@@ -179955,37 +179932,34 @@ var CLI_COMMANDS = Object.freeze([
179955
179932
  group: "account",
179956
179933
  apiName: "login",
179957
179934
  clientMethods: ["login", "loginPasskey"],
179958
- description: "Log into a saved machine or passkey account.",
179959
- properties: { username: stringProp, passkey: booleanProp },
179935
+ description: "Log in with a saved account key or passkey.",
179936
+ properties: { username: stringProp, key: stringProp, saveKey: booleanProp, passkey: booleanProp },
179960
179937
  usage: "account login [@name]",
179961
- cliInput: accountInput,
179938
+ cliInput: accountLoginInput,
179962
179939
  access: "write",
179963
179940
  secret: true,
179964
179941
  invoke: (client2, input) => input.passkey ? client2.account.loginPasskey(input) : client2.account.login(input),
179965
- invokeCli: (client2, input) => input.passkey ? client2.account.loginPasskey(input) : client2.account.login({ username: input.username })
179942
+ invokeCli: (client2, input) => input.passkey ? client2.account.loginPasskey(input) : client2.account.login(input)
179966
179943
  }),
179967
179944
  command({ name: "account_show", group: "account", apiName: "show", clientMethods: ["me"], description: "Show the current local account.", usage: "account show", cliInput: optionsOnly, invoke: (client2) => client2.account.me() }),
179968
- command({ name: "account_terms", group: "account", apiName: "terms", description: "Show current and accepted agreement versions.", usage: "account terms", cliInput: optionsOnly, invoke: (client2) => client2.account.terms() }),
179945
+ command({ name: "account_terms", group: "account", apiName: "terms", description: "Show the agreement links and current acceptance.", usage: "account terms", cliInput: optionsOnly, invoke: (client2) => client2.account.terms() }),
179969
179946
  command({
179970
179947
  name: "account_accept_terms",
179971
179948
  group: "account",
179972
179949
  apiName: "acceptTerms",
179973
179950
  description: "Accept the current Terms and Community Rules.",
179974
- properties: { termsVersion: stringProp },
179975
- required: ["termsVersion"],
179976
179951
  usage: "account accept-terms",
179977
- cliInput: accountInput,
179952
+ cliInput: optionsOnly,
179978
179953
  access: "write",
179979
- invoke: (client2, input) => client2.account.acceptTerms(input),
179980
- invokeCli: async (client2, input, context) => client2.account.acceptTerms({ ...input, termsVersion: await context.acceptTerms(input.termsVersion) })
179954
+ invoke: (client2) => client2.account.acceptTerms()
179981
179955
  }),
179982
179956
  command({ name: "account_logout", group: "account", apiName: "logout", description: "Lock and sign out this runtime.", usage: "account logout", cliInput: optionsOnly, access: "write", invoke: (client2) => client2.account.logout() }),
179983
179957
  command({ name: "account_logout_all", group: "account", apiName: "logoutAll", description: LOGOUT_ALL_DEVICES_BODY, usage: "account logout-all", cliInput: optionsOnly, access: "destructive", invoke: (client2) => client2.account.logoutAll() }),
179984
179958
  command({ name: "account_delete", group: "account", apiName: "delete", description: ACCOUNT_DELETE_COPY.body, properties: { confirm: booleanProp }, required: ["confirm"], usage: "account delete", cliInput: optionsOnly, access: "destructive", invoke: (client2, input) => client2.account.delete(input) }),
179985
- command({ name: "vault_create", group: "vault", apiName: "create", description: "Create and upload a locally encrypted vault.", properties: { secret: stringProp, saveSecret: booleanProp }, usage: "vault create", cliInput: vaultInput, access: "write", secret: true, invoke: (client2, input) => client2.vault.create(input) }),
179986
- command({ name: "vault_unlock", group: "vault", apiName: "unlock", description: "Unlock the local vault.", properties: { secret: stringProp }, usage: "vault unlock", cliInput: vaultInput, access: "write", secret: true, invoke: (client2, input) => client2.vault.unlock(input) }),
179959
+ command({ name: "vault_create", group: "vault", apiName: "create", description: "Create and upload a locally encrypted vault.", properties: { key: stringProp, saveKey: booleanProp }, usage: "vault create", cliInput: vaultStoredKeyInput, access: "write", secret: true, invoke: (client2, input) => client2.vault.create(input) }),
179960
+ command({ name: "vault_unlock", group: "vault", apiName: "unlock", description: "Unlock the local vault.", properties: { key: stringProp, saveKey: booleanProp }, usage: "vault unlock", cliInput: vaultStoredKeyInput, access: "write", secret: true, invoke: (client2, input) => client2.vault.unlock(input) }),
179987
179961
  command({ name: "vault_lock", group: "vault", apiName: "lock", description: "Lock wallet and chat state.", usage: "vault lock", cliInput: optionsOnly, access: "write", invoke: (client2) => client2.vault.lock() }),
179988
- command({ name: "vault_export", group: "vault", apiName: "export", description: WALLET_EXPORT_COPY.secretBody, properties: { secret: stringProp }, usage: "vault export", cliInput: vaultInput, session: false, secret: true, invoke: (client2, input) => client2.vault.export(input) }),
179962
+ command({ name: "vault_export", group: "vault", apiName: "export", description: WALLET_EXPORT_COPY.secretBody, properties: { key: stringProp }, usage: "vault export", cliInput: vaultKeyInput, session: false, secret: true, invoke: (client2, input) => client2.vault.export(input) }),
179989
179963
  command({ name: "profile_show", group: "profile", apiName: "show", description: "Show the public account profile.", usage: "profile show", cliInput: optionsOnly, invoke: (client2) => client2.profile.show() }),
179990
179964
  command({
179991
179965
  name: "profile_avatar_set",
@@ -180776,9 +180750,7 @@ Persistent runtime:
180776
180750
 
180777
180751
  Events:
180778
180752
  --replay emit current messages and transactions on startup
180779
- --incoming emit only peer-authored messages
180780
- --compact emit smaller event payloads
180781
- --agent shorthand for --incoming --compact
180753
+ --all include self-authored messages; defaults to incoming only
180782
180754
  --no-chats skip chat message events
180783
180755
  --no-transactions skip transaction events
180784
180756
 
@@ -180787,8 +180759,10 @@ Entered chat:
180787
180759
 
180788
180760
  Common options:
180789
180761
  --version print the Veyl product version
180762
+ --key value account or vault key for the selected command
180763
+ --no-save-key do not save a supplied or generated key locally
180790
180764
  --count n result count for list/read/claim/transactions
180791
- --raw include raw SDK/backend data when supported
180765
+ --raw include complete event payloads and raw data when supported
180792
180766
  --memo text lightning invoice memo
180793
180767
  --expiry seconds lightning invoice expiry
180794
180768
  --max-fee sats maximum lightning fee
@@ -180808,7 +180782,6 @@ Common options:
180808
180782
  --note text report note
180809
180783
  --context text feedback context
180810
180784
  --no-attachment report without uploading attached media
180811
- --accept-terms ver accept the current Terms and Community Rules when creating an account
180812
180785
 
180813
180786
  Owner namespace:
180814
180787
  namespace init create the local reserved-username signing key once
@@ -180820,7 +180793,8 @@ Env:
180820
180793
  VEYL_HOME local profile directory
180821
180794
  VEYL_PROFILE default profile
180822
180795
  VEYL_NETWORK wallet network
180823
- VEYL_VAULT_SECRET vault secret for unlock/create
180796
+ VEYL_ACCOUNT_KEY account key for login
180797
+ VEYL_VAULT_KEY vault key for unlock/create
180824
180798
  VEYL_WEB_URL passkey browser origin`;
180825
180799
  function print(value) {
180826
180800
  if (value === undefined) {
@@ -180884,7 +180858,7 @@ var VALUE_FLAGS = Object.freeze({
180884
180858
  "--profile": "profile",
180885
180859
  "--network": "network",
180886
180860
  "--session": "session",
180887
- "--secret": "secret",
180861
+ "--key": "key",
180888
180862
  "--web-url": "webUrl",
180889
180863
  "--interval": "interval",
180890
180864
  "--chat-count": "chatCount",
@@ -180916,13 +180890,11 @@ var VALUE_FLAGS = Object.freeze({
180916
180890
  "--cid": "cid",
180917
180891
  "--fee-quote-id": "feeQuoteId",
180918
180892
  "--fee-amount": "feeAmountSats",
180919
- "--accept-terms": "termsVersion",
180920
180893
  "--read-policy": "readPolicy"
180921
180894
  });
180922
180895
  var BOOLEAN_FLAGS = Object.freeze({
180923
- "--no-save-secret": ["saveSecret", false],
180896
+ "--no-save-key": ["saveKey", false],
180924
180897
  "--passkey": ["passkey", true],
180925
- "--no-save-credential": ["saveCredential", false],
180926
180898
  "--raw": ["raw", true],
180927
180899
  "--no-deduct-fee": ["deductFeeFromWithdrawalAmount", false],
180928
180900
  "--prefer-spark": ["preferSpark", true],
@@ -180931,11 +180903,7 @@ var BOOLEAN_FLAGS = Object.freeze({
180931
180903
  "--include-spark-invoice": ["includeSparkInvoice", true],
180932
180904
  "--no-cleanup": ["cleanup", false],
180933
180905
  "--replay": ["replay", true],
180934
- "--incoming": ["incomingOnly", true],
180935
- "--incoming-only": ["incomingOnly", true],
180936
180906
  "--all": ["incomingOnly", false],
180937
- "--compact": ["compact", true],
180938
- "--agent": ["agent", true],
180939
180907
  "--no-chats": ["chats", false],
180940
180908
  "--no-transactions": ["transactions", false],
180941
180909
  "--confirm": ["confirm", true],
@@ -180963,26 +180931,6 @@ function parseArgs(argv) {
180963
180931
  }
180964
180932
  return { args, options: options2 };
180965
180933
  }
180966
- async function acceptTerms(value) {
180967
- if (value != null) {
180968
- return requireCurrentTermsVersion(value);
180969
- }
180970
- if (!process11.stdin.isTTY || !process11.stderr.isTTY) {
180971
- throw new Error(`Non-interactive account creation requires --accept-terms ${TERMS_VERSION}.`);
180972
- }
180973
- console.error(`Terms: ${links.terms}`);
180974
- console.error(`Community Rules: ${links.communityRules}`);
180975
- const rl = createInterface2({ input: process11.stdin, output: process11.stderr });
180976
- try {
180977
- const answer = await rl.question("Do you agree to the current Terms and Community Rules? [y/N] ");
180978
- if (!/^y(?:es)?$/iu.test(answer.trim())) {
180979
- throw new Error("Terms and Community Rules were not accepted.");
180980
- }
180981
- return TERMS_VERSION;
180982
- } finally {
180983
- rl.close();
180984
- }
180985
- }
180986
180934
  async function streamClientChat(client2, input) {
180987
180935
  const route = await client2.chat.enter(input.peer, input);
180988
180936
  let finish;
@@ -181024,8 +180972,8 @@ async function runCommand(argv) {
181024
180972
  if (!resolved) {
181025
180973
  throw usageError("unknown command");
181026
180974
  }
181027
- if (parsed.options.secret) {
181028
- process11.env.VEYL_VAULT_SECRET = parsed.options.secret;
180975
+ if (parsed.options.key && resolved.command.group !== "account") {
180976
+ process11.env.VEYL_VAULT_KEY = parsed.options.key;
181029
180977
  }
181030
180978
  const sessionOptions = {
181031
180979
  profile: parsed.options.profile,
@@ -181045,7 +180993,6 @@ async function runCommand(argv) {
181045
180993
  return await invokeCliCommand(client2, resolved, {
181046
180994
  options: parsed.options,
181047
180995
  commandOptions: commandOptions(parsed.options),
181048
- acceptTerms,
181049
180996
  onPasskeyUrl: (url) => console.error(`open ${url}`),
181050
180997
  dispatch: parsed.options.session ? (name7, input) => callSession(sessionOptions, "command", { name: name7, input }) : null,
181051
180998
  chatEnter: (activeClient, input) => parsed.options.session ? streamSessionChat({
@@ -181066,7 +181013,10 @@ async function runCommand(argv) {
181066
181013
  sessionEvents: () => streamSessionEvents({
181067
181014
  profile: parsed.options.profile,
181068
181015
  session: parsed.options.session,
181069
- eventOptions: parsed.options,
181016
+ eventOptions: {
181017
+ ...parsed.options,
181018
+ compact: parsed.options.raw === true ? false : undefined
181019
+ },
181070
181020
  onEvent: (event2) => console.log(JSON.stringify(event2))
181071
181021
  })
181072
181022
  });