Enable distribution of Pi session data across a network (including p2p) by content-addressing session files without modifying Pi itself.
| name | description | context | agent |
|---|---|---|---|
sr-eng-review |
Review git branch using diff against main. Always use this skill after you complete a unit of work, or complete a major step in a plan. |
fork |
general-purpose |
You are a Senior Software Engineer with 15+ years of experience conducting thorough code reviews. You have deep expertise in TypeScript, functional programming paradigms, and modern web development practices. Your reviews are known for being comprehensive yet constructive, catching subtle bugs while also mentoring developers toward better practices.
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
| /** | |
| * SQLite-backed event queue for inter-worker communication. | |
| * | |
| * Provides a simple pub/sub mechanism where workers can push events and poll | |
| * for new events using cursor-based pagination. Each worker maintains its own | |
| * cursor position, enabling reliable at-least-once delivery. | |
| * | |
| * @module event-queue | |
| */ |
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
| export type RouteHandler = (context: URLPatternResult) => void; | |
| export type Cancel = () => void; | |
| type Matcher = (route: string) => URLPatternResult | undefined; | |
| const matcher = (pathname: string, baseUrl?: string): Matcher => { | |
| const pattern = new URLPattern({ pathname, baseURL: baseUrl }); | |
| return (route: string) => pattern.exec(route) ?? undefined; | |
| }; |
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
| import { type Receive, type Send, useMailbox } from "./mailbox.ts"; | |
| export type Context<Msg> = { | |
| self: string; | |
| send: (id: string, msg: Msg) => Promise<void>; | |
| receive: Receive<Msg>; | |
| spawn: (id: string, actor: Actor<Msg>) => string; | |
| }; | |
| export type Actor<Msg> = (context: Context<Msg>) => Promise<void>; |
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
| #[macro_export] | |
| macro_rules! pipe { | |
| // Base case - single function | |
| ($value:expr, $func:expr) => { | |
| $func($value) | |
| }; | |
| // Recursive case - multiple functions | |
| ($value:expr, $func:expr, $($rest:expr),+) => { | |
| pipe!($func($value), $($rest),+) |
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
| import { strict as assert } from "assert"; | |
| import { createMiddleware, Msg } from "./middleware.js"; | |
| describe("createMiddleware", () => { | |
| it("should create middleware with empty initial state", () => { | |
| const middleware = createMiddleware(); | |
| assert.deepEqual(middleware("test"), "test"); | |
| }); | |
| it("should execute single middleware", () => { |
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
| let slowAnimations = false; | |
| /** Set slow animations for debugging */ | |
| export const setSlowAnimations = (isSlow: boolean) => { | |
| slowAnimations = isSlow; | |
| }; | |
| /** @returns 10s if slow animations is turned on, otherwise returns `ms` */ | |
| export const slowable = (ms: number) => (slowAnimations ? 10000 : ms); |
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
| export const multidispatch = <T>() => { | |
| const routes = new Map< | |
| (...args: unknown[]) => boolean, | |
| (...args: unknown[]) => T | |
| >(); | |
| const call = (...args: unknown[]) => { | |
| for (const [isMatch, handler] of routes.entries()) { | |
| if (isMatch(...args)) { | |
| return handler(...args); |
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
| // Set key on object, but only if value has changed. | |
| // This is useful when setting keys on DOM elements, where setting the same | |
| // value may trigger a style recalc. | |
| // | |
| // Note that the typical layout-triggering DOM properties are read-only, | |
| // so this is safe to use to write to DOM element properties. | |
| // See https://gist.github.com/paulirish/5d52fb081b3570c81e3a. | |
| export const prop = (object, key, value) => { | |
| if (object[key] !== value) { | |
| object[key] = value |
NewerOlder