Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

Merge remote-tracking branch 'origin/main' into claude/session-worktree-option-4346fc

Kafeifei2bc5d3704de9
diff --cc apps/mobile/src/__tests__/remoteSessionStore.test.ts
index e2f0e92abf,f1b7a283eb..eb0b4a04fd
--- a/apps/mobile/src/__tests__/remoteSessionStore.test.ts
+++ b/apps/mobile/src/__tests__/remoteSessionStore.test.ts
@@@ -143,76 -143,7 +143,76 @@@ describe('remoteSessionStore', () =>
expect(remoteSessionStore.getSessionDeviceId('s1')).toBe('dev-1');
});
+ it('mirrors new-maker worktree preference pushes, including explicit false and same-value revisions', () => {
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-1')).toEqual({
+ enabled: false,
+ revision: 0,
+ });
+
+ remoteSessionStore.applyRemotePush('dev-1', 'maker:new-maker-draft:changed', {
+ claudeCode: { worktreeEnabled: true },
+ codex: { worktreeEnabled: true },
+ });
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-1')).toEqual({
+ enabled: true,
+ revision: 1,
+ });
+
+ remoteSessionStore.applyRemotePush('dev-1', 'maker:new-maker-draft:changed', {
+ codex: { worktreeEnabled: false },
+ });
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-1')).toEqual({
+ enabled: false,
+ revision: 2,
+ });
+
+ // 同值 push 仍可能晚于在途 pull,revision 必须推进让旧响应失去写权。
+ remoteSessionStore.applyRemotePush('dev-1', 'maker:new-maker-draft:changed', {
+ claudeCode: { worktreeEnabled: false },
+ });
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-1')).toEqual({
+ enabled: false,
+ revision: 3,
+ });
+
+ remoteSessionStore.applyRemotePush('dev-1', 'maker:new-maker-draft:changed', {
+ claudeCode: { worktreeEnabled: 'yes' },
+ });
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-1').revision).toBe(3);
+ });
+
+ it('isolates new-maker worktree preferences by device and removes their revisions with the device', () => {
+ remoteSessionStore.setNewMakerWorktreePreference('dev-1', true);
+ remoteSessionStore.setNewMakerWorktreePreference('dev-2', false);
+ remoteSessionStore.setNewMakerWorktreePreference('dev-2', true);
+
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-1')).toEqual({
+ enabled: true,
+ revision: 1,
+ });
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-2')).toEqual({
+ enabled: true,
+ revision: 2,
+ });
+
+ remoteSessionStore.removeDevice('dev-1');
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-1')).toEqual({
+ enabled: false,
+ revision: 0,
+ });
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-2')).toEqual({
+ enabled: true,
+ revision: 2,
+ });
+
+ remoteSessionStore.clear();
+ expect(remoteSessionStore.getNewMakerWorktreePreference('dev-2')).toEqual({
+ enabled: false,
+ revision: 0,
+ });
+ });
+
- it('mirrors session-level usage pushes into totalCostUsd / totalTokenUsage', () => {
+ it('mirrors structured session money and legacy USD usage pushes', () => {
remoteSessionStore.setDeviceSessions('dev-1', 'Mac', [session('s1')]);
// 被控端裸 UPDATE 不发 sessions:patched,这两条(sessions topic)是唯一更新通道。