fix: bump pi deps and fix lint

This commit is contained in:
Peter Steinberger
2025-12-22 20:45:22 +00:00
parent 469c8a1a4b
commit 9717f2d374
14 changed files with 812 additions and 757 deletions

View File

@@ -71,12 +71,12 @@ import {
type ResponseFrame,
ResponseFrameSchema,
SendParamsSchema,
type SessionsListParams,
SessionsListParamsSchema,
type SessionsCompactParams,
SessionsCompactParamsSchema,
type SessionsDeleteParams,
SessionsDeleteParamsSchema,
type SessionsListParams,
SessionsListParamsSchema,
type SessionsPatchParams,
SessionsPatchParamsSchema,
type SessionsResetParams,

View File

@@ -292,7 +292,11 @@ export const SessionsPatchParamsSchema = Type.Object(
thinkingLevel: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
verboseLevel: Type.Optional(Type.Union([NonEmptyString, Type.Null()])),
groupActivation: Type.Optional(
Type.Union([Type.Literal("mention"), Type.Literal("always"), Type.Null()]),
Type.Union([
Type.Literal("mention"),
Type.Literal("always"),
Type.Null(),
]),
),
syncing: Type.Optional(
Type.Union([Type.Boolean(), NonEmptyString, Type.Null()]),

View File

@@ -3390,14 +3390,16 @@ describe("gateway server", () => {
await fs.writeFile(
path.join(dir, "sess-main.jsonl"),
Array.from({ length: 10 })
.map((_, idx) => JSON.stringify({ role: "user", content: `line ${idx}` }))
.join("\n") + "\n",
`${Array.from({ length: 10 })
.map((_, idx) =>
JSON.stringify({ role: "user", content: `line ${idx}` }),
)
.join("\n")}\n`,
"utf-8",
);
await fs.writeFile(
path.join(dir, "sess-group.jsonl"),
JSON.stringify({ role: "user", content: "group line 0" }) + "\n",
`${JSON.stringify({ role: "user", content: "group line 0" })}\n`,
"utf-8",
);
@@ -3532,8 +3534,9 @@ describe("gateway server", () => {
.filter((l) => l.trim().length > 0);
expect(compactedLines).toHaveLength(3);
const filesAfterCompact = await fs.readdir(dir);
expect(filesAfterCompact.some((f) => f.startsWith("sess-main.jsonl.bak.")))
.toBe(true);
expect(
filesAfterCompact.some((f) => f.startsWith("sess-main.jsonl.bak.")),
).toBe(true);
const deleted = await rpcReq<{ ok: true; deleted: boolean }>(
ws,
@@ -3546,17 +3549,19 @@ describe("gateway server", () => {
sessions: Array<{ key: string }>;
}>(ws, "sessions.list", {});
expect(listAfterDelete.ok).toBe(true);
expect(listAfterDelete.payload?.sessions.some((s) => s.key === "group:dev"))
.toBe(false);
expect(
listAfterDelete.payload?.sessions.some((s) => s.key === "group:dev"),
).toBe(false);
const filesAfterDelete = await fs.readdir(dir);
expect(filesAfterDelete.some((f) => f.startsWith("sess-group.jsonl.deleted.")))
.toBe(true);
expect(
filesAfterDelete.some((f) => f.startsWith("sess-group.jsonl.deleted.")),
).toBe(true);
const reset = await rpcReq<{ ok: true; key: string; entry: { sessionId: string } }>(
ws,
"sessions.reset",
{ key: "main" },
);
const reset = await rpcReq<{
ok: true;
key: string;
entry: { sessionId: string };
}>(ws, "sessions.reset", { key: "main" });
expect(reset.ok).toBe(true);
expect(reset.payload?.key).toBe("main");
expect(reset.payload?.entry.sessionId).not.toBe("sess-main");

View File

@@ -271,9 +271,9 @@ import {
formatValidationErrors,
PROTOCOL_VERSION,
type RequestFrame,
type SessionsListParams,
type SessionsCompactParams,
type SessionsDeleteParams,
type SessionsListParams,
type SessionsPatchParams,
type SessionsResetParams,
type Snapshot,
@@ -303,9 +303,9 @@ import {
validateProvidersStatusParams,
validateRequestFrame,
validateSendParams,
validateSessionsListParams,
validateSessionsCompactParams,
validateSessionsDeleteParams,
validateSessionsListParams,
validateSessionsPatchParams,
validateSessionsResetParams,
validateSkillsInstallParams,
@@ -718,7 +718,6 @@ function readSessionMessages(
if (!line.trim()) continue;
try {
const parsed = JSON.parse(line);
// pi/tau logs either raw message or wrapper { message }
if (parsed?.message) {
messages.push(parsed.message);
} else if (parsed?.role && parsed?.content) {
@@ -2183,8 +2182,10 @@ export async function startGatewayServer(
};
}
const filePath = resolveSessionTranscriptCandidates(sessionId, storePath)
.find((candidate) => fs.existsSync(candidate));
const filePath = resolveSessionTranscriptCandidates(
sessionId,
storePath,
).find((candidate) => fs.existsSync(candidate));
if (!filePath) {
return {
ok: true,