feat(agent): route Desktop to state-machine loop via ACP prompt meta (#11247)
Signed-off-by: Abhijay Jain <Abhijay007j@gmail.com> Co-authored-by: Douwe Osinga <douwe.osinga@gmail.com>
This commit is contained in:
@@ -8,9 +8,11 @@ export async function acpPromptSession(
|
||||
message: Message
|
||||
): Promise<PromptResponse> {
|
||||
const client = await getAcpClient();
|
||||
const useLegacyAgentLoop = await window.electron.getSetting('useLegacyAgentLoop');
|
||||
return client.connection.agent.request(methods.agent.session.prompt, {
|
||||
sessionId,
|
||||
prompt: messageToAcpPromptContent(message),
|
||||
_meta: { goose: { unrolledAgentLoop: !useLegacyAgentLoop } },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { SecurityToggle } from '../security/SecurityToggle';
|
||||
import { ResponseStylesSection } from '../response_styles/ResponseStylesSection';
|
||||
import { GoosehintsSection } from './GoosehintsSection';
|
||||
import { SpellcheckToggle } from './SpellcheckToggle';
|
||||
import { LegacyAgentLoopToggle } from './LegacyAgentLoopToggle';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../../ui/card';
|
||||
import { defineMessages, useIntl } from '../../../i18n';
|
||||
|
||||
@@ -65,6 +66,12 @@ export default function ChatSettingsSection() {
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="pb-2 rounded-lg">
|
||||
<CardContent className="px-4 pt-4">
|
||||
<LegacyAgentLoopToggle />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="pb-2 rounded-lg">
|
||||
<CardContent className="px-2">
|
||||
<SecurityToggle />
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { defineMessages, useIntl } from '../../../i18n';
|
||||
import { Switch } from '../../ui/switch';
|
||||
|
||||
const i18n = defineMessages({
|
||||
title: {
|
||||
id: 'settings.legacyAgentLoop.title',
|
||||
defaultMessage: 'Use Legacy Agent Loop',
|
||||
},
|
||||
description: {
|
||||
id: 'settings.legacyAgentLoop.description',
|
||||
defaultMessage: 'Fall back to the classic agent loop if the new one causes issues',
|
||||
},
|
||||
});
|
||||
|
||||
export function LegacyAgentLoopToggle() {
|
||||
const intl = useIntl();
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
window.electron.getSetting('useLegacyAgentLoop').then((value) => setEnabled(value ?? false));
|
||||
}, []);
|
||||
|
||||
const handleToggle = async (checked: boolean) => {
|
||||
setEnabled(checked);
|
||||
await window.electron.setSetting('useLegacyAgentLoop', checked);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h3 className="text-text-primary text-xs">{intl.formatMessage(i18n.title)}</h3>
|
||||
<p className="text-xs text-text-secondary max-w-md mt-[2px]">
|
||||
{intl.formatMessage(i18n.description)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Switch checked={enabled} onCheckedChange={handleToggle} variant="mono" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Besuchen Sie"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4061,6 +4061,12 @@
|
||||
"settings.language.zhTW": {
|
||||
"defaultMessage": "Chinese (Traditional)"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
},
|
||||
"settings.menuBarIcon.description": {
|
||||
"defaultMessage": "Show goose in the menu bar"
|
||||
},
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Visita"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Visitez"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "जाएं"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Kunjungi"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Visita"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "次のURLにアクセスし、"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "방문하여"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Lawati"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Acesse"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Перейдите на"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Ziyaret edin"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "Truy cập"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "访问"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4669,5 +4669,11 @@
|
||||
},
|
||||
"providerConfigurationModal.deviceCodeVisit": {
|
||||
"defaultMessage": "前往"
|
||||
},
|
||||
"settings.legacyAgentLoop.description": {
|
||||
"defaultMessage": "Fall back to the classic agent loop if the new one causes issues"
|
||||
},
|
||||
"settings.legacyAgentLoop.title": {
|
||||
"defaultMessage": "Use Legacy Agent Loop"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1976,6 +1976,7 @@ const validSettingKeys: Set<string> = new Set([
|
||||
'seenAnnouncementIds',
|
||||
'disableAutoDownload',
|
||||
'recentModels',
|
||||
'useLegacyAgentLoop',
|
||||
]);
|
||||
|
||||
ipcMain.handle('set-setting', (_event, key: SettingKey, value: unknown) => {
|
||||
|
||||
@@ -55,6 +55,7 @@ export interface Settings {
|
||||
showPricing: boolean;
|
||||
seenAnnouncementIds: string[];
|
||||
recentModels: RecentModel[];
|
||||
useLegacyAgentLoop: boolean;
|
||||
}
|
||||
|
||||
export type SettingKey = keyof Settings;
|
||||
@@ -96,6 +97,7 @@ export const defaultSettings: Settings = {
|
||||
showPricing: true,
|
||||
seenAnnouncementIds: [],
|
||||
recentModels: [],
|
||||
useLegacyAgentLoop: false,
|
||||
};
|
||||
|
||||
export function getKeyboardShortcuts(settings: Settings): KeyboardShortcuts {
|
||||
|
||||
Reference in New Issue
Block a user