@ai-matrx/chat 0.7.5 → 0.7.7
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.
- package/CHANGELOG.md +36 -0
- package/dist/agents/api/fetch-pending-calls.js +4 -3
- package/dist/agents/api/submit-tool-results.js +3 -6
- package/dist/agents/components/ambient-assistant/ScrollAssistantLauncherImpl.js +13 -6
- package/dist/agents/components/chat/begin-fresh-chat.js +2 -2
- package/dist/agents/components/identity-refs/AiIdentityRef.js +2 -2
- package/dist/agents/components/inputs/smart-input/composer/ComposerSplash.js +2 -3
- package/dist/agents/components/inputs/smart-input/composer/useComposerMode.js +4 -2
- package/dist/agents/components/live-run/LiveRunDisplay.d.ts +7 -1
- package/dist/agents/components/live-run/LiveRunDisplay.js +3 -1
- package/dist/agents/components/messages-display/AgentConversationDisplay.js +1 -1
- package/dist/agents/components/messages-display/assistant/AgentEmptyMessageDisplay.js +4 -4
- package/dist/agents/components/messages-display/assistant/AssistantNoAnswer.js +1 -1
- package/dist/agents/components/messages-display/assistant/BreathingOrb.js +1 -1
- package/dist/agents/components/messages-display/assistant/InPlaceAnswerEditor.js +1 -1
- package/dist/agents/components/messages-display/citations/MessageSourcesRow.js +1 -1
- package/dist/agents/components/messages-display/conversation-tools/ConversationFindBar.js +4 -4
- package/dist/agents/components/messages-display/message-options/EditHistoryDialog.js +7 -7
- package/dist/agents/components/messages-display/user/AgentUserMessage.js +4 -4
- package/dist/agents/components/messages-display/user/CollabNoteMessage.js +2 -2
- package/dist/agents/components/messages-display/user/FirstTurnVariables.js +3 -3
- package/dist/agents/components/messages-display/user/PendingSendMessage.js +4 -4
- package/dist/agents/components/messages-display/user/RemarksTranscriptView.js +7 -7
- package/dist/agents/components/messages-display/user/ResourceAttachmentTile.js +9 -9
- package/dist/agents/components/messages-display/user/ResourceEditableToggleSamples.js +4 -4
- package/dist/agents/components/messages-display/user/UserActionBar.js +3 -3
- package/dist/agents/components/messages-display/user/UserMessageAttachmentStyleComparison.js +12 -12
- package/dist/agents/components/messages-display/user/UserMessageChipsDemo.js +19 -19
- package/dist/agents/components/messages-display/user/UserMessageHybridTileSamples.js +22 -22
- package/dist/agents/components/run/AgentRunnerPage.js +4 -4
- package/dist/agents/components/run/AssistantError.js +1 -1
- package/dist/agents/components/run/AssistantWarning.js +1 -1
- package/dist/agents/components/run/GenerationJobCard.js +5 -5
- package/dist/agents/components/run/IncompleteNote.js +1 -1
- package/dist/agents/components/run/RunJobWorkingLine.js +1 -1
- package/dist/agents/components/shared/AgentConversationColumn.js +1 -1
- package/dist/agents/components/shared/AgentHeaderMobile.js +6 -6
- package/dist/agents/components/shared/AgentModeController.js +1 -1
- package/dist/agents/components/shared/AutoInjectionSwitch.js +6 -6
- package/dist/agents/components/shared/DesktopFilterPanel.js +8 -8
- package/dist/agents/components/smart/AgentRunner.js +1 -1
- package/dist/agents/components/smart/CreateWithAiTabs.js +1 -1
- package/dist/agents/redux/agent-definition/agent-cache-bust-request.js +7 -7
- package/dist/agents/redux/execution-system/context-rules/receipt-check.js +2 -2
- package/dist/agents/redux/execution-system/inbox/inbox.thunks.d.ts +2 -2
- package/dist/agents/redux/execution-system/inbox/inbox.thunks.js +7 -15
- package/dist/agents/redux/execution-system/observational-memory/fetch-memory-cost.thunk.d.ts +1 -1
- package/dist/agents/redux/execution-system/observational-memory/fetch-memory-cost.thunk.js +7 -4
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +1 -114
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.js +28 -43
- package/dist/agents/redux/execution-system/thunks/call-conversation-api.d.ts +44 -0
- package/dist/agents/redux/execution-system/thunks/call-conversation-api.js +78 -0
- package/dist/agents/redux/execution-system/thunks/continue-agent-json.d.ts +41 -0
- package/dist/agents/redux/execution-system/thunks/continue-agent-json.js +66 -0
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.d.ts +20 -0
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +9 -2
- package/dist/agents/redux/execution-system/thunks/launch-agent-execution.thunk.js +4 -6
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.d.ts +1 -5
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.js +2 -1
- package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +7 -17
- package/dist/agents/redux/execution-system/thunks/settle-after-stop.thunk.js +2 -2
- package/dist/agents/redux/execution-system/thunks/smart-execute.thunk.js +3 -3
- package/dist/agents/redux/execution-system/utils/continuation-body.d.ts +8 -2
- package/dist/agents/redux/execution-system/utils/continuation-body.js +3 -3
- package/dist/agents/redux/execution-system/utils/required-organization.d.ts +18 -0
- package/dist/agents/redux/execution-system/utils/required-organization.js +14 -10
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.d.ts +69 -333
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.js +268 -1896
- package/dist/agents/services/mcp-connections.service.js +5 -8
- package/dist/agents/ui-first-tools/dispatcher/dispatch-ui-first-tool.thunk.js +2 -1
- package/dist/host/defaults/files-host.js +11 -1
- package/dist/host/defaults/files-ui.js +2 -1
- package/dist/host/defaults/server-api.d.ts +1 -15
- package/dist/host/defaults/server-api.js +0 -21
- package/dist/host/defaults/server.d.ts +2 -1
- package/dist/host/defaults/server.js +8 -6
- package/dist/host/request-headers.d.ts +26 -0
- package/dist/host/request-headers.js +15 -0
- package/dist/host/server/call-api.d.ts +0 -13
- package/dist/host/server/call-api.js +0 -2
- package/dist/host/server/matrx-transport.d.ts +0 -1
- package/dist/host/server/matrx-transport.js +0 -2
- package/dist/store/root-state.d.ts +4 -21
- package/dist/surfaces/hooks/useSurfaceConfig.js +2 -1
- package/dist/surfaces/runtime/surface-feedback.js +2 -2
- package/dist/tool-call-visualization/components/ArtifactResultBar.js +4 -4
- package/dist/tool-call-visualization/components/ChatResultColumn.d.ts +1 -1
- package/dist/tool-call-visualization/components/ToolCallBatch.js +2 -2
- package/dist/tool-call-visualization/components/ToolCallVisualization.js +5 -5
- package/dist/tool-call-visualization/components/ToolTabBodies.js +12 -12
- package/dist/tool-call-visualization/components/ToolUpdatesOverlay.js +4 -4
- package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.js +8 -8
- package/dist/tool-call-visualization/configured-rows/CopyToolButton.js +1 -1
- package/dist/tool-call-visualization/configured-rows/ToolProgressView.js +7 -7
- package/dist/tool-call-visualization/configured-rows/field-components.js +28 -50
- package/dist/tool-call-visualization/registry/GenericRenderer.js +4 -4
- package/dist/tool-call-visualization/renderers/_shared-entity/EmptyResultCard.js +1 -1
- package/dist/tool-call-visualization/renderers/_shared-entity/EntityCard.js +5 -5
- package/dist/tool-call-visualization/renderers/_shared-entity/PartPeekPopover.js +2 -2
- package/dist/tool-call-visualization/renderers/_shared-entity/ToolGlyph.js +1 -1
- package/dist/tool-call-visualization/renderers/_shared-entity/ToolResultCard.js +6 -6
- package/dist/tool-call-visualization/renderers/agent-call/AgentCallInline.js +5 -5
- package/dist/tool-call-visualization/renderers/agent-call/CollabCallCard.js +4 -4
- package/dist/tool-call-visualization/renderers/agent-call/ImageGenerationResult.js +1 -1
- package/dist/tool-call-visualization/renderers/ask/AskInline.js +3 -3
- package/dist/tool-call-visualization/renderers/ask-person/AskPersonInline.js +2 -2
- package/dist/tool-call-visualization/renderers/cloud-browser/CloudBrowserRunCard.js +5 -5
- package/dist/tool-call-visualization/renderers/ctx/CtxBatchInline.js +3 -3
- package/dist/tool-call-visualization/renderers/ctx/CtxGetInline.js +2 -2
- package/dist/tool-call-visualization/renderers/ctx/CtxItemCard.js +3 -3
- package/dist/tool-call-visualization/renderers/ctx/CtxPatchInline.js +6 -6
- package/dist/tool-call-visualization/renderers/dictionary/DictEntryList.js +12 -12
- package/dist/tool-call-visualization/renderers/dictionary/DictionaryOverlay.js +5 -5
- package/dist/tool-call-visualization/renderers/fs/FsInline.js +7 -7
- package/dist/tool-call-visualization/renderers/news-api/NewsInline.js +17 -17
- package/dist/tool-call-visualization/renderers/news-api/NewsOverlay.js +12 -12
- package/dist/tool-call-visualization/renderers/random-wheel/RandomWheelInline.js +34 -34
- package/dist/tool-call-visualization/renderers/records/RecordsInline.js +1 -1
- package/dist/tool-call-visualization/renderers/research/ResearchInline.js +10 -10
- package/dist/tool-call-visualization/renderers/research/ResearchOverlay.js +19 -19
- package/dist/tool-call-visualization/renderers/research/SubagentReportBlock.js +11 -11
- package/dist/tool-call-visualization/renderers/scrape/ScrapeInline.js +18 -18
- package/dist/tool-call-visualization/renderers/scrape/ScrapeOverlay.js +17 -17
- package/dist/tool-call-visualization/renderers/search/SearchInline.js +30 -30
- package/dist/tool-call-visualization/renderers/search/SearchOverlay.js +40 -40
- package/dist/tool-call-visualization/renderers/shell/ShellInline.js +3 -3
- package/dist/tool-call-visualization/renderers/skill/SkillInline.js +5 -5
- package/dist/tool-call-visualization/renderers/sql/DbSchemaInline.js +7 -7
- package/dist/tool-call-visualization/renderers/sql/SqlInline.js +4 -4
- package/dist/tool-call-visualization/renderers/workbook/WorkbookGrid.js +4 -4
- package/dist/tool-call-visualization/renderers/workbook/WorkbookInline.js +2 -2
- package/dist/tool-call-visualization/renderers/workbook/WorkbookOverlay.js +7 -7
- package/dist/tool-call-visualization/renderers/working-document/PatchDiffInline.js +3 -3
- package/dist/tool-call-visualization/result-fields/EmptyResult.js +1 -1
- package/dist/tool-call-visualization/result-fields/KeyValueGrid.js +9 -9
- package/dist/tool-call-visualization/result-fields/ResultFile.js +4 -4
- package/dist/tool-call-visualization/result-fields/ResultJson.js +1 -1
- package/dist/tool-call-visualization/result-fields/ResultMedia.js +2 -2
- package/dist/tool-call-visualization/result-fields/ResultScalar.js +2 -2
- package/dist/tool-call-visualization/result-fields/ResultTable.js +10 -10
- package/dist/tool-call-visualization/result-fields/ResultValue.js +7 -7
- package/dist/tool-call-visualization/result-fields/ShortId.js +3 -3
- package/dist/tool-call-visualization/result-fields/ToolErrorCard.js +4 -4
- package/dist/tool-call-visualization/result-fields/UrlChips.js +3 -3
- package/dist/tool-call-visualization/surface-write/SurfaceWriteDiff.js +2 -2
- package/dist/tool-call-visualization/surface-write/SurfaceWriteStress.js +1 -1
- package/dist/tool-call-visualization/window-panel/ToolCallWindowPanel.js +9 -9
- package/dist/ui/mandates-storage/mandateStorage.d.ts +36 -0
- package/dist/ui/mandates-storage/shortcutStorage.d.ts +9 -0
- package/dist/ui/markdown-stream/EnhancedChatMarkdown.js +22 -0
- package/dist/ui/markdown-stream/MarkdownStreamImpl.js +3 -3
- package/dist/ui/markdown-stream/StreamTextFallback.d.ts +6 -0
- package/dist/ui/markdown-stream/StreamTextFallback.js +23 -0
- package/dist/ui/markdown-stream/merge-thinking-across-hidden.d.ts +19 -0
- package/dist/ui/markdown-stream/merge-thinking-across-hidden.js +21 -0
- package/package.json +14 -9
- package/dist/agents/redux/execution-system/utils/content-prefilter.d.ts +0 -50
- package/dist/agents/redux/execution-system/utils/content-prefilter.js +0 -243
|
@@ -955,6 +955,7 @@ declare const definitionTable: (supabase: Client) => import("@supabase/supabase-
|
|
|
955
955
|
last_seen_revision: string | null;
|
|
956
956
|
last_seen_scan_id: string | null;
|
|
957
957
|
line: number | null;
|
|
958
|
+
line_end: number | null;
|
|
958
959
|
mandate_id: string | null;
|
|
959
960
|
mandate_key: string;
|
|
960
961
|
metadata: Json;
|
|
@@ -997,6 +998,7 @@ declare const definitionTable: (supabase: Client) => import("@supabase/supabase-
|
|
|
997
998
|
last_seen_revision?: string | null;
|
|
998
999
|
last_seen_scan_id?: string | null;
|
|
999
1000
|
line?: number | null;
|
|
1001
|
+
line_end?: number | null;
|
|
1000
1002
|
mandate_id?: string | null;
|
|
1001
1003
|
mandate_key: string;
|
|
1002
1004
|
metadata?: Json;
|
|
@@ -1039,6 +1041,7 @@ declare const definitionTable: (supabase: Client) => import("@supabase/supabase-
|
|
|
1039
1041
|
last_seen_revision?: string | null;
|
|
1040
1042
|
last_seen_scan_id?: string | null;
|
|
1041
1043
|
line?: number | null;
|
|
1044
|
+
line_end?: number | null;
|
|
1042
1045
|
mandate_id?: string | null;
|
|
1043
1046
|
mandate_key?: string;
|
|
1044
1047
|
metadata?: Json;
|
|
@@ -1833,6 +1836,12 @@ declare const definitionTable: (supabase: Client) => import("@supabase/supabase-
|
|
|
1833
1836
|
};
|
|
1834
1837
|
Returns: boolean;
|
|
1835
1838
|
};
|
|
1839
|
+
code_locations: {
|
|
1840
|
+
Args: {
|
|
1841
|
+
p_keys?: string[];
|
|
1842
|
+
};
|
|
1843
|
+
Returns: Json;
|
|
1844
|
+
};
|
|
1836
1845
|
definition_restore: {
|
|
1837
1846
|
Args: {
|
|
1838
1847
|
p_mandate_id: string;
|
|
@@ -3108,6 +3117,7 @@ declare const provisionTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
3108
3117
|
last_seen_revision: string | null;
|
|
3109
3118
|
last_seen_scan_id: string | null;
|
|
3110
3119
|
line: number | null;
|
|
3120
|
+
line_end: number | null;
|
|
3111
3121
|
mandate_id: string | null;
|
|
3112
3122
|
mandate_key: string;
|
|
3113
3123
|
metadata: Json;
|
|
@@ -3150,6 +3160,7 @@ declare const provisionTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
3150
3160
|
last_seen_revision?: string | null;
|
|
3151
3161
|
last_seen_scan_id?: string | null;
|
|
3152
3162
|
line?: number | null;
|
|
3163
|
+
line_end?: number | null;
|
|
3153
3164
|
mandate_id?: string | null;
|
|
3154
3165
|
mandate_key: string;
|
|
3155
3166
|
metadata?: Json;
|
|
@@ -3192,6 +3203,7 @@ declare const provisionTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
3192
3203
|
last_seen_revision?: string | null;
|
|
3193
3204
|
last_seen_scan_id?: string | null;
|
|
3194
3205
|
line?: number | null;
|
|
3206
|
+
line_end?: number | null;
|
|
3195
3207
|
mandate_id?: string | null;
|
|
3196
3208
|
mandate_key?: string;
|
|
3197
3209
|
metadata?: Json;
|
|
@@ -3986,6 +3998,12 @@ declare const provisionTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
3986
3998
|
};
|
|
3987
3999
|
Returns: boolean;
|
|
3988
4000
|
};
|
|
4001
|
+
code_locations: {
|
|
4002
|
+
Args: {
|
|
4003
|
+
p_keys?: string[];
|
|
4004
|
+
};
|
|
4005
|
+
Returns: Json;
|
|
4006
|
+
};
|
|
3989
4007
|
definition_restore: {
|
|
3990
4008
|
Args: {
|
|
3991
4009
|
p_mandate_id: string;
|
|
@@ -5156,6 +5174,7 @@ declare const bindingTable: (supabase: Client) => import("@supabase/supabase-js"
|
|
|
5156
5174
|
last_seen_revision: string | null;
|
|
5157
5175
|
last_seen_scan_id: string | null;
|
|
5158
5176
|
line: number | null;
|
|
5177
|
+
line_end: number | null;
|
|
5159
5178
|
mandate_id: string | null;
|
|
5160
5179
|
mandate_key: string;
|
|
5161
5180
|
metadata: Json;
|
|
@@ -5198,6 +5217,7 @@ declare const bindingTable: (supabase: Client) => import("@supabase/supabase-js"
|
|
|
5198
5217
|
last_seen_revision?: string | null;
|
|
5199
5218
|
last_seen_scan_id?: string | null;
|
|
5200
5219
|
line?: number | null;
|
|
5220
|
+
line_end?: number | null;
|
|
5201
5221
|
mandate_id?: string | null;
|
|
5202
5222
|
mandate_key: string;
|
|
5203
5223
|
metadata?: Json;
|
|
@@ -5240,6 +5260,7 @@ declare const bindingTable: (supabase: Client) => import("@supabase/supabase-js"
|
|
|
5240
5260
|
last_seen_revision?: string | null;
|
|
5241
5261
|
last_seen_scan_id?: string | null;
|
|
5242
5262
|
line?: number | null;
|
|
5263
|
+
line_end?: number | null;
|
|
5243
5264
|
mandate_id?: string | null;
|
|
5244
5265
|
mandate_key?: string;
|
|
5245
5266
|
metadata?: Json;
|
|
@@ -6034,6 +6055,12 @@ declare const bindingTable: (supabase: Client) => import("@supabase/supabase-js"
|
|
|
6034
6055
|
};
|
|
6035
6056
|
Returns: boolean;
|
|
6036
6057
|
};
|
|
6058
|
+
code_locations: {
|
|
6059
|
+
Args: {
|
|
6060
|
+
p_keys?: string[];
|
|
6061
|
+
};
|
|
6062
|
+
Returns: Json;
|
|
6063
|
+
};
|
|
6037
6064
|
definition_restore: {
|
|
6038
6065
|
Args: {
|
|
6039
6066
|
p_mandate_id: string;
|
|
@@ -7252,6 +7279,7 @@ declare const treatmentTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
7252
7279
|
last_seen_revision: string | null;
|
|
7253
7280
|
last_seen_scan_id: string | null;
|
|
7254
7281
|
line: number | null;
|
|
7282
|
+
line_end: number | null;
|
|
7255
7283
|
mandate_id: string | null;
|
|
7256
7284
|
mandate_key: string;
|
|
7257
7285
|
metadata: Json;
|
|
@@ -7294,6 +7322,7 @@ declare const treatmentTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
7294
7322
|
last_seen_revision?: string | null;
|
|
7295
7323
|
last_seen_scan_id?: string | null;
|
|
7296
7324
|
line?: number | null;
|
|
7325
|
+
line_end?: number | null;
|
|
7297
7326
|
mandate_id?: string | null;
|
|
7298
7327
|
mandate_key: string;
|
|
7299
7328
|
metadata?: Json;
|
|
@@ -7336,6 +7365,7 @@ declare const treatmentTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
7336
7365
|
last_seen_revision?: string | null;
|
|
7337
7366
|
last_seen_scan_id?: string | null;
|
|
7338
7367
|
line?: number | null;
|
|
7368
|
+
line_end?: number | null;
|
|
7339
7369
|
mandate_id?: string | null;
|
|
7340
7370
|
mandate_key?: string;
|
|
7341
7371
|
metadata?: Json;
|
|
@@ -8130,6 +8160,12 @@ declare const treatmentTable: (supabase: Client) => import("@supabase/supabase-j
|
|
|
8130
8160
|
};
|
|
8131
8161
|
Returns: boolean;
|
|
8132
8162
|
};
|
|
8163
|
+
code_locations: {
|
|
8164
|
+
Args: {
|
|
8165
|
+
p_keys?: string[];
|
|
8166
|
+
};
|
|
8167
|
+
Returns: Json;
|
|
8168
|
+
};
|
|
8133
8169
|
definition_restore: {
|
|
8134
8170
|
Args: {
|
|
8135
8171
|
p_mandate_id: string;
|
|
@@ -5185,6 +5185,7 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
|
|
|
5185
5185
|
last_seen_revision: string | null;
|
|
5186
5186
|
last_seen_scan_id: string | null;
|
|
5187
5187
|
line: number | null;
|
|
5188
|
+
line_end: number | null;
|
|
5188
5189
|
mandate_id: string | null;
|
|
5189
5190
|
mandate_key: string;
|
|
5190
5191
|
metadata: import("@ai-matrx/data/types").Json;
|
|
@@ -5227,6 +5228,7 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
|
|
|
5227
5228
|
last_seen_revision?: string | null;
|
|
5228
5229
|
last_seen_scan_id?: string | null;
|
|
5229
5230
|
line?: number | null;
|
|
5231
|
+
line_end?: number | null;
|
|
5230
5232
|
mandate_id?: string | null;
|
|
5231
5233
|
mandate_key: string;
|
|
5232
5234
|
metadata?: import("@ai-matrx/data/types").Json;
|
|
@@ -5269,6 +5271,7 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
|
|
|
5269
5271
|
last_seen_revision?: string | null;
|
|
5270
5272
|
last_seen_scan_id?: string | null;
|
|
5271
5273
|
line?: number | null;
|
|
5274
|
+
line_end?: number | null;
|
|
5272
5275
|
mandate_id?: string | null;
|
|
5273
5276
|
mandate_key?: string;
|
|
5274
5277
|
metadata?: import("@ai-matrx/data/types").Json;
|
|
@@ -6063,6 +6066,12 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
|
|
|
6063
6066
|
};
|
|
6064
6067
|
Returns: boolean;
|
|
6065
6068
|
};
|
|
6069
|
+
code_locations: {
|
|
6070
|
+
Args: {
|
|
6071
|
+
p_keys?: string[];
|
|
6072
|
+
};
|
|
6073
|
+
Returns: import("@ai-matrx/data/types").Json;
|
|
6074
|
+
};
|
|
6066
6075
|
definition_restore: {
|
|
6067
6076
|
Args: {
|
|
6068
6077
|
p_mandate_id: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { mergeThinkingAcrossHidden } from "./merge-thinking-across-hidden.js";
|
|
3
4
|
import { useState, useEffect, useLayoutEffect, useMemo, useCallback, useRef } from "react";
|
|
4
5
|
import { cn } from "@ai-matrx/design-system";
|
|
5
6
|
import { WIDE_FIGURE_HOST_CLASS, WIDE_FIGURE_PROSE_CLIP_CLASS } from "../../agents/components/shared/assistant-message-layout.js";
|
|
@@ -370,6 +371,18 @@ const EnhancedChatMarkdownInternal = ({
|
|
|
370
371
|
);
|
|
371
372
|
const isSettled = !isStreamActive;
|
|
372
373
|
const workGroupedSlots = useMemo(() => {
|
|
374
|
+
if (!machineFramesVisible) {
|
|
375
|
+
return mergeThinkingAcrossHidden(groupedSlots, {
|
|
376
|
+
isThinking: (slot) => slot.kind === "thinking",
|
|
377
|
+
isHidden: (slot) => {
|
|
378
|
+
if (slot.kind === "tool_batch") return true;
|
|
379
|
+
if (slot.kind !== "tool") return false;
|
|
380
|
+
const status = toolLifecycleMap?.[slot.callId]?.status;
|
|
381
|
+
return status === "completed" || status === "error";
|
|
382
|
+
},
|
|
383
|
+
merge: (first, next) => first.kind === "thinking" && next.kind === "thinking" ? next.chunkEndIndex === void 0 ? { kind: "thinking", chunkStartIndex: first.chunkStartIndex, seq: first.seq, ...first.timelineIndex !== void 0 ? { timelineIndex: first.timelineIndex } : {} } : { ...first, chunkEndIndex: next.chunkEndIndex } : first
|
|
384
|
+
});
|
|
385
|
+
}
|
|
373
386
|
if (!isSettled) return groupedSlots;
|
|
374
387
|
if (messageId && !settledFromRecord) return groupedSlots;
|
|
375
388
|
if (!machineFramesVisible) return groupedSlots;
|
|
@@ -412,6 +425,15 @@ const EnhancedChatMarkdownInternal = ({
|
|
|
412
425
|
machineFramesVisible
|
|
413
426
|
]);
|
|
414
427
|
const workGroupedSegments = useMemo(() => {
|
|
428
|
+
if (!machineFramesVisible) {
|
|
429
|
+
return mergeThinkingAcrossHidden(groupedSegments, {
|
|
430
|
+
isThinking: (seg) => seg.type === "thinking",
|
|
431
|
+
isHidden: (seg) => seg.type === "db_tool" || seg.type === "db_tool_batch",
|
|
432
|
+
merge: (first, next) => first.type === "thinking" && next.type === "thinking" ? { ...first, content: `${first.content}
|
|
433
|
+
|
|
434
|
+
${next.content}` } : first
|
|
435
|
+
});
|
|
436
|
+
}
|
|
415
437
|
if (!isSettled) return groupedSegments;
|
|
416
438
|
if (!machineFramesVisible) return groupedSegments;
|
|
417
439
|
const dbToolSpan = (seg) => toolSpan(seg.record?.startedAt, seg.record?.completedAt);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { RichContentHostGate } from "@ai-matrx/rich-content/host";
|
|
4
|
-
import {
|
|
4
|
+
import { StreamTextFallback } from "./StreamTextFallback.js";
|
|
5
5
|
import { MarkdownErrorBoundary } from "@ai-matrx/rich-content/display/chat-markdown/internal-handlers/MarkdownErrorBoundary";
|
|
6
6
|
import { StreamAwareChatMarkdown } from "./StreamAwareChatMarkdown.js";
|
|
7
7
|
import { BlockRenderingProvider } from "@ai-matrx/rich-content/display/chat-markdown/BlockRenderingContext";
|
|
@@ -37,11 +37,11 @@ const MarkdownStreamImpl = ({
|
|
|
37
37
|
const rendered = /* @__PURE__ */ jsx(
|
|
38
38
|
RichContentHostGate,
|
|
39
39
|
{
|
|
40
|
-
fallback: /* @__PURE__ */ jsx(
|
|
40
|
+
fallback: /* @__PURE__ */ jsx(StreamTextFallback, { content, requestId, className }),
|
|
41
41
|
children: /* @__PURE__ */ jsx(BlockRenderingProvider, { strictServerData, children: /* @__PURE__ */ jsx(
|
|
42
42
|
MarkdownErrorBoundary,
|
|
43
43
|
{
|
|
44
|
-
fallback: /* @__PURE__ */ jsx(
|
|
44
|
+
fallback: /* @__PURE__ */ jsx(StreamTextFallback, { content, requestId, className }),
|
|
45
45
|
onError: (error, errorInfo) => {
|
|
46
46
|
console.error(
|
|
47
47
|
"[MarkdownStream] Top-level error boundary caught:",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { PlainTextFallback } from "@ai-matrx/rich-content/display/chat-markdown/internal-handlers/PlainTextFallback";
|
|
5
|
+
import { useAppSelector } from "../../store/hooks.js";
|
|
6
|
+
import { selectAnswerText } from "../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
7
|
+
const selectNoText = () => "";
|
|
8
|
+
function StreamTextFallback({
|
|
9
|
+
content,
|
|
10
|
+
requestId,
|
|
11
|
+
className
|
|
12
|
+
}) {
|
|
13
|
+
const selector = React.useMemo(() => requestId ? selectAnswerText(requestId) : selectNoText, [requestId]);
|
|
14
|
+
const requestText = useAppSelector(selector);
|
|
15
|
+
const text = content.trim() ? content : requestText;
|
|
16
|
+
if (!text.trim() && requestId) {
|
|
17
|
+
return /* @__PURE__ */ jsx(PlainTextFallback, { content: "Loading\u2026", className });
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx(PlainTextFallback, { content: text, className });
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
StreamTextFallback
|
|
23
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ONE THINKING BLOCK WHERE THE PERSON SEES ONE (Applet audit, 2026-10-09).
|
|
3
|
+
*
|
|
4
|
+
* A research agent thinks, calls a tool, thinks, calls a tool — forty times. Where machine frames are
|
|
5
|
+
* hidden (an Expert, an Applet visitor) a settled tool call renders NOTHING, so those forty separate
|
|
6
|
+
* thinking runs stacked up as forty identical "Thought process" rows above the answer
|
|
7
|
+
* (state-regulatory-research, regional-itad-challenge-generator). Thinking runs separated only by items
|
|
8
|
+
* that render nothing are one thinking block to the person reading; they are merged into the first.
|
|
9
|
+
*
|
|
10
|
+
* Pure and generic: the live slots and the persisted segments each say what thinking is, what renders
|
|
11
|
+
* nothing, and how two thinking items join. Hidden items stay in place (they still render nothing).
|
|
12
|
+
*/
|
|
13
|
+
export interface MergeThinkingRules<T> {
|
|
14
|
+
isThinking(item: T): boolean;
|
|
15
|
+
/** Renders nothing in this view (e.g. a settled tool call with machine frames hidden). */
|
|
16
|
+
isHidden(item: T): boolean;
|
|
17
|
+
merge(first: T, next: T): T;
|
|
18
|
+
}
|
|
19
|
+
export declare function mergeThinkingAcrossHidden<T>(items: readonly T[], rules: MergeThinkingRules<T>): T[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function mergeThinkingAcrossHidden(items, rules) {
|
|
2
|
+
const out = [];
|
|
3
|
+
let open = -1;
|
|
4
|
+
for (const item of items) {
|
|
5
|
+
if (rules.isThinking(item)) {
|
|
6
|
+
if (open >= 0) {
|
|
7
|
+
out[open] = rules.merge(out[open], item);
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
open = out.length;
|
|
11
|
+
out.push(item);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (!rules.isHidden(item)) open = -1;
|
|
15
|
+
out.push(item);
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
mergeThinkingAcrossHidden
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/chat",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "THE one AI Matrx person-to-agent chat system: the full chat (running agents, conversations, tool calls, streaming, context, surfaces, voice) as explicit per-module subpaths @ai-matrx/chat/<domain>/<module> (no wildcards: scripts/public-modules.json) over a host contract (/host, /host/react) whose only required value is a db. One chat, one renderer: the old kernel entries (., /external-store, /matrx, /react, /tools, styles.css, tokens.css) are retired.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -2180,6 +2180,11 @@
|
|
|
2180
2180
|
"import": "./dist/agents/redux/execution-system/thunks/launch-conversation.thunk.js",
|
|
2181
2181
|
"default": "./dist/agents/redux/execution-system/thunks/launch-conversation.thunk.js"
|
|
2182
2182
|
},
|
|
2183
|
+
"./agents/redux/execution-system/thunks/continue-agent-json": {
|
|
2184
|
+
"types": "./dist/agents/redux/execution-system/thunks/continue-agent-json.d.ts",
|
|
2185
|
+
"import": "./dist/agents/redux/execution-system/thunks/continue-agent-json.js",
|
|
2186
|
+
"default": "./dist/agents/redux/execution-system/thunks/continue-agent-json.js"
|
|
2187
|
+
},
|
|
2183
2188
|
"./agents/redux/execution-system/thunks/load-agent-call-child.thunk": {
|
|
2184
2189
|
"types": "./dist/agents/redux/execution-system/thunks/load-agent-call-child.thunk.d.ts",
|
|
2185
2190
|
"import": "./dist/agents/redux/execution-system/thunks/load-agent-call-child.thunk.js",
|
|
@@ -4666,10 +4671,12 @@
|
|
|
4666
4671
|
"server-only": "^0.0.1",
|
|
4667
4672
|
"uuid": "^14.0.2",
|
|
4668
4673
|
"zod": "^4.6.5",
|
|
4669
|
-
"@ai-matrx/alchemy": "latest",
|
|
4670
4674
|
"@ai-matrx/associations": "latest",
|
|
4675
|
+
"@ai-matrx/browser-audio": "latest",
|
|
4676
|
+
"@ai-matrx/canvas": "latest",
|
|
4671
4677
|
"@ai-matrx/content-ir": "latest",
|
|
4672
|
-
"@ai-matrx/
|
|
4678
|
+
"@ai-matrx/content-ir-react": "latest",
|
|
4679
|
+
"@ai-matrx/alchemy": "latest",
|
|
4673
4680
|
"@ai-matrx/data": "latest",
|
|
4674
4681
|
"@ai-matrx/design-system": "latest",
|
|
4675
4682
|
"@ai-matrx/diff": "latest",
|
|
@@ -4677,14 +4684,12 @@
|
|
|
4677
4684
|
"@ai-matrx/kit": "latest",
|
|
4678
4685
|
"@ai-matrx/media": "latest",
|
|
4679
4686
|
"@ai-matrx/print": "latest",
|
|
4680
|
-
"@ai-matrx/realtime": "latest",
|
|
4681
4687
|
"@ai-matrx/records": "latest",
|
|
4682
4688
|
"@ai-matrx/records-ui": "latest",
|
|
4689
|
+
"@ai-matrx/rich-content": "latest",
|
|
4690
|
+
"@ai-matrx/realtime": "latest",
|
|
4683
4691
|
"@ai-matrx/rich-editor": "latest",
|
|
4684
|
-
"@ai-matrx/
|
|
4685
|
-
"@ai-matrx/canvas": "latest",
|
|
4686
|
-
"@ai-matrx/browser-audio": "latest",
|
|
4687
|
-
"@ai-matrx/rich-content": "latest"
|
|
4692
|
+
"@ai-matrx/agents": "latest"
|
|
4688
4693
|
},
|
|
4689
4694
|
"devDependencies": {
|
|
4690
4695
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
@@ -4803,5 +4808,5 @@
|
|
|
4803
4808
|
"check:side-effects": "node ../scripts/check-side-effects-listed.mjs . && node ../scripts/check-side-effects-listed.mjs --self-test",
|
|
4804
4809
|
"check:public-surface": "node ./scripts/sync-public-surface.mjs --check && node ./scripts/sync-public-surface.mjs --self-test"
|
|
4805
4810
|
},
|
|
4806
|
-
"gitHead": "
|
|
4811
|
+
"gitHead": "40e9cde039db43145b8dd46611af113404400706"
|
|
4807
4812
|
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Content Pre-Filter — Fast-reject layers for splitContentIntoBlocksV2
|
|
3
|
-
*
|
|
4
|
-
* Designed to run BEFORE any regex, JSON parsing, or XML extraction.
|
|
5
|
-
* Returns a set of candidate categories for a given line so the main
|
|
6
|
-
* parser can skip entire detection branches.
|
|
7
|
-
*
|
|
8
|
-
* Layer 0: Single-character scan (nanoseconds)
|
|
9
|
-
* Layer 1: Cheap secondary validation (tens of nanoseconds)
|
|
10
|
-
*
|
|
11
|
-
* If no candidates are found → the line is guaranteed to be plain text.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Bit flags — a line can be a candidate for multiple categories simultaneously.
|
|
15
|
-
* Using bits so the main parser can do `if (candidates & Candidate.CODE)`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const Candidate: {
|
|
18
|
-
readonly NONE: 0;
|
|
19
|
-
readonly TEXT: 0;
|
|
20
|
-
readonly CODE: number;
|
|
21
|
-
readonly XML_SIMPLE: number;
|
|
22
|
-
readonly XML_ATTR: number;
|
|
23
|
-
readonly TABLE: number;
|
|
24
|
-
readonly IMAGE: number;
|
|
25
|
-
readonly VIDEO: number;
|
|
26
|
-
readonly DIVIDER: number;
|
|
27
|
-
readonly TREE: number;
|
|
28
|
-
readonly BARE_JSON: number;
|
|
29
|
-
readonly AUDIO: number;
|
|
30
|
-
readonly MATRX_FILE: number;
|
|
31
|
-
};
|
|
32
|
-
export type CandidateFlags = number;
|
|
33
|
-
/**
|
|
34
|
-
* Scans a line and returns a bitmask of candidate categories.
|
|
35
|
-
*
|
|
36
|
-
* This scans the FULL line (not just the start) to support inline blocks
|
|
37
|
-
* like "Hello <decision prompt="...">". The scan is still cheap because
|
|
38
|
-
* we only look at individual characters — no regex, no string splitting.
|
|
39
|
-
*
|
|
40
|
-
* @param line The raw line (before trimming)
|
|
41
|
-
* @param trimmed The normalized+trimmed line (caller already has this)
|
|
42
|
-
* @returns Bitmask of Candidate flags
|
|
43
|
-
*/
|
|
44
|
-
export declare function classifyLine(line: string, trimmed: string): CandidateFlags;
|
|
45
|
-
export declare function isPlainText(flags: CandidateFlags): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Quick check for whether flags include a specific candidate.
|
|
48
|
-
* Usage: `if (hasCandidate(flags, Candidate.CODE)) { ... }`
|
|
49
|
-
*/
|
|
50
|
-
export declare function hasCandidate(flags: CandidateFlags, candidate: number): boolean;
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { OUR_FILE_URL_MARKERS } from "@ai-matrx/media/files/engine";
|
|
2
|
-
const Candidate = {
|
|
3
|
-
NONE: 0,
|
|
4
|
-
TEXT: 0,
|
|
5
|
-
// No special block detected — plain text
|
|
6
|
-
CODE: 1 << 0,
|
|
7
|
-
// ``` or ~~~ fenced code block
|
|
8
|
-
XML_SIMPLE: 1 << 1,
|
|
9
|
-
// <thinking>, <flashcards>, etc.
|
|
10
|
-
XML_ATTR: 1 << 2,
|
|
11
|
-
// <decision prompt="...">, <artifact ...>
|
|
12
|
-
TABLE: 1 << 3,
|
|
13
|
-
// | col | col |
|
|
14
|
-
IMAGE: 1 << 4,
|
|
15
|
-
//  or [Image URL: ...]
|
|
16
|
-
VIDEO: 1 << 5,
|
|
17
|
-
// [Video URL: ...]
|
|
18
|
-
DIVIDER: 1 << 7,
|
|
19
|
-
// *** or # ===
|
|
20
|
-
TREE: 1 << 8,
|
|
21
|
-
// Box-drawing / ASCII tree characters
|
|
22
|
-
BARE_JSON: 1 << 9,
|
|
23
|
-
// { "key": ... } JSON object without code fences
|
|
24
|
-
AUDIO: 1 << 10,
|
|
25
|
-
// [Audio URL: ...] or a standalone …/clip.mp3 link
|
|
26
|
-
MATRX_FILE: 1 << 11
|
|
27
|
-
// link/URL to one of OUR files (signed S3 / CDN / public / share)
|
|
28
|
-
};
|
|
29
|
-
const AUDIO_EXT_RE = /\.(mp3|wav|m4a|aac|ogg|oga|opus|flac|weba|webm)(\?[^\s)]*)?$/i;
|
|
30
|
-
function isStandaloneAudioLink(trimmed) {
|
|
31
|
-
const link = trimmed.match(/^!?\[.*?\]\((https?:\/\/[^\s)]+)\)$/);
|
|
32
|
-
if (link) return AUDIO_EXT_RE.test(link[1]);
|
|
33
|
-
if (/^https?:\/\/[^\s)]+$/.test(trimmed)) return AUDIO_EXT_RE.test(trimmed);
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
function mightBeOurFile(trimmed) {
|
|
37
|
-
const markers = OUR_FILE_URL_MARKERS;
|
|
38
|
-
for (let mi = 0; mi < markers.length; mi++) {
|
|
39
|
-
if (trimmed.includes(markers[mi])) return true;
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
const SIMPLE_XML_TAGS = /* @__PURE__ */ new Set([
|
|
44
|
-
"thinking",
|
|
45
|
-
"think",
|
|
46
|
-
"reasoning",
|
|
47
|
-
"info",
|
|
48
|
-
"task",
|
|
49
|
-
"database",
|
|
50
|
-
"private",
|
|
51
|
-
"plan",
|
|
52
|
-
"event",
|
|
53
|
-
"tool",
|
|
54
|
-
"questionnaire",
|
|
55
|
-
"flashcards",
|
|
56
|
-
"cooking_recipe",
|
|
57
|
-
"timeline",
|
|
58
|
-
"progress_tracker",
|
|
59
|
-
"troubleshooting",
|
|
60
|
-
"resources",
|
|
61
|
-
"research"
|
|
62
|
-
]);
|
|
63
|
-
const ATTR_XML_TAGS = /* @__PURE__ */ new Set([
|
|
64
|
-
"decision",
|
|
65
|
-
"artifact",
|
|
66
|
-
// Editor pill tags — carry attributes (file, line, severity, language, …)
|
|
67
|
-
// so they're classified as ATTR. The chat-markdown renderer parses them
|
|
68
|
-
// back into chips on load.
|
|
69
|
-
"editor_error",
|
|
70
|
-
"editor_code_snippet"
|
|
71
|
-
]);
|
|
72
|
-
const ALL_XML_TAGS = /* @__PURE__ */ new Set([...SIMPLE_XML_TAGS, ...ATTR_XML_TAGS]);
|
|
73
|
-
const TREE_CHARS = /* @__PURE__ */ new Set([
|
|
74
|
-
"\u251C",
|
|
75
|
-
"\u2514",
|
|
76
|
-
"\u2502",
|
|
77
|
-
"\u250C",
|
|
78
|
-
"\u2510",
|
|
79
|
-
"\u2518",
|
|
80
|
-
"\u252C",
|
|
81
|
-
"\u2534",
|
|
82
|
-
"\u2524",
|
|
83
|
-
"\u253C",
|
|
84
|
-
"\u2500"
|
|
85
|
-
]);
|
|
86
|
-
function classifyLine(line, trimmed) {
|
|
87
|
-
let flags = Candidate.NONE;
|
|
88
|
-
const len = trimmed.length;
|
|
89
|
-
if (len === 0) return flags;
|
|
90
|
-
const first = trimmed[0];
|
|
91
|
-
if (first === "`" || first === "~") {
|
|
92
|
-
if (len >= 3 && trimmed[1] === first && trimmed[2] === first) {
|
|
93
|
-
flags |= Candidate.CODE;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (first === "{") {
|
|
97
|
-
flags |= Candidate.BARE_JSON;
|
|
98
|
-
}
|
|
99
|
-
if (first === "|") {
|
|
100
|
-
if (trimmed.indexOf("|", 1) !== -1) {
|
|
101
|
-
flags |= Candidate.TABLE;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (first === "!" && len >= 2 && trimmed[1] === "[") {
|
|
105
|
-
flags |= Candidate.IMAGE;
|
|
106
|
-
}
|
|
107
|
-
if (first === "*" || first === "#") {
|
|
108
|
-
if (first === "*") {
|
|
109
|
-
if (isStarDivider(trimmed)) {
|
|
110
|
-
flags |= Candidate.DIVIDER;
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
if (len >= 4 && trimmed.indexOf("=") !== -1) {
|
|
114
|
-
flags |= Candidate.DIVIDER;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (TREE_CHARS.has(first)) {
|
|
119
|
-
flags |= Candidate.TREE;
|
|
120
|
-
}
|
|
121
|
-
let searchFrom = 0;
|
|
122
|
-
while (searchFrom < len) {
|
|
123
|
-
const ltPos = trimmed.indexOf("<", searchFrom);
|
|
124
|
-
if (ltPos === -1) break;
|
|
125
|
-
if (ltPos + 2 < len && trimmed[ltPos + 1] === "<" && trimmed[ltPos + 2] === "<") {
|
|
126
|
-
searchFrom = ltPos + 3;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (ltPos + 1 < len) {
|
|
130
|
-
const next = trimmed[ltPos + 1];
|
|
131
|
-
if (isLetter(next)) {
|
|
132
|
-
const tagName = extractTagName(trimmed, ltPos + 1);
|
|
133
|
-
if (tagName) {
|
|
134
|
-
if (SIMPLE_XML_TAGS.has(tagName)) {
|
|
135
|
-
flags |= Candidate.XML_SIMPLE;
|
|
136
|
-
}
|
|
137
|
-
if (ATTR_XML_TAGS.has(tagName)) {
|
|
138
|
-
flags |= Candidate.XML_ATTR;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
searchFrom = ltPos + 1;
|
|
144
|
-
}
|
|
145
|
-
if (!(flags & Candidate.IMAGE) || !(flags & Candidate.VIDEO) || !(flags & Candidate.AUDIO)) {
|
|
146
|
-
const bracketIdx = trimmed.indexOf("[");
|
|
147
|
-
if (bracketIdx !== -1) {
|
|
148
|
-
if (bracketIdx + 10 < len) {
|
|
149
|
-
const after = trimmed[bracketIdx + 1];
|
|
150
|
-
if (after === "I" && trimmed.substring(bracketIdx + 1, bracketIdx + 11) === "Image URL:") {
|
|
151
|
-
flags |= Candidate.IMAGE;
|
|
152
|
-
} else if (after === "V" && trimmed.substring(bracketIdx + 1, bracketIdx + 11) === "Video URL:") {
|
|
153
|
-
flags |= Candidate.VIDEO;
|
|
154
|
-
} else if (after === "A" && trimmed.substring(bracketIdx + 1, bracketIdx + 11) === "Audio URL:") {
|
|
155
|
-
flags |= Candidate.AUDIO;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (!(flags & Candidate.AUDIO) && (first === "[" || first === "!" || first === "h") && isStandaloneAudioLink(trimmed)) {
|
|
161
|
-
flags |= Candidate.AUDIO;
|
|
162
|
-
}
|
|
163
|
-
if (!(flags & Candidate.TABLE) && first !== "|") {
|
|
164
|
-
if (trimmed.indexOf("|") !== -1) {
|
|
165
|
-
const firstPipe = trimmed.indexOf("|");
|
|
166
|
-
if (firstPipe !== -1 && trimmed.indexOf("|", firstPipe + 1) !== -1) {
|
|
167
|
-
flags |= Candidate.TABLE;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (!(flags & Candidate.TREE)) {
|
|
172
|
-
for (let ci = 1; ci < len; ci++) {
|
|
173
|
-
if (TREE_CHARS.has(trimmed[ci])) {
|
|
174
|
-
flags |= Candidate.TREE;
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
if (!(flags & Candidate.TREE) && (first === " " || first === " " || first === "\u2502" || first === "|" || first === "+")) {
|
|
180
|
-
if (looksLikeAsciiTree(trimmed)) {
|
|
181
|
-
flags |= Candidate.TREE;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (!(flags & Candidate.MATRX_FILE) && mightBeOurFile(trimmed)) {
|
|
185
|
-
flags |= Candidate.MATRX_FILE;
|
|
186
|
-
}
|
|
187
|
-
return flags;
|
|
188
|
-
}
|
|
189
|
-
function isLetter(ch) {
|
|
190
|
-
const c = ch.charCodeAt(0);
|
|
191
|
-
return c >= 65 && c <= 90 || c >= 97 && c <= 122;
|
|
192
|
-
}
|
|
193
|
-
function extractTagName(str, start) {
|
|
194
|
-
let end = start;
|
|
195
|
-
while (end < str.length) {
|
|
196
|
-
const c = str.charCodeAt(end);
|
|
197
|
-
if (c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 95) {
|
|
198
|
-
end++;
|
|
199
|
-
} else {
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (end === start) return null;
|
|
204
|
-
return str.substring(start, end).toLowerCase();
|
|
205
|
-
}
|
|
206
|
-
function isStarDivider(trimmed) {
|
|
207
|
-
let starCount = 0;
|
|
208
|
-
for (let i = 0; i < trimmed.length; i++) {
|
|
209
|
-
const ch = trimmed[i];
|
|
210
|
-
if (ch === "*") {
|
|
211
|
-
starCount++;
|
|
212
|
-
} else if (ch !== " ") {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return starCount >= 3;
|
|
217
|
-
}
|
|
218
|
-
function looksLikeAsciiTree(trimmed) {
|
|
219
|
-
let i = 0;
|
|
220
|
-
while (i < trimmed.length) {
|
|
221
|
-
const ch2 = trimmed[i];
|
|
222
|
-
if (ch2 === " " || ch2 === " " || ch2 === "\u2502" || ch2 === "|") {
|
|
223
|
-
i++;
|
|
224
|
-
} else {
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
if (i >= trimmed.length) return false;
|
|
229
|
-
const ch = trimmed[i];
|
|
230
|
-
return ch === "\u251C" || ch === "\u2514" || ch === "+";
|
|
231
|
-
}
|
|
232
|
-
function isPlainText(flags) {
|
|
233
|
-
return flags === Candidate.NONE;
|
|
234
|
-
}
|
|
235
|
-
function hasCandidate(flags, candidate) {
|
|
236
|
-
return (flags & candidate) !== 0;
|
|
237
|
-
}
|
|
238
|
-
export {
|
|
239
|
-
Candidate,
|
|
240
|
-
classifyLine,
|
|
241
|
-
hasCandidate,
|
|
242
|
-
isPlainText
|
|
243
|
-
};
|