Skip to content

Adds kairos#298

Merged
ringabout merged 4 commits intoplanety:develfrom
jmgomez:kairos
Apr 1, 2026
Merged

Adds kairos#298
ringabout merged 4 commits intoplanety:develfrom
jmgomez:kairos

Conversation

@jmgomez
Copy link
Copy Markdown
Contributor

@jmgomez jmgomez commented Mar 31, 2026

fixes #247

This PR adds support to chronos via Kairos (https://github.com/jmgomez/kairos). User can toggle it by using nimble features or asyncBackend nim convention

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 introduces an async-backend switch in Prologue to enable a chronos-based runtime via the Kairos HTTP server, selectable through a Nimble feature or a compiler define. It updates core modules to import a new asyncbackend shim instead of asyncdispatch directly, and adds documentation plus example/benchmark files.

Changes:

  • Add src/prologue/core/asyncbackend.nim to centralize switching between asyncdispatch + httpx (default) and chronos (Kairos mode).
  • Update core/middleware/OpenAPI/websocket modules to import asyncbackend and conditionally use Kairos-specific modules/types where needed.
  • Document the chronos/Kairos backend in the README and add new kairos-oriented examples/benchmarks.

Reviewed changes

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

Show a summary per file
File Description
tests/compile/test_readme/example_kairos.nim Adds a Kairos-oriented “hello world” compile example.
tests/compile/test_readme/example_kairos_middleware.nim Adds a Kairos-oriented middleware compile example.
tests/benchmark/b_logue_async.nim Adds an asyncdispatch-based async benchmark for Prologue.
tests/benchmark/b_kairos.nim Adds a (named) Kairos benchmark using Prologue app setup.
tests/benchmark/b_kairos_async.nim Adds a chronos-based async benchmark variant.
src/prologue/websocket/websocket.nim Switch websocket implementation between Kairos ws and websocketx.
src/prologue/openapi/openapi.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/utils.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/staticfilevirtualpath.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/staticfile.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/sessions/signedcookiesession.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/sessions/redissession.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/sessions/memorysession.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/csrf.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/cors.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/clickjacking.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/middlewares/auth.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/core/middlewaresbase.nim Import asyncbackend instead of asyncdispatch.
src/prologue/core/context.nim Add backend-conditioned asyncfile import and relax raises for Kairos mode.
src/prologue/core/beast/server.nim Add Kairos/httpx settings switch; adjust serving implementation.
src/prologue/core/beast/request.nim Switch NativeRequest type between Kairos and httpx; small API tweak.
src/prologue/core/asyncbackend.nim New module implementing backend selection and re-exports.
src/prologue/core/async/sync.nim Replace direct asyncdispatch import with asyncbackend.
src/prologue/core/application.nim Re-export asyncbackend and adjust logging calls/async run setup.
README.md Document enabling chronos via the Kairos feature/define.
prologue.nimble Add optional kairos feature dependency.

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

Comment thread src/prologue/core/beast/server.nim
Comment thread src/prologue/core/asyncbackend.nim
Comment thread prologue.nimble
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 5 comments.


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

Comment thread src/prologue/core/beast/server.nim
Comment thread src/prologue/core/application.nim Outdated
Comment thread src/prologue/core/asyncbackend.nim Outdated
Comment thread tests/compile/test_readme/example_kairos.nim
Comment thread tests/compile/test_readme/example_kairos_middleware.nim
ringabout and others added 2 commits April 1, 2026 08:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ringabout ringabout merged commit dd053b3 into planety:devel Apr 1, 2026
2 checks passed
@ringabout
Copy link
Copy Markdown
Member

Excellent work!

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.

Chronos support

3 participants