@ai-matrx/chat 0.3.33 → 0.4.2

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 (129) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/agents/addressing/useAgentHref.js +4 -1
  3. package/dist/agents/api/submit-tool-results.js +11 -1
  4. package/dist/agents/components/ambient-assistant/intelligence-places.js +2 -2
  5. package/dist/agents/components/chat/intelligence-places.js +7 -7
  6. package/dist/agents/components/chat/useCanvasScopedToConversation.js +1 -1
  7. package/dist/agents/components/inputs/smart-input/RunToolPicker.js +7 -13
  8. package/dist/agents/components/inputs/smart-input/composer/ComposerAgentPill.js +3 -2
  9. package/dist/agents/components/inputs/smart-input/composer/useComposerAgent.js +5 -5
  10. package/dist/agents/components/inputs/smart-input/composer/useComposerAgentFilter.js +3 -2
  11. package/dist/agents/components/messages-display/AgentConversationDisplay.js +4 -1
  12. package/dist/agents/components/run-controls/RunConfigOverrides.js +10 -16
  13. package/dist/agents/components/run-controls/panels/shared.d.ts +1 -1
  14. package/dist/agents/components/shared/AgentConversationColumn.js +3 -2
  15. package/dist/agents/components/working-document/workingDocumentSurface.d.ts +1 -1
  16. package/dist/agents/hooks/useAgentModelLabel.js +4 -3
  17. package/dist/agents/hooks/useDiffEnrichment.js +3 -5
  18. package/dist/agents/hooks/useModelControls.d.ts +5 -161
  19. package/dist/agents/identity/model-catalog.d.ts +37 -0
  20. package/dist/agents/identity/model-catalog.js +105 -0
  21. package/dist/agents/redux/agent-definition/selectors.d.ts +237 -237
  22. package/dist/agents/redux/agent-definition/thunks.d.ts +1 -1
  23. package/dist/agents/redux/agent-settings/agentSettingsSlice.d.ts +1 -1
  24. package/dist/agents/redux/agent-settings/agentSettingsSlice.js +4 -6
  25. package/dist/agents/redux/agent-settings/selectors.d.ts +13 -152
  26. package/dist/agents/redux/agent-settings/selectors.js +0 -39
  27. package/dist/agents/redux/agent-settings/useNormalizedControls.d.ts +8 -0
  28. package/dist/agents/redux/agent-settings/useNormalizedControls.js +24 -0
  29. package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +50 -50
  30. package/dist/agents/redux/agent-shortcuts/selectors.d.ts +147 -147
  31. package/dist/agents/redux/conversation-history/selectors.d.ts +16 -16
  32. package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +2 -2
  33. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +54 -54
  34. package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +14 -14
  35. package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +5 -5
  36. package/dist/agents/redux/execution-system/host-conversations/conversation-abilities.d.ts +12 -0
  37. package/dist/agents/redux/execution-system/host-conversations/conversation-abilities.js +25 -0
  38. package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.d.ts +50 -0
  39. package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.js +367 -0
  40. package/dist/agents/redux/execution-system/host-conversations/host-conversations.selectors.d.ts +28 -0
  41. package/dist/agents/redux/execution-system/host-conversations/host-conversations.selectors.js +41 -0
  42. package/dist/agents/redux/execution-system/host-conversations/host-conversations.slice.d.ts +43 -0
  43. package/dist/agents/redux/execution-system/host-conversations/host-conversations.slice.js +38 -0
  44. package/dist/agents/redux/execution-system/host-conversations/source-registry.d.ts +9 -0
  45. package/dist/agents/redux/execution-system/host-conversations/source-registry.js +15 -0
  46. package/dist/agents/redux/execution-system/host-conversations/useHostConversation.d.ts +4 -0
  47. package/dist/agents/redux/execution-system/host-conversations/useHostConversation.js +24 -0
  48. package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +3 -3
  49. package/dist/agents/redux/execution-system/instance-resources/default-remark-durability.d.ts +22 -0
  50. package/dist/agents/redux/execution-system/instance-resources/default-remark-durability.js +164 -0
  51. package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +8 -8
  52. package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +5 -5
  53. package/dist/agents/redux/execution-system/instance-user-input/composer-draft-store.js +20 -0
  54. package/dist/agents/redux/execution-system/instance-user-input/useComposerDraftRestore.js +2 -1
  55. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +7 -7
  56. package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +1 -1
  57. package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +7 -7
  58. package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +1 -1
  59. package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +14 -14
  60. package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +2 -1
  61. package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +4 -3
  62. package/dist/agents/redux/execution-system/thunks/load-conversation.thunk.js +6 -0
  63. package/dist/agents/redux/execution-system/thunks/load-older-messages.thunk.js +12 -0
  64. package/dist/agents/redux/execution-system/thunks/process-stream.js +5 -3
  65. package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +1 -1
  66. package/dist/agents/redux/execution-system/thunks/smart-execute.thunk.js +43 -0
  67. package/dist/agents/redux/execution-system/utils/continuation-body.d.ts +1 -0
  68. package/dist/agents/redux/execution-system/utils/continuation-body.js +2 -1
  69. package/dist/agents/redux/model-registry.d.ts +6 -4
  70. package/dist/agents/redux/model-registry.js +23 -5
  71. package/dist/agents/redux/proposed-directives/proposedDirectivesSlice.d.ts +1 -1
  72. package/dist/agents/redux/tools/tools.selectors.d.ts +1 -1
  73. package/dist/agents/resources/default-picker-items.d.ts +17 -0
  74. package/dist/agents/resources/default-picker-items.js +48 -0
  75. package/dist/agents/runtime/generation-job.js +4 -7
  76. package/dist/agents/runtime/get-model-capabilities.js +3 -3
  77. package/dist/agents/types/instance.types.d.ts +2 -1
  78. package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +2 -2
  79. package/dist/cx-chat/components/SsrSidebarChats.js +1 -1
  80. package/dist/cx-chat/components/sidebar/SidebarUserFooter.js +1 -1
  81. package/dist/host/app-identity.d.ts +20 -0
  82. package/dist/host/app-identity.js +21 -0
  83. package/dist/host/bare-host-chrome.d.ts +14 -0
  84. package/dist/host/bare-host-chrome.js +44 -0
  85. package/dist/host/configure.d.ts +9 -1
  86. package/dist/host/configure.js +44 -8
  87. package/dist/host/content-ir-slots.d.ts +5 -1
  88. package/dist/host/content-ir-slots.js +5 -1
  89. package/dist/host/contract.d.ts +39 -2
  90. package/dist/host/db-types.d.ts +375 -10
  91. package/dist/host/defaults/navigation-hooks.d.ts +2 -0
  92. package/dist/host/defaults/navigation-hooks.js +7 -1
  93. package/dist/host/defaults/navigation.d.ts +4 -3
  94. package/dist/host/defaults/navigation.js +38 -7
  95. package/dist/host/defaults/org.d.ts +12 -4
  96. package/dist/host/defaults/org.js +39 -1
  97. package/dist/host/defaults/workspace-gate.d.ts +16 -0
  98. package/dist/host/defaults/workspace-gate.js +88 -0
  99. package/dist/host/diagnostics.d.ts +7 -2
  100. package/dist/host/diagnostics.js +6 -0
  101. package/dist/host/identity.js +2 -1
  102. package/dist/host/index.d.ts +5 -2
  103. package/dist/host/index.js +21 -1
  104. package/dist/host/no-database.d.ts +38 -0
  105. package/dist/host/no-database.js +107 -0
  106. package/dist/host/react.d.ts +1 -0
  107. package/dist/host/react.js +25 -2
  108. package/dist/host/registered-source.js +2 -2
  109. package/dist/host/source.d.ts +109 -0
  110. package/dist/host/source.js +86 -0
  111. package/dist/host/ui-slots.d.ts +8 -8
  112. package/dist/host/ui-slots.js +5 -3
  113. package/dist/mandates/useMandate.js +13 -0
  114. package/dist/public-chat/components/PublicMessageOptionsMenu.js +1 -1
  115. package/dist/store/create-chat-store.d.ts +4 -4
  116. package/dist/store/middlewares.d.ts +5 -5
  117. package/dist/store/slices.d.ts +1 -1
  118. package/dist/store/slices.js +4 -3
  119. package/dist/surfaces/redux/selectors.d.ts +2 -2
  120. package/dist/testing/turn-harness.d.ts +35 -0
  121. package/dist/testing/turn-harness.js +85 -0
  122. package/dist/tool-call-visualization/intelligence-places.js +1 -1
  123. package/dist/tool-call-visualization/redux/selectors.d.ts +1 -1
  124. package/dist/voice-agent/intelligence-places.js +6 -6
  125. package/package.json +9 -6
  126. package/dist/agents/model-registry/modelRegistrySlice.d.ts +0 -691
  127. package/dist/agents/model-registry/modelRegistrySlice.js +0 -574
  128. package/dist/host/model-class.d.ts +0 -33
  129. package/dist/host/model-class.js +0 -21
@@ -7156,6 +7156,13 @@ export type ChatDatabase = {
7156
7156
  referencedRelation: "user_request_summary";
7157
7157
  referencedColumns: ["id"];
7158
7158
  },
7159
+ {
7160
+ foreignKeyName: "fk_cx_tool_call_parent";
7161
+ columns: ["parent_call_id"];
7162
+ isOneToOne: false;
7163
+ referencedRelation: "_tool_call_facts";
7164
+ referencedColumns: ["tool_call_id"];
7165
+ },
7159
7166
  {
7160
7167
  foreignKeyName: "fk_cx_tool_call_parent";
7161
7168
  columns: ["parent_call_id"];
@@ -7559,6 +7566,48 @@ export type ChatDatabase = {
7559
7566
  };
7560
7567
  };
7561
7568
  Views: {
7569
+ _tool_call_facts: {
7570
+ Row: {
7571
+ after_trim: number | null;
7572
+ agent_id: string | null;
7573
+ chars_refetched_same_data: number | null;
7574
+ conversation_id: string | null;
7575
+ created_at: string | null;
7576
+ gap_calls: number | null;
7577
+ gap_secs: number | null;
7578
+ is_repeat: number | null;
7579
+ new_data: number | null;
7580
+ output_chars: number | null;
7581
+ person_id: string | null;
7582
+ same_data: number | null;
7583
+ tool_call_id: string | null;
7584
+ tool_name: string | null;
7585
+ unknown_data: number | null;
7586
+ };
7587
+ Relationships: [
7588
+ {
7589
+ foreignKeyName: "cx_tool_call_conversation_id_fkey";
7590
+ columns: ["conversation_id"];
7591
+ isOneToOne: false;
7592
+ referencedRelation: "admin_conversation_summary";
7593
+ referencedColumns: ["id"];
7594
+ },
7595
+ {
7596
+ foreignKeyName: "cx_tool_call_conversation_id_fkey";
7597
+ columns: ["conversation_id"];
7598
+ isOneToOne: false;
7599
+ referencedRelation: "conversation";
7600
+ referencedColumns: ["id"];
7601
+ },
7602
+ {
7603
+ foreignKeyName: "cx_tool_call_conversation_id_fkey";
7604
+ columns: ["conversation_id"];
7605
+ isOneToOne: false;
7606
+ referencedRelation: "conversation_summary";
7607
+ referencedColumns: ["id"];
7608
+ }
7609
+ ];
7610
+ };
7562
7611
  admin_conversation_summary: {
7563
7612
  Row: {
7564
7613
  conversation_type: string | null;
@@ -14049,6 +14098,48 @@ export type ChatDatabase = {
14049
14098
  }
14050
14099
  ];
14051
14100
  };
14101
+ access_shadow_log: {
14102
+ Row: {
14103
+ at: string;
14104
+ caller: string;
14105
+ compared: number | null;
14106
+ disagreed: number | null;
14107
+ error: string | null;
14108
+ id: string;
14109
+ level: string;
14110
+ new_answer: boolean | null;
14111
+ old_answer: boolean | null;
14112
+ person: string;
14113
+ target: string | null;
14114
+ };
14115
+ Insert: {
14116
+ at?: string;
14117
+ caller: string;
14118
+ compared?: number | null;
14119
+ disagreed?: number | null;
14120
+ error?: string | null;
14121
+ id?: string;
14122
+ level: string;
14123
+ new_answer?: boolean | null;
14124
+ old_answer?: boolean | null;
14125
+ person: string;
14126
+ target?: string | null;
14127
+ };
14128
+ Update: {
14129
+ at?: string;
14130
+ caller?: string;
14131
+ compared?: number | null;
14132
+ disagreed?: number | null;
14133
+ error?: string | null;
14134
+ id?: string;
14135
+ level?: string;
14136
+ new_answer?: boolean | null;
14137
+ old_answer?: boolean | null;
14138
+ person?: string;
14139
+ target?: string | null;
14140
+ };
14141
+ Relationships: [];
14142
+ };
14052
14143
  account_closure: {
14053
14144
  Row: {
14054
14145
  closed_at: string;
@@ -16511,12 +16602,6 @@ export type ChatDatabase = {
16511
16602
  };
16512
16603
  Returns: string;
16513
16604
  };
16514
- default_organization_id: {
16515
- Args: {
16516
- p_user_id: string;
16517
- };
16518
- Returns: string;
16519
- };
16520
16605
  derive_organization_abbreviation: {
16521
16606
  Args: {
16522
16607
  p_name: string;
@@ -16813,6 +16898,31 @@ export type ChatDatabase = {
16813
16898
  };
16814
16899
  Returns: boolean;
16815
16900
  };
16901
+ has_access_for_many: {
16902
+ Args: {
16903
+ p_level: string;
16904
+ p_person: string;
16905
+ p_targets: string[];
16906
+ p_type?: string;
16907
+ };
16908
+ Returns: {
16909
+ allowed: boolean;
16910
+ target: string;
16911
+ }[];
16912
+ };
16913
+ has_access_for_shadow: {
16914
+ Args: {
16915
+ p_caller?: string;
16916
+ p_level: string;
16917
+ p_person: string;
16918
+ p_targets: string[];
16919
+ p_type?: string;
16920
+ };
16921
+ Returns: {
16922
+ allowed: boolean;
16923
+ target: string;
16924
+ }[];
16925
+ };
16816
16926
  has_org_access: {
16817
16927
  Args: {
16818
16928
  p_org: string;
@@ -16924,6 +17034,12 @@ export type ChatDatabase = {
16924
17034
  Args: never;
16925
17035
  Returns: boolean;
16926
17036
  };
17037
+ kernel_shadow_on: {
17038
+ Args: {
17039
+ p_person: string;
17040
+ };
17041
+ Returns: boolean;
17042
+ };
16927
17043
  lane_of: {
16928
17044
  Args: {
16929
17045
  p_resource_id: string;
@@ -22497,6 +22613,108 @@ export type ChatDatabase = {
22497
22613
  };
22498
22614
  Relationships: [];
22499
22615
  };
22616
+ device_handoff: {
22617
+ Row: {
22618
+ completed_at: string | null;
22619
+ created_at: string;
22620
+ created_by: string | null;
22621
+ deleted_at: string | null;
22622
+ envelope_id: string | null;
22623
+ expires_at: string;
22624
+ id: string;
22625
+ ip: unknown;
22626
+ metadata: Json;
22627
+ method: string | null;
22628
+ opened_at: string | null;
22629
+ organization_id: string;
22630
+ phone_last4: string | null;
22631
+ published_to_web: boolean;
22632
+ published_to_web_at: string | null;
22633
+ published_to_web_by: string | null;
22634
+ purpose: string;
22635
+ result_file_id: string | null;
22636
+ secret_hash: string;
22637
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
22638
+ status: string;
22639
+ strokes: Json | null;
22640
+ subject_id: string | null;
22641
+ subject_type: string | null;
22642
+ target: string | null;
22643
+ texts_sent: number;
22644
+ updated_at: string;
22645
+ updated_by: string | null;
22646
+ user_agent: string | null;
22647
+ version: number;
22648
+ visibility: Database["platform"]["Enums"]["visibility"];
22649
+ };
22650
+ Insert: {
22651
+ completed_at?: string | null;
22652
+ created_at?: string;
22653
+ created_by?: string | null;
22654
+ deleted_at?: string | null;
22655
+ envelope_id?: string | null;
22656
+ expires_at: string;
22657
+ id?: string;
22658
+ ip?: unknown;
22659
+ metadata?: Json;
22660
+ method?: string | null;
22661
+ opened_at?: string | null;
22662
+ organization_id: string;
22663
+ phone_last4?: string | null;
22664
+ published_to_web?: boolean;
22665
+ published_to_web_at?: string | null;
22666
+ published_to_web_by?: string | null;
22667
+ purpose: string;
22668
+ result_file_id?: string | null;
22669
+ secret_hash: string;
22670
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
22671
+ status?: string;
22672
+ strokes?: Json | null;
22673
+ subject_id?: string | null;
22674
+ subject_type?: string | null;
22675
+ target?: string | null;
22676
+ texts_sent?: number;
22677
+ updated_at?: string;
22678
+ updated_by?: string | null;
22679
+ user_agent?: string | null;
22680
+ version?: number;
22681
+ visibility?: Database["platform"]["Enums"]["visibility"];
22682
+ };
22683
+ Update: {
22684
+ completed_at?: string | null;
22685
+ created_at?: string;
22686
+ created_by?: string | null;
22687
+ deleted_at?: string | null;
22688
+ envelope_id?: string | null;
22689
+ expires_at?: string;
22690
+ id?: string;
22691
+ ip?: unknown;
22692
+ metadata?: Json;
22693
+ method?: string | null;
22694
+ opened_at?: string | null;
22695
+ organization_id?: string;
22696
+ phone_last4?: string | null;
22697
+ published_to_web?: boolean;
22698
+ published_to_web_at?: string | null;
22699
+ published_to_web_by?: string | null;
22700
+ purpose?: string;
22701
+ result_file_id?: string | null;
22702
+ secret_hash?: string;
22703
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
22704
+ status?: string;
22705
+ strokes?: Json | null;
22706
+ subject_id?: string | null;
22707
+ subject_type?: string | null;
22708
+ target?: string | null;
22709
+ texts_sent?: number;
22710
+ updated_at?: string;
22711
+ updated_by?: string | null;
22712
+ user_agent?: string | null;
22713
+ version?: number;
22714
+ visibility?: Database["platform"]["Enums"]["visibility"];
22715
+ };
22716
+ Relationships: [];
22717
+ };
22500
22718
  domain_classification: {
22501
22719
  Row: {
22502
22720
  authority: number | null;
@@ -25264,6 +25482,7 @@ export type ChatDatabase = {
25264
25482
  published_to_web_by: string | null;
25265
25483
  readable_columns: string[];
25266
25484
  resource: string;
25485
+ session_sliding: boolean;
25267
25486
  session_ttl_minutes: number;
25268
25487
  shown_to: Database["platform"]["Enums"]["shown_to"] | null;
25269
25488
  updated_at: string;
@@ -25297,6 +25516,7 @@ export type ChatDatabase = {
25297
25516
  published_to_web_by?: string | null;
25298
25517
  readable_columns?: string[];
25299
25518
  resource: string;
25519
+ session_sliding?: boolean;
25300
25520
  session_ttl_minutes?: number;
25301
25521
  shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
25302
25522
  updated_at?: string;
@@ -25330,6 +25550,7 @@ export type ChatDatabase = {
25330
25550
  published_to_web_by?: string | null;
25331
25551
  readable_columns?: string[];
25332
25552
  resource?: string;
25553
+ session_sliding?: boolean;
25333
25554
  session_ttl_minutes?: number;
25334
25555
  shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
25335
25556
  updated_at?: string;
@@ -28027,6 +28248,13 @@ export type ChatDatabase = {
28027
28248
  };
28028
28249
  Returns: Json;
28029
28250
  };
28251
+ _device_handoff_live: {
28252
+ Args: {
28253
+ p_expires_at: string;
28254
+ p_status: string;
28255
+ };
28256
+ Returns: boolean;
28257
+ };
28030
28258
  _door_follows_its_function_impl: {
28031
28259
  Args: {
28032
28260
  p_schemas: string[];
@@ -30030,6 +30258,64 @@ export type ChatDatabase = {
30030
30258
  type_value: string;
30031
30259
  }[];
30032
30260
  };
30261
+ device_handoff_cancel: {
30262
+ Args: {
30263
+ p_handoff_id: string;
30264
+ p_subject_id: string;
30265
+ };
30266
+ Returns: Json;
30267
+ };
30268
+ device_handoff_complete: {
30269
+ Args: {
30270
+ p_image_file_id: string;
30271
+ p_ip: unknown;
30272
+ p_method: string;
30273
+ p_secret: string;
30274
+ p_strokes: Json;
30275
+ p_ua: string;
30276
+ };
30277
+ Returns: Json;
30278
+ };
30279
+ device_handoff_open: {
30280
+ Args: {
30281
+ p_ip: unknown;
30282
+ p_secret: string;
30283
+ p_ua: string;
30284
+ };
30285
+ Returns: Json;
30286
+ };
30287
+ device_handoff_start: {
30288
+ Args: {
30289
+ p_envelope_id: string;
30290
+ p_organization_id: string;
30291
+ p_path: string;
30292
+ p_purpose: string;
30293
+ p_subject_id: string;
30294
+ p_subject_type: string;
30295
+ p_target: string;
30296
+ p_ttl_minutes: number;
30297
+ };
30298
+ Returns: Json;
30299
+ };
30300
+ device_handoff_status: {
30301
+ Args: {
30302
+ p_handoff_id: string;
30303
+ p_subject_id: string;
30304
+ };
30305
+ Returns: Json;
30306
+ };
30307
+ device_handoff_text: {
30308
+ Args: {
30309
+ p_handoff_id: string;
30310
+ p_ip: unknown;
30311
+ p_per_ip_per_day: number;
30312
+ p_per_subject: number;
30313
+ p_phone: string;
30314
+ p_secret: string;
30315
+ p_subject_id: string;
30316
+ };
30317
+ Returns: Json;
30318
+ };
30033
30319
  doctrine_shape_vocabulary: {
30034
30320
  Args: never;
30035
30321
  Returns: {
@@ -30145,6 +30431,14 @@ export type ChatDatabase = {
30145
30431
  Args: never;
30146
30432
  Returns: Json;
30147
30433
  };
30434
+ drill_def__tool_refetch: {
30435
+ Args: never;
30436
+ Returns: Json;
30437
+ };
30438
+ drill_def__user_acquisition: {
30439
+ Args: never;
30440
+ Returns: Json;
30441
+ };
30148
30442
  drill_def__workflow_runs: {
30149
30443
  Args: never;
30150
30444
  Returns: Json;
@@ -30487,10 +30781,18 @@ export type ChatDatabase = {
30487
30781
  Args: never;
30488
30782
  Returns: Json;
30489
30783
  };
30784
+ kernel_fingerprint_status: {
30785
+ Args: never;
30786
+ Returns: Json;
30787
+ };
30490
30788
  kernel_fixture_tokens: {
30491
30789
  Args: never;
30492
30790
  Returns: string[];
30493
30791
  };
30792
+ kernel_follow_now: {
30793
+ Args: never;
30794
+ Returns: Json;
30795
+ };
30494
30796
  knob_archive: {
30495
30797
  Args: {
30496
30798
  p_feature: string;
@@ -50930,12 +51232,13 @@ export type ChatDatabase = {
50930
51232
  created_at: string;
50931
51233
  created_by: string | null;
50932
51234
  custom_fields: Json;
50933
- default_organization_id: string | null;
50934
51235
  deleted_at: string | null;
50935
51236
  id: string;
51237
+ last_active_organization_id: string | null;
50936
51238
  metadata: Json;
50937
51239
  organization_id: string;
50938
51240
  preferences: Json;
51241
+ startup_organization_id: string | null;
50939
51242
  updated_at: string;
50940
51243
  updated_by: string | null;
50941
51244
  user_id: string;
@@ -50946,12 +51249,13 @@ export type ChatDatabase = {
50946
51249
  created_at?: string;
50947
51250
  created_by?: string | null;
50948
51251
  custom_fields?: Json;
50949
- default_organization_id?: string | null;
50950
51252
  deleted_at?: string | null;
50951
51253
  id?: string;
51254
+ last_active_organization_id?: string | null;
50952
51255
  metadata?: Json;
50953
51256
  organization_id: string;
50954
51257
  preferences: Json;
51258
+ startup_organization_id?: string | null;
50955
51259
  updated_at?: string;
50956
51260
  updated_by?: string | null;
50957
51261
  user_id: string;
@@ -50962,12 +51266,13 @@ export type ChatDatabase = {
50962
51266
  created_at?: string;
50963
51267
  created_by?: string | null;
50964
51268
  custom_fields?: Json;
50965
- default_organization_id?: string | null;
50966
51269
  deleted_at?: string | null;
50967
51270
  id?: string;
51271
+ last_active_organization_id?: string | null;
50968
51272
  metadata?: Json;
50969
51273
  organization_id?: string;
50970
51274
  preferences?: Json;
51275
+ startup_organization_id?: string | null;
50971
51276
  updated_at?: string;
50972
51277
  updated_by?: string | null;
50973
51278
  user_id?: string;
@@ -51300,9 +51605,53 @@ export type ChatDatabase = {
51300
51605
  };
51301
51606
  };
51302
51607
  Views: {
51303
- [_ in never]: never;
51608
+ _acquisition_facts: {
51609
+ Row: {
51610
+ blocked: boolean | null;
51611
+ campaign: string | null;
51612
+ converted_at: string | null;
51613
+ cost: number | null;
51614
+ created_at: string | null;
51615
+ guest_id: string | null;
51616
+ identity_id: string | null;
51617
+ identity_state: string | null;
51618
+ landing_host: string | null;
51619
+ landing_path: string | null;
51620
+ person_id: string | null;
51621
+ referrer: string | null;
51622
+ referrer_host: string | null;
51623
+ referrer_state: string | null;
51624
+ requests: number | null;
51625
+ traffic_kind: string | null;
51626
+ utm_campaign: string | null;
51627
+ utm_medium: string | null;
51628
+ utm_source: string | null;
51629
+ };
51630
+ Relationships: [];
51631
+ };
51304
51632
  };
51305
51633
  Functions: {
51634
+ _set_own_organization_choice: {
51635
+ Args: {
51636
+ p_column: string;
51637
+ p_organization_id: string;
51638
+ };
51639
+ Returns: string;
51640
+ };
51641
+ acquisition_host_is_local: {
51642
+ Args: {
51643
+ p_host: string;
51644
+ };
51645
+ Returns: boolean;
51646
+ };
51647
+ acquisition_traffic_kind: {
51648
+ Args: {
51649
+ p_landing_host: string;
51650
+ p_referrer: string;
51651
+ p_user_agent: string;
51652
+ };
51653
+ Returns: string;
51654
+ };
51306
51655
  admin_account_facts: {
51307
51656
  Args: never;
51308
51657
  Returns: {
@@ -51378,6 +51727,10 @@ export type ChatDatabase = {
51378
51727
  Args: never;
51379
51728
  Returns: number;
51380
51729
  };
51730
+ my_organization_choices: {
51731
+ Args: never;
51732
+ Returns: Json;
51733
+ };
51381
51734
  my_organization_vault_access: {
51382
51735
  Args: {
51383
51736
  p_organization_id: string;
@@ -51408,6 +51761,12 @@ export type ChatDatabase = {
51408
51761
  vault_access: string;
51409
51762
  }[];
51410
51763
  };
51764
+ set_last_active_organization: {
51765
+ Args: {
51766
+ p_organization_id: string;
51767
+ };
51768
+ Returns: string;
51769
+ };
51411
51770
  set_organization_vault_access: {
51412
51771
  Args: {
51413
51772
  p_access: string;
@@ -51417,6 +51776,12 @@ export type ChatDatabase = {
51417
51776
  };
51418
51777
  Returns: string;
51419
51778
  };
51779
+ set_startup_organization: {
51780
+ Args: {
51781
+ p_organization_id: string;
51782
+ };
51783
+ Returns: string;
51784
+ };
51420
51785
  user_preferences_drift_report: {
51421
51786
  Args: never;
51422
51787
  Returns: {
@@ -1,3 +1,5 @@
1
1
  import type { ChatSearchParams } from "../contract.js";
2
+ /** Fired after the default port moves the address with the history API (no page load). */
3
+ export declare const CHAT_NAVIGATED_EVENT = "ai-matrx-chat:navigated";
2
4
  export declare function useWindowPathname(): string;
3
5
  export declare function useWindowSearchParams(): ChatSearchParams;
@@ -1,11 +1,16 @@
1
1
  "use client";
2
2
  import { useSyncExternalStore } from "react";
3
3
  const hasWindow = () => typeof window !== "undefined";
4
+ const CHAT_NAVIGATED_EVENT = "ai-matrx-chat:navigated";
4
5
  function subscribeToHistory(listener) {
5
6
  if (!hasWindow()) return () => {
6
7
  };
7
8
  window.addEventListener("popstate", listener);
8
- return () => window.removeEventListener("popstate", listener);
9
+ window.addEventListener(CHAT_NAVIGATED_EVENT, listener);
10
+ return () => {
11
+ window.removeEventListener("popstate", listener);
12
+ window.removeEventListener(CHAT_NAVIGATED_EVENT, listener);
13
+ };
9
14
  }
10
15
  function useWindowPathname() {
11
16
  return useSyncExternalStore(
@@ -32,6 +37,7 @@ function useWindowSearchParams() {
32
37
  return paramsFor(search);
33
38
  }
34
39
  export {
40
+ CHAT_NAVIGATED_EVENT,
35
41
  useWindowPathname,
36
42
  useWindowSearchParams
37
43
  };
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Default navigation port: full page loads through `window.location`, links as
3
- * plain anchors, the path and query read from `window.location` (kept current
4
- * across back/forward). matrx-frontend overrides with the package's Next
2
+ * Default navigation port: CLIENT-SIDE navigation through the history API (no page load, the
3
+ * mounted chat keeps its state), links as anchors that navigate the same way, the path and query
4
+ * read from `window.location` (kept current across back/forward and the port's own moves). An
5
+ * address on another origin is a real page load. matrx-frontend overrides with the package's Next
5
6
  * binding (`next/navigation`).
6
7
  */
7
8
  import type { ChatNavigationPort } from "../contract.js";
@@ -1,18 +1,49 @@
1
1
  import { createElement } from "react";
2
- import { useWindowPathname, useWindowSearchParams } from "./navigation-hooks.js";
3
- function PlainLink({ prefetch, replace, scroll, ...anchor }) {
2
+ import { CHAT_NAVIGATED_EVENT, useWindowPathname, useWindowSearchParams } from "./navigation-hooks.js";
3
+ const hasWindow = () => typeof window !== "undefined";
4
+ function sameOriginAddress(href) {
5
+ if (!hasWindow()) return null;
6
+ try {
7
+ const url = new URL(href, window.location.href);
8
+ return url.origin === window.location.origin ? url.pathname + url.search + url.hash : null;
9
+ } catch {
10
+ return null;
11
+ }
12
+ }
13
+ function move(href, mode) {
14
+ if (!hasWindow()) return;
15
+ const address = sameOriginAddress(href);
16
+ if (address === null) {
17
+ if (mode === "push") window.location.assign(href);
18
+ else window.location.replace(href);
19
+ return;
20
+ }
21
+ if (mode === "push") window.history.pushState(null, "", address);
22
+ else window.history.replaceState(null, "", address);
23
+ window.dispatchEvent(new Event(CHAT_NAVIGATED_EVENT));
24
+ }
25
+ function PlainLink({ prefetch, replace, scroll, onClick, ...anchor }) {
4
26
  void prefetch;
5
- void replace;
6
27
  void scroll;
7
- return createElement("a", anchor);
28
+ return createElement("a", {
29
+ ...anchor,
30
+ onClick: (event) => {
31
+ onClick?.(event);
32
+ const href = typeof anchor.href === "string" ? anchor.href : null;
33
+ if (event.defaultPrevented || !href || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || anchor.target && anchor.target !== "_self" || sameOriginAddress(href) === null) {
34
+ return;
35
+ }
36
+ event.preventDefault();
37
+ move(href, replace ? "replace" : "push");
38
+ }
39
+ });
8
40
  }
9
- const hasWindow = () => typeof window !== "undefined";
10
41
  const windowRouter = {
11
42
  push(href) {
12
- if (hasWindow()) window.location.assign(href);
43
+ move(href, "push");
13
44
  },
14
45
  replace(href) {
15
- if (hasWindow()) window.location.replace(href);
46
+ move(href, "replace");
16
47
  },
17
48
  back() {
18
49
  if (hasWindow()) window.history.back();
@@ -1,8 +1,16 @@
1
1
  /**
2
- * Default org port. A bare host has no organization picker, and the platform
3
- * rule is hold-and-set — never auto-pick. So: no active org, and `require`
4
- * refuses with a named, remedied error that is also shown and recorded.
5
- * A host with a picker (matrx-frontend) overrides this port.
2
+ * Org ports for a host that brings no organization port of its own.
3
+ *
4
+ * `createStoredOrg` (the default): the person picks in the package's own
5
+ * `WorkspaceGate` picker (`./workspace-gate.tsx`, memberships read over `db`),
6
+ * the choice is remembered on this device, and `require` resolves it. Nothing is
7
+ * ever picked on the person's behalf (hold-and-set); with no choice yet `require`
8
+ * refuses exactly like `createNoPickerOrg`, and the gate shows the picker.
9
+ * `createNoPickerOrg`: never an organization — for a host that must not write.
10
+ * A host with its own picker (matrx-frontend) overrides the port.
6
11
  */
7
12
  import type { ChatDiagnosticsPort, ChatNotifyPort, ChatOrgPort } from "../contract.js";
8
13
  export declare function createNoPickerOrg(notify: () => ChatNotifyPort, diagnostics: () => ChatDiagnosticsPort): ChatOrgPort;
14
+ /** Where the bare-host choice is remembered (this device only). */
15
+ export declare const CHAT_ACTIVE_ORG_STORAGE_KEY = "matrx-chat:active-organization";
16
+ export declare function createStoredOrg(notify: () => ChatNotifyPort, diagnostics: () => ChatDiagnosticsPort): ChatOrgPort;