feat(chats): add managed projectless chat sessions
Create projectless chat sessions under a managed, date-scoped Chats directory and clean abandoned or deleted session folders. Add Chats to sidebar state, startup cache, shared context, and Electron Mini Chat while keeping VS Code project-only. Resolve managed chat directories to one server-side memory owner and document the runtime contracts.
This commit is contained in:
@@ -1,7 +1,29 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import type { OpencodeClient } from '@opencode-ai/sdk/v2'
|
||||
import type { OpencodeClient, Session } from '@opencode-ai/sdk/v2'
|
||||
|
||||
import { listGlobalSessionPages, splitGlobalSessionsByArchived } from './globalSessions'
|
||||
import { filterManagedChatsForRuntime, listGlobalSessionPages, splitGlobalSessionsByArchived } from './globalSessions'
|
||||
|
||||
describe('managed Chats runtime visibility', () => {
|
||||
const session = (id: string, directory: string): Session => ({
|
||||
id,
|
||||
slug: id,
|
||||
projectID: 'project',
|
||||
directory,
|
||||
title: id,
|
||||
version: '1',
|
||||
time: { created: 1, updated: 1 },
|
||||
})
|
||||
const chat = session('chat', '/home/user/.config/openchamber/chats/2026-08-21/session-a')
|
||||
const project = session('project', '/workspace/project')
|
||||
|
||||
test('VS Code rejects managed Chats before they enter global state', () => {
|
||||
expect(filterManagedChatsForRuntime([chat, project], true)).toEqual([project])
|
||||
})
|
||||
|
||||
test('other runtimes retain managed Chats', () => {
|
||||
expect(filterManagedChatsForRuntime([chat, project], false)).toEqual([chat, project])
|
||||
})
|
||||
})
|
||||
|
||||
describe('listGlobalSessionPages', () => {
|
||||
test('sanitizes session list records before returning them', async () => {
|
||||
|
||||
Reference in New Issue
Block a user