studio-engine 0.74.11 → 0.75.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.
data/lib/studio.rb CHANGED
@@ -10,6 +10,7 @@ require "studio/theme_resolver"
10
10
  require "studio/ui_primitives"
11
11
  require "studio/js_literal"
12
12
  require "studio/js_identifier"
13
+ require "studio/partial_block"
13
14
  require "studio/sidebar_sections"
14
15
  require "studio/profile_sections"
15
16
  require "studio/profile_image"
@@ -21,6 +22,8 @@ require "studio/s3"
21
22
  require "studio/image_cache"
22
23
  require "studio/link_token"
23
24
  require "studio/link_resolution"
25
+ require "studio/session_fingerprint"
26
+ require "studio/session_state"
24
27
  require "studio/email"
25
28
  require "studio/email_smoke"
26
29
  require "studio/mail_transport"
@@ -269,6 +272,33 @@ module Studio
269
272
  # its own routes (it can still reuse Studio::Link + Studio::LinkConsumption).
270
273
  mattr_accessor :draw_link_routes, default: true
271
274
 
275
+ # Draw the session-drift rehydrate endpoint, GET /session/state
276
+ # (Studio::SessionStatesController, helper studio_session_state_path). See
277
+ # docs/SESSION_DRIFT.md.
278
+ #
279
+ # OFF by default, and not because of a name collision (no consumer owns the
280
+ # path or the helper, checked 2026-09-16). The endpoint is a JSON GET that
281
+ # inherits the HOST's ApplicationController filters, and the browser store calls
282
+ # it whenever a tab returns from the background or learns another tab changed
283
+ # the session. A host must look at its own filters before that traffic starts:
284
+ # one that redirects every request to an onboarding page would answer the store
285
+ # with HTML. turf-monster already runs its own copy of this loop
286
+ # (/account/session_state), so drawing it there by default would double the
287
+ # requests. Each app's adoption turns it on:
288
+ #
289
+ # config.draw_session_routes = true
290
+ #
291
+ # With it off, every page still carries the stamp and the store still detects
292
+ # drift (another tab, expiry). It cannot repair a page in place, so it stays
293
+ # `stale` and the host decides what to do.
294
+ mattr_accessor :draw_session_routes, default: false
295
+
296
+ # The key Studio::SessionFingerprint signs with. nil (the default) derives one
297
+ # from the app's secret_key_base via Rails.application.key_generator, which
298
+ # every process of the app agrees on. Set it only to share fingerprints across
299
+ # two apps on one origin or to pin a value in a test.
300
+ mattr_accessor :session_fingerprint_secret, default: nil
301
+
272
302
  # Draw the shared transactional-email page at /admin/emails
273
303
  # (Studio::EmailsController). OFF by default because the path AND its helper
274
304
  # names (admin_emails_path / admin_email_path) are already taken in
@@ -886,6 +916,14 @@ module Studio
886
916
  constraints: { token: %r{[^/]+} }
887
917
  end
888
918
 
919
+ # The session-drift rehydrate endpoint (Studio::SessionStatesController).
920
+ # OPT-IN — see Studio.draw_session_routes. JSON only: the browser store is
921
+ # its one caller, and an HTML answer would only ever be a mistake.
922
+ if Studio.draw_session_routes
923
+ get "session/state", to: "studio/session_states#show", as: :studio_session_state,
924
+ defaults: { format: :json }
925
+ end
926
+
889
927
  # Knowledge layer — /admin/knowledge (Studio::KnowledgeDoc): folder/flat
890
928
  # document browser, upload-to-inbox intake, per-agent access map, and
891
929
  # 15-minute presigned downloads. Opt-in (default off) like every route
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: studio-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.74.11
4
+ version: 0.75.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McRitchie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-14 00:00:00.000000000 Z
11
+ date: 2026-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -303,6 +303,7 @@ files:
303
303
  - app/assets/images/state-flags/wy.svg
304
304
  - app/assets/javascripts/studio/alpine.js
305
305
  - app/assets/javascripts/studio/canvas_confetti.js
306
+ - app/assets/javascripts/studio/session.js
306
307
  - app/assets/javascripts/studio/sortable.js
307
308
  - app/assets/javascripts/studio/sticky_table_header.js
308
309
  - app/assets/javascripts/studio/studio_confetti.js
@@ -317,6 +318,7 @@ files:
317
318
  - app/controllers/concerns/studio/impersonation.rb
318
319
  - app/controllers/concerns/studio/link_consumption.rb
319
320
  - app/controllers/concerns/studio/magic_link_issuing.rb
321
+ - app/controllers/concerns/studio/session_drift.rb
320
322
  - app/controllers/error_logs_controller.rb
321
323
  - app/controllers/magic_links_controller.rb
322
324
  - app/controllers/navbar_controller.rb
@@ -335,6 +337,7 @@ files:
335
337
  - app/controllers/studio/models_controller.rb
336
338
  - app/controllers/studio/onboarding_controller.rb
337
339
  - app/controllers/studio/profiles_controller.rb
340
+ - app/controllers/studio/session_states_controller.rb
338
341
  - app/controllers/style_controller.rb
339
342
  - app/controllers/theme_settings_controller.rb
340
343
  - app/helpers/studio/admin_models_table_helper.rb
@@ -413,6 +416,7 @@ files:
413
416
  - app/views/studio/_fizz_layer.html.erb
414
417
  - app/views/studio/_hold_button.html.erb
415
418
  - app/views/studio/_leveling_activity_assets.html.erb
419
+ - app/views/studio/_session_stamp.html.erb
416
420
  - app/views/studio/admin_models/_arenas_table.html.erb
417
421
  - app/views/studio/admin_models/_teams_table.html.erb
418
422
  - app/views/studio/admin_models/index.html.erb
@@ -570,10 +574,13 @@ files:
570
574
  - lib/studio/name_parts.rb
571
575
  - lib/studio/newsletter.rb
572
576
  - lib/studio/oauth_identity.rb
577
+ - lib/studio/partial_block.rb
573
578
  - lib/studio/profile_image.rb
574
579
  - lib/studio/profile_sections.rb
575
580
  - lib/studio/redis.rb
576
581
  - lib/studio/s3.rb
582
+ - lib/studio/session_fingerprint.rb
583
+ - lib/studio/session_state.rb
577
584
  - lib/studio/sidebar_sections.rb
578
585
  - lib/studio/theme_resolver.rb
579
586
  - lib/studio/ui_primitives.rb