@neeter/server
Advanced tools
+15
-0
@@ -15,2 +15,3 @@ import { Hono } from "hono"; | ||
| "custom", | ||
| "checkpoint", | ||
| ]); | ||
@@ -141,2 +142,16 @@ /** | ||
| }); | ||
| app.post(`${basePath}/sessions/:id/rewind`, async (c) => { | ||
| const session = sessions.get(c.req.param("id")); | ||
| if (!session) | ||
| return c.json({ error: "Session not found" }, 404); | ||
| const body = await c.req.json(); | ||
| if (!body.userMessageId?.trim()) { | ||
| return c.json({ error: "userMessageId is required" }, 400); | ||
| } | ||
| const result = await session.messageIterator.rewindFiles(body.userMessageId.trim(), { | ||
| dryRun: body.dryRun, | ||
| }); | ||
| session.lastActivityAt = Date.now(); | ||
| return c.json(result); | ||
| }); | ||
| app.post(`${basePath}/sessions/:id/abort`, (c) => { | ||
@@ -143,0 +158,0 @@ const session = sessions.get(c.req.param("id")); |
@@ -1,5 +0,4 @@ | ||
| import { type HookCallbackMatcher, type HookEvent, type McpServerConfig, query } from "@anthropic-ai/claude-agent-sdk"; | ||
| import { type HookCallbackMatcher, type HookEvent, type McpServerConfig, type Query } from "@anthropic-ai/claude-agent-sdk"; | ||
| import type { SessionHistoryEntry, SessionStore, SSEEvent } from "@neeter/types"; | ||
| import { PermissionGate } from "./permission-gate.js"; | ||
| type SDKMessage = ReturnType<typeof query> extends AsyncGenerator<infer T> ? T : never; | ||
| /** Configuration returned by the `SessionManager` factory for each new session. */ | ||
@@ -40,2 +39,4 @@ export interface SessionInit<TCtx> { | ||
| env?: Record<string, string | undefined>; | ||
| /** Track file changes and enable rewinding to previous states. Off by default. */ | ||
| enableFileCheckpointing?: boolean; | ||
| } | ||
@@ -53,3 +54,3 @@ export interface ResumeOptions { | ||
| pushMessage(text: string): void; | ||
| messageIterator: AsyncIterable<SDKMessage>; | ||
| messageIterator: Query; | ||
| permissionGate: PermissionGate; | ||
@@ -90,2 +91,1 @@ abort(): void; | ||
| } | ||
| export {}; |
+12
-2
@@ -160,4 +160,14 @@ import { query, } from "@anthropic-ai/claude-agent-sdk"; | ||
| ...(init.hooks ? { hooks: init.hooks } : {}), | ||
| ...(init.extraArgs ? { extraArgs: init.extraArgs } : {}), | ||
| ...(init.env ? { env: init.env } : {}), | ||
| ...(init.enableFileCheckpointing ? { enableFileCheckpointing: true } : {}), | ||
| extraArgs: { | ||
| ...(init.enableFileCheckpointing ? { "replay-user-messages": null } : {}), | ||
| ...init.extraArgs, | ||
| }, | ||
| env: { | ||
| ...process.env, | ||
| ...(init.enableFileCheckpointing | ||
| ? { CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING: "1" } | ||
| : {}), | ||
| ...init.env, | ||
| }, | ||
| ...extraQueryOptions, | ||
@@ -164,0 +174,0 @@ }, |
@@ -136,2 +136,9 @@ import { PushChannel } from "./push-channel.js"; | ||
| case "user": { | ||
| const uuid = message.uuid; | ||
| if (uuid) { | ||
| events.push({ | ||
| event: "checkpoint", | ||
| data: JSON.stringify({ userMessageUuid: uuid }), | ||
| }); | ||
| } | ||
| const msg = message.message; | ||
@@ -138,0 +145,0 @@ if (Array.isArray(msg?.content)) { |
+2
-2
| { | ||
| "name": "@neeter/server", | ||
| "version": "0.10.11", | ||
| "version": "0.11.0", | ||
| "description": "Hono server toolkit for building chat UIs on top of the Claude Agent SDK", | ||
@@ -24,3 +24,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@neeter/types": "0.10.11" | ||
| "@neeter/types": "0.11.0" | ||
| }, | ||
@@ -27,0 +27,0 @@ "peerDependencies": { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
46952
2.86%1057
3.12%3
50%+ Added
- Removed
Updated