refactor: remove session syncing metadata

This commit is contained in:
Peter Steinberger
2025-12-23 00:50:42 +01:00
parent c0c20ebf3e
commit ce04308c17
11 changed files with 1 additions and 175 deletions

View File

@@ -12,7 +12,6 @@ const mocks = vi.hoisted(() => ({
model: "pi:opus",
sessionId: "abc123",
systemSent: true,
syncing: true,
},
}),
resolveStorePath: vi.fn().mockReturnValue("/tmp/sessions.json"),
@@ -56,7 +55,6 @@ describe("statusCommand", () => {
expect(payload.sessions.recent[0].percentUsed).toBe(50);
expect(payload.sessions.recent[0].remainingTokens).toBe(5000);
expect(payload.sessions.recent[0].flags).toContain("verbose:on");
expect(payload.sessions.recent[0].flags).toContain("syncing");
});
it("prints formatted lines otherwise", async () => {

View File

@@ -29,7 +29,6 @@ export type SessionStatus = {
verboseLevel?: string;
systemSent?: boolean;
abortedLastRun?: boolean;
syncing?: boolean | string;
inputTokens?: number;
outputTokens?: number;
totalTokens: number | null;
@@ -101,7 +100,6 @@ export async function getStatusSummary(): Promise<StatusSummary> {
verboseLevel: entry?.verboseLevel,
systemSent: entry?.systemSent,
abortedLastRun: entry?.abortedLastRun,
syncing: entry?.syncing,
inputTokens: entry?.inputTokens,
outputTokens: entry?.outputTokens,
totalTokens: total ?? null,
@@ -178,10 +176,6 @@ const buildFlags = (entry: SessionEntry): string[] => {
flags.push(`verbose:${verbose}`);
if (entry?.systemSent) flags.push("system");
if (entry?.abortedLastRun) flags.push("aborted");
const syncing = entry?.syncing as unknown;
if (syncing === true || syncing === "on") flags.push("syncing");
else if (typeof syncing === "string" && syncing)
flags.push(`sync:${syncing}`);
const sessionId = entry?.sessionId as unknown;
if (typeof sessionId === "string" && sessionId.length > 0)
flags.push(`id:${sessionId}`);

View File

@@ -25,8 +25,6 @@ export type SessionEntry = {
contextTokens?: number;
lastChannel?: "whatsapp" | "telegram" | "webchat";
lastTo?: string;
// Optional flag to mirror Mac app UI and future sync states.
syncing?: boolean | string;
skillsSnapshot?: SessionSkillSnapshot;
};
@@ -134,7 +132,6 @@ export async function updateLastRoute(params: {
totalTokens: existing?.totalTokens,
model: existing?.model,
contextTokens: existing?.contextTokens,
syncing: existing?.syncing,
skillsSnapshot: existing?.skillsSnapshot,
lastChannel: channel,
lastTo: to?.trim() ? to.trim() : undefined,

View File

@@ -133,7 +133,6 @@ function resolveCronSession(params: {
contextTokens: entry?.contextTokens,
lastChannel: entry?.lastChannel,
lastTo: entry?.lastTo,
syncing: entry?.syncing,
};
return { storePath, store, sessionEntry, systemSent, isNewSession: !fresh };
}

View File

@@ -298,9 +298,6 @@ export const SessionsPatchParamsSchema = Type.Object(
Type.Null(),
]),
),
syncing: Type.Optional(
Type.Union([Type.Boolean(), NonEmptyString, Type.Null()]),
),
},
{ additionalProperties: false },
);

View File

@@ -3506,20 +3506,6 @@ describe("gateway server", () => {
expect(main2?.thinkingLevel).toBe("medium");
expect(main2?.verboseLevel).toBeUndefined();
const syncPatched = await rpcReq<{ ok: true; key: string }>(
ws,
"sessions.patch",
{ key: "main", syncing: true },
);
expect(syncPatched.ok).toBe(true);
const list3 = await rpcReq<{
sessions: Array<{ key: string; syncing?: boolean | string }>;
}>(ws, "sessions.list", {});
expect(list3.ok).toBe(true);
const main3 = list3.payload?.sessions.find((s) => s.key === "main");
expect(main3?.syncing).toBe(true);
const compacted = await rpcReq<{ ok: true; compacted: boolean }>(
ws,
"sessions.compact",

View File

@@ -364,7 +364,6 @@ type GatewaySessionRow = {
totalTokens?: number;
model?: string;
contextTokens?: number;
syncing?: boolean | string;
};
type SessionsListResult = {
@@ -843,7 +842,6 @@ function listSessionsFromStore(params: {
totalTokens: total,
model: entry?.model,
contextTokens: entry?.contextTokens,
syncing: entry?.syncing,
} satisfies GatewaySessionRow;
})
.sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0));
@@ -2014,15 +2012,6 @@ export async function startGatewayServer(
}
}
if ("syncing" in p) {
const raw = p.syncing;
if (raw === null) {
delete next.syncing;
} else if (raw !== undefined) {
next.syncing = raw as boolean | string;
}
}
store[key] = next;
await saveSessionStore(storePath, store);
const payload: SessionsPatchResult = {
@@ -2066,7 +2055,6 @@ export async function startGatewayServer(
abortedLastRun: false,
thinkingLevel: entry?.thinkingLevel,
verboseLevel: entry?.verboseLevel,
syncing: entry?.syncing,
model: entry?.model,
contextTokens: entry?.contextTokens,
lastChannel: entry?.lastChannel,
@@ -4321,15 +4309,6 @@ export async function startGatewayServer(
}
}
if ("syncing" in p) {
const raw = p.syncing;
if (raw === null) {
delete next.syncing;
} else if (raw !== undefined) {
next.syncing = raw as boolean | string;
}
}
store[key] = next;
await saveSessionStore(storePath, store);
const result: SessionsPatchResult = {
@@ -4374,7 +4353,6 @@ export async function startGatewayServer(
abortedLastRun: false,
thinkingLevel: entry?.thinkingLevel,
verboseLevel: entry?.verboseLevel,
syncing: entry?.syncing,
model: entry?.model,
contextTokens: entry?.contextTokens,
lastChannel: entry?.lastChannel,