Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/plugin-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub fn valid_id(id: &str) -> Result<()> {
}
pub fn bundled_manifests() -> Vec<Manifest> {
vec![
serde_json::from_str(include_str!("../../../src/bundled/diffs/manifest.json"))
.expect("bundled diffs manifest"),
serde_json::from_str(include_str!(
"../../../src/bundled/channel-templates/manifest.json"
))
Expand Down
17 changes: 17 additions & 0 deletions docs/plugin-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,23 @@ mounted page; see [sidebar ownership](channels.md#ownership).

## Conversation contributions

`registerMessage({ id, title, matches, component })` contributes an optional whole
message body. Components receive `{ message: ChannelMessage }`; the first active
match wins, throwing matchers are skipped, and render failure/removal restores the
host body. Registration uses the same owned contribution lifetime as inline/link
renderers. The host retains author/time chrome, actions, attachments and session
ownership. `MessageRenderer` is a host-matched author-preview type, not event
admission or cross-version capability negotiation.

The bundled **Diff viewer** (`buzz.diffs`) handles `ChannelMessage.diff` from legacy
kind 40008. Shared history, live, thread and exact readers retain these messages
independently of the plugin, preserving raw patches rather than interpreting them
as Markdown images or links. The plugin supplies an inline preview and expanded
Unified/Split dialog. Disabled/failed rendering, malformed/incomplete patches and
patches over the display parsing budget retain escaped raw text. Metadata is
untrusted presentation, not repository access authority. No sending, applying,
repository fetching or sidebar panels are added.

`registerLink({ id, title, matches, className?, component })` contributes optional
presentation for links already recognized by messages. The host retains the anchor,
destination, new-tab/modifier behavior and panel activation. Components receive
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"mdast-util-from-markdown": "2.0.3",
"nostr-tools": "2.25.2",
"react": "19.2.8",
"react-diff-view": "3.3.2",
"react-dom": "19.2.8",
"react-markdown": "10.1.0",
"remark-breaks": "4.0.0",
Expand Down
59 changes: 59 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scripts/design-system/check-icons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const nonIconDependencies = new Set([
"nostr-tools",
"postcss",
"react",
"react-diff-view", // Patch tables/parser, not an icon library.
"react-dom",
"react-markdown",
"remark-breaks",
Expand Down
2 changes: 1 addition & 1 deletion src/app/shell/SearchResults.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ it("shows the real read failure, retains conversation choices, and retries to an
const request = wire.next();
expect(request.filters).toEqual([
{
kinds: [40002, 9], // The real reader canonicalizes set order.
kinds: [40002, 40008, 9], // The real reader canonicalizes set order.
search: "wes-cr",
search_mode: "prefix",
limit: 20,
Expand Down
4 changes: 2 additions & 2 deletions src/app/shell/useSearchMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function useSearchMessages(session: RelaySession, query: string) {
.read(
[
{
kinds: [9, 40002],
kinds: [9, 40002, 40008],

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Resolve the relay indexing dependency before claiming diff search.

Adding 40008 to the request cannot return diff hits on an allowlist-indexed relay. Current block/buzz source at d01e5f82058463709a22e93bb4cd795da5f53e10 creates search_tsv only for 0, 9, 40002, 45001 and 45003; its maintenance script has the same set. Kind-40008 rows get NULL, so the search query's search_tsv @@ ... predicate excludes them regardless of this filter. This is a source-proven fresh-install/allowlist-maintained relay limitation, not a claim about the deployed database. Coordinate the relay index change and real-relay search evidence, or explicitly defer diff search from this delivery contract. Synthetic search responses do not establish that integration.

search: query,
search_mode: "prefix",
limit: 20,
Expand All @@ -65,7 +65,7 @@ export function useSearchMessages(session: RelaySession, query: string) {
const destinations = event.tags.filter(([name]) => name === "h");
const channelId = destinations[0]?.[1];
if (
![9, 40002].includes(event.kind) ||
![9, 40002, 40008].includes(event.kind) ||
destinations.length !== 1 ||
!channelId ||
!session.channels.get?.(channelId)
Expand Down
2 changes: 1 addition & 1 deletion src/bundled/channels/useHiddenDms.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ it("checks a hidden DM directly on return for messages missed while closed", asy
});
expect(restored.result.current.hiddenIds.has("dm")).toBe(false);
expect(h.read).toHaveBeenCalledWith(
[{ kinds: [9, 40002], "#h": ["dm"], limit: 100 }],
[{ kinds: [9, 40002, 40008], "#h": ["dm"], limit: 100 }],
expect.objectContaining({ priority: "background" }),
);
});
Expand Down
5 changes: 3 additions & 2 deletions src/bundled/channels/useHiddenDms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export function useHiddenDms(
show(messages.map((message) => message.channelId)),
);
const stopOutgoing = session.outbox?.observeSend((event) => {
if (event.kind !== 9 && event.kind !== 40002) return;
if (event.kind !== 9 && event.kind !== 40002 && event.kind !== 40008)
return;
const destinations = event.tags.filter(([name]) => name === "h");
const id = destinations.length === 1 ? destinations[0]?.[1] : undefined;
const hiddenAtSend = current.current.find((entry) => entry.id === id);
Expand Down Expand Up @@ -182,7 +183,7 @@ export function useHiddenDms(
const events = await session.read(
[
{
kinds: [9, 40002],
kinds: [9, 40002, 40008],
"#h": [id],
limit: entry.knownIds ? 50 : 100,
},
Expand Down
Loading
Loading