remote-codex 0.11.12 → 0.11.14

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.
@@ -151,6 +151,7 @@ var RelayStore = class _RelayStore {
151
151
  id: crypto.randomUUID(),
152
152
  ownerUserId: user.id,
153
153
  name: input.name.trim() || "Remote Codex device",
154
+ token,
154
155
  tokenHash: sha256(token),
155
156
  tokenPreview: previewToken(token),
156
157
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -326,6 +327,7 @@ var RelayStore = class _RelayStore {
326
327
  id: device.id,
327
328
  ownerUserId: device.ownerUserId,
328
329
  name: device.name,
330
+ token: device.token,
329
331
  tokenPreview: device.tokenPreview,
330
332
  connected: Boolean(status?.connected),
331
333
  connectedAt: status?.connectedAt ?? null,
@@ -366,6 +368,7 @@ var RelayStore = class _RelayStore {
366
368
  id TEXT PRIMARY KEY,
367
369
  owner_user_id TEXT NOT NULL REFERENCES relay_users(id) ON DELETE CASCADE,
368
370
  name TEXT NOT NULL,
371
+ token TEXT,
369
372
  token_hash TEXT NOT NULL UNIQUE,
370
373
  token_preview TEXT NOT NULL,
371
374
  created_at TEXT NOT NULL
@@ -391,6 +394,14 @@ var RelayStore = class _RelayStore {
391
394
  CREATE INDEX IF NOT EXISTS relay_shares_target_idx ON relay_shares(target_user_id);
392
395
  CREATE INDEX IF NOT EXISTS relay_shares_device_thread_idx ON relay_shares(device_id, thread_id);
393
396
  `);
397
+ this.ensureColumn("relay_devices", "token", "TEXT");
398
+ }
399
+ ensureColumn(table, column, definition) {
400
+ const columns = this.sqlite.prepare(`PRAGMA table_info(${table})`).all();
401
+ if (columns.some((existing) => existing.name === column)) {
402
+ return;
403
+ }
404
+ this.sqlite.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
394
405
  }
395
406
  importLegacyJson(legacyJsonPath) {
396
407
  if (!legacyJsonPath || !fs.existsSync(legacyJsonPath)) {
@@ -544,13 +555,14 @@ var RelayStore = class _RelayStore {
544
555
  this.sqlite.prepare(
545
556
  `
546
557
  INSERT INTO relay_devices (
547
- id, owner_user_id, name, token_hash, token_preview, created_at
548
- ) VALUES (?, ?, ?, ?, ?, ?)
558
+ id, owner_user_id, name, token, token_hash, token_preview, created_at
559
+ ) VALUES (?, ?, ?, ?, ?, ?, ?)
549
560
  `
550
561
  ).run(
551
562
  device.id,
552
563
  device.ownerUserId,
553
564
  device.name,
565
+ device.token ?? null,
554
566
  device.tokenHash,
555
567
  device.tokenPreview,
556
568
  device.createdAt
@@ -628,6 +640,7 @@ var RelayStore = class _RelayStore {
628
640
  id: row.id,
629
641
  ownerUserId: row.owner_user_id,
630
642
  name: row.name,
643
+ token: row.token ?? null,
631
644
  tokenHash: row.token_hash,
632
645
  tokenPreview: row.token_preview,
633
646
  createdAt: row.created_at