From fb0f0f7cd5fd18afb98abef133174d59c27ac4e5 Mon Sep 17 00:00:00 2001 From: Cristina Poncela Cubeiro <140309543+cristinaponcela@users.noreply.github.com> Date: Fri, 31 Jul 2026 05:19:23 +0200 Subject: [PATCH] rename: vars --- .../agent/src/harness/session/memory-repo.ts | 2 +- .../agent/src/harness/session/repo-utils.ts | 10 ++++----- packages/agent/test/harness/repo.test.ts | 14 ++++++------ .../test/harness/sqlite-migrations.test.ts | 22 +++++++++---------- .../agent/test/harness/sqlite-node.test.ts | 12 +++++----- scripts/browser-smoke-entry.ts | 6 ++--- 6 files changed, 32 insertions(+), 34 deletions(-) diff --git a/packages/agent/src/harness/session/memory-repo.ts b/packages/agent/src/harness/session/memory-repo.ts index cdea7ae21..b6f4c8ce8 100644 --- a/packages/agent/src/harness/session/memory-repo.ts +++ b/packages/agent/src/harness/session/memory-repo.ts @@ -11,7 +11,7 @@ import { import { InMemorySessionStorage } from "./memory-storage.ts"; import { createSessionId, createTimestamp, getEntriesToFork } from "./repo-utils.ts"; -export class MemorySessionStore implements SessionStore { +export class InMemorySessionStore implements SessionStore { private sessions = new Map>(); async create(options: { id?: string } = {}): Promise { diff --git a/packages/agent/src/harness/session/repo-utils.ts b/packages/agent/src/harness/session/repo-utils.ts index 0d38dda68..310f8c6ca 100644 --- a/packages/agent/src/harness/session/repo-utils.ts +++ b/packages/agent/src/harness/session/repo-utils.ts @@ -52,7 +52,7 @@ export function after( }; } -export class SessionRepository< +export class SessionRepo< TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends SessionCreateOptions = SessionCreateOptions, TListOptions = void, @@ -94,19 +94,17 @@ export class SessionRepository< } } -export function createSessionRepository< +export function createSessionRepo< TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends SessionCreateOptions = SessionCreateOptions, TListOptions = void, >(options: { store: SessionStore; search?: SessionSearch | null; -}): SessionRepository { - return new SessionRepository(options); +}): SessionRepo { + return new SessionRepo(options); } -export { SessionRepository as SessionRepo }; - export function findSessionEntryMatches( metadata: TMetadata, entries: SessionTreeEntry[], diff --git a/packages/agent/test/harness/repo.test.ts b/packages/agent/test/harness/repo.test.ts index 22ac198e7..f1323c912 100644 --- a/packages/agent/test/harness/repo.test.ts +++ b/packages/agent/test/harness/repo.test.ts @@ -2,13 +2,13 @@ import { existsSync } from "node:fs"; import { describe, expect, it } from "vitest"; import { NodeExecutionEnv } from "../../src/harness/env/nodejs.ts"; import { JsonlSessionStore } from "../../src/harness/session/jsonl-repo.ts"; -import { MemorySessionStore } from "../../src/harness/session/memory-repo.ts"; -import { SessionRepository } from "../../src/harness/session/repo-utils.ts"; +import { InMemorySessionStore } from "../../src/harness/session/memory-repo.ts"; +import { SessionRepo } from "../../src/harness/session/repo-utils.ts"; import { createAssistantMessage, createTempDir, createUserMessage } from "./session-test-utils.ts"; -describe("MemorySessionStore", () => { +describe("InMemorySessionStore", () => { it("opens, deletes, and forks by metadata", async () => { - const repo = new SessionRepository({ store: new MemorySessionStore() }); + const repo = new SessionRepo({ store: new InMemorySessionStore() }); const session = await repo.create({ id: "session-1" }); const metadata = await session.getMetadata(); const user1 = await session.appendMessage(createUserMessage("one")); @@ -31,7 +31,7 @@ describe("JsonlSessionStore", () => { const env = new NodeExecutionEnv({ cwd: root }); const cwd = "/tmp/my-project"; const otherCwd = "/tmp/other-project"; - const repo = new SessionRepository({ store: new JsonlSessionStore({ fs: env, sessionsRoot: root }) }); + const repo = new SessionRepo({ store: new JsonlSessionStore({ fs: env, sessionsRoot: root }) }); const session = await repo.create({ cwd, id: "019de8c2-de29-73e9-ae0c-e134db34c447" }); const otherSession = await repo.create({ cwd: otherCwd, id: "other-session" }); const metadata = await session.getMetadata(); @@ -48,7 +48,7 @@ describe("JsonlSessionStore", () => { it("opens, deletes, and forks by metadata", async () => { const root = createTempDir(); const env = new NodeExecutionEnv({ cwd: root }); - const repo = new SessionRepository({ store: new JsonlSessionStore({ fs: env, sessionsRoot: root }) }); + const repo = new SessionRepo({ store: new JsonlSessionStore({ fs: env, sessionsRoot: root }) }); const source = await repo.create({ cwd: "/tmp/source", id: "source-session" }); const sourceMetadata = await source.getMetadata(); const user1 = await source.appendMessage(createUserMessage("one")); @@ -70,7 +70,7 @@ describe("JsonlSessionStore", () => { it("persists header metadata through create, list, and fork", async () => { const root = createTempDir(); const env = new NodeExecutionEnv({ cwd: root }); - const repo = new SessionRepository({ store: new JsonlSessionStore({ fs: env, sessionsRoot: root }) }); + const repo = new SessionRepo({ store: new JsonlSessionStore({ fs: env, sessionsRoot: root }) }); const source = await repo.create({ cwd: "/tmp/source", id: "source-session", diff --git a/packages/agent/test/harness/sqlite-migrations.test.ts b/packages/agent/test/harness/sqlite-migrations.test.ts index 5cf612eae..e072a1468 100644 --- a/packages/agent/test/harness/sqlite-migrations.test.ts +++ b/packages/agent/test/harness/sqlite-migrations.test.ts @@ -14,7 +14,7 @@ import { type SqliteStatement, } from "../../../storage/sqlite-node/src/index.ts"; import { NodeExecutionEnv } from "../../src/harness/env/nodejs.ts"; -import { SessionRepository } from "../../src/harness/session/repo-utils.ts"; +import { SessionRepo } from "../../src/harness/session/repo-utils.ts"; import { createAssistantMessage, createUserMessage } from "./session-test-utils.ts"; function createTempDir(): string { @@ -70,7 +70,7 @@ describe("SQLite migrations", () => { const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); const sqlite = createNodeSqliteFactory(); - const repo = new SessionRepository({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); await repo.create({ cwd: root, id: "session-1" }); const db = await sqlite.open(databasePath); @@ -112,7 +112,7 @@ describe("SQLite migrations", () => { const root = createTempDir(); const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite: createNodeSqliteFactory(), databasePath }), }); const source = await repo.create({ @@ -139,7 +139,7 @@ describe("SQLite migrations", () => { const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); const sqlite = createNodeSqliteFactory(); - const repo = new SessionRepository({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); const session = await repo.create({ cwd: root, id: "session-1" }); const rootId = await session.appendMessage(createUserMessage("root")); const childId = await session.appendMessage(createAssistantMessage("child")); @@ -175,7 +175,7 @@ describe("SQLite migrations", () => { const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); const sqlite = createNodeSqliteFactory(); - const repo = new SessionRepository({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); const session = await repo.create({ cwd: root, id: "session-1" }); const rootId = await session.appendMessage(createUserMessage("root")); const firstChildId = await session.appendMessage(createAssistantMessage("first child")); @@ -203,7 +203,7 @@ describe("SQLite migrations", () => { const root = createTempDir(); const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite: createNodeSqliteFactory(), databasePath }), }); const session = await repo.create({ cwd: root, id: "session-1" }); @@ -225,7 +225,7 @@ describe("SQLite migrations", () => { const root = createTempDir(); const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite: createNodeSqliteFactory(), databasePath }), }); const session = await repo.create({ cwd: root, id: "session-1" }); @@ -254,7 +254,7 @@ describe("SQLite migrations", () => { open: async () => db, }; const env = new NodeExecutionEnv({ cwd: root }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite, databasePath: join(root, "sessions.sqlite") }), }); @@ -274,7 +274,7 @@ describe("SQLite migrations", () => { open: async () => db, }; const env = new NodeExecutionEnv({ cwd: root }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite, databasePath: join(root, "sessions.sqlite") }), }); const metadata: SqliteSessionMetadata = { @@ -294,7 +294,7 @@ describe("SQLite migrations", () => { const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); const storage = new SqliteSessionStore({ env, sqlite: createNodeSqliteFactory(), databasePath }); - const repo = new SessionRepository({ store: storage }); + const repo = new SessionRepo({ store: storage }); let cleanupCount = 0; const sourceStorage = { async getEntries() { @@ -367,7 +367,7 @@ describe("SQLite migrations", () => { const databasePath = join(root, "sessions.sqlite"); const env = new NodeExecutionEnv({ cwd: root }); const sqlite = createNodeSqliteFactory(); - const repo = new SessionRepository({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); + const repo = new SessionRepo({ store: new SqliteSessionStore({ env, sqlite, databasePath }) }); const session = await repo.create({ cwd: root, id: "session-1" }); const userId = await session.appendMessage(createUserMessage("one")); await session.appendThinkingLevelChange("high"); diff --git a/packages/agent/test/harness/sqlite-node.test.ts b/packages/agent/test/harness/sqlite-node.test.ts index d99a02f25..f24951d94 100644 --- a/packages/agent/test/harness/sqlite-node.test.ts +++ b/packages/agent/test/harness/sqlite-node.test.ts @@ -8,7 +8,7 @@ import { } from "../../../storage/sqlite-node/src/index.ts"; import { NodeExecutionEnv } from "../../src/harness/env/nodejs.ts"; import { JsonlSessionStore } from "../../src/harness/session/jsonl-repo.ts"; -import { SessionRepository } from "../../src/harness/session/repo-utils.ts"; +import { SessionRepo } from "../../src/harness/session/repo-utils.ts"; import { ScanningSessionSearch } from "../../src/harness/session/search-backend.ts"; import { IndexedSessionStore } from "../../src/harness/session/search-index.ts"; import type { @@ -26,7 +26,7 @@ describe("JsonlSessionStore with scanning search", () => { const root = createTempDir(); const env = new NodeExecutionEnv({ cwd: root }); const store = new JsonlSessionStore({ fs: env, sessionsRoot: join(root, "sessions") }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store, search: new ScanningSessionSearch(store), }); @@ -48,7 +48,7 @@ describe("SqliteSessionStore with explicit SQLite FTS5 search", () => { const sqlite = createNodeSqliteFactory(); const databasePath = join(root, "sessions.sqlite"); const search = new SqliteSessionSearch({ env, sqlite, databasePath }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new IndexedSessionStore({ store: new SqliteSessionStore({ env, sqlite, databasePath }), index: search, @@ -96,7 +96,7 @@ describe("JsonlSessionStore with SQLite search index", () => { sqlite, databasePath: join(root, "search.sqlite"), }); - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new IndexedSessionStore({ store: new JsonlSessionStore({ fs: env, sessionsRoot: join(root, "sessions") }), index: search, @@ -141,7 +141,7 @@ describe("JsonlSessionStore with multiple search indexes", () => { await secondary.deleteSession(metadata); }, }; - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new IndexedSessionStore({ store: new JsonlSessionStore({ fs: env, sessionsRoot: join(root, "sessions") }), index, @@ -183,7 +183,7 @@ describe("SqliteSessionStore with custom search", () => { return []; }, }; - const repo = new SessionRepository({ + const repo = new SessionRepo({ store: new IndexedSessionStore({ store: new SqliteSessionStore({ env: new NodeExecutionEnv({ cwd: root }), diff --git a/scripts/browser-smoke-entry.ts b/scripts/browser-smoke-entry.ts index 32176ce75..66ac4baa4 100644 --- a/scripts/browser-smoke-entry.ts +++ b/scripts/browser-smoke-entry.ts @@ -10,10 +10,10 @@ import { formatSkillInvocation, formatSkillsForSystemPrompt, getOrThrow, - MemorySessionStore, + InMemorySessionStore, ok, parseCommandArgs, - SessionRepository, + SessionRepo, streamProxy, toError, truncateHead, @@ -27,7 +27,7 @@ const stream = createAssistantMessageEventStream(); const agent = new Agent({ initialState: { model }, streamFn: streamSimple }); agent.steer({ role: "user", content: [{ type: "text", text: "queued" }], timestamp: 0 }); -const repo = new SessionRepository({ store: new MemorySessionStore() }); +const repo = new SessionRepo({ store: new InMemorySessionStore() }); const result = getOrThrow(ok({ value: 1 })); const customMessage = createCustomMessage("note", "hello", true, undefined, "2026-01-01T00:00:00.000Z"); const llmMessages = convertToLlm([customMessage]);