This repository was archived by the owner on Aug 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Render agent thread updates: markdown links and agent-authored messages #3380
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2ef43de
Auto-post canvas creation and turn-complete updates into the task thread
k11kirky dd391e3
Move thread auto-posts server-side; keep client rendering support
k11kirky 5ce84d0
Adopt structured agent thread rows (author_kind/event/payload)
k11kirky 911f0d9
Adapt agent thread announcements to current thread UI
k11kirky 90c7a61
Respect thread author kinds and markdown link boundaries
k11kirky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| const URL_PATTERN = /https?:\/\/[^\s<>]+/gi; | ||
|
|
||
| // Named links written as markdown `[label](https://url)` — the shape auto-posted | ||
| // thread messages use. Label excludes brackets and the URL excludes parens so | ||
| // the token boundaries are unambiguous (same reasoning as MENTION_PATTERN). | ||
| const MARKDOWN_LINK_PATTERN = /\[([^\][\n]+)\]\((https?:\/\/[^\s()]+)\)/gi; | ||
|
|
||
| export interface LinkTextSegment { | ||
| type: "text"; | ||
| text: string; | ||
|
|
@@ -39,8 +44,34 @@ function trimTrailingPunctuation(url: string): string { | |
| return url.slice(0, end); | ||
| } | ||
|
|
||
| /** Split plain text into text and http(s) link segments, in document order. */ | ||
| /** | ||
| * Split plain text into text and http(s) link segments, in document order. | ||
| * Markdown-style `[label](url)` tokens become links titled by their label; | ||
| * bare URLs in the remaining text link as themselves. | ||
| */ | ||
| export function splitLinkSegments(text: string): LinkSegment[] { | ||
| const segments: LinkSegment[] = []; | ||
| let lastIndex = 0; | ||
| MARKDOWN_LINK_PATTERN.lastIndex = 0; | ||
| for (const match of text.matchAll(MARKDOWN_LINK_PATTERN)) { | ||
| const index = match.index ?? 0; | ||
| if (index > lastIndex) { | ||
| segments.push(...splitBareUrlSegments(text.slice(lastIndex, index))); | ||
| } | ||
| segments.push({ | ||
| type: "link", | ||
| text: match[1] ?? "", | ||
| href: match[2] ?? "", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Medium: Deceptive external links A collaborator can post |
||
| }); | ||
| lastIndex = index + match[0].length; | ||
| } | ||
| if (lastIndex < text.length) { | ||
| segments.push(...splitBareUrlSegments(text.slice(lastIndex))); | ||
| } | ||
| return segments; | ||
| } | ||
|
|
||
| function splitBareUrlSegments(text: string): LinkSegment[] { | ||
| const segments: LinkSegment[] = []; | ||
| let lastIndex = 0; | ||
| URL_PATTERN.lastIndex = 0; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.