Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(teammates): 每天查待办统一走开关入口;手机输入区未就绪时不提供帮我查查
zqchris6d765086c0e3
diff --git a/apps/desktop/src/renderer/features/bots/BotRoutines.tsx b/apps/desktop/src/renderer/features/bots/BotRoutines.tsxindex baf9fdea3c..9c50e23df4 100644--- a/apps/desktop/src/renderer/features/bots/BotRoutines.tsx+++ b/apps/desktop/src/renderer/features/bots/BotRoutines.tsx@@ -272,7 +272,12 @@ export function BotRoutines({routine={routine}disabled={busy}onEnabledChange={(enabled) =>- void act(() => window.electronAPI.routines.save(botId, routineInput({ ...routine, enabled }), routine.id))+ void act(() =>+ // 每天查待办与近况开关同一个入口:恢复时按当前模板重建,并通知近况。+ routine.builtin === 'todo-check'+ ? window.electronAPI.localDb.bots.todos.dailyCheck(botId, enabled)+ : window.electronAPI.routines.save(botId, routineInput({ ...routine, enabled }), routine.id),+ )}/>) : (diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsxindex 78e672fb83..8f17fdd850 100644--- a/apps/mobile/app/sessions/[sessionId].tsx+++ b/apps/mobile/app/sessions/[sessionId].tsx@@ -9656,7 +9656,7 @@ function SessionScreenContent() {// 伙伴近况里的「帮我查查」:输入框空着就作为主人的一句话直接发出(与手动发送同一条路径,带来源设备);// 已有草稿或附件时不替主人连同草稿一起发,只把这句话放进输入框。const askCompanionInComposer = useCallback((text: string) => {- if (!canUseComposer) return;+ if (!canUseComposer || !composerDraftHydrated) return;const idle = !composerDocumentHasContent(composerDocumentRef.current)&& attachments.length === 0 && pendingUploads.length === 0 && !queueEditingRef.current;if (idle && sendLatestRef.current) {@@ -9668,7 +9668,7 @@ function SessionScreenContent() {if (editor) editor.insertNode(node);else applyComposerDocument(appendComposerNode(composerDocumentRef.current, node));requestAnimationFrame(() => composerInputRef.current?.focus());- }, [applyComposerDocument, attachments.length, canUseComposer, pendingUploads.length]);+ }, [applyComposerDocument, attachments.length, canUseComposer, composerDraftHydrated, pendingUploads.length]);const deleteMessage = useCallback((clientId: string) => {if (!deviceId || messageActionBusy) return;@@ -9774,6 +9774,7 @@ function SessionScreenContent() {sessionId={sessionId ?? ''}onQuoteTodo={quoteTodoInComposer}onAskCompanion={askCompanionInComposer}+ askCompanionReady={canUseComposer && composerDraftHydrated}onSearch={() => setSearchOpen(true)}onBack={goBackToHome} /></> : <SessionHeaderBardiff --git a/apps/mobile/src/__tests__/CompanionHeaderNavigation.test.tsx b/apps/mobile/src/__tests__/CompanionHeaderNavigation.test.tsxindex 1fc0727d56..98ec99847a 100644--- a/apps/mobile/src/__tests__/CompanionHeaderNavigation.test.tsx+++ b/apps/mobile/src/__tests__/CompanionHeaderNavigation.test.tsx@@ -127,7 +127,7 @@ const moduleConstant = (name: string) => source.statements.find(n => ts.isVariab&& n.declarationList.declarations.some(d => d.name.getText(source) === name))!.getText(source);const compiled = ts.transpileModule(`${moduleConstant('COMPANION_NATIVE_HEADER_OPTIONS')}function PageHost({ bindings }) {- const { auth, deviceId, sessionId, companionResource, companionEntry, shareSelectionActive, setSearchOpen, goBackToHome, companionWorkingLabel, quoteTodoInComposer, askCompanionInComposer } = bindings;+ const { auth, deviceId, sessionId, companionResource, companionEntry, shareSelectionActive, setSearchOpen, goBackToHome, companionWorkingLabel, quoteTodoInComposer, askCompanionInComposer, canUseComposer, composerDraftHydrated } = bindings;const currentSession = null;const isSideChatSheet = false;const companionSettingsRequest = bindings.companionSettingsRequest;@@ -143,7 +143,7 @@ const PageHost = new Function('React', 'useState', 'useHostManagedSession', 'Comconst pageBindings = () => ({ auth: h.auth, deviceId: 'pc', sessionId: 'session-a', shareSelectionActive: false,companionEntry: { ready: true },companionResource: { ref: { kind: 'bot', collectionId: 'bots', id: 'bot-a' }, display: { title: 'Cindy' } } as RemoteResource | null,- setSearchOpen: vi.fn(), goBackToHome: vi.fn(), companionWorkingLabel: null as string | null, quoteTodoInComposer: vi.fn(), askCompanionInComposer: vi.fn() });+ setSearchOpen: vi.fn(), goBackToHome: vi.fn(), companionWorkingLabel: null as string | null, quoteTodoInComposer: vi.fn(), askCompanionInComposer: vi.fn(), canUseComposer: true, composerDraftHydrated: true });const showPage = (bindings: ReturnType<typeof pageBindings>) => act(async () => { root.render(<PageHost bindings={bindings} />); });it('wires the page: title while entry validation runs, Back to the roster, and the working breath', async () => {@@ -202,6 +202,9 @@ it('reads todos only for an advertised, online host, and clears the due dot by o// 「帮我查查」 is the owner's own words, sent through this chat's composer.await act(async () => h.glance.onCheckTodos());expect(props.onAskCompanion).toHaveBeenCalledWith('devices.glance.checkPrompt');+ // While the chat cannot take it (read-only, locked, draft not restored) 「帮我查查」 is not offered.+ await act(async () => root.render(<CompanionHeader {...props} resource={withTodos} askCompanionReady={false} />));+ expect(h.glance.onCheckTodos).toBeUndefined();await act(async () => h.glance.onOpenTask('child-1'));expect(h.push).toHaveBeenCalledWith({ pathname: '/sessions/[sessionId]', params: { sessionId: 'child-1', deviceId: 'pc' } });});diff --git a/apps/mobile/src/session/CompanionGlanceSheet.tsx b/apps/mobile/src/session/CompanionGlanceSheet.tsxindex 5c78613ff5..f8cbb5c1c0 100644--- a/apps/mobile/src/session/CompanionGlanceSheet.tsx+++ b/apps/mobile/src/session/CompanionGlanceSheet.tsx@@ -68,8 +68,8 @@ export function CompanionGlanceSheet({cloudHome: boolean;todos: GlanceTodoState;onQuoteTodo(todo: TeammateTodo): void;- /** 「帮我查查」: ask the teammate, as the owner, to look for new todos now. */- onCheckTodos(): void;+ /** 「帮我查查」: ask the teammate, as the owner, to look for new todos now; absent while this chat cannot send. */+ onCheckTodos?(): void;onOpenTask(sessionId: string): void;onOpenCindy(hosted: HostedRemoteCollectionItem): void;onSwitchHome(): void;@@ -87,7 +87,7 @@ export function CompanionGlanceSheet({</View><Computers botId={botId} deviceId={deviceId} deviceName={deviceName} online={online} cloudHome={cloudHome}onOpenCindy={hosted => afterClose(() => onOpenCindy(hosted))} onSwitchHome={() => afterClose(onSwitchHome)} />- <Todos todos={todos} online={online} onQuote={todo => afterClose(() => onQuoteTodo(todo))} onCheck={() => afterClose(onCheckTodos)} />+ <Todos todos={todos} online={online} onQuote={todo => afterClose(() => onQuoteTodo(todo))} onCheck={onCheckTodos ? () => afterClose(onCheckTodos) : undefined} /><Outputs botId={botId} deviceId={deviceId} sessionId={sessionId} online={online}onOpenTask={taskId => afterClose(() => onOpenTask(taskId))} /></ScrollView>@@ -192,7 +192,7 @@ function sourceText(todo: TeammateTodo, t: (key: string) => string): string {}function Todos({ todos, online, onQuote, onCheck }: {- todos: GlanceTodoState; online: boolean; onQuote(todo: TeammateTodo): void; onCheck(): void;+ todos: GlanceTodoState; online: boolean; onQuote(todo: TeammateTodo): void; onCheck?(): void;}) {const { t, i18n } = useTranslation();const { colors } = useTheme();@@ -206,7 +206,7 @@ function Todos({ todos, online, onQuote, onCheck }: {// Not offered by this desktop, or not read yet while offline: no section at all.if (!todos.loaded) return null;const checkRow = <Row key="check" icon={<ScanSearch size={ICON_GLYPH} strokeWidth={iconStroke.regular} color={colors.textSecondary} />}- title={t('devices.glance.check')} meta={t('devices.glance.checkMeta')} onPress={online ? onCheck : undefined} testID="companion.glance.todo.check" />;+ title={t('devices.glance.check')} meta={t('devices.glance.checkMeta')} muted={!online || !onCheck} onPress={online ? onCheck : undefined} testID="companion.glance.todo.check" />;const changeDaily = async (next: boolean) => {setError(null);setDailyBusy(true);diff --git a/apps/mobile/src/session/CompanionHeader.tsx b/apps/mobile/src/session/CompanionHeader.tsxindex 7916aecf2b..3ad54a53bb 100644--- a/apps/mobile/src/session/CompanionHeader.tsx+++ b/apps/mobile/src/session/CompanionHeader.tsx@@ -37,13 +37,15 @@ export function CompanionHeader(props: {onQuoteTodo(todo: TeammateTodo): void;/** Say something to the teammate as the owner: sent right away when the composer is empty, otherwise put into it. */onAskCompanion(text: string): void;+ /** The composer can take that line now (writable and its draft restored); otherwise 「帮我查查」 is disabled. */+ askCompanionReady?: boolean;onSearch(): void; onBack(): void;}) {const { accountGeneration } = useAuth();return <CompanionHeaderContent key={accountGeneration} {...props} />;}-function CompanionHeaderContent({ resource, deviceId, deviceName, online, controlsReady = true, working = false, sessionId, onQuoteTodo, onAskCompanion, onSearch, onBack, settingsRequest }: Parameters<typeof CompanionHeader>[0]) {+function CompanionHeaderContent({ resource, deviceId, deviceName, online, controlsReady = true, working = false, sessionId, onQuoteTodo, onAskCompanion, askCompanionReady = true, onSearch, onBack, settingsRequest }: Parameters<typeof CompanionHeader>[0]) {const { t, i18n } = useTranslation();const styles = useThemedStyles(makeStyles);const navigation = useTeammateNavigation();@@ -89,7 +91,7 @@ function CompanionHeaderContent({ resource, deviceId, deviceName, online, contro<CompanionGlanceSheet visible={glance} onClose={() => setGlance(false)} name={name} avatar={resource.display.avatar} botId={resource.ref.id}deviceId={deviceId} deviceName={deviceName} sessionId={sessionId} online={online} cloudHome={homed} todos={todos}onQuoteTodo={onQuoteTodo}- onCheckTodos={() => onAskCompanion(t('devices.glance.checkPrompt'))}+ onCheckTodos={askCompanionReady ? () => onAskCompanion(t('devices.glance.checkPrompt')) : undefined}onOpenTask={taskId => router.push({ pathname: '/sessions/[sessionId]', params: { sessionId: taskId, deviceId } })}onOpenCindy={hosted => void navigation.openTeammate(hosted, { replace: true })}onSwitchHome={() => setHomeSheet(true)} />