Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ode",
"version": "0.0.82",
"version": "0.0.83",
"description": "Coding anywhere with your coding agents connected",
"module": "packages/core/index.ts",
"type": "module",
Expand Down
20 changes: 1 addition & 19 deletions packages/agents/session-state/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,9 @@ export function extractSessionTitle(value: unknown): string | undefined {
return trimmed;
};

const normalizeSlug = (candidate: unknown): string | undefined => {
if (typeof candidate !== "string") return undefined;
const trimmed = candidate.trim();
if (!trimmed) return undefined;
if (trimmed.startsWith("new-session")) return undefined;
const spaced = trimmed.replace(/[-_]+/g, " ").trim();
if (!spaced) return undefined;
return spaced.replace(/\b\w/g, (char) => char.toUpperCase());
};

if (!value || typeof value !== "object") return undefined;

const queue: unknown[] = [value];
let firstSlug: string | undefined;

while (queue.length > 0) {
const current = queue.shift();
Expand All @@ -96,26 +85,19 @@ export function extractSessionTitle(value: unknown): string | undefined {
const directTitle = normalizeTitle(record.title);
if (directTitle) return directTitle;

if (!firstSlug) {
firstSlug = normalizeSlug(record.slug) ?? firstSlug;
}

const info = record.info;
if (info && typeof info === "object" && !Array.isArray(info)) {
const infoRecord = info as Record<string, unknown>;
const infoTitle = normalizeTitle(infoRecord.title);
if (infoTitle) return infoTitle;
if (!firstSlug) {
firstSlug = normalizeSlug(infoRecord.slug) ?? firstSlug;
}
}

for (const nested of Object.values(record)) {
if (nested && typeof nested === "object") queue.push(nested);
}
}

return firstSlug;
return undefined;
}

export function extractPrefixedRecord<TRecord>(
Expand Down
4 changes: 2 additions & 2 deletions packages/agents/test/session-inspector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe("session inspector", () => {
expect(preview).toContain("`Grep`");
});

it("falls back to session slug when OpenCode title is generic", () => {
it("ignores session slug when OpenCode title is generic", () => {
const startedAt = Date.now();
const state = buildSessionMessageState([
{
Expand All @@ -195,7 +195,7 @@ describe("session inspector", () => {
},
]);

expect(state.sessionTitle).toBe("Neon Harbor");
expect(state.sessionTitle).toBeUndefined();
});

it("prefers summarized title over sibling slug", () => {
Expand Down