feat(sidechat): 侧边对话——每对话一 Tab(Codex 对齐)+ 完整上下文继承 + 保存为新会话 (#286)
三轮实测驱动迭代:种子信封透传(surfaceOp 校验)、每线程一 Tab 交互重做完、四连修(fork 丢 this / 自绘 history+save 图标 / collectOwnEvents 大页回源修重开丢工具行 / descriptor 入种子修目录 corrupt 行 + 前缀过滤保拓扑零噪音)。739 单测 + 挂载冒烟 12/12 全绿。
This commit is contained in:
1 parent
50a888845f
commit
7f4f84c4cf
27 files changed
+3501
-13
No files matched your search
+32
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Built-in registration tests: the plugin registers 6 tabs and 6 file
|
||||
* Built-in registration tests: the plugin registers 7 tabs and 6 file
|
||||
* viewers through the same service external plugins use (dogfooding);
|
||||
* the catch-all `code` viewer, the NUL-sniffing `binary-download` viewer,
|
||||
* and the html sandbox settings pin the registry's behavior. (Office
|
||||
@@ -16,6 +16,7 @@ import { createSidebarStore } from '../src/client/state.ts'
|
||||
import { allLeaves } from '../src/client/state.ts'
|
||||
import { registerBuiltins } from '../src/client/builtins/index.ts'
|
||||
import type { BuiltinTabOptions } from '../src/client/builtins/tabs.tsx'
|
||||
import { parkSidechatReopen } from '../src/client/SideChatView.tsx'
|
||||
import { t } from '../src/client/locales.ts'
|
||||
|
||||
function setup(options: BuiltinTabOptions = {}): { service: ReturnType<typeof createBetterSidebarService>; store: ReturnType<typeof createSidebarStore>; dispose: () => void } {
|
||||
@@ -26,10 +27,10 @@ function setup(options: BuiltinTabOptions = {}): { service: ReturnType<typeof cr
|
||||
}
|
||||
|
||||
describe('built-in tab registrations', () => {
|
||||
it('registers the 6 built-in tabs', () => {
|
||||
it('registers the 7 built-in tabs', () => {
|
||||
const { service } = setup()
|
||||
expect(service.getTabs().map(t => t.id).sort()).toEqual(
|
||||
['browser', 'diff', 'editor', 'git', 'subagent', 'terminal'],
|
||||
['browser', 'diff', 'editor', 'git', 'sidechat', 'subagent', 'terminal'],
|
||||
)
|
||||
})
|
||||
|
||||
@@ -48,6 +49,34 @@ describe('built-in tab registrations', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('the side chat tab sits between tasks and terminal in the + menu', () => {
|
||||
const { service } = setup()
|
||||
const sidechat = service.getTab('sidechat')
|
||||
expect(sidechat?.order).toBe(35)
|
||||
expect(sidechat?.hidden).not.toBe(true)
|
||||
})
|
||||
|
||||
it('side chat mints one tab per thread (Codex-style multi-instance)', () => {
|
||||
const { service } = setup()
|
||||
const sidechat = service.getTab('sidechat')
|
||||
expect(sidechat?.single).not.toBe(true)
|
||||
// A plain open mints a fresh autoCreate tab (the view creates the
|
||||
// thread on mount); two opens never collide. (createTab ignores the
|
||||
// state argument for sidechat — the cast stands in for it.)
|
||||
const first = sidechat?.createTab?.(undefined as never)
|
||||
const second = sidechat?.createTab?.(undefined as never)
|
||||
expect(first?.tab.meta).toEqual({ autoCreate: true })
|
||||
expect(first?.tab.id).not.toBe(second?.tab.id)
|
||||
// A parked reopen target mints the deterministic reattach tab, and
|
||||
// dedupeKey focuses an already-open thread instead of duplicating it.
|
||||
parkSidechatReopen('session-t1')
|
||||
const reopen = sidechat?.createTab?.(undefined as never)
|
||||
expect(reopen?.tab.id).toBe('sidechat:session-t1')
|
||||
expect(reopen?.tab.meta).toEqual({ threadId: 'session-t1' })
|
||||
expect(sidechat?.dedupeKey?.(reopen!.tab)).toBe('session-t1')
|
||||
expect(sidechat?.dedupeKey?.(first!.tab)).toBeUndefined()
|
||||
})
|
||||
|
||||
it('the subagent tab declares its auto-open related settings', () => {
|
||||
const { service } = setup()
|
||||
const toggles = service.getTab('subagent')?.settings?.toggles ?? []
|
||||
|
||||
Reference in new issue
Block a user