45bfae6e94
Initial import of all source code, config, and README assets: the packages workspace (cli, core, server, web, docs, landing, skills), build scripts, tooling config, and CI workflows. Includes the data-layout revision made on this branch: the local data root defaults to ~/.penguin/data (PENGUIN_HOME still overrides; the installer keeps its binaries in ~/.penguin), and every Agent lives under <project>/agents/<agent>/ — path helpers, the three agent-enumeration scans, the system prompt, built-in Skills, tests and docs all follow the new layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ihk8iQuo3kv2aPjAYEPuR
25 lines
790 B
TypeScript
25 lines
790 B
TypeScript
/**
|
|
* User-level server event stream: GET /api/events (SSE user channel).
|
|
* Carries cross-Session notifications (reserved for automated tasks); sends a `hello` handshake event on connect.
|
|
*/
|
|
import { Hono } from "hono";
|
|
import type { AppEnv } from "../../auth/middleware.js";
|
|
import { sseEndpoint } from "../sse.js";
|
|
import type { AppDeps } from "../../app.js";
|
|
|
|
/** The user channel's key in ChannelHub. */
|
|
export function userChannelKey(userId: string): string {
|
|
return `user:${userId}`;
|
|
}
|
|
|
|
export function eventsRoutes(deps: AppDeps): Hono<AppEnv> {
|
|
const app = new Hono<AppEnv>();
|
|
|
|
app.get("/", (c) => {
|
|
const channel = deps.channels.get(userChannelKey(c.var.user.userId));
|
|
return sseEndpoint(c, channel, { initialEvents: [{ type: "hello" }] });
|
|
});
|
|
|
|
return app;
|
|
}
|