sibyl-memory-cli 0.3.4__tar.gz → 0.3.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sibyl-memory-cli
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Command-line interface for the Sibyl Memory Plugin. `sibyl init` activates, `sibyl upgrade` runs the staker / subscription flow, `sibyl status` shows current tier and DB stats, `sibyl whoami` gives a one-line account summary, `sibyl devices` lists active devices and supports per-device revoke.
5
5
  Author-email: "SIBYL, Sibyl Labs LLC" <sibyl@sibyllabs.org>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sibyl-memory-cli"
7
- version = "0.3.4"
7
+ version = "0.3.5"
8
8
  description = "Command-line interface for the Sibyl Memory Plugin. `sibyl init` activates, `sibyl upgrade` runs the staker / subscription flow, `sibyl status` shows current tier and DB stats, `sibyl whoami` gives a one-line account summary, `sibyl devices` lists active devices and supports per-device revoke."
9
9
  authors = [{ name = "SIBYL, Sibyl Labs LLC", email = "sibyl@sibyllabs.org" }]
10
10
  license = { text = "MIT" }
@@ -58,16 +58,16 @@ DEFAULT_DB_PATH = Path("~/.sibyl-memory/memory.db").expanduser()
58
58
  DEFAULT_TIER_CACHE_PATH = Path("~/.sibyl-memory/tier_cache.json").expanduser()
59
59
 
60
60
  POLL_INTERVAL_SEC = 3
61
- # v0.3.4 fix: bumped from 10min to 30min to match the server-side
62
- # PAIRING_TTL_SECONDS (also raised to 30min in session-init.js). At the prior
63
- # 10min CLI timeout the server kept the pairing code valid 5min longer than
64
- # the CLI was listening — users who took 10-15min to find the code in their
65
- # inbox would hit a silent-success failure: browser shows the success modal,
66
- # server binds the session, but the CLI has already exited and the local
67
- # credentials.json never lands. The user sees no error anywhere and concludes
68
- # "the plugin doesn't work." The two windows now match.
69
- INIT_TIMEOUT_SEC = 30 * 60 # 30 minutes for /init activation
70
- UPGRADE_TIMEOUT_SEC = 30 * 60 # 30 minutes for upgrade — wallet ux can be slow
61
+ # v0.3.5 fix: the CLI no longer carries its own activation deadline. The
62
+ # server's /session-init response includes pairing_ttl_seconds — the CLI
63
+ # polls until that timestamp, deferring to the server as the single source
64
+ # of truth. The constants below are fallbacks only, used when session-init
65
+ # fails to return a value (network error, schema drift). Drift between CLI
66
+ # and server is now impossible by construction; the prior 10min/15min
67
+ # silent-success gap can't recur because there is no CLI-side number to
68
+ # diverge from the server's.
69
+ INIT_TIMEOUT_FALLBACK_SEC = 30 * 60 # used only if session-init returns no TTL
70
+ UPGRADE_TIMEOUT_SEC = 30 * 60 # upgrade flow uses local constant — no server handshake to defer to
71
71
 
72
72
  # ---- Color / output ----------------------------------------------------
73
73
 
@@ -262,8 +262,16 @@ def cmd_init(args: argparse.Namespace) -> int:
262
262
  # Pre-register the session + pairing code hash with the server.
263
263
  # The code itself never leaves the user's machine until they type it
264
264
  # into the browser.
265
+ #
266
+ # v0.3.5: capture pairing_ttl_seconds from the response and use it as
267
+ # the activation deadline. Server is the single source of truth — if
268
+ # the server-side TTL ever changes, the CLI adopts the new value
269
+ # automatically without a re-publish. INIT_TIMEOUT_FALLBACK_SEC only
270
+ # applies when the call fails entirely (network error) or the response
271
+ # is missing the field (schema drift).
272
+ pairing_ttl_seconds = None
265
273
  try:
266
- http_request(
274
+ init_resp = http_request(
267
275
  "POST",
268
276
  "/api/plugin/session-init",
269
277
  body={
@@ -277,11 +285,17 @@ def cmd_init(args: argparse.Namespace) -> int:
277
285
  },
278
286
  timeout=10.0,
279
287
  )
288
+ if isinstance(init_resp, dict):
289
+ v = init_resp.get("pairing_ttl_seconds")
290
+ if isinstance(v, (int, float)) and v > 0:
291
+ pairing_ttl_seconds = int(v)
280
292
  except HttpError as e:
281
293
  # Non-fatal: SIWE path doesn't need the pairing code. If session-init
282
294
  # fails the user can still complete SIWE. Surface the warning.
283
295
  print(yellow(f"Warning: session-init failed ({e.status}). Wallet path still works; email path may not."))
284
296
 
297
+ activation_window_sec = pairing_ttl_seconds if pairing_ttl_seconds else INIT_TIMEOUT_FALLBACK_SEC
298
+
285
299
  print()
286
300
  print(a.section_header("activation", subtitle="three paths · pick whichever fits your device"))
287
301
  print()
@@ -301,7 +315,7 @@ def cmd_init(args: argparse.Namespace) -> int:
301
315
  pass
302
316
 
303
317
  # Poll /api/plugin/check
304
- deadline = time.time() + INIT_TIMEOUT_SEC
318
+ deadline = time.time() + activation_window_sec
305
319
  last_status = ""
306
320
  spinner = "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"
307
321
  spin_i = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sibyl-memory-cli
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Command-line interface for the Sibyl Memory Plugin. `sibyl init` activates, `sibyl upgrade` runs the staker / subscription flow, `sibyl status` shows current tier and DB stats, `sibyl whoami` gives a one-line account summary, `sibyl devices` lists active devices and supports per-device revoke.
5
5
  Author-email: "SIBYL, Sibyl Labs LLC" <sibyl@sibyllabs.org>
6
6
  License: MIT