mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 23:56:07 +00:00
refactor: stop inferring agent scope from transcript paths
This commit is contained in:
@@ -123,13 +123,7 @@ export async function rotateTranscriptFileAfterCompaction(params: {
|
||||
}
|
||||
|
||||
function resolveAgentIdFromTranscriptPath(transcriptPath: string): string {
|
||||
const resolved = path.resolve(transcriptPath);
|
||||
const sessionsDir = path.dirname(resolved);
|
||||
const agentDir = path.dirname(sessionsDir);
|
||||
const agentsDir = path.dirname(agentDir);
|
||||
if (path.basename(sessionsDir) === "sessions" && path.basename(agentsDir) === "agents") {
|
||||
return normalizeAgentId(path.basename(agentDir));
|
||||
}
|
||||
void transcriptPath;
|
||||
return DEFAULT_AGENT_ID;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
replaceSqliteSessionTranscriptEvents,
|
||||
resolveSqliteSessionTranscriptScopeForPath,
|
||||
} from "../../config/sessions/transcript-store.sqlite.js";
|
||||
import { DEFAULT_AGENT_ID, normalizeAgentId } from "../../routing/session-key.js";
|
||||
import { DEFAULT_AGENT_ID } from "../../routing/session-key.js";
|
||||
import type {
|
||||
FileEntry,
|
||||
SessionContext,
|
||||
@@ -56,13 +56,7 @@ function resolveDefaultSessionDir(cwd: string): string {
|
||||
}
|
||||
|
||||
function resolveAgentIdFromSessionPath(sessionFile: string): string {
|
||||
const resolved = path.resolve(sessionFile);
|
||||
const sessionsDir = path.dirname(resolved);
|
||||
const agentDir = path.dirname(sessionsDir);
|
||||
const agentsDir = path.dirname(agentDir);
|
||||
if (path.basename(sessionsDir) === "sessions" && path.basename(agentsDir) === "agents") {
|
||||
return normalizeAgentId(path.basename(agentDir));
|
||||
}
|
||||
void sessionFile;
|
||||
return DEFAULT_AGENT_ID;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
replaceSqliteSessionTranscriptEvents,
|
||||
resolveSqliteSessionTranscriptScopeForPath,
|
||||
} from "../../config/sessions/transcript-store.sqlite.js";
|
||||
import { DEFAULT_AGENT_ID, normalizeAgentId } from "../../routing/session-key.js";
|
||||
import { DEFAULT_AGENT_ID } from "../../routing/session-key.js";
|
||||
import type {
|
||||
FileEntry,
|
||||
SessionContext,
|
||||
@@ -49,13 +49,7 @@ function generateEntryId(byId: { has(id: string): boolean }): string {
|
||||
}
|
||||
|
||||
function resolveAgentIdFromTranscriptPath(sessionFile: string): string {
|
||||
const resolved = path.resolve(sessionFile);
|
||||
const sessionsDir = path.dirname(resolved);
|
||||
const agentDir = path.dirname(sessionsDir);
|
||||
const agentsDir = path.dirname(agentDir);
|
||||
if (path.basename(sessionsDir) === "sessions" && path.basename(agentsDir) === "agents") {
|
||||
return normalizeAgentId(path.basename(agentDir));
|
||||
}
|
||||
void sessionFile;
|
||||
return DEFAULT_AGENT_ID;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,13 +94,7 @@ export async function replayRecentUserAssistantMessages(params: {
|
||||
}
|
||||
|
||||
function resolveAgentIdFromSessionPath(sessionFile: string): string {
|
||||
const resolved = path.resolve(sessionFile);
|
||||
const sessionsDir = path.dirname(resolved);
|
||||
const agentDir = path.dirname(sessionsDir);
|
||||
const agentsDir = path.dirname(agentDir);
|
||||
if (path.basename(sessionsDir) === "sessions" && path.basename(agentsDir) === "agents") {
|
||||
return path.basename(agentDir);
|
||||
}
|
||||
void sessionFile;
|
||||
return DEFAULT_AGENT_ID;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user