@nivaro/react 0.2.54 → 0.2.56

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 (151) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +367 -2
  4. package/dist/index.js +645 -616
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/stale-chunk.js +60 -0
  150. package/dist/shared/lib/worker-socket.js +200 -0
  151. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -575,6 +575,50 @@ declare interface AvailableBulkAction {
575
575
  guard?: GuardRule[] | null;
576
576
  }
577
577
 
578
+ declare type BackgroundPhase = 'idle' | 'offer' | 'starting' | 'running' | 'done' | 'error';
579
+
580
+ /**
581
+ * "Run in background" for slow reads (#2759) — the client half of /api/background-runs.
582
+ *
583
+ * A custom query, report widget, page widget or dashboard widget that is still loading after a
584
+ * moment asks the server how long it usually takes. Known-slow (or still loading after
585
+ * OFFER_ANYWAY_MS) → the page offers to hand it to the server. The server replays the SAME
586
+ * request as the signed-in person on its background pool; the page shows elapsed time against
587
+ * the usual time, the Jobs tray carries the run if they leave, and when it is ready the result
588
+ * drops into the page's own query cache — the normal refetch replaces it as usual.
589
+ *
590
+ * A run is remembered per request in sessionStorage, so coming back to the page (or a remount)
591
+ * picks it up instead of offering again.
592
+ */
593
+ export declare interface BackgroundRequest {
594
+ method: 'GET' | 'POST';
595
+ /** API path without the /api prefix, e.g. `/custom-queries/pub-health/execute`. */
596
+ url: string;
597
+ body?: unknown;
598
+ }
599
+
600
+ /**
601
+ * The "Run in background" strip for a slow read (#2759). Render it inside the loading state of
602
+ * a custom query, report widget, page widget or dashboard widget; it stays empty until the read
603
+ * has been loading for a moment AND is known to be slow (or has simply been loading a long time),
604
+ * then offers to hand the read to the server. While the server runs it, the strip shows elapsed
605
+ * time against the usual time; when the result is ready it fills the page's own query and the
606
+ * strip goes away. Every state is inline — no dialog.
607
+ */
608
+ export declare function BackgroundRunOffer({ className, ...opts }: UseBackgroundRunOptions & {
609
+ className?: string;
610
+ }): JSX.Element | null;
611
+
612
+ declare interface BackgroundRunView {
613
+ id: string;
614
+ status: 'running' | 'completed' | 'error';
615
+ started_at: string;
616
+ finished_at: string | null;
617
+ expected_ms: number | null;
618
+ error: string | null;
619
+ result_kept: boolean;
620
+ }
621
+
578
622
  export declare interface BannerLine {
579
623
  api: string;
580
624
  tone: 'danger' | 'warning' | 'neutral' | 'positive';
@@ -882,6 +926,8 @@ export declare interface ChangeReasonChallenge {
882
926
  field: string;
883
927
  value: unknown;
884
928
  }>;
929
+ /** #2705: asked by the layout ("Are you sure?") rather than the collection. */
930
+ confirm?: boolean;
885
931
  }
886
932
 
887
933
  /**
@@ -931,6 +977,10 @@ declare interface ChannelMeta {
931
977
  }>;
932
978
  welcome_note?: string | null;
933
979
  default_roles?: string[];
980
+ /** Who may use @channel / @here (#2483); null = the owner and admins. */
981
+ mention_policy?: 'owner' | 'members' | 'admins' | null;
982
+ /** Set while the owner has an unanswered idle-archive suggestion (#2485). */
983
+ archive_suggested_at?: string | null;
934
984
  }
935
985
 
936
986
  declare interface Chapter {
@@ -1048,6 +1098,8 @@ export declare interface ChatMessage {
1048
1098
  reactions?: ChatReaction[];
1049
1099
  /** The admin who was masquerading as the sender when it was sent. */
1050
1100
  masquerade_admin_name?: string | null;
1101
+ /** The connected app (an AI assistant over MCP) that posted it for the sender (#2492). */
1102
+ via_app?: string | null;
1051
1103
  /** Thread reply (#927): the root it answers. Null on the timeline. */
1052
1104
  parent_id?: number | null;
1053
1105
  /** Quoted message (#928). */
@@ -1728,6 +1780,8 @@ export declare function createLiveQueryBridge(qc: QueryClient, realtime: Realtim
1728
1780
 
1729
1781
  export declare function createSocketRealtime(opts: SocketRealtimeOptions): SocketRealtime;
1730
1782
 
1783
+ export declare function createWorkerSocket(opts: WorkerSocketOptions): WorkerSocket;
1784
+
1731
1785
  export declare function CronBuilder({ value, onChange, disabled }: {
1732
1786
  value: string;
1733
1787
  onChange: (cron: string) => void;
@@ -2523,6 +2577,12 @@ export declare function extractExpressionTokens(src: string): string[];
2523
2577
  /** Extract the slot key from an assignment field name, or null. */
2524
2578
  export declare function extSlotKey(field: string): string | null;
2525
2579
 
2580
+ declare interface FallbackSocket extends SocketLike {
2581
+ once?(event: string, cb: Listener): unknown;
2582
+ connect?(): unknown;
2583
+ disconnect?(): unknown;
2584
+ }
2585
+
2526
2586
  declare type FetchCfg = {
2527
2587
  apiBase: string;
2528
2588
  authHeaders: Record<string, string>;
@@ -2572,6 +2632,24 @@ export declare function fieldDrilldownConfig(field: {
2572
2632
  _overrides?: Record<string, unknown> | null;
2573
2633
  }): FieldDrilldownConfig | null;
2574
2634
 
2635
+ export declare interface FieldFocus {
2636
+ /** field name (or `row:<collection>:<id>` / `cell:<collection>:<row>:<field>`) → who is in it. */
2637
+ editing: Record<string, SignalPerson>;
2638
+ /** Tell the record's other viewers you are in this field. */
2639
+ focus: (field: string) => void;
2640
+ /** …and that you left it. */
2641
+ blur: (field: string) => void;
2642
+ }
2643
+
2644
+ export declare interface FieldFocusOptions {
2645
+ /**
2646
+ * Watch the document for focus moving between `[data-field]` wrappers (what the shared
2647
+ * form renders around every field) and send focus/blur yourself. Off by default: a host
2648
+ * that already relays focus (the admin) must not send it twice.
2649
+ */
2650
+ capture?: boolean;
2651
+ }
2652
+
2575
2653
  declare interface FieldGroup {
2576
2654
  /** Content block (#53): type 'content' renders this text instead of fields. */
2577
2655
  content?: string | null;
@@ -4094,9 +4172,18 @@ declare interface InputBinding {
4094
4172
  binding_value: string;
4095
4173
  }
4096
4174
 
4175
+ /**
4176
+ * Document-level intent listener: resting on (or keyboard-focusing) a same-origin link
4177
+ * preloads its screen's code, and a record link also warms the record. Returns the uninstaller.
4178
+ */
4179
+ export declare function installIntentPrefetch(opts: IntentPrefetchOptions): () => void;
4180
+
4097
4181
  /** Idempotent; a no-op outside a browser. Watches for the rest of the page's life. */
4098
4182
  export declare function installReplayTail(): void;
4099
4183
 
4184
+ /** Listen for chunk-load failures (Vite's preload error and unhandled import rejections). */
4185
+ export declare function installStaleChunkRecovery(opts?: StaleChunkRecoveryOptions): () => void;
4186
+
4100
4187
  export declare type IntegrationActionResult = {
4101
4188
  key: string;
4102
4189
  ok: boolean;
@@ -4431,6 +4518,17 @@ export declare interface IntegrationSignalView {
4431
4518
  shown: number;
4432
4519
  }
4433
4520
 
4521
+ declare interface IntentPrefetchOptions {
4522
+ qc: QueryClient;
4523
+ client: NivaroClient | null;
4524
+ /** A link's same-origin path → the record it opens, or null. */
4525
+ matchRecord?: (path: string) => RecordTarget | null;
4526
+ /** Load the code for the screen a same-origin path opens. */
4527
+ preloadRoute?: (path: string) => void;
4528
+ /** Only links inside this element (default: the whole document). */
4529
+ root?: HTMLElement | Document;
4530
+ }
4531
+
4434
4532
  /** A title card before the recording (real extra edited time). Blank
4435
4533
  * `title` / `subtitle` mean the video's title and the first line of its
4436
4534
  * description. */
@@ -4452,6 +4550,21 @@ export declare function isChatPanelPinned(): boolean;
4452
4550
 
4453
4551
  export declare function isCleanRecording(): boolean;
4454
4552
 
4553
+ /**
4554
+ * Stale code chunks after a deploy. Screens load lazily by hashed file names, and a new
4555
+ * release no longer serves the previous build's files — so a tab opened before the deploy
4556
+ * failed to open any screen it had not visited yet ("Failed to fetch dynamically imported
4557
+ * module") until someone reloaded. During a rolling deploy one replica briefly serves the new
4558
+ * build while another still serves the old one, which makes it likelier.
4559
+ *
4560
+ * `installStaleChunkRecovery()` reloads the tab onto the current build when a chunk fails to
4561
+ * load. A second failure within the window means a reload does not help (the server really
4562
+ * is missing the file, or the network is down): it stops reloading and calls `onGiveUp`, so
4563
+ * the host can say so instead of looping.
4564
+ */
4565
+ /** Whether an error (or a rejection reason) is a code chunk that could not be loaded. */
4566
+ export declare function isStaleChunkError(reason: unknown): boolean;
4567
+
4455
4568
  export declare function ItemActionButtons({ collection, itemId }: {
4456
4569
  collection: string;
4457
4570
  itemId: string;
@@ -4743,6 +4856,8 @@ declare interface LayoutDesign {
4743
4856
  lastChange?(t: DesignTarget): LastChange | null;
4744
4857
  /** A new record's starting value for the field, as grey placeholder text (#2633). */
4745
4858
  ghost?(field: string): string | null;
4859
+ /** #2701: the width handle on a selected field set its width (12, 6, 4 or 3 columns). */
4860
+ resizeWidth?(t: DesignTarget, span: number): void;
4746
4861
  }
4747
4862
 
4748
4863
  /**
@@ -4830,6 +4945,8 @@ declare interface LayoutGroup {
4830
4945
  visibility_mode?: string | null;
4831
4946
  /** Migration 311 — read-board width: full | half | third | null (auto). */
4832
4947
  read_width?: string | null;
4948
+ /** Rows of fields and the empty-section text ride here (lib/form-structure.ts). */
4949
+ swap_config?: string | null;
4833
4950
  }
4834
4951
 
4835
4952
  export declare type LayoutItem = FormGroupDescriptor | '__ungrouped__';
@@ -4858,6 +4975,8 @@ declare interface LayoutMeta {
4858
4975
  default_values?: Record<string, unknown> | null;
4859
4976
  /** Quick picker: relation fields walked one step at a time on create. */
4860
4977
  quick_picker?: string[] | null;
4978
+ /** Entry ergonomics (#2702-#2728): keyboard, tab order, mode, badge — see lib/entry-config. */
4979
+ entry_config?: Record<string, unknown> | null;
4861
4980
  }
4862
4981
 
4863
4982
  declare interface LayoutSlotHandle {
@@ -4932,6 +5051,8 @@ export declare function LearningPathCard({ className }: {
4932
5051
  className?: string;
4933
5052
  }): JSX.Element;
4934
5053
 
5054
+ declare type Listener = (...args: any[]) => void;
5055
+
4935
5056
  export declare function listFieldInterfaces(): string[];
4936
5057
 
4937
5058
  /**
@@ -6368,6 +6489,13 @@ declare interface PersonRef {
6368
6489
  ooo_end?: string | null;
6369
6490
  }
6370
6491
 
6492
+ /** Where a picker sits on a record form: enough for the server to count a miss per placement. */
6493
+ declare interface PickerMissPlacement {
6494
+ layoutId: number;
6495
+ collection: string;
6496
+ field: string;
6497
+ }
6498
+
6371
6499
  declare type PinnedCfg = {
6372
6500
  when?: {
6373
6501
  field: string;
@@ -6399,7 +6527,7 @@ declare type PipelineBinding = {
6399
6527
  dimensions?: PipelineOwnerDimension[];
6400
6528
  };
6401
6529
 
6402
- export declare type PipelineEditorSection = 'states' | 'transitions' | 'branches' | 'bindings' | 'matrix' | 'simulator' | 'canvas' | 'flow-map' | 'replay' | 'migration' | 'coverage' | 'lint' | 'skip-report' | 'ai-review' | 'versions' | 'matrix-versions';
6530
+ export declare type PipelineEditorSection = 'states' | 'transitions' | 'branches' | 'bindings' | 'matrix' | 'simulator' | 'canvas' | 'flow-map' | 'replay' | 'cumulative-flow' | 'migration' | 'coverage' | 'lint' | 'skip-report' | 'ai-review' | 'versions' | 'matrix-versions';
6403
6531
 
6404
6532
  export declare function PipelineEditorView({ templateId, onBack, onExport, hidden }: {
6405
6533
  templateId: string;
@@ -6564,6 +6692,17 @@ declare function pollProposal(opts: {
6564
6692
  */
6565
6693
  export declare function precisionOf(options: unknown, fallback?: number): number;
6566
6694
 
6695
+ /** API prefetches one tab may make in any rolling minute. */
6696
+ export declare const PREFETCH_PER_MINUTE = 30;
6697
+
6698
+ /**
6699
+ * Warm a record page: its readOne and the layout it will open with. Returns how many requests
6700
+ * went out (0 when both were fresh or the budget was spent).
6701
+ */
6702
+ export declare function prefetchRecord(qc: QueryClient, client: NivaroClient, collection: string, id: string | number, opts?: {
6703
+ layout?: boolean;
6704
+ }): number;
6705
+
6567
6706
  export declare interface PreparedReplayClip {
6568
6707
  /** Upload what was taken at prepare time; null when nothing is recording. */
6569
6708
  commit(timeoutMs?: number): Promise<ReplayLink | null>;
@@ -7512,6 +7651,36 @@ export declare function RecordOutboxHost({ userId, onOpenRecord }: {
7512
7651
  onOpenRecord?: (collection: string, itemId: string) => void;
7513
7652
  }): null;
7514
7653
 
7654
+ /**
7655
+ * Presence hooks for headless frontends (#2487, #2486), over the host's realtime adapter —
7656
+ * the socket the host already holds (`createSocketRealtime`, or the shared worker's facade).
7657
+ * Without an adapter every hook is inert and returns nothing, like the live hooks.
7658
+ *
7659
+ * usePresence('orders', id) → { viewers } who else has this record open
7660
+ * useFieldFocus('orders', id) → { editing, focus, blur } the field (or grid cell) each
7661
+ * person is in, and your own
7662
+ * useTyping('orders', id) → { typing, setTyping } "Beth is writing a note"
7663
+ * useRowPresence('orders', ids) → { [id]: { ids, count } } who has each list row open
7664
+ *
7665
+ * All of it is names-only and server-gated: the record room admits only people who may open
7666
+ * the record (the read gate), `presence:rows` carries user ids and the names come from
7667
+ * `GET /presence/people`, which answers only with people the viewer may see.
7668
+ *
7669
+ * The admin's own record page keeps `useRecordPresence` (its record room rides a tab-local
7670
+ * socket when the shared worker is off); these hooks need an adapter whose `emit` reaches a
7671
+ * socket this tab owns, which `createSocketRealtime` and the worker facade both give.
7672
+ */
7673
+ export declare interface RecordPresence {
7674
+ /** The OTHER people with this record open right now. */
7675
+ viewers: SignalPerson[];
7676
+ }
7677
+
7678
+ /** The query keys the record page reads (ItemEditForm / admin ItemEdit share them). */
7679
+ export declare function recordQueryKeys(collection: string, id: string | number): {
7680
+ item: QueryKey;
7681
+ layout: QueryKey;
7682
+ };
7683
+
7515
7684
  /**
7516
7685
  * Read-only record presentation. With `design` (the layout editor's canvas)
7517
7686
  * the whole view — its own hooks included — runs inside DesignCanvas: a
@@ -7614,6 +7783,11 @@ export declare function RecordSubscribeButton({ collection, itemId, recordLabel,
7614
7783
  compact?: boolean;
7615
7784
  }): JSX.Element;
7616
7785
 
7786
+ declare interface RecordTarget {
7787
+ collection: string;
7788
+ id: string;
7789
+ }
7790
+
7617
7791
  declare type Rect = {
7618
7792
  x: number;
7619
7793
  y: number;
@@ -7657,8 +7831,11 @@ export declare function RelatedRecordsPanel({ collection, itemId, title, default
7657
7831
  defaultExpanded?: boolean;
7658
7832
  }): JSX.Element;
7659
7833
 
7660
- export declare function RelationCombobox({ collection, value, onChange, disabled, placeholder, extraFilter, autoSelectSingle, optionSort, requiredParent, facets, fieldKey, narrowedBy, pinned }: {
7834
+ export declare function RelationCombobox({ collection, value, onChange, disabled, placeholder, extraFilter, autoSelectSingle, optionSort, requiredParent, facets, fieldKey, narrowedBy, pinned, missPlacement }: {
7661
7835
  collection: string;
7836
+ /** The record-form placement this picker sits on: searches that find
7837
+ * nothing are counted there (#2726). Absent = not reported. */
7838
+ missPlacement?: PickerMissPlacement | null;
7662
7839
  value: unknown;
7663
7840
  onChange: (v: unknown) => void;
7664
7841
  /** A "floating" option shown FIRST regardless of search or sort — the
@@ -8173,6 +8350,35 @@ declare interface RowMatchPanelConfig {
8173
8350
  };
8174
8351
  }
8175
8352
 
8353
+ /**
8354
+ * "Who has this row open" on a list row (#2486): up to three 16px avatar discs, overlapping,
8355
+ * then "+N" when more people are there; the names in the instant tooltip. People the viewer
8356
+ * may not see (the presence visibility rule) count but show no face — a neutral disc with
8357
+ * the number stands for them. Nothing renders when nobody else has the row open.
8358
+ *
8359
+ * Small on purpose: it sits in the row's 16px mark slot (next to the lock / new / unseen
8360
+ * marks) or inline after a label, and must never move the text beside it.
8361
+ */
8362
+ export declare function RowPresence({ viewers, size, dataAttr, max }: {
8363
+ viewers: RowViewers | null | undefined;
8364
+ size?: number;
8365
+ dataAttr?: string;
8366
+ max?: number;
8367
+ }): JSX.Element | null;
8368
+
8369
+ export declare function rowPresenceKey(collection: string, item: string | number): string;
8370
+
8371
+ export declare interface RowPresenceOptions {
8372
+ enabled?: boolean;
8373
+ /** Without a realtime adapter, poll counts this often (0 = never). Default 30 000. */
8374
+ pollMs?: number;
8375
+ }
8376
+
8377
+ export declare interface RowRef {
8378
+ collection: string;
8379
+ item: string | number;
8380
+ }
8381
+
8176
8382
  declare interface RowRule {
8177
8383
  trigger_field?: string | null;
8178
8384
  /** Additional trigger fields — any of them changing fires the rule. */
@@ -8197,6 +8403,13 @@ declare interface RowSnooze {
8197
8403
  note: string | null;
8198
8404
  }
8199
8405
 
8406
+ export declare interface RowViewers {
8407
+ /** The OTHER people with the row open whom the viewer may see (names resolvable). */
8408
+ ids: string[];
8409
+ /** Everyone else with it open, visible or not (the count the chip shows). */
8410
+ count: number;
8411
+ }
8412
+
8200
8413
  /** Route-change timing: from the navigation to a settled double-rAF frame. */
8201
8414
  export declare function rumRouteChange(pathname: string): void;
8202
8415
 
@@ -8351,6 +8564,9 @@ export declare function setServerClockOffset(ms: number): void;
8351
8564
 
8352
8565
  export declare function setTimeDisplay(mode: string | null | undefined): void;
8353
8566
 
8567
+ /** True when this browser can share a socket between tabs. */
8568
+ export declare function sharedWorkerSupported(): boolean;
8569
+
8354
8570
  /**
8355
8571
  * The pure part of opening a query sheet: which tabs it has, which tab opens
8356
8572
  * first, and the optional header strip (a query of its own, rendered above
@@ -8380,6 +8596,12 @@ declare interface SheetItem {
8380
8596
  url: string;
8381
8597
  }
8382
8598
 
8599
+ /**
8600
+ * Whether a host should try the worker: supported, not switched off for this browser, and the
8601
+ * worker URL on this page's origin (a SharedWorker script must be same-origin).
8602
+ */
8603
+ export declare function shouldUseWorkerSocket(url: string): boolean;
8604
+
8383
8605
  export declare function SignalCard({ signal, expanded, onToggle, onOpenRecord, onExplain, canExplain }: SignalCardProps): JSX.Element;
8384
8606
 
8385
8607
  export declare interface SignalCardProps {
@@ -8568,6 +8790,9 @@ export declare function SnoozeMenu({ signal, signalLabel, rowKey, group, default
8568
8790
  * `nvr:config-update`; `client:force-refresh` → `nvr:force-refresh` (the window events admin's
8569
8791
  * socket raises, so shared banners and forms behave the same in every host).
8570
8792
  * - Connection state for the reconnect banner and stale marks (`status` / `onStatus`).
8793
+ * - Missed events while connected (#2462): a room whose own counter (`_rseq`) skips is caught up
8794
+ * alone (`catchup:room`); `realtime:stale` (#2460 — the server held this socket's broadcasts
8795
+ * while it was too far behind) refetches the rooms it names and raises `nvr:realtime-stale`.
8571
8796
  *
8572
8797
  * The socket is duck-typed (socket.io-client's `Socket` fits), so this package takes no
8573
8798
  * dependency on socket.io-client. It never decides what a viewer may see: every room is gated by
@@ -8590,6 +8815,16 @@ export declare interface SocketLike {
8590
8815
  };
8591
8816
  }
8592
8817
 
8818
+ declare interface SocketLike_2 {
8819
+ on(ev: string, fn: (...a: any[]) => void): unknown;
8820
+ onAny?(fn: (ev: string, ...a: any[]) => void): unknown;
8821
+ offAny?(fn: (ev: string, ...a: any[]) => void): unknown;
8822
+ off?(ev: string, fn: (...a: any[]) => void): unknown;
8823
+ io?: {
8824
+ on?(ev: string, fn: (...a: any[]) => void): unknown;
8825
+ };
8826
+ }
8827
+
8593
8828
  export declare interface SocketRealtime extends RealtimeAdapter {
8594
8829
  status(): RealtimeStatus;
8595
8830
  onStatus(cb: (s: RealtimeStatus) => void): () => void;
@@ -8634,6 +8869,16 @@ declare interface SpriteSheet {
8634
8869
  interval_ms: number;
8635
8870
  }
8636
8871
 
8872
+ declare interface StaleChunkRecoveryOptions {
8873
+ /** Called instead of a second reload inside the window. */
8874
+ onGiveUp?: () => void;
8875
+ /** Test seams. */
8876
+ storage?: Pick<Storage, 'getItem' | 'setItem'> | null;
8877
+ reload?: () => void;
8878
+ now?: () => number;
8879
+ target?: Pick<Window, 'addEventListener' | 'removeEventListener'>;
8880
+ }
8881
+
8637
8882
  /**
8638
8883
  * Idempotent; safe from an effect that runs more than once, and safe to call
8639
8884
  * from several components — only the first call arms the timer.
@@ -8929,6 +9174,9 @@ declare interface TailRequest {
8929
9174
  ms: number;
8930
9175
  }
8931
9176
 
9177
+ /** Feed the bus from a socket.io-style client. Returns the undo. */
9178
+ export declare function tapReplaySocket(socket: SocketLike_2): () => void;
9179
+
8932
9180
  export declare function TaskPanel({ collection, item, title, defaultExpanded, queuedTasks, onQueueTask, onRemoveQueuedTask }: {
8933
9181
  collection: string;
8934
9182
  item: string;
@@ -9140,6 +9388,13 @@ export declare interface TuningSummary {
9140
9388
  }>;
9141
9389
  }
9142
9390
 
9391
+ export declare interface Typing {
9392
+ /** Names of the other people writing a note on this record right now. */
9393
+ typing: string[];
9394
+ /** Call with true while the person types (it repeats the heartbeat), false when they stop. */
9395
+ setTyping: (active: boolean) => void;
9396
+ }
9397
+
9143
9398
  /** What is unsaved right now — the leave-page prompt, the changes tray and
9144
9399
  * the host's own dirty indicator all read this one breakdown. */
9145
9400
  declare interface UnsavedSummary {
@@ -9247,6 +9502,34 @@ export declare function useAutoRecord(opts?: {
9247
9502
  /** Available actions per collection, for the viewer. */
9248
9503
  export declare function useAvailableBulkActions(collections: string[]): UseQueryResult<NoInfer<Record<string, AvailableBulkAction[]>>, Error>;
9249
9504
 
9505
+ declare interface UseBackgroundRun {
9506
+ phase: BackgroundPhase;
9507
+ /** The usual duration the server knows, ms. */
9508
+ typicalMs: number | null;
9509
+ run: BackgroundRunView | null;
9510
+ error: string | null;
9511
+ start: () => void;
9512
+ }
9513
+
9514
+ export declare function useBackgroundRun(opts: UseBackgroundRunOptions): UseBackgroundRun;
9515
+
9516
+ declare interface UseBackgroundRunOptions {
9517
+ /** True while the page's own read is still loading. */
9518
+ pending: boolean;
9519
+ /** The read the page is making; null = nothing to offer. */
9520
+ request: BackgroundRequest | null;
9521
+ /** What the person will see in the Jobs tray. */
9522
+ label: string;
9523
+ /** The page's query to fill when the run is ready (setQueryData with `select(body)`). */
9524
+ queryKey?: QueryKey;
9525
+ /** Response body → the query's data. Default: the body itself. */
9526
+ select?: (body: unknown) => unknown;
9527
+ /** For pages that keep the read in their own state: the finished response body. */
9528
+ onResult?: (body: unknown) => void;
9529
+ /** The result was not kept (too big / expired): read again — the route's cache answers. */
9530
+ onGone?: () => void;
9531
+ }
9532
+
9250
9533
  export declare function useChannelAdmin(channelId: number | null): {
9251
9534
  update: UseMutationResult<unknown, Error, {
9252
9535
  name?: string;
@@ -9264,6 +9547,7 @@ export declare function useChannelAdmin(channelId: number | null): {
9264
9547
  }>;
9265
9548
  welcome_note?: string | null;
9266
9549
  default_roles?: string[];
9550
+ mention_policy?: "owner" | "members" | "admins" | null;
9267
9551
  }, unknown>;
9268
9552
  addMember: UseMutationResult<unknown, Error, string, unknown>;
9269
9553
  removeMember: UseMutationResult<unknown, Error, string, unknown>;
@@ -9403,6 +9687,9 @@ export declare function useFeatureFlags(): {
9403
9687
 
9404
9688
  export declare function useFieldArray(form: UseNivaroFormReturn, field: string): FieldArrayReturn;
9405
9689
 
9690
+ /** Which field or grid cell each co-viewer is editing, and a way to announce your own. */
9691
+ export declare function useFieldFocus(collection: string | null | undefined, item: string | number | null | undefined, opts?: FieldFocusOptions): FieldFocus;
9692
+
9406
9693
  export declare function useFieldState(form: UseNivaroFormReturn, field: string): FieldState;
9407
9694
 
9408
9695
  /**
@@ -9474,8 +9761,24 @@ version_id: string | null;
9474
9761
  steps: WalkStep[];
9475
9762
  }>, Error>;
9476
9763
 
9764
+ /**
9765
+ * Idle next page: once a list page has loaded and more pages exist, fetch the next one into its
9766
+ * own key while the browser has nothing better to do.
9767
+ */
9768
+ export declare function useIdleNextPage(opts: {
9769
+ enabled: boolean;
9770
+ queryKey: QueryKey;
9771
+ queryFn: () => Promise<unknown>;
9772
+ qc: QueryClient;
9773
+ }): void;
9774
+
9477
9775
  export declare function useImportHealth(): UseQueryResult<NoInfer<ImportHealth>, Error>;
9478
9776
 
9777
+ /** Mount once in an app shell (inside the QueryClientProvider). */
9778
+ export declare function useIntentPrefetch(opts: IntentPrefetchOptions & {
9779
+ enabled?: boolean;
9780
+ }): void;
9781
+
9479
9782
  /** True when clean mode runs AND `userId` is the signed-in person (the host's
9480
9783
  * setRecordingSelf, else the record form's auth context). */
9481
9784
  export declare function useIsRecordingSelf(userId: string | number | null | undefined): boolean;
@@ -9703,6 +10006,9 @@ export declare function usePersonProfile(userId: string | null | undefined): Use
9703
10006
 
9704
10007
  export declare function usePlanGridHost(): PlanGridHost | null;
9705
10008
 
10009
+ /** Who else is viewing one record (joins its room; names only). */
10010
+ export declare function usePresence(collection: string | null | undefined, item: string | number | null | undefined): RecordPresence;
10011
+
9706
10012
  /**
9707
10013
  * Publish what this page shows. Re-publishes only when the context's content
9708
10014
  * changes (compared as JSON), and withdraws it when the page unmounts.
@@ -9849,6 +10155,13 @@ export declare function userOptionFilter(isAdmin: boolean): {
9849
10155
  })[];
9850
10156
  };
9851
10157
 
10158
+ /**
10159
+ * Who has each of these rows open, keyed `collection:item`: live through the presence room
10160
+ * (`presence:watch` → `presence:rows`), a 30 s count poll when the host has no realtime
10161
+ * adapter. The viewer's own tabs are left out. Rows may span collections (a queue).
10162
+ */
10163
+ export declare function useRowPresence(rows: RowRef[], opts?: RowPresenceOptions): Record<string, RowViewers>;
10164
+
9852
10165
  /** Stacked avatar cluster (+N) with a hover/pinnable portal roster whose rows
9853
10166
  * are UserChips — the single user-display primitive for owners/user lists.
9854
10167
  * Reused by the item-header Owners chip and the collection browser. */
@@ -9929,6 +10242,9 @@ emoji: string;
9929
10242
  */
9930
10243
  export declare function useTopicPresence(topic: string | null | undefined, selfId?: string | null): TopicPresence;
9931
10244
 
10245
+ /** "Beth is writing a note" on a record's comment thread, both directions. */
10246
+ export declare function useTyping(collection: string | null | undefined, item: string | number | null | undefined): Typing;
10247
+
9932
10248
  export declare function useTypingIndicator(room: string | null): {
9933
10249
  onType: () => void;
9934
10250
  clearTyping: () => void;
@@ -10142,6 +10458,55 @@ export declare function withClipKind<T extends {
10142
10458
 
10143
10459
  export declare function withGetCoalescing(client: NivaroClient, opts?: CoalescingOptions): NivaroClient;
10144
10460
 
10461
+ export declare interface WorkerSocket extends FallbackSocket {
10462
+ once(event: string, cb: Listener): unknown;
10463
+ onAny(cb: (event: string, ...args: any[]) => void): unknown;
10464
+ offAny(cb: (event: string, ...args: any[]) => void): unknown;
10465
+ listeners(event: string): Listener[];
10466
+ connect(): void;
10467
+ disconnect(): void;
10468
+ /** 'pending' until the worker greets or the fallback is taken. */
10469
+ mode(): 'pending' | 'worker' | 'fallback';
10470
+ /** The transport the worker's socket uses (for status displays). */
10471
+ io: {
10472
+ engine: {
10473
+ transport: {
10474
+ name?: string;
10475
+ };
10476
+ once(ev: string, cb: () => void): void;
10477
+ };
10478
+ };
10479
+ }
10480
+
10481
+ export declare interface WorkerSocketOptions {
10482
+ /** Same-origin URL of the worker script. */
10483
+ url: string;
10484
+ /** SharedWorker name: one worker per app on an origin (`admin`, `efp-new`). */
10485
+ name?: string;
10486
+ /** `client:hello` app label. */
10487
+ app: string;
10488
+ /** Extra `client:hello` features (the worker always adds `coalesce`). */
10489
+ features?: string[];
10490
+ /** Build fields for `client:hello` (client-version.ts `clientVersion()`). */
10491
+ version?: Record<string, unknown>;
10492
+ /** Mint a `/auth/ws-token` for the worker's socket (the worker asks one tab per connect). */
10493
+ authToken: () => Promise<string | null>;
10494
+ /** The host's own socket, created only when the worker cannot serve this tab. */
10495
+ fallback: () => FallbackSocket;
10496
+ /** Told once when the mode settles, and again if the worker is abandoned later. */
10497
+ onMode?: (mode: 'worker' | 'fallback', reason: string) => void;
10498
+ /**
10499
+ * How long to wait for the worker's greeting before falling back (default 15000: a cold
10500
+ * worker fetches its script and socket.io's client first, slow on a dev proxy).
10501
+ */
10502
+ readyTimeoutMs?: number;
10503
+ /** No ping from the worker for this long = it is gone (default 20000). */
10504
+ silentMs?: number;
10505
+ }
10506
+
10507
+ /** The person's override for this browser, when they set one (a support step). */
10508
+ export declare function workerSocketPreference(): 'on' | 'off' | null;
10509
+
10145
10510
  export declare function WorkflowPanel({ collection, item }: {
10146
10511
  collection: string;
10147
10512
  item: string;