Skip to content

Enhance SSE send format and expand file includes for .mts/.cts - #44

Merged
Vanessa219 merged 4 commits into
siyuan-note:mainfrom
Zuoqiu-Yingyi:perf/improve-sse-sent
May 13, 2026
Merged

Enhance SSE send format and expand file includes for .mts/.cts#44
Vanessa219 merged 4 commits into
siyuan-note:mainfrom
Zuoqiu-Yingyi:perf/improve-sse-sent

Conversation

@Zuoqiu-Yingyi

Copy link
Copy Markdown
Contributor

dprint.json: expand file includes to cover .mts and .cts files and set importDeclaration.spaceSurroundingNamedImports to false.

src/kernel.ts: change SSE port.send usage to the object form (including event, data, id, retry) for update events and send the connection message as a plain data payload. This adapts to the updated SSE send API/shape and ensures update events include an id and retry hint.

dprint.json: expand file includes to cover .mts and .cts files and set importDeclaration.spaceSurroundingNamedImports to false.

src/kernel.ts: change SSE port.send usage to the object form (including event, data, id, retry) for update events and send the connection message as a plain data payload. This adapts to the updated SSE send API/shape and ensures update events include an id and retry hint.
Register a filesystem watcher for the plugin storage directory on load and remove it on unload. Adds storage.watcher.add("./") in the onload path and storage.watcher.remove("./") in the onunload path, and includes storage in the siyuan destructuring. This ensures the plugin listens for storage events and cleans up the watcher to avoid resource leaks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates formatting configuration to include modern TypeScript module extensions and adapts the sample SSE server handler to a newer port.send payload shape, including SSE metadata (event name, id, retry).

Changes:

  • Expanded dprint.json includes to cover .mts and .cts, and adjusted named-import spacing configuration.
  • Added storage directory filesystem watching on plugin load and removed the watch on unload.
  • Updated SSE request.port.send usage to send an object payload (with event, data, id, retry) for update events and a plain data payload for the connection message.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/kernel.ts Adds storage watcher lifecycle wiring and updates SSE send calls to the new object-form payload.
dprint.json Extends formatter include globs for .mts/.cts and tweaks TypeScript import formatting behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/kernel.ts Outdated
Comment thread src/kernel.ts Outdated
Zuoqiu-Yingyi and others added 2 commits May 13, 2026 11:09
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Clarify the Server-Sent Events handler docs: replace the previous signature port.send(eventType, data) with the single-argument port.send(event) and remove the explicit mapping notes for `event:` and `data:`. This is a documentation-only change to reduce confusion about the SSE send API; no functional code changes.
@Zuoqiu-Yingyi

Copy link
Copy Markdown
Contributor Author

@Vanessa219 已修复报告的问题

@Vanessa219
Vanessa219 merged commit 83fce54 into siyuan-note:main May 13, 2026
Vanessa219 added a commit that referenced this pull request May 13, 2026
@Vanessa219

Copy link
Copy Markdown
Member

#42

@Zuoqiu-Yingyi
Zuoqiu-Yingyi deleted the perf/improve-sse-sent branch May 13, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants