mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-28 19:25:45 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa957c9ca9 | ||
|
|
a96a4d61f1 |
+4
-7
@@ -209,8 +209,7 @@ snapshot so a mixed edit can apply its live subset and still name the paths that
|
||||
listen: "127.0.0.1:6767",
|
||||
hostnames: true | string[], // legacy alias `allowedHosts` is migrated on load
|
||||
trustedProxies: true | string[], // defaults to ["loopback"]; Express proxy names/CIDRs
|
||||
tools: { enabled: boolean, groups: { orchestration, schedules, changeRequests, browser: boolean } },
|
||||
mcp: { enabled: boolean, injectIntoAgents: boolean }, // legacy, read only when `tools` is absent
|
||||
mcp: { enabled: boolean, injectIntoAgents: boolean },
|
||||
git: { maxProcessesPerSecond: number, maxProcessConcurrency: number },
|
||||
appendSystemPrompt: string, // appended to supported provider system/developer prompts
|
||||
terminalProfiles: TerminalProfile[], // named shell commands; omitted means DEFAULT_TERMINAL_PROFILES
|
||||
@@ -312,14 +311,12 @@ Each entry may include a Paseo-tool policy:
|
||||
Absent `paseoTools`, or absent fields within it, means Paseo tools are enabled and all tools are
|
||||
allowed. `enabled: false` disables the provider's Paseo catalog; `disabledTools` lists exact tool
|
||||
IDs to omit. The policy covers the core and browser catalog, not the voice-only `speak` tool.
|
||||
Browser tools also require `daemon.tools.groups.browser` and a connected browser host.
|
||||
Browser tools also require `daemon.browserTools.enabled` and a connected browser host.
|
||||
This policy controls the catalog presented to an agent. It is not an authorization boundary for
|
||||
agents that can access the host through a shell.
|
||||
|
||||
`daemon.tools` is the global override. When `enabled` is `false`, no provider receives Paseo or
|
||||
plugin tools; otherwise each group in `daemon.tools.groups` and then the provider policy applies.
|
||||
When `daemon.tools` is absent, the daemon reads the legacy `daemon.mcp.injectIntoAgents` and
|
||||
`daemon.browserTools.enabled` fields. Provider and global policy are resolved when a
|
||||
`daemon.mcp.injectIntoAgents` is the global override. When it is `false`, no provider receives
|
||||
Paseo tools; otherwise the provider policy applies. Provider and global policy are resolved when a
|
||||
session is created, resumed, imported, or reloaded, so configuration changes affect the next
|
||||
session rather than an already-running one.
|
||||
|
||||
|
||||
@@ -233,6 +233,57 @@ test("opening an agent focuses the composer when a mouse drives the UI", async (
|
||||
}
|
||||
});
|
||||
|
||||
/** The composer frame's border colour once its border-color transition has finished. */
|
||||
async function readSettledFrameBorder(page: Page): Promise<string> {
|
||||
return composerLocator(page).evaluate(async (input) => {
|
||||
let frame = input.parentElement;
|
||||
while (frame && parseFloat(getComputedStyle(frame).borderTopWidth) < 1) {
|
||||
frame = frame.parentElement;
|
||||
}
|
||||
if (!frame) throw new Error("Composer frame has no border");
|
||||
while (frame.getAnimations().length > 0) {
|
||||
await new Promise((resolve) => requestAnimationFrame(resolve));
|
||||
}
|
||||
return getComputedStyle(frame).borderTopColor;
|
||||
});
|
||||
}
|
||||
|
||||
test("the composer frame shows hover and focus", async ({ page }) => {
|
||||
const agent = await seedMockAgentWorkspace({
|
||||
repoPrefix: "composer-frame-focus-",
|
||||
title: "Composer frame focus",
|
||||
});
|
||||
|
||||
try {
|
||||
await openAgentRoute(page, agent);
|
||||
const composer = composerLocator(page);
|
||||
await expectComposerVisible(page);
|
||||
await page.mouse.move(0, 0);
|
||||
await blurComposerInput(page);
|
||||
const rest = await readSettledFrameBorder(page);
|
||||
|
||||
await composer.hover();
|
||||
const hover = await readSettledFrameBorder(page);
|
||||
expect(hover).not.toBe(rest);
|
||||
|
||||
await composer.click();
|
||||
await page.mouse.move(0, 0);
|
||||
await expectComposerFocused(page);
|
||||
const focus = await readSettledFrameBorder(page);
|
||||
expect(focus).not.toBe(rest);
|
||||
expect(focus).not.toBe(hover);
|
||||
|
||||
await composer.hover();
|
||||
expect(await readSettledFrameBorder(page)).toBe(focus);
|
||||
|
||||
await page.mouse.move(0, 0);
|
||||
await blurComposerInput(page);
|
||||
expect(await readSettledFrameBorder(page)).toBe(rest);
|
||||
} finally {
|
||||
await agent.cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
async function waitForAnimationFrames(page: Page, count: number): Promise<void> {
|
||||
await page.evaluate(async (frames) => {
|
||||
for (let frame = 0; frame < frames; frame += 1) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
finishSetup,
|
||||
goToSetupStep,
|
||||
hostGivesAgentsPaseoTools,
|
||||
hostToolGroups,
|
||||
openAppAsNewUser,
|
||||
openRelayPairingFromSetup,
|
||||
closeRelayPairing,
|
||||
@@ -25,7 +24,6 @@ import {
|
||||
recordFirstLaunch,
|
||||
setupModal,
|
||||
setupPrimaryButton,
|
||||
setHostTools,
|
||||
setupSheet,
|
||||
showSetupAgainFromSettings,
|
||||
skipSetup,
|
||||
@@ -428,30 +426,6 @@ test("setup choices carry over to Settings and the phone step pairs over relay",
|
||||
}
|
||||
});
|
||||
|
||||
test("setup offers only Enable tools and keeps the host's tool groups", async ({ page }) => {
|
||||
const host = await startSetupHost("tool-groups");
|
||||
|
||||
try {
|
||||
await setHostTools(host, { groups: { schedules: false, browser: true } });
|
||||
await openAppAsNewUser(page, host);
|
||||
await expectSetupStep(page, "Welcome to Paseo");
|
||||
await goToSetupStep(page, "Orchestration");
|
||||
await expectSetupStep(page, "Let agents use Paseo");
|
||||
await expect(paseoToolsSwitch(setupModal(page))).toBeChecked();
|
||||
// Setup offers only the main switch; tool groups live in Settings.
|
||||
await expect(
|
||||
setupModal(page).getByRole("switch", { name: "Browser", exact: true }),
|
||||
).toHaveCount(0);
|
||||
await continueSetup(page);
|
||||
await expectSetupStep(page, "Take your agents with you");
|
||||
|
||||
await expect.poll(() => hostGivesAgentsPaseoTools(host), { timeout: 30_000 }).toBe(true);
|
||||
expect(await hostToolGroups(host)).toMatchObject({ schedules: false, browser: true });
|
||||
} finally {
|
||||
await host.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("with no skills picked, skills read as off and Continue moves on", async ({ page }) => {
|
||||
const host = await startSetupHost("no-skills");
|
||||
|
||||
@@ -489,7 +463,6 @@ test("in the compact layout, Finish on Orchestration applies its switches", asyn
|
||||
const primary = (label: string) => page.getByRole("button", { name: label, exact: true });
|
||||
|
||||
try {
|
||||
await setHostTools(host, { enabled: false });
|
||||
await openAppAsNewUser(page, host);
|
||||
await step("Welcome to Paseo");
|
||||
await primary("Continue").click();
|
||||
@@ -498,7 +471,7 @@ test("in the compact layout, Finish on Orchestration applies its switches", asyn
|
||||
await step("Add your projects");
|
||||
await primary("Continue").click();
|
||||
|
||||
// The host has tools off; the setup switch still starts on.
|
||||
// The setup host starts with Paseo tools off; the switch starts on.
|
||||
expect(await hostGivesAgentsPaseoTools(host)).toBe(false);
|
||||
await step("Let agents use Paseo");
|
||||
await expect(paseoToolsSwitch(page)).toBeChecked();
|
||||
|
||||
@@ -4,10 +4,6 @@ import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { expect, type Locator, type Page } from "@playwright/test";
|
||||
import type { DaemonClient as InternalDaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import type {
|
||||
MutableDaemonToolGroups,
|
||||
MutableDaemonToolsConfigPatch,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import { addProjectFlow, addProjectFlowInput, expectAddProjectTab } from "./add-project-flow";
|
||||
import { connectDaemonClient } from "./daemon-client-loader";
|
||||
import { buildCreateAgentPreferences, buildSeededHost } from "./daemon-registry";
|
||||
@@ -142,7 +138,7 @@ export async function goToSetupStep(page: Page, label: string): Promise<void> {
|
||||
}
|
||||
|
||||
export function paseoToolsSwitch(scope: Page | Locator): Locator {
|
||||
return scope.getByRole("switch", { name: "Enable tools", exact: true });
|
||||
return scope.getByRole("switch", { name: "Inject Paseo tools", exact: true });
|
||||
}
|
||||
|
||||
/** Whether the host gives its agents Paseo tools, read from the host itself. */
|
||||
@@ -151,37 +147,7 @@ export async function hostGivesAgentsPaseoTools(host: { port: number }): Promise
|
||||
Pick<InternalDaemonClient, "connect" | "close" | "getDaemonConfig">
|
||||
>({ clientIdPrefix: "app-e2e-onboarding", port: host.port });
|
||||
try {
|
||||
const config = (await client.getDaemonConfig()).config;
|
||||
return config.tools?.enabled ?? config.mcp.injectIntoAgents !== false;
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** The host's saved tool groups, read from the host itself. */
|
||||
export async function hostToolGroups(host: {
|
||||
port: number;
|
||||
}): Promise<MutableDaemonToolGroups | undefined> {
|
||||
const client = await connectDaemonClient<
|
||||
Pick<InternalDaemonClient, "connect" | "close" | "getDaemonConfig">
|
||||
>({ clientIdPrefix: "app-e2e-onboarding", port: host.port });
|
||||
try {
|
||||
return (await client.getDaemonConfig()).config.tools?.groups;
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** Saves tool settings on the host, the way Settings does. */
|
||||
export async function setHostTools(
|
||||
host: { port: number },
|
||||
tools: MutableDaemonToolsConfigPatch,
|
||||
): Promise<void> {
|
||||
const client = await connectDaemonClient<
|
||||
Pick<InternalDaemonClient, "connect" | "close" | "patchDaemonConfig">
|
||||
>({ clientIdPrefix: "app-e2e-onboarding", port: host.port });
|
||||
try {
|
||||
await client.patchDaemonConfig({ tools });
|
||||
return (await client.getDaemonConfig()).config.mcp.injectIntoAgents !== false;
|
||||
} finally {
|
||||
await client.close();
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ export async function expectHostConnectionsCard(page: Page, port: string): Promi
|
||||
export async function expectHostInjectMcpCard(page: Page): Promise<void> {
|
||||
const card = page.getByTestId("host-page-inject-mcp-card");
|
||||
await expect(card).toBeVisible();
|
||||
await expect(card.getByRole("switch", { name: "Enable tools" })).toBeVisible();
|
||||
await expect(card.getByRole("switch", { name: "Inject Paseo tools" })).toBeVisible();
|
||||
}
|
||||
|
||||
function idleAgentReleaseSwitch(page: Page) {
|
||||
|
||||
@@ -2,19 +2,12 @@ import { useCallback, useMemo, useState, type ReactNode } from "react";
|
||||
import { View } from "react-native";
|
||||
import { isWeb } from "@/constants/platform";
|
||||
import { SettingsRowChildren } from "./row-children";
|
||||
import { SettingsRowHeader, type SettingsRowHintStatus } from "./row-header";
|
||||
import { SettingsRowHeader } from "./row-header";
|
||||
|
||||
interface SettingsCollapsibleRowProps {
|
||||
label: string;
|
||||
/** A line under the label explaining the group. */
|
||||
hint?: string;
|
||||
hintStatus?: SettingsRowHintStatus;
|
||||
/** A short status shown before the chevron, so the row says something while collapsed. */
|
||||
summary?: string;
|
||||
/** A control acting on the row's subject in place, such as a switch, before the chevron. */
|
||||
control?: ReactNode;
|
||||
/** Names the expand/collapse button for assistive tech when the label alone is not enough. */
|
||||
accessibilityLabel?: string;
|
||||
defaultExpanded?: boolean;
|
||||
testID?: string;
|
||||
/** The rows revealed underneath, separated like the rows of a `SettingsCard` and laid out as nested rows. */
|
||||
@@ -28,11 +21,7 @@ interface SettingsCollapsibleRowProps {
|
||||
*/
|
||||
export function SettingsCollapsibleRow({
|
||||
label,
|
||||
hint,
|
||||
hintStatus,
|
||||
summary,
|
||||
control,
|
||||
accessibilityLabel,
|
||||
defaultExpanded = false,
|
||||
testID,
|
||||
children,
|
||||
@@ -50,11 +39,7 @@ export function SettingsCollapsibleRow({
|
||||
<View testID={testID}>
|
||||
<SettingsRowHeader
|
||||
label={label}
|
||||
hint={hint}
|
||||
hintStatus={hintStatus}
|
||||
summary={summary}
|
||||
control={control}
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
onPress={toggle}
|
||||
expanded={expanded}
|
||||
accessibilityState={accessibilityState}
|
||||
|
||||
@@ -110,6 +110,7 @@ import {
|
||||
applyDictationTranscript,
|
||||
computeCanStartDictation,
|
||||
resolveAlternateSendAction,
|
||||
resolveComposerFramePhase,
|
||||
resolveComposerSurfacePresentation,
|
||||
resolveComposerSurfaceText,
|
||||
resolveMessageInputEnterAction,
|
||||
@@ -1368,6 +1369,8 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
const dictationToggleKeys = useShortcutKeys("dictation-toggle");
|
||||
const focusInputKeys = useShortcutKeys("focus-message-input");
|
||||
const [isInputFocused, setIsInputFocused] = useState(false);
|
||||
// Only the frame's pointer events set it, so hover stays a web thing; see docs/hover.md.
|
||||
const [isInputHovered, setIsInputHovered] = useState(false);
|
||||
useKeyboardFocusSurface("message-input", isInputFocused && isPaneFocused);
|
||||
// Web text is DOM-owned between deferred draft publications. The action button only needs
|
||||
// this boundary, so publish empty/non-empty transitions without rerendering for every key.
|
||||
@@ -2038,15 +2041,32 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
void handleStopRealtimeVoice();
|
||||
}, [handleStopRealtimeVoice]);
|
||||
|
||||
const handleInputWrapperPointerEnter = useCallback(() => setIsInputHovered(true), []);
|
||||
const handleInputWrapperPointerLeave = useCallback(() => setIsInputHovered(false), []);
|
||||
const framePhase = resolveComposerFramePhase({
|
||||
hovered: isInputHovered,
|
||||
focused: isInputFocused,
|
||||
readOnly,
|
||||
disabled,
|
||||
});
|
||||
const inputWrapperCombinedStyle = useMemo(
|
||||
() => [
|
||||
styles.inputWrapper,
|
||||
Platform.OS !== "ios" && isCompact && !isFullscreen && styles.inputWrapperCompact,
|
||||
readOnly && styles.inputWrapperReadOnly,
|
||||
framePhase === "hover" && styles.inputWrapperHovered,
|
||||
framePhase === "active" && styles.inputWrapperFocused,
|
||||
inputWrapperStyle,
|
||||
{ opacity: surfacePresentation.input.opacity },
|
||||
],
|
||||
[inputWrapperStyle, isCompact, isFullscreen, readOnly, surfacePresentation.input.opacity],
|
||||
[
|
||||
framePhase,
|
||||
inputWrapperStyle,
|
||||
isCompact,
|
||||
isFullscreen,
|
||||
readOnly,
|
||||
surfacePresentation.input.opacity,
|
||||
],
|
||||
);
|
||||
// `withUnistyles` maps this component's `style` into a `.hash > *` child
|
||||
// rule, which ties on specificity with react-native-web's own
|
||||
@@ -2394,6 +2414,8 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
|
||||
onExit={exitFullscreen}
|
||||
inputWrapperRef={inputWrapperRef}
|
||||
inputWrapperStyle={inputWrapperCombinedStyle}
|
||||
onInputWrapperPointerEnter={handleInputWrapperPointerEnter}
|
||||
onInputWrapperPointerLeave={handleInputWrapperPointerLeave}
|
||||
inputPointerEvents={surfacePresentation.input.pointerEvents}
|
||||
attachmentSlot={attachmentSlot}
|
||||
showFullscreenButton={shouldShowFullscreenControl(
|
||||
@@ -2448,6 +2470,15 @@ const styles = StyleSheet.create((theme: Theme) => ({
|
||||
inputWrapperReadOnly: {
|
||||
borderStyle: "dotted",
|
||||
},
|
||||
// The rest border is already the `borderAccent` that `controlHover` gives other inputs, so
|
||||
// hover steps up one surface; focus takes the accent, like their focus ring. Colour only:
|
||||
// the border width stays put, so the frame never shifts under the pointer.
|
||||
inputWrapperHovered: {
|
||||
borderColor: theme.colors.surface4,
|
||||
},
|
||||
inputWrapperFocused: {
|
||||
borderColor: theme.colors.accent,
|
||||
},
|
||||
// The band the fullscreen glyph sits in is the input's own padding, so a tap
|
||||
// anywhere in it (under the glyph, or where the glyph would be) is a tap on the
|
||||
// editor: it focuses, shows the keyboard, and places the caret. Reserved whether
|
||||
|
||||
@@ -37,6 +37,8 @@ export function ComposerInputPresentation({
|
||||
onExit,
|
||||
inputWrapperRef,
|
||||
inputWrapperStyle,
|
||||
onInputWrapperPointerEnter,
|
||||
onInputWrapperPointerLeave,
|
||||
inputPointerEvents,
|
||||
attachmentSlot,
|
||||
showFullscreenButton,
|
||||
@@ -53,6 +55,9 @@ export function ComposerInputPresentation({
|
||||
onExit: () => void;
|
||||
inputWrapperRef: Ref<View>;
|
||||
inputWrapperStyle: ViewProps["style"];
|
||||
/** Hover tracking for the frame's border; the frame is a plain View, per docs/hover.md. */
|
||||
onInputWrapperPointerEnter: () => void;
|
||||
onInputWrapperPointerLeave: () => void;
|
||||
inputPointerEvents: ViewProps["pointerEvents"];
|
||||
attachmentSlot: ReactNode;
|
||||
showFullscreenButton: boolean;
|
||||
@@ -107,6 +112,8 @@ export function ComposerInputPresentation({
|
||||
ref={inputWrapperRef}
|
||||
style={fullscreen ? styles.fullscreenInputWrapper : inputWrapperStyle}
|
||||
pointerEvents={inputPointerEvents}
|
||||
onPointerEnter={onInputWrapperPointerEnter}
|
||||
onPointerLeave={onInputWrapperPointerLeave}
|
||||
>
|
||||
{fullscreen ? null : attachmentSlot}
|
||||
<View style={fullscreen ? styles.fullscreenTextSurface : styles.inlineTextSurface}>
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
computeCanStartDictation,
|
||||
type MessageInputEnterContext,
|
||||
resolveActiveSendBehavior,
|
||||
resolveComposerFramePhase,
|
||||
resolveComposerSurfacePresentation,
|
||||
resolveComposerSurfaceText,
|
||||
resolveGlyphRailOffset,
|
||||
@@ -614,3 +615,23 @@ describe("fullscreen glyph rail", () => {
|
||||
expect(offset + inkInset).toBeCloseTo(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("composer frame phase", () => {
|
||||
const rest = { hovered: false, focused: false, readOnly: false, disabled: false };
|
||||
|
||||
it("shows the focus border while the editor has focus, hovered or not", () => {
|
||||
expect(resolveComposerFramePhase({ ...rest, focused: true })).toBe("active");
|
||||
expect(resolveComposerFramePhase({ ...rest, focused: true, hovered: true })).toBe("active");
|
||||
});
|
||||
|
||||
it("shows the hover border only while the pointer is over an unfocused frame", () => {
|
||||
expect(resolveComposerFramePhase({ ...rest, hovered: true })).toBe("hover");
|
||||
expect(resolveComposerFramePhase(rest)).toBe("rest");
|
||||
});
|
||||
|
||||
it("keeps a read-only or disabled frame at rest", () => {
|
||||
const engaged = { ...rest, hovered: true, focused: true };
|
||||
expect(resolveComposerFramePhase({ ...engaged, readOnly: true })).toBe("rest");
|
||||
expect(resolveComposerFramePhase({ ...engaged, disabled: true })).toBe("rest");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,6 +3,10 @@ import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import type { ActiveTurnBehavior } from "@getpaseo/protocol/messages";
|
||||
import type { MessagePayload, TextReplacement } from "@/composer/types";
|
||||
import type { MessageInputKeyboardActionKind } from "@/keyboard/actions";
|
||||
import {
|
||||
getControlInteractionPhase,
|
||||
type ControlInteractionPhase,
|
||||
} from "@/components/ui/control-geometry";
|
||||
|
||||
export type SendBehavior = ActiveTurnBehavior | "queue";
|
||||
|
||||
@@ -246,6 +250,23 @@ export function resolveGlyphRailOffset(input: {
|
||||
return -inkInset;
|
||||
}
|
||||
|
||||
/**
|
||||
* The composer frame follows the phases of the app's other inputs: focus wins over hover, and
|
||||
* a frame you can't type into (read-only, disabled) stays at rest.
|
||||
*/
|
||||
export function resolveComposerFramePhase(input: {
|
||||
hovered: boolean;
|
||||
focused: boolean;
|
||||
readOnly: boolean;
|
||||
disabled: boolean;
|
||||
}): ControlInteractionPhase {
|
||||
return getControlInteractionPhase({
|
||||
hovered: input.hovered,
|
||||
focused: input.focused,
|
||||
disabled: input.readOnly || input.disabled,
|
||||
});
|
||||
}
|
||||
|
||||
export function resolveComposerSurfaceText(
|
||||
liveText: string,
|
||||
replacement: TextReplacement,
|
||||
|
||||
@@ -385,7 +385,7 @@ describe("translation resources", () => {
|
||||
expect(en.settings.host.notFound).toBe("Host not found");
|
||||
expect(en.settings.host.connections.title).toBe("Connections");
|
||||
expect(en.settings.host.daemon.restart.title).toBe("Restart daemon");
|
||||
expect(en.settings.host.orchestration.enableTools.title).toBe("Enable tools");
|
||||
expect(en.settings.host.orchestration.enableTools.title).toBe("Enable Paseo tools");
|
||||
expect(en.settings.providers.title).toBe("Providers");
|
||||
expect(en.settings.providers.models.addModel).toBe("Add model");
|
||||
expect(en.settings.providers.diagnostic.title).toBe("Diagnostic");
|
||||
|
||||
@@ -2643,9 +2643,6 @@ export const ar: TranslationResources = {
|
||||
info: "يحوّل وضع الصوت كلامك إلى نص ويقرأ ردود الوكيل بصوت عالٍ.",
|
||||
enabled: "وضع الصوت",
|
||||
enabledHint: "تحدّث مع وكلائك دون استخدام يديك",
|
||||
toolsRequiredTitle: "يتطلب وضع الصوت أدوات الوكلاء",
|
||||
toolsRequiredDescription: "فعّل «تمكين الأدوات» حتى يتمكن الوكيل من نطق الردود.",
|
||||
enablingTools: "جارٍ التمكين...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "مفتاح API",
|
||||
@@ -3137,35 +3134,15 @@ export const ar: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "التعليمات",
|
||||
toolsTitle: "أدوات الوكلاء",
|
||||
pluginNote: "الأدوات التي تضيفها الإضافات تتبع أيضًا خيار تمكين الأدوات",
|
||||
updateHostForGroups: "حدّث هذا المضيف لضبط مجموعات الأدوات الفردية",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "التنسيق",
|
||||
hint: "إدارة مساحات العمل والوكلاء والطرفيات والسكربتات",
|
||||
},
|
||||
schedules: {
|
||||
title: "الجداول الزمنية",
|
||||
hint: "إنشاء وإدارة الجداول الزمنية ونبضات المتابعة",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "مراقبة طلبات السحب",
|
||||
hint: "مراقبة تحديثات طلبات السحب والدمج",
|
||||
},
|
||||
browser: {
|
||||
title: "المتصفح",
|
||||
hint: "التحكم في علامات تبويب متصفح Paseo بما في ذلك الجلسات المسجّل الدخول إليها. فعّل هذا الخيار فقط للوكلاء الموثوقين.",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "التنسيق",
|
||||
unavailable: "اتصل بهذا المضيف لإدارة التنسيق",
|
||||
enableTools: {
|
||||
title: "تمكين الأدوات",
|
||||
hint: "يسمح لـ Paseo والإضافات بتوفير الأدوات للوكلاء. مطلوب لوضع الصوت.",
|
||||
accessibilityLabel: "تمكين الأدوات",
|
||||
updateFailed: "تعذر تحديث الأدوات.",
|
||||
title: "تمكين أدوات Paseo",
|
||||
hint: "سيتمكن الوكلاء من إدارة أشجار العمل والوكلاء والجداول الزمنية",
|
||||
accessibilityLabel: "حقن أدوات Paseo",
|
||||
updateFailed: "تعذر تحديث أدوات Paseo.",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "موجه النظام",
|
||||
|
||||
@@ -2741,9 +2741,6 @@ export const en = {
|
||||
info: "Voice mode transcribes what you say and reads agent replies aloud.",
|
||||
enabled: "Voice mode",
|
||||
enabledHint: "Talk with your agents hands-free",
|
||||
toolsRequiredTitle: "Voice mode requires agent tools",
|
||||
toolsRequiredDescription: "Turn on Enable tools so the agent can speak replies.",
|
||||
enablingTools: "Enabling...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API key",
|
||||
@@ -3237,35 +3234,15 @@ export const en = {
|
||||
tools: {
|
||||
instructionsTitle: "Instructions",
|
||||
toolsTitle: "Agent tools",
|
||||
pluginNote: "Tools added by plugins also follow Enable tools",
|
||||
updateHostForGroups: "Update this host to configure individual tool groups",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "Orchestration",
|
||||
hint: "Manage workspaces, agents, terminals, and scripts",
|
||||
},
|
||||
schedules: {
|
||||
title: "Schedules",
|
||||
hint: "Create and manage schedules and heartbeats",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "PR watching",
|
||||
hint: "Watch pull requests and merge requests for updates",
|
||||
},
|
||||
browser: {
|
||||
title: "Browser",
|
||||
hint: "Control Paseo browser tabs, including logged-in state. Enable only for agents you trust.",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orchestration",
|
||||
unavailable: "Connect to this host to manage orchestration",
|
||||
enableTools: {
|
||||
title: "Enable tools",
|
||||
hint: "Let Paseo and plugins give tools to agents. Required for voice mode.",
|
||||
accessibilityLabel: "Enable tools",
|
||||
updateFailed: "Unable to update tools.",
|
||||
title: "Enable Paseo tools",
|
||||
hint: "Agents will be able to manage worktrees, agents and schedules",
|
||||
accessibilityLabel: "Inject Paseo tools",
|
||||
updateFailed: "Unable to update Paseo tools.",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "System prompt",
|
||||
|
||||
@@ -2665,10 +2665,6 @@ export const es: TranslationResources = {
|
||||
info: "El modo de voz transcribe lo que dices y lee en voz alta las respuestas del agente.",
|
||||
enabled: "Modo de voz",
|
||||
enabledHint: "Habla con tus agentes sin usar las manos",
|
||||
toolsRequiredTitle: "El modo de voz requiere herramientas de agentes",
|
||||
toolsRequiredDescription:
|
||||
"Activa Habilitar herramientas para que el agente pueda hablar sus respuestas.",
|
||||
enablingTools: "Activando...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "Clave de API",
|
||||
@@ -3171,35 +3167,15 @@ export const es: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "Instrucciones",
|
||||
toolsTitle: "Herramientas de agentes",
|
||||
pluginNote: "Las herramientas de los plugins también siguen Habilitar herramientas",
|
||||
updateHostForGroups: "Actualiza este host para configurar grupos de herramientas",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "Orquestación",
|
||||
hint: "Gestiona workspaces, agentes, terminales y scripts",
|
||||
},
|
||||
schedules: {
|
||||
title: "Programaciones",
|
||||
hint: "Crea y gestiona programaciones y heartbeats",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "Seguimiento de PR",
|
||||
hint: "Supervisa pull requests y merge requests para ver actualizaciones",
|
||||
},
|
||||
browser: {
|
||||
title: "Navegador",
|
||||
hint: "Controla las pestañas del navegador de Paseo, incluido el estado con sesión iniciada. Actívalo solo para agentes de confianza.",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orquestación",
|
||||
unavailable: "Conéctese a este host para administrar la orquestación",
|
||||
enableTools: {
|
||||
title: "Habilitar herramientas",
|
||||
hint: "Permite que Paseo y los plugins proporcionen herramientas a los agentes. Necesario para el modo de voz.",
|
||||
accessibilityLabel: "Habilitar herramientas",
|
||||
updateFailed: "No se pudieron actualizar las herramientas.",
|
||||
title: "Habilitar herramientasPaseo",
|
||||
hint: "Los agentes podrán gestionar árboles de trabajo, agentes y horarios.",
|
||||
accessibilityLabel: "Inyectar herramientasPaseo",
|
||||
updateFailed: "No se pudieron actualizar las herramientas de Paseo.",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "Aviso del sistema",
|
||||
|
||||
@@ -2665,10 +2665,6 @@ export const fr: TranslationResources = {
|
||||
info: "Le mode vocal transcrit ce que vous dites et lit à voix haute les réponses de l'agent.",
|
||||
enabled: "Mode vocal",
|
||||
enabledHint: "Parlez à vos agents sans les mains",
|
||||
toolsRequiredTitle: "Le mode vocal nécessite les outils des agents",
|
||||
toolsRequiredDescription:
|
||||
"Activez Activer les outils pour que l'agent puisse lire ses réponses à voix haute.",
|
||||
enablingTools: "Activation...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "Clé d'API",
|
||||
@@ -3173,35 +3169,15 @@ export const fr: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "Instructions",
|
||||
toolsTitle: "Outils des agents",
|
||||
pluginNote: "Les outils ajoutés par les plugins suivent aussi Activer les outils",
|
||||
updateHostForGroups: "Mettez à jour cet hôte pour configurer chaque groupe d'outils",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "Orchestration",
|
||||
hint: "Gérer les workspaces, les agents, les terminaux et les scripts",
|
||||
},
|
||||
schedules: {
|
||||
title: "Planifications",
|
||||
hint: "Créer et gérer des planifications et des heartbeats",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "Suivi des PR",
|
||||
hint: "Surveiller les pull requests et merge requests",
|
||||
},
|
||||
browser: {
|
||||
title: "Navigateur",
|
||||
hint: "Contrôler les onglets du navigateur Paseo, y compris les sessions connectées. Activez uniquement pour des agents de confiance.",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orchestration",
|
||||
unavailable: "Connectez-vous à cet hôte pour gérer l’orchestration",
|
||||
enableTools: {
|
||||
title: "Activer les outils",
|
||||
hint: "Autorise Paseo et les plugins à fournir des outils aux agents. Requis pour le mode vocal.",
|
||||
accessibilityLabel: "Activer les outils",
|
||||
updateFailed: "Impossible de mettre à jour les outils.",
|
||||
title: "Activer les outils Paseo",
|
||||
hint: "Les agents pourront gérer les worktrees, les agents et les planifications",
|
||||
accessibilityLabel: "Injecter les outils Paseo",
|
||||
updateFailed: "Impossible de mettre à jour les outils Paseo.",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "Prompt système",
|
||||
|
||||
@@ -2633,10 +2633,6 @@ export const ja: TranslationResources = {
|
||||
info: "ボイスモードは話した内容を文字起こしし、エージェントの返答を読み上げます。",
|
||||
enabled: "ボイスモード",
|
||||
enabledHint: "ハンズフリーでエージェントと会話します",
|
||||
toolsRequiredTitle: "ボイスモードにはエージェントツールが必要です",
|
||||
toolsRequiredDescription:
|
||||
"エージェントが音声で返答できるように、ツールを有効にしてください。",
|
||||
enablingTools: "有効化中...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API キー",
|
||||
@@ -3133,35 +3129,15 @@ export const ja: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "指示",
|
||||
toolsTitle: "エージェントツール",
|
||||
pluginNote: "プラグインが追加するツールもこのスイッチに従います",
|
||||
updateHostForGroups: "ツールグループを個別に設定するにはホストを更新してください",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "オーケストレーション",
|
||||
hint: "ワークスペース、エージェント、ターミナル、スクリプトを管理します",
|
||||
},
|
||||
schedules: {
|
||||
title: "スケジュール",
|
||||
hint: "スケジュールとハートビートを作成・管理します",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "PRの監視",
|
||||
hint: "プルリクエストやマージリクエストの更新を監視します",
|
||||
},
|
||||
browser: {
|
||||
title: "ブラウザ",
|
||||
hint: "ログイン状態を含む Paseo のブラウザタブを操作します。信頼できるエージェントにのみ有効にしてください。",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "オーケストレーション",
|
||||
unavailable: "オーケストレーションを管理するにはこのホストに接続してください",
|
||||
enableTools: {
|
||||
title: "ツールを有効にする",
|
||||
hint: "Paseo とプラグインからエージェントへツールを提供します。ボイスモードに必要です。",
|
||||
accessibilityLabel: "ツールを有効にする",
|
||||
updateFailed: "ツールを更新できませんでした。",
|
||||
title: "Paseoツールを有効にする",
|
||||
hint: "エージェントがワークツリー、エージェント、スケジュールを管理できるようになります",
|
||||
accessibilityLabel: "Paseoツールを有効にする",
|
||||
updateFailed: "Paseoツールを更新できませんでした。",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "システムプロンプト",
|
||||
|
||||
@@ -2619,9 +2619,6 @@ export const ko: TranslationResources = {
|
||||
info: "음성 모드는 말한 내용을 텍스트로 옮기고 에이전트의 답변을 소리 내어 읽어 줍니다.",
|
||||
enabled: "음성 모드",
|
||||
enabledHint: "손을 쓰지 않고 에이전트와 대화하세요",
|
||||
toolsRequiredTitle: "음성 모드에는 에이전트 도구가 필요합니다",
|
||||
toolsRequiredDescription: "에이전트가 음성으로 답할 수 있도록 도구 활성화를 켜세요.",
|
||||
enablingTools: "활성화 중...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API 키",
|
||||
@@ -3116,35 +3113,15 @@ export const ko: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "지침",
|
||||
toolsTitle: "에이전트 도구",
|
||||
pluginNote: "플러그인이 추가한 도구도 도구 활성화 스위치를 따릅니다",
|
||||
updateHostForGroups: "개별 도구 그룹을 설정하려면 이 호스트를 업데이트하세요",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "오케스트레이션",
|
||||
hint: "워크스페이스, 에이전트, 터미널, 스크립트 관리",
|
||||
},
|
||||
schedules: {
|
||||
title: "일정",
|
||||
hint: "일정 및 하트비트 생성과 관리",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "PR 감시",
|
||||
hint: "풀 리퀘스트와 머지 리퀘스트 업데이트 감시",
|
||||
},
|
||||
browser: {
|
||||
title: "브라우저",
|
||||
hint: "로그인된 상태를 포함해 Paseo 브라우저 탭을 제어합니다. 신뢰하는 에이전트에만 활성화하세요.",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "오케스트레이션",
|
||||
unavailable: "오케스트레이션을 관리하려면 이 호스트에 연결하세요",
|
||||
enableTools: {
|
||||
title: "도구 활성화",
|
||||
hint: "Paseo와 플러그인이 에이전트에 도구를 제공할 수 있게 합니다. 음성 모드에 필요합니다.",
|
||||
accessibilityLabel: "도구 활성화",
|
||||
updateFailed: "도구를 업데이트할 수 없습니다.",
|
||||
title: "Paseo 도구 활성화",
|
||||
hint: "에이전트가 워크트리, 에이전트, 일정을 관리할 수 있습니다",
|
||||
accessibilityLabel: "Paseo 도구 주입",
|
||||
updateFailed: "Paseo 도구를 업데이트할 수 없습니다.",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "시스템 프롬프트",
|
||||
|
||||
@@ -2650,10 +2650,6 @@ export const ptBR: TranslationResources = {
|
||||
info: "O modo de voz transcreve o que você diz e lê em voz alta as respostas do agente.",
|
||||
enabled: "Modo de voz",
|
||||
enabledHint: "Converse com seus agentes sem usar as mãos",
|
||||
toolsRequiredTitle: "O modo de voz requer ferramentas de agentes",
|
||||
toolsRequiredDescription:
|
||||
"Ative Ativar ferramentas para que o agente possa falar as respostas.",
|
||||
enablingTools: "Ativando...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "Chave de API",
|
||||
@@ -3152,35 +3148,15 @@ export const ptBR: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "Instruções",
|
||||
toolsTitle: "Ferramentas de agentes",
|
||||
pluginNote: "Ferramentas adicionadas por plugins também seguem Ativar ferramentas",
|
||||
updateHostForGroups: "Atualize este host para configurar grupos de ferramentas",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "Orquestração",
|
||||
hint: "Gerencie workspaces, agentes, terminais e scripts",
|
||||
},
|
||||
schedules: {
|
||||
title: "Agendamentos",
|
||||
hint: "Crie e gerencie agendamentos e heartbeats",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "Monitoramento de PR",
|
||||
hint: "Acompanhe atualizações de pull requests e merge requests",
|
||||
},
|
||||
browser: {
|
||||
title: "Navegador",
|
||||
hint: "Controle abas do navegador do Paseo, incluindo sessões conectadas. Ative apenas para agentes confiáveis.",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "Orquestração",
|
||||
unavailable: "Conecte-se a este host para gerenciar a orquestração",
|
||||
enableTools: {
|
||||
title: "Ativar ferramentas",
|
||||
hint: "Permite que o Paseo e plugins forneçam ferramentas aos agentes. Necessário para o modo de voz.",
|
||||
accessibilityLabel: "Ativar ferramentas",
|
||||
updateFailed: "Não foi possível atualizar as ferramentas.",
|
||||
title: "Ativar ferramentas do Paseo",
|
||||
hint: "Agentes poderão gerenciar worktrees, agentes e agendamentos",
|
||||
accessibilityLabel: "Injetar ferramentas do Paseo",
|
||||
updateFailed: "Não foi possível atualizar as ferramentas do Paseo.",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "Prompt do sistema",
|
||||
|
||||
@@ -2651,10 +2651,6 @@ export const ru: TranslationResources = {
|
||||
info: "Голосовой режим расшифровывает вашу речь и зачитывает ответы агента вслух.",
|
||||
enabled: "Голосовой режим",
|
||||
enabledHint: "Общайтесь с агентами без рук",
|
||||
toolsRequiredTitle: "Для голосового режима нужны инструменты агентов",
|
||||
toolsRequiredDescription:
|
||||
"Включите «Включить инструменты», чтобы агент мог озвучивать ответы.",
|
||||
enablingTools: "Включение...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API-ключ",
|
||||
@@ -3160,35 +3156,15 @@ export const ru: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "Инструкции",
|
||||
toolsTitle: "Инструменты агентов",
|
||||
pluginNote: "Инструменты плагинов также зависят от переключателя «Включить инструменты»",
|
||||
updateHostForGroups: "Обновите этот хост, чтобы настраивать отдельные группы инструментов",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "Оркестрация",
|
||||
hint: "Управление рабочими пространствами, агентами, терминалами и скриптами",
|
||||
},
|
||||
schedules: {
|
||||
title: "Расписания",
|
||||
hint: "Создание и управление расписаниями и heartbeat",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "Отслеживание PR",
|
||||
hint: "Отслеживание обновлений pull request и merge request",
|
||||
},
|
||||
browser: {
|
||||
title: "Браузер",
|
||||
hint: "Управление вкладками браузера Paseo, включая авторизованные сессии. Включайте только для доверенных агентов.",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "Оркестрация",
|
||||
unavailable: "Подключитесь к этому хосту, чтобы управлять оркестрацией.",
|
||||
enableTools: {
|
||||
title: "Включить инструменты",
|
||||
hint: "Позволяет Paseo и плагинам предоставлять агентам инструменты. Требуется для голосового режима.",
|
||||
accessibilityLabel: "Включить инструменты",
|
||||
updateFailed: "Не удалось обновить инструменты.",
|
||||
title: "Включить инструменты Paseo",
|
||||
hint: "Агенты смогут управлять worktree, агентами и расписаниями.",
|
||||
accessibilityLabel: "Добавить инструменты Paseo",
|
||||
updateFailed: "Не удалось обновить инструменты Paseo.",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "Системный промпт",
|
||||
|
||||
@@ -2582,9 +2582,6 @@ export const zhCN: TranslationResources = {
|
||||
info: "语音模式会转写你说的话,并朗读智能体的回复。",
|
||||
enabled: "语音模式",
|
||||
enabledHint: "免手动与智能体对话",
|
||||
toolsRequiredTitle: "语音模式需要启用代理工具",
|
||||
toolsRequiredDescription: "开启“启用工具”后,智能体才能播报语音回复。",
|
||||
enablingTools: "正在启用...",
|
||||
},
|
||||
openai: {
|
||||
apiKey: "API 密钥",
|
||||
@@ -3070,35 +3067,15 @@ export const zhCN: TranslationResources = {
|
||||
tools: {
|
||||
instructionsTitle: "指令",
|
||||
toolsTitle: "代理工具",
|
||||
pluginNote: "插件提供的工具同样受“启用工具”开关控制",
|
||||
updateHostForGroups: "更新此 Host 以单独配置各个工具组",
|
||||
groups: {
|
||||
orchestration: {
|
||||
title: "编排",
|
||||
hint: "管理工作区、智能体、终端和脚本",
|
||||
},
|
||||
schedules: {
|
||||
title: "计划任务",
|
||||
hint: "创建和管理计划任务与心跳",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "PR 监控",
|
||||
hint: "监控 Pull Request 和 Merge Request 的更新",
|
||||
},
|
||||
browser: {
|
||||
title: "浏览器",
|
||||
hint: "控制 Paseo 浏览器标签页,包括已登录状态。仅对受信任的智能体启用。",
|
||||
},
|
||||
},
|
||||
},
|
||||
orchestration: {
|
||||
title: "编排",
|
||||
unavailable: "连接到这个 Host 以管理编排",
|
||||
enableTools: {
|
||||
title: "启用工具",
|
||||
hint: "允许 Paseo 和插件为智能体提供工具。语音模式需要开启此项。",
|
||||
accessibilityLabel: "启用工具",
|
||||
updateFailed: "无法更新工具设置。",
|
||||
title: "启用 Paseo tools",
|
||||
hint: "Agent 将能够管理 worktree、Agent 和计划",
|
||||
accessibilityLabel: "注入 Paseo tools",
|
||||
updateFailed: "无法更新 Paseo 工具。",
|
||||
},
|
||||
systemPrompt: {
|
||||
title: "System prompt",
|
||||
|
||||
@@ -9,11 +9,6 @@ import {
|
||||
import { useToast } from "@/contexts/toast-context";
|
||||
import { useCliInstall } from "@/desktop/hooks/use-install-status";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import {
|
||||
createOnboardingAgentToolsPatch,
|
||||
isHostAgentToolsEnabled,
|
||||
} from "@/screens/settings/agent-tools-config";
|
||||
|
||||
export type OrchestrationChoice = "tools" | "skills" | "cli";
|
||||
type Choices = Record<OrchestrationChoice, boolean>;
|
||||
@@ -44,7 +39,6 @@ export function useOrchestrationSetup(serverId: string): OrchestrationSetupContr
|
||||
const toast = useToast();
|
||||
const skills = useAgentSkills(serverId);
|
||||
const cli = useCliInstall();
|
||||
const supportsToolsConfig = useHostFeature(serverId, "daemonToolsConfig");
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
const [chosen, setChosen] = useState<Choices>(ALL_ON);
|
||||
// With nothing picked there is nothing to install, so skills read as off, as they do in Settings.
|
||||
@@ -66,7 +60,7 @@ export function useOrchestrationSetup(serverId: string): OrchestrationSetupContr
|
||||
|
||||
// What the host and this computer have now, or null while it is still being read. A choice is
|
||||
// skipped only when it is known to match; an unknown state is always written.
|
||||
const toolsEnabled = config ? isHostAgentToolsEnabled(config) : null;
|
||||
const toolsOn = config ? config.mcp.injectIntoAgents !== false : null;
|
||||
const skillsInstalled = skills.status ? areSkillsInstalled(skills.status) : null;
|
||||
const cliInstalled = cli.status ? cli.status.installed : null;
|
||||
const { reconcile, uninstall } = skills;
|
||||
@@ -74,21 +68,16 @@ export function useOrchestrationSetup(serverId: string): OrchestrationSetupContr
|
||||
const offersSkills = offered.skills;
|
||||
const offersCli = offered.cli;
|
||||
|
||||
const applyTools = useCallback(() => {
|
||||
const patch = createOnboardingAgentToolsPatch({
|
||||
enabled: choices.tools,
|
||||
currentEnabled: toolsEnabled,
|
||||
supportsToolsConfig,
|
||||
});
|
||||
if (!patch) return Promise.resolve(true);
|
||||
return patchConfig(patch)
|
||||
.then(Boolean, () => false)
|
||||
.then((done) => {
|
||||
if (!done) toast.error(t("settings.host.orchestration.enableTools.updateFailed"));
|
||||
return done;
|
||||
});
|
||||
}, [choices.tools, toolsEnabled, patchConfig, supportsToolsConfig, t, toast]);
|
||||
|
||||
const setTools = useCallback(
|
||||
(on: boolean) =>
|
||||
patchConfig({ mcp: { injectIntoAgents: on } })
|
||||
.then(Boolean, () => false)
|
||||
.then((done) => {
|
||||
if (!done) toast.error(t("settings.host.orchestration.enableTools.updateFailed"));
|
||||
return done;
|
||||
}),
|
||||
[patchConfig, t, toast],
|
||||
);
|
||||
const setSkillsInstalled = useCallback(
|
||||
(on: boolean) => (on ? reconcile() : uninstall()),
|
||||
[reconcile, uninstall],
|
||||
@@ -98,7 +87,7 @@ export function useOrchestrationSetup(serverId: string): OrchestrationSetupContr
|
||||
setIsApplying(true);
|
||||
try {
|
||||
const results = await Promise.all([
|
||||
applyTools(),
|
||||
choices.tools === toolsOn ? true : setTools(choices.tools),
|
||||
!offersSkills || choices.skills === skillsInstalled
|
||||
? true
|
||||
: setSkillsInstalled(choices.skills),
|
||||
@@ -109,23 +98,16 @@ export function useOrchestrationSetup(serverId: string): OrchestrationSetupContr
|
||||
setIsApplying(false);
|
||||
}
|
||||
}, [
|
||||
applyTools,
|
||||
choices.cli,
|
||||
choices.skills,
|
||||
choices,
|
||||
toolsOn,
|
||||
setTools,
|
||||
offersSkills,
|
||||
skillsInstalled,
|
||||
setSkillsInstalled,
|
||||
offersSkills,
|
||||
offersCli,
|
||||
cliInstalled,
|
||||
setCliInstalled,
|
||||
]);
|
||||
|
||||
return {
|
||||
choices,
|
||||
setChoice,
|
||||
offered,
|
||||
skills,
|
||||
isApplying,
|
||||
apply,
|
||||
};
|
||||
return { choices, setChoice, offered, skills, isApplying, apply };
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useCallback } from "react";
|
||||
import { AgentSkillsRow } from "@/agent-skills";
|
||||
import { SettingsCard } from "@/components/settings";
|
||||
import { CommandLineRow } from "@/desktop/components/integrations-section";
|
||||
import { EnableToolsSwitchRow } from "@/screens/settings/agent-tools-row";
|
||||
import { PaseoToolsRow } from "@/screens/settings/paseo-tools-card";
|
||||
import type { OrchestrationSetupController } from "../orchestration-setup";
|
||||
|
||||
/** Three switches, all on to start; Continue applies them. */
|
||||
@@ -13,7 +13,7 @@ export function OrchestrationStep({ setup }: { setup: OrchestrationSetupControll
|
||||
const setCli = useCallback((on: boolean) => setChoice("cli", on), [setChoice]);
|
||||
return (
|
||||
<SettingsCard>
|
||||
<EnableToolsSwitchRow value={choices.tools} onValueChange={setTools} disabled={isApplying} />
|
||||
<PaseoToolsRow value={choices.tools} onValueChange={setTools} disabled={isApplying} />
|
||||
{offered.skills ? (
|
||||
<AgentSkillsRow
|
||||
skills={setup.skills}
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
import type { MutableDaemonConfig } from "@getpaseo/protocol/messages";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
createAgentToolGroupPatch,
|
||||
createAgentToolsMasterPatch,
|
||||
createOnboardingAgentToolsPatch,
|
||||
DEFAULT_AGENT_TOOL_GROUPS,
|
||||
isHostAgentToolsEnabled,
|
||||
resolveAgentToolsState,
|
||||
} from "./agent-tools-config";
|
||||
|
||||
function makeConfig(overrides: Partial<MutableDaemonConfig> = {}): MutableDaemonConfig {
|
||||
return {
|
||||
relay: { enabled: false },
|
||||
mcp: { injectIntoAgents: true },
|
||||
browserTools: { enabled: false },
|
||||
providers: {},
|
||||
metadataGeneration: { providers: [] },
|
||||
autoArchiveAfterMerge: false,
|
||||
enableTerminalAgentHooks: false,
|
||||
appendSystemPrompt: "",
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe("agent tools UI state and legacy daemon compatibility", () => {
|
||||
it("reads unified daemon.tools state from a modern daemon", () => {
|
||||
const state = resolveAgentToolsState({
|
||||
config: makeConfig({
|
||||
tools: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
mcp: { injectIntoAgents: true },
|
||||
browserTools: { enabled: true },
|
||||
}),
|
||||
supportsToolsConfig: true,
|
||||
});
|
||||
|
||||
expect(state).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
supportsGroupControls: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves saved group values when master enabled is false", () => {
|
||||
const state = resolveAgentToolsState({
|
||||
config: makeConfig({
|
||||
tools: {
|
||||
enabled: false,
|
||||
groups: {
|
||||
orchestration: false,
|
||||
schedules: true,
|
||||
changeRequests: false,
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
mcp: { injectIntoAgents: false },
|
||||
browserTools: { enabled: true },
|
||||
}),
|
||||
supportsToolsConfig: true,
|
||||
});
|
||||
|
||||
expect(state.enabled).toBe(false);
|
||||
expect(state.groups).toEqual({
|
||||
orchestration: false,
|
||||
schedules: true,
|
||||
changeRequests: false,
|
||||
browser: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back cleanly to legacy mcp.injectIntoAgents and browserTools.enabled on older daemons", () => {
|
||||
const state = resolveAgentToolsState({
|
||||
config: makeConfig({
|
||||
mcp: { injectIntoAgents: false },
|
||||
browserTools: { enabled: true },
|
||||
}),
|
||||
supportsToolsConfig: false,
|
||||
});
|
||||
|
||||
expect(state).toEqual({
|
||||
enabled: false,
|
||||
groups: {
|
||||
...DEFAULT_AGENT_TOOL_GROUPS,
|
||||
browser: true,
|
||||
},
|
||||
supportsGroupControls: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("builds tools.* patches for modern daemons and legacy mcp/browserTools patches for older daemons", () => {
|
||||
expect(createAgentToolsMasterPatch({ enabled: false, supportsToolsConfig: true })).toEqual({
|
||||
tools: { enabled: false },
|
||||
});
|
||||
expect(createAgentToolsMasterPatch({ enabled: false, supportsToolsConfig: false })).toEqual({
|
||||
mcp: { injectIntoAgents: false },
|
||||
});
|
||||
|
||||
expect(
|
||||
createAgentToolGroupPatch({
|
||||
group: "schedules",
|
||||
enabled: false,
|
||||
supportsToolsConfig: true,
|
||||
}),
|
||||
).toEqual({
|
||||
tools: { groups: { schedules: false } },
|
||||
});
|
||||
expect(
|
||||
createAgentToolGroupPatch({
|
||||
group: "browser",
|
||||
enabled: true,
|
||||
supportsToolsConfig: false,
|
||||
}),
|
||||
).toEqual({
|
||||
browserTools: { enabled: true },
|
||||
});
|
||||
expect(
|
||||
createAgentToolGroupPatch({
|
||||
group: "orchestration",
|
||||
enabled: false,
|
||||
supportsToolsConfig: false,
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("setup writes only the main switch, and only when it differs from the host", () => {
|
||||
expect(
|
||||
createOnboardingAgentToolsPatch({
|
||||
enabled: true,
|
||||
currentEnabled: true,
|
||||
supportsToolsConfig: true,
|
||||
}),
|
||||
).toBeNull();
|
||||
|
||||
expect(
|
||||
createOnboardingAgentToolsPatch({
|
||||
enabled: true,
|
||||
currentEnabled: false,
|
||||
supportsToolsConfig: true,
|
||||
}),
|
||||
).toEqual({ tools: { enabled: true } });
|
||||
|
||||
expect(
|
||||
createOnboardingAgentToolsPatch({
|
||||
enabled: true,
|
||||
currentEnabled: null,
|
||||
supportsToolsConfig: true,
|
||||
}),
|
||||
).toEqual({ tools: { enabled: true } });
|
||||
|
||||
expect(
|
||||
createOnboardingAgentToolsPatch({
|
||||
enabled: false,
|
||||
currentEnabled: true,
|
||||
supportsToolsConfig: false,
|
||||
}),
|
||||
).toEqual({ mcp: { injectIntoAgents: false } });
|
||||
});
|
||||
|
||||
it("reports whether host agent tools are enabled for Voice UI checks", () => {
|
||||
expect(isHostAgentToolsEnabled(null)).toBe(true);
|
||||
expect(isHostAgentToolsEnabled(makeConfig({ tools: { enabled: true } }))).toBe(true);
|
||||
expect(isHostAgentToolsEnabled(makeConfig({ tools: { enabled: false } }))).toBe(false);
|
||||
expect(isHostAgentToolsEnabled(makeConfig({ mcp: { injectIntoAgents: false } }))).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -1,85 +0,0 @@
|
||||
import {
|
||||
BUILTIN_TOOL_GROUPS,
|
||||
DEFAULT_DAEMON_TOOL_GROUPS,
|
||||
type BuiltInToolGroup,
|
||||
type MutableDaemonConfig,
|
||||
type MutableDaemonConfigPatch,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
|
||||
export type AgentToolGroupId = BuiltInToolGroup;
|
||||
export type AgentToolGroupsState = Record<AgentToolGroupId, boolean>;
|
||||
|
||||
export const AGENT_TOOL_GROUP_ORDER: readonly AgentToolGroupId[] = BUILTIN_TOOL_GROUPS;
|
||||
export const DEFAULT_AGENT_TOOL_GROUPS: AgentToolGroupsState = { ...DEFAULT_DAEMON_TOOL_GROUPS };
|
||||
|
||||
export interface ResolvedAgentToolsState {
|
||||
enabled: boolean;
|
||||
groups: AgentToolGroupsState;
|
||||
supportsGroupControls: boolean;
|
||||
}
|
||||
|
||||
export function isHostAgentToolsEnabled(config: MutableDaemonConfig | null | undefined): boolean {
|
||||
if (!config) return true;
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
return config.tools?.enabled ?? config.mcp.injectIntoAgents !== false;
|
||||
}
|
||||
|
||||
export function resolveAgentToolsState(input: {
|
||||
config: MutableDaemonConfig | null | undefined;
|
||||
supportsToolsConfig: boolean;
|
||||
}): ResolvedAgentToolsState {
|
||||
const { config, supportsToolsConfig } = input;
|
||||
const enabled = isHostAgentToolsEnabled(config);
|
||||
const groups: AgentToolGroupsState = {
|
||||
orchestration: config?.tools?.groups?.orchestration ?? DEFAULT_AGENT_TOOL_GROUPS.orchestration,
|
||||
schedules: config?.tools?.groups?.schedules ?? DEFAULT_AGENT_TOOL_GROUPS.schedules,
|
||||
changeRequests:
|
||||
config?.tools?.groups?.changeRequests ?? DEFAULT_AGENT_TOOL_GROUPS.changeRequests,
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
browser: config?.tools?.groups?.browser ?? config?.browserTools.enabled === true,
|
||||
};
|
||||
return {
|
||||
enabled,
|
||||
groups,
|
||||
supportsGroupControls: supportsToolsConfig,
|
||||
};
|
||||
}
|
||||
|
||||
export function createAgentToolsMasterPatch(input: {
|
||||
enabled: boolean;
|
||||
supportsToolsConfig: boolean;
|
||||
}): MutableDaemonConfigPatch {
|
||||
if (input.supportsToolsConfig) {
|
||||
return { tools: { enabled: input.enabled } };
|
||||
}
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
return { mcp: { injectIntoAgents: input.enabled } };
|
||||
}
|
||||
|
||||
export function createAgentToolGroupPatch(input: {
|
||||
group: AgentToolGroupId;
|
||||
enabled: boolean;
|
||||
supportsToolsConfig: boolean;
|
||||
}): MutableDaemonConfigPatch | null {
|
||||
if (input.supportsToolsConfig) {
|
||||
return { tools: { groups: { [input.group]: input.enabled } } };
|
||||
}
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
if (input.group === "browser") {
|
||||
return { browserTools: { enabled: input.enabled } };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup only sets the main switch. It never writes tool groups, so the host keeps the groups saved
|
||||
* in Settings. An unknown host state is always written.
|
||||
*/
|
||||
export function createOnboardingAgentToolsPatch(input: {
|
||||
enabled: boolean;
|
||||
currentEnabled: boolean | null;
|
||||
supportsToolsConfig: boolean;
|
||||
}): MutableDaemonConfigPatch | null {
|
||||
if (input.currentEnabled === input.enabled) return null;
|
||||
return createAgentToolsMasterPatch(input);
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
import React, { act, useCallback, useState } from "react";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { I18nextProvider } from "react-i18next";
|
||||
import { SettingsCard } from "@/components/settings";
|
||||
import { i18n } from "@/i18n/i18next";
|
||||
import {
|
||||
DEFAULT_AGENT_TOOL_GROUPS,
|
||||
type AgentToolGroupId,
|
||||
type AgentToolGroupsState,
|
||||
} from "./agent-tools-config";
|
||||
import { AgentToolsRow } from "./agent-tools-row";
|
||||
|
||||
let root: Root | null = null;
|
||||
let container: HTMLDivElement | null = null;
|
||||
|
||||
afterEach(() => {
|
||||
act(() => root?.unmount());
|
||||
container?.remove();
|
||||
root = null;
|
||||
container = null;
|
||||
});
|
||||
|
||||
function Harness({
|
||||
initialEnabled = true,
|
||||
initialGroups = DEFAULT_AGENT_TOOL_GROUPS,
|
||||
supportsGroupControls = true,
|
||||
}: {
|
||||
initialEnabled?: boolean;
|
||||
initialGroups?: AgentToolGroupsState;
|
||||
supportsGroupControls?: boolean;
|
||||
}) {
|
||||
const [enabled, setEnabled] = useState(initialEnabled);
|
||||
const [groups, setGroups] = useState<AgentToolGroupsState>(initialGroups);
|
||||
|
||||
const handleGroupChange = useCallback((group: AgentToolGroupId, next: boolean) => {
|
||||
setGroups((current) => ({ ...current, [group]: next }));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<SettingsCard>
|
||||
<AgentToolsRow
|
||||
enabled={enabled}
|
||||
groups={groups}
|
||||
supportsGroupControls={supportsGroupControls}
|
||||
onEnabledChange={setEnabled}
|
||||
onGroupChange={handleGroupChange}
|
||||
/>
|
||||
</SettingsCard>
|
||||
</I18nextProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function mount(props?: React.ComponentProps<typeof Harness>) {
|
||||
container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
root = createRoot(container);
|
||||
act(() => {
|
||||
root?.render(<Harness {...props} />);
|
||||
});
|
||||
}
|
||||
|
||||
function byTestId(testID: string): HTMLElement | null {
|
||||
return document.querySelector(`[data-testid="${testID}"]`);
|
||||
}
|
||||
|
||||
function expandButton(): HTMLElement {
|
||||
const row = byTestId("host-page-tools-row-toggle");
|
||||
const button = row?.querySelector('[role="button"]');
|
||||
if (!(button instanceof HTMLElement)) {
|
||||
throw new Error("Expected expand button in host-page-tools-row-toggle");
|
||||
}
|
||||
return button;
|
||||
}
|
||||
|
||||
describe("AgentToolsRow collapsible behavior", () => {
|
||||
it("starts collapsed, expands to show all four groups, and preserves selections when toggled off and on", () => {
|
||||
mount({
|
||||
initialEnabled: true,
|
||||
initialGroups: {
|
||||
orchestration: true,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
|
||||
const masterSwitch = byTestId("host-page-tools-master-switch");
|
||||
expect(masterSwitch?.getAttribute("aria-checked")).toBe("true");
|
||||
expect(byTestId("host-page-tool-group-orchestration")).toBeNull();
|
||||
|
||||
// Expand the row
|
||||
act(() => {
|
||||
expandButton().click();
|
||||
});
|
||||
|
||||
expect(byTestId("host-page-tool-group-orchestration")).not.toBeNull();
|
||||
expect(byTestId("host-page-tool-group-schedules")).not.toBeNull();
|
||||
expect(byTestId("host-page-tool-group-changeRequests")).not.toBeNull();
|
||||
expect(byTestId("host-page-browser-tools-card")).not.toBeNull();
|
||||
expect(document.body.textContent).toContain("Tools added by plugins also follow Enable tools");
|
||||
expect(document.body.textContent).not.toContain("MCP");
|
||||
|
||||
const browserSwitch = byTestId("host-page-browser-tools-switch")!;
|
||||
const schedulesSwitch = byTestId("host-page-tool-group-schedules-switch")!;
|
||||
expect(browserSwitch.getAttribute("aria-checked")).toBe("true");
|
||||
expect(schedulesSwitch.getAttribute("aria-checked")).toBe("false");
|
||||
expect(browserSwitch.getAttribute("aria-disabled")).not.toBe("true");
|
||||
|
||||
// Turn master switch off: stays expanded, disables group switches, preserves selections
|
||||
act(() => {
|
||||
masterSwitch?.click();
|
||||
});
|
||||
|
||||
expect(masterSwitch?.getAttribute("aria-checked")).toBe("false");
|
||||
expect(browserSwitch.getAttribute("aria-disabled")).toBe("true");
|
||||
expect(browserSwitch.getAttribute("aria-checked")).toBe("true");
|
||||
expect(schedulesSwitch.getAttribute("aria-disabled")).toBe("true");
|
||||
expect(schedulesSwitch.getAttribute("aria-checked")).toBe("false");
|
||||
|
||||
// Turn master switch back on: group switches become interactive again with saved state
|
||||
act(() => {
|
||||
masterSwitch?.click();
|
||||
});
|
||||
|
||||
expect(masterSwitch?.getAttribute("aria-checked")).toBe("true");
|
||||
expect(browserSwitch.getAttribute("aria-disabled")).not.toBe("true");
|
||||
expect(browserSwitch.getAttribute("aria-checked")).toBe("true");
|
||||
});
|
||||
|
||||
it("shows only Browser and an update hint on older daemons without daemonToolsConfig", () => {
|
||||
mount({ supportsGroupControls: false });
|
||||
|
||||
act(() => {
|
||||
expandButton().click();
|
||||
});
|
||||
|
||||
expect(byTestId("host-page-browser-tools-card")).not.toBeNull();
|
||||
expect(byTestId("host-page-tool-group-orchestration")).toBeNull();
|
||||
expect(byTestId("host-page-tool-group-schedules")).toBeNull();
|
||||
expect(byTestId("host-page-tool-group-changeRequests")).toBeNull();
|
||||
expect(document.body.textContent).toContain(
|
||||
"Update this host to configure individual tool groups",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,272 +0,0 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { StyleSheet } from "react-native-unistyles";
|
||||
import type { MutableDaemonConfigPatch } from "@getpaseo/protocol/messages";
|
||||
import { SettingsCollapsibleRow, SettingsRow } from "@/components/settings";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import {
|
||||
AGENT_TOOL_GROUP_ORDER,
|
||||
createAgentToolGroupPatch,
|
||||
createAgentToolsMasterPatch,
|
||||
resolveAgentToolsState,
|
||||
type AgentToolGroupId,
|
||||
type AgentToolGroupsState,
|
||||
} from "./agent-tools-config";
|
||||
|
||||
const GROUP_TRANSLATION_KEYS: Record<
|
||||
AgentToolGroupId,
|
||||
{
|
||||
title:
|
||||
| "settings.host.tools.groups.orchestration.title"
|
||||
| "settings.host.tools.groups.schedules.title"
|
||||
| "settings.host.tools.groups.changeRequests.title"
|
||||
| "settings.host.tools.groups.browser.title";
|
||||
hint:
|
||||
| "settings.host.tools.groups.orchestration.hint"
|
||||
| "settings.host.tools.groups.schedules.hint"
|
||||
| "settings.host.tools.groups.changeRequests.hint"
|
||||
| "settings.host.tools.groups.browser.hint";
|
||||
}
|
||||
> = {
|
||||
orchestration: {
|
||||
title: "settings.host.tools.groups.orchestration.title",
|
||||
hint: "settings.host.tools.groups.orchestration.hint",
|
||||
},
|
||||
schedules: {
|
||||
title: "settings.host.tools.groups.schedules.title",
|
||||
hint: "settings.host.tools.groups.schedules.hint",
|
||||
},
|
||||
changeRequests: {
|
||||
title: "settings.host.tools.groups.changeRequests.title",
|
||||
hint: "settings.host.tools.groups.changeRequests.hint",
|
||||
},
|
||||
browser: {
|
||||
title: "settings.host.tools.groups.browser.title",
|
||||
hint: "settings.host.tools.groups.browser.hint",
|
||||
},
|
||||
};
|
||||
|
||||
function toErrorMessage(error: unknown): string {
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
|
||||
function resolveHintStatus(
|
||||
error: string | null | undefined,
|
||||
isPending: boolean | undefined,
|
||||
): "error" | "busy" | undefined {
|
||||
if (error) return "error";
|
||||
if (isPending) return "busy";
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** The host's expandable "Enable tools" row, bound to the host's config, for composing inside a SettingsCard. */
|
||||
export function HostAgentToolsRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const supportsToolsConfig = useHostFeature(serverId, "daemonToolsConfig");
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
const state = useMemo(
|
||||
() => resolveAgentToolsState({ config, supportsToolsConfig }),
|
||||
[config, supportsToolsConfig],
|
||||
);
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (patch: MutableDaemonConfigPatch) => {
|
||||
const result = await patchConfig(patch);
|
||||
if (!result) {
|
||||
throw new Error(t("workspace.terminal.hostDisconnected"));
|
||||
}
|
||||
return result;
|
||||
},
|
||||
});
|
||||
|
||||
const handleEnabledChange = useCallback(
|
||||
(enabled: boolean) => {
|
||||
mutation.mutate(createAgentToolsMasterPatch({ enabled, supportsToolsConfig }));
|
||||
},
|
||||
[mutation, supportsToolsConfig],
|
||||
);
|
||||
|
||||
const handleGroupChange = useCallback(
|
||||
(group: AgentToolGroupId, enabled: boolean) => {
|
||||
const patch = createAgentToolGroupPatch({ group, enabled, supportsToolsConfig });
|
||||
if (!patch) return;
|
||||
mutation.mutate(patch);
|
||||
},
|
||||
[mutation, supportsToolsConfig],
|
||||
);
|
||||
|
||||
if (!isConnected) return null;
|
||||
|
||||
return (
|
||||
<AgentToolsRow
|
||||
enabled={state.enabled}
|
||||
groups={state.groups}
|
||||
supportsGroupControls={state.supportsGroupControls}
|
||||
onEnabledChange={handleEnabledChange}
|
||||
onGroupChange={handleGroupChange}
|
||||
isPending={mutation.isPending}
|
||||
error={mutation.error ? toErrorMessage(mutation.error) : null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/** Plain "Enable tools" switch with no group controls, for setup. Groups stay in Settings. */
|
||||
export function EnableToolsSwitchRow({
|
||||
value,
|
||||
onValueChange,
|
||||
disabled,
|
||||
}: {
|
||||
value: boolean;
|
||||
onValueChange: (enabled: boolean) => void;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<SettingsRow
|
||||
label={t("settings.host.orchestration.enableTools.title")}
|
||||
hint={t("settings.host.orchestration.enableTools.hint")}
|
||||
>
|
||||
<Switch
|
||||
value={value}
|
||||
onValueChange={onValueChange}
|
||||
disabled={disabled}
|
||||
accessibilityLabel={t("settings.host.orchestration.enableTools.accessibilityLabel")}
|
||||
/>
|
||||
</SettingsRow>
|
||||
);
|
||||
}
|
||||
|
||||
/** Expandable "Enable tools" row on its own, for callers that control the state. */
|
||||
export function AgentToolsRow({
|
||||
enabled,
|
||||
groups,
|
||||
supportsGroupControls,
|
||||
onEnabledChange,
|
||||
onGroupChange,
|
||||
disabled,
|
||||
isPending,
|
||||
error,
|
||||
}: {
|
||||
enabled: boolean;
|
||||
groups: AgentToolGroupsState;
|
||||
supportsGroupControls: boolean;
|
||||
onEnabledChange: (enabled: boolean) => void;
|
||||
onGroupChange: (group: AgentToolGroupId, enabled: boolean) => void;
|
||||
disabled?: boolean;
|
||||
isPending?: boolean;
|
||||
error?: string | null;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const visibleGroups: readonly AgentToolGroupId[] = supportsGroupControls
|
||||
? AGENT_TOOL_GROUP_ORDER
|
||||
: ["browser"];
|
||||
const controlsDisabled = Boolean(disabled || isPending);
|
||||
const hint = error ?? t("settings.host.orchestration.enableTools.hint");
|
||||
const hintStatus = resolveHintStatus(error, isPending);
|
||||
|
||||
const masterControl = useMemo(
|
||||
() => (
|
||||
<Switch
|
||||
value={enabled}
|
||||
onValueChange={onEnabledChange}
|
||||
disabled={controlsDisabled}
|
||||
accessibilityLabel={t("settings.host.orchestration.enableTools.accessibilityLabel")}
|
||||
testID="host-page-tools-master-switch"
|
||||
/>
|
||||
),
|
||||
[controlsDisabled, enabled, onEnabledChange, t],
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsCollapsibleRow
|
||||
label={t("settings.host.orchestration.enableTools.title")}
|
||||
hint={hint}
|
||||
hintStatus={hintStatus}
|
||||
control={masterControl}
|
||||
testID="host-page-tools-row"
|
||||
>
|
||||
{visibleGroups.map((group) => (
|
||||
<ToolGroupSwitchRow
|
||||
key={group}
|
||||
group={group}
|
||||
value={groups[group]}
|
||||
disabled={controlsDisabled || !enabled}
|
||||
dimmed={!enabled}
|
||||
onGroupChange={onGroupChange}
|
||||
/>
|
||||
))}
|
||||
<View style={styles.noteRow}>
|
||||
<Text style={settingsStyles.rowHint}>
|
||||
{supportsGroupControls
|
||||
? t("settings.host.tools.pluginNote")
|
||||
: t("settings.host.tools.updateHostForGroups")}
|
||||
</Text>
|
||||
</View>
|
||||
</SettingsCollapsibleRow>
|
||||
);
|
||||
}
|
||||
|
||||
function ToolGroupSwitchRow({
|
||||
group,
|
||||
value,
|
||||
disabled,
|
||||
dimmed,
|
||||
onGroupChange,
|
||||
}: {
|
||||
group: AgentToolGroupId;
|
||||
value: boolean;
|
||||
disabled: boolean;
|
||||
dimmed: boolean;
|
||||
onGroupChange: (group: AgentToolGroupId, enabled: boolean) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const keys = GROUP_TRANSLATION_KEYS[group];
|
||||
const label = t(keys.title);
|
||||
const handleChange = useCallback(
|
||||
(next: boolean) => {
|
||||
onGroupChange(group, next);
|
||||
},
|
||||
[group, onGroupChange],
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={dimmed ? styles.disabledGroup : undefined}>
|
||||
<SettingsRow
|
||||
label={label}
|
||||
hint={t(keys.hint)}
|
||||
testID={
|
||||
group === "browser" ? "host-page-browser-tools-card" : `host-page-tool-group-${group}`
|
||||
}
|
||||
>
|
||||
<Switch
|
||||
value={value}
|
||||
onValueChange={handleChange}
|
||||
disabled={disabled}
|
||||
accessibilityLabel={label}
|
||||
testID={
|
||||
group === "browser"
|
||||
? "host-page-browser-tools-switch"
|
||||
: `host-page-tool-group-${group}-switch`
|
||||
}
|
||||
/>
|
||||
</SettingsRow>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
disabledGroup: {
|
||||
opacity: theme.opacity[50],
|
||||
},
|
||||
noteRow: {
|
||||
paddingHorizontal: theme.spacing[4],
|
||||
paddingVertical: theme.spacing[2],
|
||||
},
|
||||
}));
|
||||
@@ -0,0 +1,74 @@
|
||||
import React, { useCallback, useMemo } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { SettingsRow } from "@/components/settings";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { settingsStyles } from "@/styles/settings";
|
||||
import {
|
||||
createBrowserToolsPatch,
|
||||
getBrowserToolsCardState,
|
||||
getBrowserToolsMutationViewState,
|
||||
} from "./browser-tools-config";
|
||||
|
||||
export function BrowserToolsRow({ serverId }: { serverId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
const state = getBrowserToolsCardState({ isConnected, config });
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (next: boolean) => {
|
||||
const result = await patchConfig(createBrowserToolsPatch(next));
|
||||
if (!result) {
|
||||
throw new Error(t("workspace.terminal.hostDisconnected"));
|
||||
}
|
||||
return result;
|
||||
},
|
||||
});
|
||||
const mutationView = getBrowserToolsMutationViewState({
|
||||
isPending: mutation.isPending,
|
||||
error: mutation.error,
|
||||
});
|
||||
|
||||
const handleValueChange = useCallback(
|
||||
(next: boolean) => {
|
||||
mutation.mutate(next);
|
||||
},
|
||||
[mutation],
|
||||
);
|
||||
|
||||
const hint = useMemo(
|
||||
() => (
|
||||
<View>
|
||||
<Text style={settingsStyles.rowHint}>{state.warning}</Text>
|
||||
{mutationView.loadingText ? (
|
||||
<Text style={settingsStyles.rowHint} testID="host-page-browser-tools-loading">
|
||||
{mutationView.loadingText}
|
||||
</Text>
|
||||
) : null}
|
||||
</View>
|
||||
),
|
||||
[mutationView.loadingText, state.warning],
|
||||
);
|
||||
|
||||
if (!state.isVisible) return null;
|
||||
|
||||
return (
|
||||
<SettingsRow
|
||||
label={state.title}
|
||||
hint={hint}
|
||||
error={mutationView.errorText ?? undefined}
|
||||
testID="host-page-browser-tools-card"
|
||||
>
|
||||
<Switch
|
||||
value={state.isEnabled}
|
||||
onValueChange={handleValueChange}
|
||||
disabled={mutationView.isSwitchDisabled}
|
||||
accessibilityLabel="Enable browser tools"
|
||||
testID="host-page-browser-tools-switch"
|
||||
/>
|
||||
</SettingsRow>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import type { MutableDaemonConfig } from "@getpaseo/protocol/messages";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
BROWSER_TOOLS_WARNING,
|
||||
createBrowserToolsPatch,
|
||||
getBrowserToolsCardState,
|
||||
getBrowserToolsMutationViewState,
|
||||
} from "./browser-tools-config";
|
||||
|
||||
function makeConfig(browserToolsEnabled = false): MutableDaemonConfig {
|
||||
return {
|
||||
relay: { enabled: false },
|
||||
mcp: { injectIntoAgents: false },
|
||||
browserTools: { enabled: browserToolsEnabled },
|
||||
providers: {},
|
||||
metadataGeneration: { providers: [] },
|
||||
autoArchiveAfterMerge: false,
|
||||
enableTerminalAgentHooks: false,
|
||||
appendSystemPrompt: "",
|
||||
};
|
||||
}
|
||||
|
||||
describe("browser tools opt-in config", () => {
|
||||
it("shows the card with the logged-in browser state warning when connected", () => {
|
||||
expect(getBrowserToolsCardState({ isConnected: true, config: makeConfig(false) })).toEqual({
|
||||
isVisible: true,
|
||||
isEnabled: false,
|
||||
title: "Browser tools",
|
||||
warning: BROWSER_TOOLS_WARNING,
|
||||
});
|
||||
});
|
||||
|
||||
it("reads enabled state from daemon config", () => {
|
||||
expect(getBrowserToolsCardState({ isConnected: true, config: makeConfig(true) })).toMatchObject(
|
||||
{
|
||||
isEnabled: true,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("hides the card when the host is disconnected", () => {
|
||||
expect(
|
||||
getBrowserToolsCardState({ isConnected: false, config: makeConfig(true) }),
|
||||
).toMatchObject({
|
||||
isVisible: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("writes daemon.browserTools.enabled when toggled", () => {
|
||||
expect(createBrowserToolsPatch(true)).toEqual({ browserTools: { enabled: true } });
|
||||
expect(createBrowserToolsPatch(false)).toEqual({ browserTools: { enabled: false } });
|
||||
});
|
||||
|
||||
it("shows loading and disables the toggle while browser tool settings save", () => {
|
||||
expect(getBrowserToolsMutationViewState({ isPending: true, error: null })).toEqual({
|
||||
isSwitchDisabled: true,
|
||||
loadingText: "Updating browser tools…",
|
||||
errorText: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("shows the save error when browser tool settings fail", () => {
|
||||
expect(
|
||||
getBrowserToolsMutationViewState({ isPending: false, error: new Error("Disk full") }),
|
||||
).toEqual({
|
||||
isSwitchDisabled: false,
|
||||
loadingText: null,
|
||||
errorText: "Disk full",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
import type { MutableDaemonConfig } from "@getpaseo/protocol/messages";
|
||||
|
||||
export const BROWSER_TOOLS_TITLE = "Browser tools";
|
||||
export const BROWSER_TOOLS_WARNING =
|
||||
"Allow agents to access and control Paseo browser tabs, including logged-in browser state. Only enable this for agents you trust.";
|
||||
|
||||
export interface BrowserToolsCardState {
|
||||
isVisible: boolean;
|
||||
isEnabled: boolean;
|
||||
title: string;
|
||||
warning: string;
|
||||
}
|
||||
|
||||
export interface BrowserToolsMutationViewState {
|
||||
isSwitchDisabled: boolean;
|
||||
loadingText: string | null;
|
||||
errorText: string | null;
|
||||
}
|
||||
|
||||
export function getBrowserToolsCardState(input: {
|
||||
isConnected: boolean;
|
||||
config: MutableDaemonConfig | null;
|
||||
}): BrowserToolsCardState {
|
||||
return {
|
||||
isVisible: input.isConnected,
|
||||
isEnabled: input.config?.browserTools.enabled === true,
|
||||
title: BROWSER_TOOLS_TITLE,
|
||||
warning: BROWSER_TOOLS_WARNING,
|
||||
};
|
||||
}
|
||||
|
||||
export function createBrowserToolsPatch(enabled: boolean): Partial<MutableDaemonConfig> {
|
||||
return { browserTools: { enabled } };
|
||||
}
|
||||
|
||||
export function getBrowserToolsMutationViewState(input: {
|
||||
isPending: boolean;
|
||||
error: unknown;
|
||||
}): BrowserToolsMutationViewState {
|
||||
return {
|
||||
isSwitchDisabled: input.isPending,
|
||||
loadingText: input.isPending ? "Updating browser tools…" : null,
|
||||
errorText: input.error ? toErrorMessage(input.error) : null,
|
||||
};
|
||||
}
|
||||
|
||||
function toErrorMessage(error: unknown): string {
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
@@ -61,7 +61,8 @@ import { formatConnectionStatus, getConnectionStatusTone } from "@/utils/daemons
|
||||
import { ICON_SIZE } from "@/styles/theme";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
import { useProviderIcon } from "@/components/provider-icons";
|
||||
import { HostAgentToolsRow } from "./agent-tools-row";
|
||||
import { BrowserToolsRow } from "./browser-tools-card";
|
||||
import { HostPaseoToolsRow } from "./paseo-tools-card";
|
||||
import { RestartRecoveryRow } from "./restart-recovery-card";
|
||||
import { IdleRuntimeCleanupRow } from "./idle-runtime-cleanup-card";
|
||||
import { restartDaemonFromSettings, updateDaemonFromSettings } from "./daemon-lifecycle";
|
||||
@@ -260,7 +261,8 @@ export function HostToolsPage({ serverId }: { serverId: string }) {
|
||||
</SettingsSection>
|
||||
<SettingsSection title={t("settings.host.tools.toolsTitle")}>
|
||||
<SettingsCard testID="host-page-inject-mcp-card">
|
||||
<HostAgentToolsRow serverId={serverId} />
|
||||
<HostPaseoToolsRow serverId={serverId} />
|
||||
<BrowserToolsRow serverId={serverId} />
|
||||
</SettingsCard>
|
||||
</SettingsSection>
|
||||
</>
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { SettingsRow } from "@/components/settings";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
|
||||
/** The host's "give agents Paseo tools" row, bound to the host's config, for composing inside a SettingsCard. */
|
||||
export function HostPaseoToolsRow({ serverId }: { serverId: string }) {
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
|
||||
const handleValueChange = useCallback(
|
||||
(next: boolean) => {
|
||||
void patchConfig({ mcp: { injectIntoAgents: next } });
|
||||
},
|
||||
[patchConfig],
|
||||
);
|
||||
|
||||
if (!isConnected) return null;
|
||||
|
||||
return (
|
||||
<PaseoToolsRow
|
||||
value={config?.mcp.injectIntoAgents !== false}
|
||||
onValueChange={handleValueChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/** The Paseo tools row on its own, for a caller that decides what the switch is bound to. */
|
||||
export function PaseoToolsRow({
|
||||
value,
|
||||
onValueChange,
|
||||
disabled,
|
||||
}: {
|
||||
value: boolean;
|
||||
onValueChange: (next: boolean) => void;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<SettingsRow
|
||||
label={t("settings.host.orchestration.enableTools.title")}
|
||||
hint={t("settings.host.orchestration.enableTools.hint")}
|
||||
>
|
||||
<Switch
|
||||
value={value}
|
||||
onValueChange={onValueChange}
|
||||
disabled={disabled}
|
||||
accessibilityLabel={t("settings.host.orchestration.enableTools.accessibilityLabel")}
|
||||
/>
|
||||
</SettingsRow>
|
||||
);
|
||||
}
|
||||
@@ -11,14 +11,12 @@ import {
|
||||
SettingsSection,
|
||||
} from "@/components/settings";
|
||||
import { Alert } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { LoadingSpinner } from "@/components/ui/loading-spinner";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useToast } from "@/contexts/toast-api-context";
|
||||
import { useDaemonConfig } from "@/hooks/use-daemon-config";
|
||||
import { useHostFeature } from "@/runtime/host-features";
|
||||
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
|
||||
import { createAgentToolsMasterPatch, isHostAgentToolsEnabled } from "../agent-tools-config";
|
||||
import { SpeechProviderSheet } from "./speech-provider-sheet";
|
||||
import { useLocalSpeechModels } from "./use-local-speech-models";
|
||||
import {
|
||||
@@ -47,25 +45,10 @@ export function HostVoicePage({ serverId }: { serverId: string }) {
|
||||
const toast = useToast();
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
const supported = useHostFeature(serverId, "speechSettings");
|
||||
const supportsToolsConfig = useHostFeature(serverId, "daemonToolsConfig");
|
||||
const { config, patchConfig } = useDaemonConfig(serverId);
|
||||
const localModels = useLocalSpeechModels(serverId);
|
||||
const { refresh: refreshModels } = localModels;
|
||||
const [sheet, setSheet] = useState<OpenSheet | null>(null);
|
||||
const [enablingTools, setEnablingTools] = useState(false);
|
||||
|
||||
const enableHostTools = useCallback(() => {
|
||||
setEnablingTools(true);
|
||||
patchConfig(createAgentToolsMasterPatch({ enabled: true, supportsToolsConfig }))
|
||||
.catch((error: unknown) => {
|
||||
toast.error(
|
||||
`${t("settings.host.orchestration.enableTools.updateFailed")} ${errorMessage(error)}`,
|
||||
);
|
||||
})
|
||||
.finally(() => {
|
||||
setEnablingTools(false);
|
||||
});
|
||||
}, [patchConfig, supportsToolsConfig, t, toast]);
|
||||
|
||||
// Selecting a model changes which models are in use, so the catalog is re-read after a save.
|
||||
const save = useCallback<SavePatch>(
|
||||
@@ -152,28 +135,6 @@ export function HostVoicePage({ serverId }: { serverId: string }) {
|
||||
info={t("settings.voice.voiceMode.info")}
|
||||
testID="voice-voice-mode"
|
||||
>
|
||||
{!isHostAgentToolsEnabled(config) ? (
|
||||
<View style={styles.alertSpacing}>
|
||||
<Alert
|
||||
size="md"
|
||||
variant="warning"
|
||||
title={t("settings.voice.voiceMode.toolsRequiredTitle")}
|
||||
description={t("settings.voice.voiceMode.toolsRequiredDescription")}
|
||||
testID="voice-tools-required-alert"
|
||||
>
|
||||
<Button
|
||||
variant="outline"
|
||||
onPress={enableHostTools}
|
||||
disabled={enablingTools}
|
||||
testID="voice-enable-tools-button"
|
||||
>
|
||||
{enablingTools
|
||||
? t("settings.voice.voiceMode.enablingTools")
|
||||
: t("settings.host.orchestration.enableTools.title")}
|
||||
</Button>
|
||||
</Alert>
|
||||
</View>
|
||||
) : null}
|
||||
<SettingsCard>
|
||||
<FeatureSwitchRow
|
||||
label={t("settings.voice.voiceMode.enabled")}
|
||||
@@ -281,9 +242,6 @@ function summaryLabel(t: TFunction, summary: SpeechSiteSummary): string {
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create((theme) => ({
|
||||
alertSpacing: {
|
||||
marginBottom: theme.spacing[3],
|
||||
},
|
||||
loading: {
|
||||
paddingVertical: theme.spacing[8],
|
||||
alignItems: "center",
|
||||
|
||||
@@ -2304,7 +2304,14 @@ class AcpRuntime {
|
||||
if (!active.deferred && wasOpenQualifying && !isOpen && this.toolKeepsTurnOpen(snapshot)) {
|
||||
active.crossedEndTurn = true;
|
||||
}
|
||||
if (isOpenQualifying) active.replyState = "idle";
|
||||
if (
|
||||
isOpenQualifying ||
|
||||
(!isOpen &&
|
||||
this.toolKeepsTurnOpen(snapshot) &&
|
||||
active.replyState === "settled_with_open_tools")
|
||||
) {
|
||||
active.replyState = "idle";
|
||||
}
|
||||
if (active.deferred) this.scheduleDeferredSettle();
|
||||
}
|
||||
|
||||
|
||||
@@ -5518,7 +5518,7 @@ describe("deferTurnOnRunningTools", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("settles on the reply timer when reply usage arrives before the final background tool completes", async () => {
|
||||
it("keeps the turn open after an interim status reply while another background tool is still running", async () => {
|
||||
const { connector, instances } = connectorHarness({
|
||||
handleRequest(instance, request) {
|
||||
if (request.method !== "session/prompt") return false;
|
||||
@@ -5526,9 +5526,9 @@ describe("deferTurnOnRunningTools", () => {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "bg-u1",
|
||||
toolCallId: "bg-interim-1",
|
||||
name: "run_command",
|
||||
title: "Job 1",
|
||||
title: "Build",
|
||||
status: "in_progress",
|
||||
},
|
||||
});
|
||||
@@ -5536,9 +5536,9 @@ describe("deferTurnOnRunningTools", () => {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "bg-u2",
|
||||
toolCallId: "bg-interim-2",
|
||||
name: "run_command",
|
||||
title: "Job 2",
|
||||
title: "Review",
|
||||
status: "in_progress",
|
||||
},
|
||||
});
|
||||
@@ -5547,12 +5547,12 @@ describe("deferTurnOnRunningTools", () => {
|
||||
},
|
||||
});
|
||||
const registration = runAcpProvider({
|
||||
id: "deferred-usage-before-tool",
|
||||
label: "Deferred Usage Before Tool",
|
||||
id: "deferred-interim-reply-two-tools",
|
||||
label: "Deferred Interim Reply Two Tools",
|
||||
connector,
|
||||
acpOptions: {
|
||||
deferTurnOnRunningTools: {
|
||||
settleDelayMs: 30,
|
||||
settleDelayMs: 40,
|
||||
quietLimitMs: 1_500,
|
||||
},
|
||||
},
|
||||
@@ -5570,9 +5570,9 @@ describe("deferTurnOnRunningTools", () => {
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "usage-first-turn",
|
||||
clientMessageId: "interim-two-tools-turn",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "run jobs" }] },
|
||||
input: { type: "message", content: [{ type: "text", text: "build and review" }] },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
@@ -5580,47 +5580,310 @@ describe("deferTurnOnRunningTools", () => {
|
||||
(event) =>
|
||||
event.type === "timeline.item" &&
|
||||
event.item.type === "tool_call" &&
|
||||
event.item.id === "bg-u2",
|
||||
event.item.id === "bg-interim-2",
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
|
||||
// Job 1 finishes, reply + usage_update arrive while Job 2 is still running.
|
||||
// Job 1 completes and the agent sends an interim status reply + usage while Job 2 is still running.
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: { sessionUpdate: "tool_call_update", toolCallId: "bg-u1", status: "completed" },
|
||||
update: {
|
||||
sessionUpdate: "tool_call_update",
|
||||
toolCallId: "bg-interim-1",
|
||||
status: "completed",
|
||||
},
|
||||
});
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: textChunk("All done."),
|
||||
update: textChunk("Build passed, waiting on review."),
|
||||
});
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: { sessionUpdate: "usage_update", used: 300, size: 1000 },
|
||||
});
|
||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||
// Still running because Job 2 has not completed yet.
|
||||
await new Promise((resolve) => setTimeout(resolve, 60));
|
||||
expect(
|
||||
events.some(
|
||||
(event) =>
|
||||
event.type === "session.turn" &&
|
||||
event.turnId === "acp:usage-first-turn" &&
|
||||
event.turnId === "acp:interim-two-tools-turn" &&
|
||||
event.state !== "started",
|
||||
),
|
||||
).toBe(false);
|
||||
|
||||
// Job 2 completes -> should settle via settleDelayMs, not quietLimitMs.
|
||||
// Job 2 completes; pause longer than settleDelayMs to simulate LLM TTFB before wakeup chunks stream.
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call_update",
|
||||
toolCallId: "bg-interim-2",
|
||||
status: "completed",
|
||||
},
|
||||
});
|
||||
await new Promise((resolve) => setTimeout(resolve, 160));
|
||||
expect(
|
||||
events.some(
|
||||
(event) =>
|
||||
event.type === "session.turn" &&
|
||||
event.turnId === "acp:interim-two-tools-turn" &&
|
||||
event.state !== "started",
|
||||
),
|
||||
).toBe(false);
|
||||
|
||||
// Follow-up reply arrives after all tools are complete -> settles via settleDelayMs.
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "agent_thought_chunk",
|
||||
content: { type: "text", text: "Reviewing findings..." },
|
||||
},
|
||||
});
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: textChunk("Review complete and applied."),
|
||||
});
|
||||
const startedAt = Date.now();
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: { sessionUpdate: "tool_call_update", toolCallId: "bg-u2", status: "completed" },
|
||||
update: { sessionUpdate: "usage_update", used: 450, size: 1000 },
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) =>
|
||||
event.type === "session.turn" &&
|
||||
event.turnId === "acp:usage-first-turn" &&
|
||||
event.turnId === "acp:interim-two-tools-turn" &&
|
||||
event.state === "completed",
|
||||
);
|
||||
expect(Date.now() - startedAt).toBeLessThan(400);
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps the turn open after a mid-wait status check reply on a single background tool", async () => {
|
||||
const { connector, instances } = connectorHarness({
|
||||
handleRequest(instance, request) {
|
||||
if (request.method !== "session/prompt") return false;
|
||||
instance.notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "bg-long",
|
||||
name: "run_command",
|
||||
title: "Long review",
|
||||
status: "in_progress",
|
||||
},
|
||||
});
|
||||
instance.respond(request, { stopReason: "end_turn" });
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const registration = runAcpProvider({
|
||||
id: "deferred-interim-status-check",
|
||||
label: "Deferred Interim Status Check",
|
||||
connector,
|
||||
acpOptions: {
|
||||
deferTurnOnRunningTools: {
|
||||
settleDelayMs: 40,
|
||||
quietLimitMs: 1_500,
|
||||
},
|
||||
},
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["prompt.message"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
await connection.send({
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "interim-status-check-turn",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "run long review" }] },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) =>
|
||||
event.type === "timeline.item" &&
|
||||
event.item.type === "tool_call" &&
|
||||
event.item.id === "bg-long",
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
|
||||
// Mid-wait notification wakes the agent to inspect task status and send a progress update.
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "check-1",
|
||||
name: "manage_task",
|
||||
title: "Manage task",
|
||||
status: "in_progress",
|
||||
},
|
||||
});
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call_update",
|
||||
toolCallId: "check-1",
|
||||
status: "completed",
|
||||
},
|
||||
});
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: textChunk("Still running, continuing to wait."),
|
||||
});
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: { sessionUpdate: "usage_update", used: 250, size: 1000 },
|
||||
});
|
||||
await new Promise((resolve) => setTimeout(resolve, 60));
|
||||
|
||||
// Long background job finally completes; turn must remain open past settleDelayMs for follow-up.
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call_update",
|
||||
toolCallId: "bg-long",
|
||||
status: "completed",
|
||||
},
|
||||
});
|
||||
await new Promise((resolve) => setTimeout(resolve, 160));
|
||||
expect(
|
||||
events.some(
|
||||
(event) =>
|
||||
event.type === "session.turn" &&
|
||||
event.turnId === "acp:interim-status-check-turn" &&
|
||||
event.state !== "started",
|
||||
),
|
||||
).toBe(false);
|
||||
|
||||
// Final reply arrives -> settles quickly via settleDelayMs.
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: textChunk("Long review finished."),
|
||||
});
|
||||
const startedAt = Date.now();
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: { sessionUpdate: "usage_update", used: 400, size: 1000 },
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) =>
|
||||
event.type === "session.turn" &&
|
||||
event.turnId === "acp:interim-status-check-turn" &&
|
||||
event.state === "completed",
|
||||
);
|
||||
expect(Date.now() - startedAt).toBeLessThan(400);
|
||||
} finally {
|
||||
await connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("settles on the reply timer when an open tool is reclassified as an excluded daemon after reply usage", async () => {
|
||||
const { connector, instances } = connectorHarness({
|
||||
handleRequest(instance, request) {
|
||||
if (request.method !== "session/prompt") return false;
|
||||
instance.notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call",
|
||||
toolCallId: "late-daemon",
|
||||
name: "run_command",
|
||||
title: "Dev server",
|
||||
status: "in_progress",
|
||||
},
|
||||
});
|
||||
instance.respond(request, { stopReason: "end_turn" });
|
||||
return true;
|
||||
},
|
||||
});
|
||||
const registration = runAcpProvider({
|
||||
id: "deferred-daemon-reclassify-after-usage",
|
||||
label: "Deferred Daemon Reclassify After Usage",
|
||||
connector,
|
||||
acpOptions: {
|
||||
deferTurnOnRunningTools: {
|
||||
settleDelayMs: 40,
|
||||
quietLimitMs: 1_500,
|
||||
keepsTurnOpen(toolCall) {
|
||||
const input = toolCall.input;
|
||||
if (typeof input !== "object" || input === null || Array.isArray(input)) return true;
|
||||
return input.IsDaemon !== true;
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const connection = await registration.connect({
|
||||
versions: [1],
|
||||
capabilities: ["prompt.message"],
|
||||
});
|
||||
const events: ProviderEvent[] = [];
|
||||
connection.onEvent((event) => events.push(event));
|
||||
try {
|
||||
await connection.send(openInput());
|
||||
await waitForEvent(events, (event) => event.type === "session.ready");
|
||||
await connection.send({
|
||||
type: "session.prompt",
|
||||
sessionId: "session-1",
|
||||
prompt: {
|
||||
clientMessageId: "daemon-reclassify-after-usage-turn",
|
||||
delivery: "auto",
|
||||
input: { type: "message", content: [{ type: "text", text: "start dev server" }] },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) =>
|
||||
event.type === "timeline.item" &&
|
||||
event.item.type === "tool_call" &&
|
||||
event.item.id === "late-daemon",
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 20));
|
||||
|
||||
// Final reply + usage arrive before rawInput identifies the running tool as a daemon.
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: textChunk("Dev server is up."),
|
||||
});
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: { sessionUpdate: "usage_update", used: 200, size: 1000 },
|
||||
});
|
||||
await new Promise((resolve) => setTimeout(resolve, 60));
|
||||
expect(
|
||||
events.some(
|
||||
(event) =>
|
||||
event.type === "session.turn" &&
|
||||
event.turnId === "acp:daemon-reclassify-after-usage-turn" &&
|
||||
event.state !== "started",
|
||||
),
|
||||
).toBe(false);
|
||||
|
||||
// Reclassifying the still-running tool as a daemon releases the settled reply on settleDelayMs.
|
||||
const startedAt = Date.now();
|
||||
instances[1].notify("session/update", {
|
||||
sessionId: "connector-session",
|
||||
update: {
|
||||
sessionUpdate: "tool_call_update",
|
||||
toolCallId: "late-daemon",
|
||||
status: "in_progress",
|
||||
rawInput: { CommandLine: "npm run dev", IsDaemon: true },
|
||||
},
|
||||
});
|
||||
await waitForEvent(
|
||||
events,
|
||||
(event) =>
|
||||
event.type === "session.turn" &&
|
||||
event.turnId === "acp:daemon-reclassify-after-usage-turn" &&
|
||||
event.state === "completed",
|
||||
400,
|
||||
);
|
||||
expect(Date.now() - startedAt).toBeLessThan(400);
|
||||
} finally {
|
||||
|
||||
@@ -239,40 +239,6 @@ const MutableBrowserToolsConfigSchema = z
|
||||
enabled: z.boolean().default(false),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export {
|
||||
BUILTIN_TOOL_GROUPS,
|
||||
DEFAULT_DAEMON_TOOL_GROUPS,
|
||||
type BuiltInToolGroup,
|
||||
} from "./tool-groups.js";
|
||||
|
||||
export const MutableDaemonToolGroupsSchema = z
|
||||
.object({
|
||||
orchestration: z.boolean().optional(),
|
||||
schedules: z.boolean().optional(),
|
||||
changeRequests: z.boolean().optional(),
|
||||
browser: z.boolean().optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const MutableDaemonToolsConfigSchema = z
|
||||
.object({
|
||||
enabled: z.boolean(),
|
||||
groups: MutableDaemonToolGroupsSchema.optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const MutableDaemonToolsConfigPatchSchema = z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
groups: MutableDaemonToolGroupsSchema.optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export type MutableDaemonToolGroups = z.infer<typeof MutableDaemonToolGroupsSchema>;
|
||||
export type MutableDaemonToolsConfig = z.infer<typeof MutableDaemonToolsConfigSchema>;
|
||||
export type MutableDaemonToolsConfigPatch = z.infer<typeof MutableDaemonToolsConfigPatchSchema>;
|
||||
|
||||
const MutableRelayConfigSchema = z
|
||||
.object({
|
||||
enabled: z.boolean(),
|
||||
@@ -286,15 +252,12 @@ export const MutableDaemonConfigSchema = z
|
||||
.object({
|
||||
// COMPAT(relayConfig): added in v0.2.6, remove after 2027-01-31 when old daemons are unsupported.
|
||||
relay: MutableRelayConfigSchema.optional(),
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep while older clients read mcp.injectIntoAgents.
|
||||
mcp: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
injectIntoAgents: z.boolean(),
|
||||
})
|
||||
.passthrough(),
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, optional while older daemons omit it.
|
||||
tools: MutableDaemonToolsConfigSchema.optional(),
|
||||
hostnames: z.union([z.literal(true), z.array(z.string())]).optional(),
|
||||
cors: z
|
||||
.object({
|
||||
@@ -313,7 +276,6 @@ export const MutableDaemonConfigSchema = z
|
||||
catalogRefreshTimeoutMs: z.number().int().positive().optional(),
|
||||
// COMPAT(usageSetting): added in v0.14, remove after 2027-05-01.
|
||||
usage: z.object({ enabled: z.boolean() }).optional(),
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep while older clients read browserTools.enabled.
|
||||
browserTools: MutableBrowserToolsConfigSchema.default({ enabled: false }),
|
||||
providers: z.record(z.string(), MutableDaemonProviderConfigSchema).default({}),
|
||||
metadataGeneration: MutableMetadataGenerationConfigSchema.default({ providers: [] }),
|
||||
@@ -340,12 +302,8 @@ export const MutableDaemonConfigSchema = z
|
||||
export const MutableDaemonConfigPatchSchema = z
|
||||
.object({
|
||||
relay: MutableRelayConfigSchema.partial().optional(),
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep while older clients patch mcp.injectIntoAgents.
|
||||
mcp: z.object({ injectIntoAgents: z.boolean().optional() }).passthrough().optional(),
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, optional while older clients omit it.
|
||||
tools: MutableDaemonToolsConfigPatchSchema.optional(),
|
||||
usage: z.object({ enabled: z.boolean() }).optional(),
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep while older clients patch browserTools.enabled.
|
||||
browserTools: MutableBrowserToolsConfigSchema.partial().optional(),
|
||||
providers: z
|
||||
.record(z.string(), MutableDaemonProviderConfigSchema.partial().passthrough())
|
||||
@@ -4137,8 +4095,6 @@ export const ServerInfoStatusPayloadSchema = z
|
||||
// COMPAT(usageSetting): added in v0.14, remove after 2027-05-01.
|
||||
usageSetting: z.boolean().optional(),
|
||||
usageSources: z.boolean().optional(),
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, remove gate after 2027-06-01.
|
||||
daemonToolsConfig: z.boolean().optional(),
|
||||
// COMPAT(providerInstallation): added in v0.17.0, remove gate after 2027-05-13.
|
||||
providerInstallation: z.boolean().optional(),
|
||||
// COMPAT(providersSnapshotCwd): added in v0.3.2, remove gate after 2027-02-10.
|
||||
|
||||
@@ -800,56 +800,3 @@ describe("provider metrics", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("daemon tools config wire compatibility", () => {
|
||||
const baseConfig = {
|
||||
mcp: { enabled: true, injectIntoAgents: true },
|
||||
browserTools: { enabled: false },
|
||||
};
|
||||
const tools = {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: false,
|
||||
},
|
||||
};
|
||||
|
||||
test("new apps read daemon.tools and daemonToolsConfig feature from a new daemon", () => {
|
||||
const parsed = MutableDaemonConfigSchema.parse({ ...baseConfig, tools });
|
||||
expect(parsed.tools).toEqual(tools);
|
||||
|
||||
const serverInfo = ServerInfoStatusPayloadSchema.parse({
|
||||
status: "server_info",
|
||||
serverId: "srv_1",
|
||||
features: { daemonToolsConfig: true },
|
||||
});
|
||||
expect(serverInfo.features?.daemonToolsConfig).toBe(true);
|
||||
});
|
||||
|
||||
test("new apps accept configs from older daemons that omit tools and daemonToolsConfig", () => {
|
||||
const parsed = MutableDaemonConfigSchema.parse(baseConfig);
|
||||
expect(parsed.tools).toBeUndefined();
|
||||
expect(parsed.mcp.injectIntoAgents).toBe(true);
|
||||
expect(parsed.browserTools.enabled).toBe(false);
|
||||
});
|
||||
|
||||
test("patches accept both unified tools patches and legacy mcp/browserTools patches", () => {
|
||||
expect(
|
||||
MutableDaemonConfigPatchSchema.parse({
|
||||
tools: { enabled: false, groups: { browser: true } },
|
||||
}).tools,
|
||||
).toEqual({ enabled: false, groups: { browser: true } });
|
||||
|
||||
expect(
|
||||
MutableDaemonConfigPatchSchema.parse({
|
||||
mcp: { injectIntoAgents: false },
|
||||
browserTools: { enabled: true },
|
||||
}),
|
||||
).toMatchObject({
|
||||
mcp: { injectIntoAgents: false },
|
||||
browserTools: { enabled: true },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Kept free of Zod so configuration code can read tool groups without loading the wire schemas.
|
||||
export const BUILTIN_TOOL_GROUPS = [
|
||||
"orchestration",
|
||||
"schedules",
|
||||
"changeRequests",
|
||||
"browser",
|
||||
] as const;
|
||||
|
||||
export type BuiltInToolGroup = (typeof BUILTIN_TOOL_GROUPS)[number];
|
||||
|
||||
export const DEFAULT_DAEMON_TOOL_GROUPS = {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: false,
|
||||
} as const satisfies Record<BuiltInToolGroup, boolean>;
|
||||
@@ -18,8 +18,6 @@ import { withTimeout } from "../../utils/promise-timeout.js";
|
||||
import { hashDaemonPassword } from "../auth.js";
|
||||
import { createPaseoDaemon, type PaseoDaemonConfig } from "../bootstrap.js";
|
||||
import { createTestAgentClients } from "../test-utils/fake-agent-client.js";
|
||||
import { DaemonClient } from "../test-utils/daemon-client.js";
|
||||
import { createTestPaseoDaemon } from "../test-utils/paseo-daemon.js";
|
||||
import type {
|
||||
AgentClient,
|
||||
AgentPersistenceHandle,
|
||||
@@ -571,63 +569,6 @@ describe("agent MCP end-to-end (offline)", () => {
|
||||
}
|
||||
}, 30_000);
|
||||
|
||||
test("tool settings saved by a client change the agent's MCP catalog without a restart", async () => {
|
||||
const daemon = await createTestPaseoDaemon();
|
||||
const agentCwd = await mkdtemp(path.join(os.tmpdir(), "paseo-agent-cwd-tools-"));
|
||||
const mcpUrl = `http://127.0.0.1:${daemon.port}/mcp/agents`;
|
||||
const client = await createMcpClient(mcpUrl);
|
||||
const settingsClient = new DaemonClient({
|
||||
url: `ws://127.0.0.1:${daemon.port}/ws`,
|
||||
appVersion: "0.18.2",
|
||||
});
|
||||
let agentId: string | null = null;
|
||||
async function agentToolNames(): Promise<string[]> {
|
||||
const agentClient = new StandardMcpClient({ name: "agent-mcp-e2e", version: "0.0.0" });
|
||||
await agentClient.connect(
|
||||
new StandardMcpHttpTransport(new URL(`${mcpUrl}?callerAgentId=${agentId!}`)),
|
||||
);
|
||||
try {
|
||||
return (await agentClient.listTools()).tools.map((tool) => tool.name);
|
||||
} finally {
|
||||
await agentClient.close();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await settingsClient.connect();
|
||||
const created = await client.callTool({
|
||||
name: "create_agent",
|
||||
args: {
|
||||
cwd: agentCwd,
|
||||
title: "Tool settings",
|
||||
provider: "claude/claude-test-model",
|
||||
mode: "bypassPermissions",
|
||||
initialPrompt: "reply with done and stop",
|
||||
},
|
||||
});
|
||||
const payload = getStructuredContent(created);
|
||||
agentId = typeof payload?.agentId === "string" ? payload.agentId : null;
|
||||
expect(agentId).toBeTruthy();
|
||||
|
||||
const defaults = await agentToolNames();
|
||||
expect(defaults).toEqual(expect.arrayContaining(["create_agent", "create_schedule"]));
|
||||
|
||||
await settingsClient.patchDaemonConfig({ tools: { groups: { schedules: false } } });
|
||||
const withoutSchedules = await agentToolNames();
|
||||
expect(withoutSchedules).toContain("create_agent");
|
||||
expect(withoutSchedules).not.toContain("create_schedule");
|
||||
expect(withoutSchedules).not.toContain("create_heartbeat");
|
||||
} finally {
|
||||
if (agentId) {
|
||||
await client.callTool({ name: "kill_agent", args: { agentId } });
|
||||
}
|
||||
await settingsClient.close();
|
||||
await client.close();
|
||||
await daemon.close();
|
||||
await rm(agentCwd, { recursive: true, force: true });
|
||||
}
|
||||
}, 30_000);
|
||||
|
||||
test("create_agent injects a loopback MCP URL when the daemon listens on all interfaces", async () => {
|
||||
const paseoHome = await mkdtemp(path.join(os.tmpdir(), "paseo-home-"));
|
||||
const staticDir = await mkdtemp(path.join(os.tmpdir(), "paseo-static-"));
|
||||
|
||||
@@ -27,7 +27,6 @@ interface McpToolResult {
|
||||
|
||||
interface McpClient {
|
||||
callTool: (input: { name: string; args?: StructuredContent }) => Promise<McpToolResult>;
|
||||
listTools: () => Promise<{ tools: Array<{ name: string }> }>;
|
||||
close: () => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -87,10 +86,7 @@ async function createMcpClient(url: string): Promise<McpClient> {
|
||||
const transport = new StreamableHTTPClientTransport(new URL(url));
|
||||
const rawClient = await experimental_createMCPClient({ transport });
|
||||
const boundCallTool: McpClient["callTool"] = Reflect.get(rawClient, "callTool").bind(rawClient);
|
||||
const boundListTools: McpClient["listTools"] = Reflect.get(rawClient, "listTools").bind(
|
||||
rawClient,
|
||||
);
|
||||
return { callTool: boundCallTool, listTools: boundListTools, close: () => rawClient.close() };
|
||||
return { callTool: boundCallTool, close: () => rawClient.close() };
|
||||
}
|
||||
|
||||
async function callToolStructured(
|
||||
@@ -1112,18 +1108,16 @@ describe("Suite C: Schedule Tools", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("create_heartbeat is omitted without callerAgentId", async () => {
|
||||
const listed = await topLevelClient.listTools();
|
||||
expect(listed.tools.some((tool) => tool.name === "create_heartbeat")).toBe(false);
|
||||
await expect(
|
||||
topLevelClient.callTool({
|
||||
name: "create_heartbeat",
|
||||
args: {
|
||||
prompt: "say hello",
|
||||
cron: "*/5 * * * *",
|
||||
},
|
||||
}),
|
||||
).rejects.toThrow(/create_heartbeat/i);
|
||||
test("create_heartbeat without callerAgentId throws", async () => {
|
||||
await expectToolError(
|
||||
topLevelClient,
|
||||
"create_heartbeat",
|
||||
{
|
||||
prompt: "say hello",
|
||||
cron: "*/5 * * * *",
|
||||
},
|
||||
/requires an agent-scoped session/i,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -6614,7 +6614,7 @@ describe("create_heartbeat MCP tool", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("is omitted outside an agent-scoped session", async () => {
|
||||
it("requires an agent-scoped session", async () => {
|
||||
const { agentManager, agentStorage } = createTestDeps();
|
||||
const createOrReplace = vi.fn();
|
||||
const server = await createAgentMcpServer({
|
||||
@@ -6624,9 +6624,15 @@ describe("create_heartbeat MCP tool", () => {
|
||||
scheduleService: { createOrReplace } as unknown as ScheduleService,
|
||||
logger,
|
||||
});
|
||||
const tool = registeredTool(server, "create_heartbeat");
|
||||
|
||||
await expect(
|
||||
tool.handler({
|
||||
prompt: "check status",
|
||||
cron: "*/15 * * * *",
|
||||
}),
|
||||
).rejects.toThrow("create_heartbeat requires an agent-scoped session");
|
||||
|
||||
expect(lookupTool(server, "create_heartbeat")).toBeUndefined();
|
||||
expect(lookupTool(server, "delete_heartbeat")).toBeUndefined();
|
||||
expect(createOrReplace).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,16 +24,8 @@ import {
|
||||
ActiveTurnBehaviorSchema,
|
||||
AgentActiveTurnBehaviorSchema,
|
||||
AgentProfileSchema,
|
||||
type DaemonPermission,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import type { DaemonConfigStore } from "../../daemon-config-store.js";
|
||||
import { normalizeDaemonToolGroups, type ResolvedDaemonToolsConfig } from "../../tools-config.js";
|
||||
import {
|
||||
BUILTIN_TOOL_METADATA,
|
||||
isBuiltInToolGroup,
|
||||
isToolAllowedInScope,
|
||||
type BuiltInToolName,
|
||||
} from "./tool-metadata.js";
|
||||
import { featuresFromControls } from "@getpaseo/protocol/option-controls";
|
||||
import {
|
||||
AgentFeatureSchema,
|
||||
@@ -183,9 +175,6 @@ export interface PaseoToolHostDependencies {
|
||||
firstAgentContext?: FirstAgentContext,
|
||||
context?: { background?: boolean; callerWorkspaceId?: string },
|
||||
) => Promise<string>;
|
||||
toolsConfig?: ResolvedDaemonToolsConfig;
|
||||
allowedPermissions?: ReadonlySet<DaemonPermission>;
|
||||
// COMPAT(legacyBrowserToolsOption): added in v0.18.2, prefer toolsConfig.groups.browser.
|
||||
browserToolsEnabled?: boolean;
|
||||
browserToolsBroker?: BrowserToolsBroker | null;
|
||||
paseoToolPolicy?: ProviderPaseoToolsPolicy;
|
||||
@@ -802,30 +791,13 @@ function createToolCatalog(
|
||||
listAgents: (args, context) => localHostOperations.get("list_agents")!(args, context),
|
||||
},
|
||||
});
|
||||
const toolsConfig: ResolvedDaemonToolsConfig = options.toolsConfig ?? {
|
||||
enabled: true,
|
||||
groups: normalizeDaemonToolGroups(undefined, options.browserToolsEnabled),
|
||||
};
|
||||
const registerTool = (
|
||||
name: BuiltInToolName,
|
||||
name: string,
|
||||
config: PaseoToolConfig,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Tool handlers are schema-validated at registration boundaries.
|
||||
handler: (input: any, context: PaseoToolExecutionContext) => Promise<PaseoToolResult>,
|
||||
) => {
|
||||
builtinNames.add(name);
|
||||
const metadata = BUILTIN_TOOL_METADATA[name];
|
||||
if (!isToolAllowedInScope(metadata.scope, scope)) {
|
||||
return;
|
||||
}
|
||||
if (scope === "agent" && !toolsConfig.enabled) {
|
||||
return;
|
||||
}
|
||||
if (isBuiltInToolGroup(metadata.group) && !toolsConfig.groups[metadata.group]) {
|
||||
return;
|
||||
}
|
||||
if (options.allowedPermissions && !options.allowedPermissions.has(metadata.permission)) {
|
||||
return;
|
||||
}
|
||||
if (!isPaseoToolEnabled(options.paseoToolPolicy, name)) {
|
||||
return;
|
||||
}
|
||||
@@ -889,9 +861,6 @@ function createToolCatalog(
|
||||
name,
|
||||
title: config.title,
|
||||
description: config.description ?? name,
|
||||
group: metadata.group,
|
||||
scope: metadata.scope,
|
||||
permission: metadata.permission,
|
||||
inputSchema: config.inputSchema,
|
||||
outputSchema: config.outputSchema,
|
||||
handler: handler as PaseoToolDefinition["handler"],
|
||||
@@ -1481,7 +1450,7 @@ function createToolCatalog(
|
||||
return toCatalog();
|
||||
}
|
||||
|
||||
if (options.browserToolsBroker) {
|
||||
if (options.browserToolsEnabled && options.browserToolsBroker) {
|
||||
registerBrowserTools({
|
||||
registerTool,
|
||||
broker: options.browserToolsBroker,
|
||||
@@ -3588,8 +3557,6 @@ function createToolCatalog(
|
||||
agentManager,
|
||||
callerAgentId,
|
||||
scope,
|
||||
toolsEnabled: toolsConfig.enabled,
|
||||
allowedPermissions: options.allowedPermissions,
|
||||
tools,
|
||||
builtinNames,
|
||||
policy: options.paseoToolPolicy,
|
||||
|
||||
@@ -1,35 +1,20 @@
|
||||
import { z } from "zod";
|
||||
import type { DaemonPermission } from "@getpaseo/protocol/messages";
|
||||
import type { ProviderPaseoToolsPolicy } from "@getpaseo/protocol/provider-config";
|
||||
import type { AgentManager } from "../agent-manager.js";
|
||||
import { isPaseoToolEnabled } from "../paseo-tool-policy.js";
|
||||
import type { PaseoToolDefinition } from "./types.js";
|
||||
import { addModelVisibleStructuredContent } from "./paseo-tool-serialization.js";
|
||||
|
||||
const PLUGIN_TOOL_PERMISSION: DaemonPermission = "workspace.write";
|
||||
|
||||
export function registerPluginTools(options: {
|
||||
agentManager: AgentManager;
|
||||
callerAgentId?: string;
|
||||
scope: "agent" | "top-level";
|
||||
toolsEnabled?: boolean;
|
||||
allowedPermissions?: ReadonlySet<DaemonPermission>;
|
||||
tools: Map<string, PaseoToolDefinition>;
|
||||
builtinNames: Set<string>;
|
||||
policy?: ProviderPaseoToolsPolicy;
|
||||
}): void {
|
||||
const {
|
||||
agentManager,
|
||||
callerAgentId,
|
||||
scope,
|
||||
toolsEnabled = true,
|
||||
allowedPermissions,
|
||||
tools,
|
||||
builtinNames,
|
||||
policy,
|
||||
} = options;
|
||||
if (scope !== "agent" || !callerAgentId || !toolsEnabled) return;
|
||||
if (allowedPermissions && !allowedPermissions.has(PLUGIN_TOOL_PERMISSION)) return;
|
||||
const { agentManager, callerAgentId, scope, tools, builtinNames, policy } = options;
|
||||
if (scope !== "agent" || !callerAgentId) return;
|
||||
for (const tool of agentManager.getPluginTools(callerAgentId)) {
|
||||
if (builtinNames.has(tool.name)) {
|
||||
throw new Error(
|
||||
@@ -41,9 +26,6 @@ export function registerPluginTools(options: {
|
||||
name: tool.name,
|
||||
title: tool.title,
|
||||
description: tool.description,
|
||||
group: "plugin",
|
||||
scope: "agent",
|
||||
permission: PLUGIN_TOOL_PERMISSION,
|
||||
inputSchema: z.fromJSONSchema(tool.inputSchema),
|
||||
async handler(input, { signal }) {
|
||||
const result = await agentManager.executePluginTool({
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
import {
|
||||
BUILTIN_TOOL_GROUPS,
|
||||
type BuiltInToolGroup,
|
||||
type DaemonPermission,
|
||||
} from "@getpaseo/protocol/messages";
|
||||
import type { PaseoToolGroup, PaseoToolScope } from "./types.js";
|
||||
|
||||
export interface PaseoToolMetadata {
|
||||
readonly group: PaseoToolGroup;
|
||||
readonly scope: PaseoToolScope;
|
||||
readonly permission: DaemonPermission;
|
||||
}
|
||||
|
||||
const BUILTIN_TOOL_GROUP_SET: ReadonlySet<string> = new Set(BUILTIN_TOOL_GROUPS);
|
||||
|
||||
export function isBuiltInToolGroup(group: PaseoToolGroup): group is BuiltInToolGroup {
|
||||
return BUILTIN_TOOL_GROUP_SET.has(group);
|
||||
}
|
||||
|
||||
export function isToolAllowedInScope(
|
||||
toolScope: PaseoToolScope,
|
||||
catalogScope: "agent" | "top-level",
|
||||
): boolean {
|
||||
return toolScope === "both" || toolScope === catalogScope;
|
||||
}
|
||||
|
||||
export const BUILTIN_TOOL_METADATA = {
|
||||
// Voice (internal session-attached)
|
||||
speak: { group: "voice", scope: "agent", permission: "workspace.write" },
|
||||
|
||||
// Browser automation (opt-in group, bound to agent workspace)
|
||||
browser_list_hosts: { group: "browser", scope: "agent", permission: "workspace.read" },
|
||||
browser_list_tabs: { group: "browser", scope: "agent", permission: "workspace.read" },
|
||||
browser_new_tab: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_snapshot: { group: "browser", scope: "agent", permission: "workspace.read" },
|
||||
browser_click: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_fill: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_wait: { group: "browser", scope: "agent", permission: "workspace.read" },
|
||||
browser_type: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_keypress: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_navigate: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_back: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_forward: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_reload: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_screenshot: { group: "browser", scope: "agent", permission: "workspace.read" },
|
||||
browser_upload: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_hover: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_select: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_drag: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_logs: { group: "browser", scope: "agent", permission: "workspace.read" },
|
||||
browser_evaluate: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_scroll: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_resize: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
browser_close_tab: { group: "browser", scope: "agent", permission: "workspace.write" },
|
||||
|
||||
// Orchestration (hosts, workspaces, agents, prompts, permissions, providers, scripts, terminals)
|
||||
list_hosts: { group: "orchestration", scope: "both", permission: "daemon.read" },
|
||||
create_workspace: { group: "orchestration", scope: "both", permission: "workspace.manage" },
|
||||
list_workspaces: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
archive_workspace: { group: "orchestration", scope: "both", permission: "workspace.manage" },
|
||||
rename_workspace: { group: "orchestration", scope: "both", permission: "workspace.manage" },
|
||||
update_workspace: { group: "orchestration", scope: "both", permission: "workspace.manage" },
|
||||
create_agent: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
send_agent_prompt: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
get_agent_status: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
get_agent_activity: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
list_agents: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
cancel_agent: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
archive_agent: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
kill_agent: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
update_agent: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
set_agent_mode: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
list_pending_permissions: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
respond_to_permission: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
list_providers: { group: "orchestration", scope: "both", permission: "daemon.read" },
|
||||
list_models: { group: "orchestration", scope: "both", permission: "daemon.read" },
|
||||
list_profiles: { group: "orchestration", scope: "both", permission: "daemon.read" },
|
||||
inspect_provider: { group: "orchestration", scope: "both", permission: "daemon.read" },
|
||||
list_workspace_scripts: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
start_workspace_script: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
stop_workspace_script: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
list_terminals: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
create_terminal: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
kill_terminal: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
capture_terminal: { group: "orchestration", scope: "both", permission: "workspace.read" },
|
||||
send_terminal_keys: { group: "orchestration", scope: "both", permission: "workspace.write" },
|
||||
|
||||
// Schedules & agent-scoped heartbeats
|
||||
create_schedule: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
create_heartbeat: { group: "schedules", scope: "agent", permission: "automation.manage" },
|
||||
delete_heartbeat: { group: "schedules", scope: "agent", permission: "automation.manage" },
|
||||
list_schedules: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
inspect_schedule: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
pause_schedule: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
resume_schedule: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
delete_schedule: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
update_schedule: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
schedule_logs: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
run_schedule_once: { group: "schedules", scope: "both", permission: "automation.manage" },
|
||||
|
||||
// Change request watching (PR/MR subscriptions)
|
||||
subscribe_change_request: {
|
||||
group: "changeRequests",
|
||||
scope: "agent",
|
||||
permission: "workspace.read",
|
||||
},
|
||||
unsubscribe_change_request: {
|
||||
group: "changeRequests",
|
||||
scope: "agent",
|
||||
permission: "workspace.read",
|
||||
},
|
||||
} as const satisfies Record<string, PaseoToolMetadata>;
|
||||
|
||||
export type BuiltInToolName = keyof typeof BUILTIN_TOOL_METADATA;
|
||||
@@ -1,273 +0,0 @@
|
||||
import { DAEMON_PERMISSIONS } from "@getpaseo/protocol/messages";
|
||||
import pino from "pino";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { createAgentMcpServer } from "../mcp-server.js";
|
||||
import type { AgentManager } from "../agent-manager.js";
|
||||
import type { AgentStorage } from "../agent-storage.js";
|
||||
import type { ProviderSnapshotManager } from "../provider-snapshot-manager.js";
|
||||
import type { BrowserToolsBroker } from "../../browser-tools/broker.js";
|
||||
import type { ChangeRequestWatches } from "../change-request-watches/index.js";
|
||||
import { createPaseoToolCatalog, type PaseoToolHostDependencies } from "./paseo-tools.js";
|
||||
|
||||
function createMinimalDeps(
|
||||
overrides: Partial<PaseoToolHostDependencies> = {},
|
||||
): PaseoToolHostDependencies {
|
||||
const pluginTools = [
|
||||
{
|
||||
pluginId: "demo-plugin",
|
||||
pluginInstanceId: "inst-1",
|
||||
name: "demo_plugin_tool",
|
||||
title: "Demo plugin tool",
|
||||
description: "Contributed by plugin",
|
||||
inputSchema: { type: "object", properties: {} },
|
||||
},
|
||||
];
|
||||
const agentManager = {
|
||||
getAgent: () => ({
|
||||
id: "agent-1",
|
||||
provider: "codex",
|
||||
cwd: "/tmp/repo",
|
||||
workspaceId: "ws-1",
|
||||
lifecycle: "idle",
|
||||
currentModeId: "default",
|
||||
availableModes: [],
|
||||
config: { title: "Test Agent" },
|
||||
}),
|
||||
getPluginTools: (agentId: string) => (agentId === "agent-1" ? pluginTools : []),
|
||||
executePluginTool: async () => ({ text: "ok" }),
|
||||
} as unknown as AgentManager;
|
||||
const agentStorage = {
|
||||
getAgent: async () => null,
|
||||
listAgents: async () => [],
|
||||
} as unknown as AgentStorage;
|
||||
const providerSnapshotManager = {
|
||||
getSnapshot: () => [],
|
||||
} as unknown as ProviderSnapshotManager;
|
||||
const browserToolsBroker = {
|
||||
listBrowserHosts: () => [],
|
||||
execute: async () => ({
|
||||
requestId: "req-1",
|
||||
ok: true,
|
||||
result: { command: "list_tabs", tabs: [] },
|
||||
}),
|
||||
} as unknown as BrowserToolsBroker;
|
||||
const changeRequestWatches = {
|
||||
subscribe: async () => ({}),
|
||||
unsubscribe: async () => ({ url: "", removed: true }),
|
||||
} as unknown as ChangeRequestWatches;
|
||||
|
||||
return {
|
||||
agentManager,
|
||||
agentStorage,
|
||||
providerSnapshotManager,
|
||||
browserToolsBroker,
|
||||
changeRequestWatches,
|
||||
logger: pino({ level: "silent" }),
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe("Paseo Tool Registry grouping, scope, and permission metadata", () => {
|
||||
test("every registered tool declares a valid group, scope, and semantic permission", () => {
|
||||
const validPermissions = new Set<string>(DAEMON_PERMISSIONS);
|
||||
const catalog = createPaseoToolCatalog(
|
||||
createMinimalDeps({
|
||||
callerAgentId: "agent-1",
|
||||
enableVoiceTools: true,
|
||||
toolsConfig: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(catalog.tools.size).toBeGreaterThan(45);
|
||||
for (const tool of catalog.tools.values()) {
|
||||
expect([
|
||||
"orchestration",
|
||||
"schedules",
|
||||
"changeRequests",
|
||||
"browser",
|
||||
"voice",
|
||||
"plugin",
|
||||
]).toContain(tool.group);
|
||||
expect(["agent", "top-level", "both"]).toContain(tool.scope);
|
||||
expect(validPermissions.has(tool.permission)).toBe(true);
|
||||
}
|
||||
|
||||
expect(catalog.getTool("create_agent")).toMatchObject({
|
||||
group: "orchestration",
|
||||
scope: "both",
|
||||
permission: "workspace.write",
|
||||
});
|
||||
expect(catalog.getTool("list_agents")).toMatchObject({
|
||||
group: "orchestration",
|
||||
scope: "both",
|
||||
permission: "workspace.read",
|
||||
});
|
||||
expect(catalog.getTool("list_hosts")).toMatchObject({
|
||||
group: "orchestration",
|
||||
scope: "both",
|
||||
permission: "daemon.read",
|
||||
});
|
||||
expect(catalog.getTool("create_schedule")).toMatchObject({
|
||||
group: "schedules",
|
||||
scope: "both",
|
||||
permission: "automation.manage",
|
||||
});
|
||||
expect(catalog.getTool("create_heartbeat")).toMatchObject({
|
||||
group: "schedules",
|
||||
scope: "agent",
|
||||
permission: "automation.manage",
|
||||
});
|
||||
expect(catalog.getTool("subscribe_change_request")).toMatchObject({
|
||||
group: "changeRequests",
|
||||
scope: "agent",
|
||||
permission: "workspace.read",
|
||||
});
|
||||
expect(catalog.getTool("browser_list_tabs")).toMatchObject({
|
||||
group: "browser",
|
||||
scope: "agent",
|
||||
permission: "workspace.read",
|
||||
});
|
||||
expect(catalog.getTool("browser_click")).toMatchObject({
|
||||
group: "browser",
|
||||
scope: "agent",
|
||||
permission: "workspace.write",
|
||||
});
|
||||
expect(catalog.getTool("speak")).toMatchObject({
|
||||
group: "voice",
|
||||
scope: "agent",
|
||||
permission: "workspace.write",
|
||||
});
|
||||
expect(catalog.getTool("demo_plugin_tool")).toMatchObject({
|
||||
group: "plugin",
|
||||
scope: "agent",
|
||||
permission: "workspace.write",
|
||||
});
|
||||
});
|
||||
|
||||
test("filters built-in groups consistently in both native catalog and MCP server adapter", async () => {
|
||||
const deps = createMinimalDeps({
|
||||
callerAgentId: "agent-1",
|
||||
toolsConfig: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: false,
|
||||
schedules: true,
|
||||
changeRequests: false,
|
||||
browser: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
const catalog = createPaseoToolCatalog(deps);
|
||||
const mcpServer = await createAgentMcpServer(deps);
|
||||
const mcpRegisteredNames = Object.keys(
|
||||
(mcpServer as unknown as { _registeredTools: Record<string, unknown> })._registeredTools,
|
||||
).sort();
|
||||
|
||||
expect([...catalog.tools.keys()].sort()).toEqual(mcpRegisteredNames);
|
||||
expect(catalog.getTool("list_agents")).toBeUndefined();
|
||||
expect(catalog.getTool("subscribe_change_request")).toBeUndefined();
|
||||
expect(catalog.getTool("browser_list_tabs")).toBeUndefined();
|
||||
expect(catalog.getTool("create_schedule")).toBeDefined();
|
||||
expect(catalog.getTool("create_heartbeat")).toBeDefined();
|
||||
expect(catalog.getTool("demo_plugin_tool")).toBeDefined();
|
||||
});
|
||||
|
||||
test("keeps voice speak tool and plugin tools available when all built-in groups are disabled", () => {
|
||||
const catalog = createPaseoToolCatalog(
|
||||
createMinimalDeps({
|
||||
callerAgentId: "agent-1",
|
||||
enableVoiceTools: true,
|
||||
toolsConfig: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: false,
|
||||
schedules: false,
|
||||
changeRequests: false,
|
||||
browser: false,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect([...catalog.tools.keys()].sort()).toEqual(["demo_plugin_tool", "speak"]);
|
||||
});
|
||||
|
||||
test("omits all agent tools including speak and plugin tools when master tools.enabled is false", () => {
|
||||
const catalog = createPaseoToolCatalog(
|
||||
createMinimalDeps({
|
||||
callerAgentId: "agent-1",
|
||||
enableVoiceTools: true,
|
||||
toolsConfig: {
|
||||
enabled: false,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect([...catalog.tools.keys()]).toEqual([]);
|
||||
});
|
||||
|
||||
test("top-level catalog excludes agent-only tools and supports permission filtering for external MCP", () => {
|
||||
const fullTopLevel = createPaseoToolCatalog(
|
||||
createMinimalDeps({
|
||||
enableVoiceTools: true,
|
||||
toolsConfig: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(fullTopLevel.getTool("list_agents")).toBeDefined();
|
||||
expect(fullTopLevel.getTool("create_schedule")).toBeDefined();
|
||||
expect(fullTopLevel.getTool("create_heartbeat")).toBeUndefined();
|
||||
expect(fullTopLevel.getTool("delete_heartbeat")).toBeUndefined();
|
||||
expect(fullTopLevel.getTool("subscribe_change_request")).toBeUndefined();
|
||||
expect(fullTopLevel.getTool("unsubscribe_change_request")).toBeUndefined();
|
||||
expect(fullTopLevel.getTool("browser_list_tabs")).toBeUndefined();
|
||||
expect(fullTopLevel.getTool("speak")).toBeUndefined();
|
||||
expect(fullTopLevel.getTool("demo_plugin_tool")).toBeUndefined();
|
||||
|
||||
const readOnlyTopLevel = createPaseoToolCatalog(
|
||||
createMinimalDeps({
|
||||
toolsConfig: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
allowedPermissions: new Set(["daemon.read", "workspace.read"]),
|
||||
}),
|
||||
);
|
||||
|
||||
expect(readOnlyTopLevel.getTool("list_hosts")).toBeDefined();
|
||||
expect(readOnlyTopLevel.getTool("list_agents")).toBeDefined();
|
||||
expect(readOnlyTopLevel.getTool("create_agent")).toBeUndefined();
|
||||
expect(readOnlyTopLevel.getTool("create_workspace")).toBeUndefined();
|
||||
expect(readOnlyTopLevel.getTool("create_schedule")).toBeUndefined();
|
||||
for (const tool of readOnlyTopLevel.tools.values()) {
|
||||
expect(["daemon.read", "workspace.read"]).toContain(tool.permission);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,10 +1,6 @@
|
||||
import type { z } from "zod";
|
||||
import type { BuiltInToolGroup, DaemonPermission } from "@getpaseo/protocol/messages";
|
||||
import type { ProviderPaseoToolsPolicy } from "@getpaseo/protocol/provider-config";
|
||||
|
||||
export type PaseoToolGroup = BuiltInToolGroup | "voice" | "plugin";
|
||||
export type PaseoToolScope = "agent" | "top-level" | "both";
|
||||
|
||||
export class PaseoToolInputError extends Error {
|
||||
readonly status = 400;
|
||||
|
||||
@@ -38,9 +34,6 @@ export interface PaseoToolConfig {
|
||||
export interface PaseoToolDefinition extends PaseoToolConfig {
|
||||
name: string;
|
||||
description: string;
|
||||
group: PaseoToolGroup;
|
||||
scope: PaseoToolScope;
|
||||
permission: DaemonPermission;
|
||||
handler: (input: unknown, context: PaseoToolExecutionContext) => Promise<PaseoToolResult>;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,11 +126,6 @@ import {
|
||||
import { CheckoutDiffManager } from "./checkout-diff-manager.js";
|
||||
import { ScheduleService } from "./schedule/service.js";
|
||||
import { DaemonConfigStore, type MutableDaemonConfig } from "./daemon-config-store.js";
|
||||
import {
|
||||
resolveDaemonToolsFromConfigOptions,
|
||||
resolveDaemonToolsFromMutableConfig,
|
||||
type ResolvedDaemonToolsConfig,
|
||||
} from "./tools-config.js";
|
||||
import { createOrchestrationSkills } from "./orchestration-skills/index.js";
|
||||
import {
|
||||
resolveReloadableConfig,
|
||||
@@ -352,7 +347,6 @@ export interface PaseoDaemonConfig {
|
||||
allowedHosts?: HostnamesConfig;
|
||||
hostnames?: HostnamesConfig;
|
||||
trustedProxies?: true | string[];
|
||||
tools?: ResolvedDaemonToolsConfig;
|
||||
mcpEnabled?: boolean;
|
||||
mcpInjectIntoAgents?: boolean;
|
||||
usageEnabled?: boolean;
|
||||
@@ -530,23 +524,12 @@ function isListenOverridden(config: PaseoDaemonConfig): boolean {
|
||||
|
||||
function createInitialMutableDaemonConfig(config: ResolvedDaemonSettings): MutableDaemonConfig {
|
||||
const providers = config.providerOverrides ?? {};
|
||||
const tools = resolveDaemonToolsFromConfigOptions({
|
||||
tools: config.tools,
|
||||
mcpEnabled: config.mcpEnabled,
|
||||
mcpInjectIntoAgents: config.mcpInjectIntoAgents,
|
||||
browserToolsEnabled: config.browserToolsEnabled,
|
||||
});
|
||||
|
||||
const initialConfig: MutableDaemonConfig = {
|
||||
relay: createInitialRelayConfig(config),
|
||||
tools: {
|
||||
enabled: tools.enabled,
|
||||
groups: { ...tools.groups },
|
||||
},
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep legacy fields synced for older clients.
|
||||
mcp: {
|
||||
enabled: config.mcpEnabled ?? true,
|
||||
injectIntoAgents: tools.enabled,
|
||||
injectIntoAgents: config.mcpInjectIntoAgents ?? true,
|
||||
},
|
||||
...(config.hostnames !== undefined ? { hostnames: config.hostnames } : {}),
|
||||
cors: { allowedOrigins: config.corsAllowedOrigins },
|
||||
@@ -557,8 +540,7 @@ function createInitialMutableDaemonConfig(config: ResolvedDaemonSettings): Mutab
|
||||
? { catalogRefreshTimeoutMs: config.providerCatalogRefreshTimeoutMs }
|
||||
: {}),
|
||||
usage: { enabled: config.usageEnabled !== false },
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep legacy field synced for older clients.
|
||||
browserTools: { enabled: tools.groups.browser },
|
||||
browserTools: { enabled: config.browserToolsEnabled ?? false },
|
||||
providers,
|
||||
metadataGeneration: createInitialMetadataGenerationConfig(config),
|
||||
autoArchiveAfterMerge: config.autoArchiveAfterMerge ?? false,
|
||||
@@ -1636,7 +1618,6 @@ export async function createPaseoDaemon(
|
||||
clearWorkspaceArchiving,
|
||||
ensureWorkspaceForCreate: createAgentCommandDependencies.ensureWorkspaceForCreate,
|
||||
createPaseoWorktree: createAgentCommandDependencies.createPaseoWorktree,
|
||||
toolsConfig: getCurrentToolsConfig(),
|
||||
browserToolsEnabled: browserToolsPolicy.isEnabled(),
|
||||
browserToolsBroker,
|
||||
paseoToolPolicy:
|
||||
@@ -1653,19 +1634,16 @@ export async function createPaseoDaemon(
|
||||
});
|
||||
const createAgentToolCatalog = (runtime: PaseoToolRuntimeContext) =>
|
||||
createPaseoToolCatalog(createAgentToolHostDependencies(runtime));
|
||||
const getCurrentToolsConfig = () => resolveDaemonToolsFromMutableConfig(daemonConfigStore.get());
|
||||
let mcpEnabled = config.mcpEnabled ?? true;
|
||||
const setAgentProviderToolsEnabled = (enabled: boolean) => {
|
||||
agentProviderRuntime.setPaseoToolCatalog(
|
||||
enabled ? createPaseoAgentToolManifest(createAgentToolHostDependencies({})) : null,
|
||||
);
|
||||
};
|
||||
agentManager.setPaseoToolCatalogFactory(createAgentToolCatalog);
|
||||
const initialTools = getCurrentToolsConfig();
|
||||
const initialInject = mcpEnabled && initialTools.enabled;
|
||||
agentManager.setPaseoToolsEnabled(initialInject);
|
||||
setAgentProviderToolsEnabled(initialInject);
|
||||
agentManager.setPaseoToolsEnabled(config.mcpInjectIntoAgents !== false);
|
||||
setAgentProviderToolsEnabled(config.mcpEnabled !== false && config.mcpInjectIntoAgents !== false);
|
||||
|
||||
let mcpEnabled = config.mcpEnabled ?? true;
|
||||
let agentMcpBaseUrl: string | null = null;
|
||||
{
|
||||
const agentMcpRoute = "/mcp/agents";
|
||||
@@ -1852,28 +1830,21 @@ export async function createPaseoDaemon(
|
||||
);
|
||||
}
|
||||
const mcpBaseUrl = loopbackAgentEndpoint.getMcpBaseUrl();
|
||||
const syncAgentToolsState = () => {
|
||||
const currentTools = getCurrentToolsConfig();
|
||||
const inject = mcpEnabled && currentTools.enabled;
|
||||
agentMcpBaseUrl = inject ? mcpBaseUrl : null;
|
||||
agentManager.setMcpBaseUrl(agentMcpBaseUrl);
|
||||
agentManager.setPaseoToolsEnabled(inject);
|
||||
setAgentProviderToolsEnabled(inject);
|
||||
};
|
||||
syncAgentToolsState();
|
||||
agentMcpBaseUrl =
|
||||
!mcpEnabled || config.mcpInjectIntoAgents === false ? null : mcpBaseUrl;
|
||||
agentManager.setMcpBaseUrl(agentMcpBaseUrl);
|
||||
agentManager.setPaseoToolsEnabled(mcpEnabled && config.mcpInjectIntoAgents !== false);
|
||||
daemonConfigStore.onFieldChange("mcp.enabled", (value) => {
|
||||
mcpEnabled = value !== false;
|
||||
syncAgentToolsState();
|
||||
const inject = daemonConfigStore.get().mcp.injectIntoAgents !== false;
|
||||
agentManager.setMcpBaseUrl(mcpEnabled && inject ? mcpBaseUrl : null);
|
||||
agentManager.setPaseoToolsEnabled(mcpEnabled && inject);
|
||||
setAgentProviderToolsEnabled(mcpEnabled && inject);
|
||||
});
|
||||
daemonConfigStore.onFieldChange("tools", () => {
|
||||
syncAgentToolsState();
|
||||
});
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep older config watchers in sync.
|
||||
daemonConfigStore.onFieldChange("mcp.injectIntoAgents", () => {
|
||||
syncAgentToolsState();
|
||||
});
|
||||
daemonConfigStore.onFieldChange("browserTools.enabled", () => {
|
||||
syncAgentToolsState();
|
||||
daemonConfigStore.onFieldChange("mcp.injectIntoAgents", (value) => {
|
||||
agentManager.setMcpBaseUrl(mcpEnabled && value ? mcpBaseUrl : null);
|
||||
agentManager.setPaseoToolsEnabled(mcpEnabled && value !== false);
|
||||
setAgentProviderToolsEnabled(mcpEnabled && value !== false);
|
||||
});
|
||||
daemonConfigStore.onFieldChange("appendSystemPrompt", (value) => {
|
||||
agentManager.setAppendSystemPrompt(typeof value === "string" ? value : "");
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { DaemonConfigStore } from "../daemon-config-store.js";
|
||||
import { resolveDaemonToolsFromMutableConfig } from "../tools-config.js";
|
||||
import type { DaemonConfigStore, MutableDaemonConfig } from "../daemon-config-store.js";
|
||||
|
||||
export interface BrowserToolsPolicy {
|
||||
isEnabled(): boolean;
|
||||
@@ -9,7 +8,14 @@ export class DaemonConfigBrowserToolsPolicy implements BrowserToolsPolicy {
|
||||
public constructor(private readonly configStore: Pick<DaemonConfigStore, "get">) {}
|
||||
|
||||
public isEnabled(): boolean {
|
||||
const tools = resolveDaemonToolsFromMutableConfig(this.configStore.get());
|
||||
return tools.enabled && tools.groups.browser;
|
||||
return readBrowserToolsEnabled(this.configStore.get());
|
||||
}
|
||||
}
|
||||
|
||||
function readBrowserToolsEnabled(config: MutableDaemonConfig): boolean {
|
||||
const browserTools = config.browserTools;
|
||||
if (typeof browserTools !== "object" || browserTools === null || Array.isArray(browserTools)) {
|
||||
return false;
|
||||
}
|
||||
return browserTools.enabled === true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { z } from "zod";
|
||||
import { BrowserAutomationBrowserIdSchema } from "@getpaseo/protocol/browser-automation/rpc-schemas";
|
||||
import type { BrowserToolsBroker } from "./broker.js";
|
||||
import type { BrowserHostTarget, BrowserToolsResponsePayload } from "./errors.js";
|
||||
import type { BuiltInToolName } from "../agent/tools/tool-metadata.js";
|
||||
import type {
|
||||
PaseoToolConfig,
|
||||
PaseoToolExecutionContext,
|
||||
@@ -17,7 +16,7 @@ interface CallerAgentContext {
|
||||
|
||||
export interface RegisterBrowserToolsOptions {
|
||||
registerTool: (
|
||||
name: BuiltInToolName,
|
||||
name: string,
|
||||
config: PaseoToolConfig,
|
||||
handler: (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Tool inputs are validated by the catalog before execution.
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, test } from "vitest";
|
||||
|
||||
import { DaemonConfigBrowserToolsPolicy } from "./browser-tools/policy.js";
|
||||
import { loadConfig, resolveReloadableConfig } from "./config.js";
|
||||
import { DaemonConfigStore } from "./daemon-config-store.js";
|
||||
import { loadPersistedConfig } from "./persisted-config.js";
|
||||
import { resolveDaemonToolsFromConfigOptions } from "./tools-config.js";
|
||||
|
||||
const roots: string[] = [];
|
||||
|
||||
async function createPaseoHome(config: unknown): Promise<string> {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "paseo-config-tools-"));
|
||||
roots.push(root);
|
||||
const paseoHome = path.join(root, ".paseo");
|
||||
await mkdir(paseoHome, { recursive: true });
|
||||
await writeFile(path.join(paseoHome, "config.json"), JSON.stringify(config, null, 2));
|
||||
return paseoHome;
|
||||
}
|
||||
|
||||
describe("daemon.tools config resolution and backward compatibility", () => {
|
||||
afterEach(async () => {
|
||||
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
|
||||
});
|
||||
|
||||
test("defaults tools.enabled to true and browser group to false on fresh installs", async () => {
|
||||
const home = await createPaseoHome({ version: 1 });
|
||||
const config = loadConfig(home, { env: {} });
|
||||
|
||||
expect(config.tools).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: false,
|
||||
},
|
||||
});
|
||||
expect(config.mcpInjectIntoAgents).toBe(true);
|
||||
expect(config.browserToolsEnabled).toBe(false);
|
||||
});
|
||||
|
||||
test("reads explicit daemon.tools config including individual group overrides", async () => {
|
||||
const home = await createPaseoHome({
|
||||
version: 1,
|
||||
daemon: {
|
||||
tools: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: false,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const config = loadConfig(home, { env: {} });
|
||||
|
||||
expect(config.tools).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: false,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
expect(config.browserToolsEnabled).toBe(true);
|
||||
});
|
||||
|
||||
test("falls back to legacy daemon.mcp.enabled and daemon.mcp.injectIntoAgents when daemon.tools is absent", async () => {
|
||||
const disabledMcpHome = await createPaseoHome({
|
||||
version: 1,
|
||||
daemon: { mcp: { enabled: false } },
|
||||
});
|
||||
expect(loadConfig(disabledMcpHome, { env: {} }).tools?.enabled).toBe(false);
|
||||
|
||||
const disabledInjectHome = await createPaseoHome({
|
||||
version: 1,
|
||||
daemon: { mcp: { enabled: true, injectIntoAgents: false } },
|
||||
});
|
||||
expect(loadConfig(disabledInjectHome, { env: {} }).tools?.enabled).toBe(false);
|
||||
|
||||
const enabledInjectHome = await createPaseoHome({
|
||||
version: 1,
|
||||
daemon: { mcp: { enabled: true, injectIntoAgents: true } },
|
||||
});
|
||||
expect(loadConfig(enabledInjectHome, { env: {} }).tools?.enabled).toBe(true);
|
||||
});
|
||||
|
||||
test("falls back to legacy daemon.browserTools.enabled when daemon.tools.groups.browser is absent", async () => {
|
||||
const home = await createPaseoHome({
|
||||
version: 1,
|
||||
daemon: { browserTools: { enabled: true } },
|
||||
});
|
||||
const config = loadConfig(home, { env: {} });
|
||||
|
||||
expect(config.tools).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
expect(config.browserToolsEnabled).toBe(true);
|
||||
});
|
||||
|
||||
test("prefers explicit daemon.tools over legacy daemon.mcp and daemon.browserTools fields", async () => {
|
||||
const home = await createPaseoHome({
|
||||
version: 1,
|
||||
daemon: {
|
||||
mcp: { enabled: false, injectIntoAgents: false },
|
||||
browserTools: { enabled: true },
|
||||
tools: {
|
||||
enabled: true,
|
||||
groups: { browser: false },
|
||||
},
|
||||
},
|
||||
});
|
||||
const config = loadConfig(home, { env: {} });
|
||||
|
||||
expect(config.tools).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: false,
|
||||
},
|
||||
});
|
||||
expect(config.browserToolsEnabled).toBe(false);
|
||||
});
|
||||
|
||||
test("preserves legacy CLI override flags (--no-mcp, --no-inject-mcp)", async () => {
|
||||
const home = await createPaseoHome({
|
||||
version: 1,
|
||||
daemon: { tools: { enabled: true } },
|
||||
});
|
||||
|
||||
expect(loadConfig(home, { env: {}, cli: { mcpEnabled: false } }).tools?.enabled).toBe(false);
|
||||
expect(loadConfig(home, { env: {}, cli: { mcpInjectIntoAgents: false } }).tools?.enabled).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test("DaemonConfigStore patches tools, preserves group choices across master off/on, and syncs legacy fields", async () => {
|
||||
const home = await createPaseoHome({ version: 1 });
|
||||
const store = new DaemonConfigStore(home, {
|
||||
relay: { enabled: false },
|
||||
tools: {
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: false,
|
||||
},
|
||||
},
|
||||
mcp: { enabled: true, injectIntoAgents: true },
|
||||
browserTools: { enabled: false },
|
||||
providers: {},
|
||||
metadataGeneration: { providers: [] },
|
||||
autoArchiveAfterMerge: false,
|
||||
enableTerminalAgentHooks: false,
|
||||
appendSystemPrompt: "",
|
||||
});
|
||||
const browserPolicy = new DaemonConfigBrowserToolsPolicy(store);
|
||||
|
||||
expect(browserPolicy.isEnabled()).toBe(false);
|
||||
|
||||
await store.patch({ tools: { groups: { browser: true, schedules: false } } });
|
||||
expect(store.get().tools).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
expect(store.get().browserTools.enabled).toBe(true);
|
||||
expect(browserPolicy.isEnabled()).toBe(true);
|
||||
|
||||
// Turning master switch off disables browser policy while preserving saved group selections.
|
||||
await store.patch({ tools: { enabled: false } });
|
||||
expect(store.get().tools).toEqual({
|
||||
enabled: false,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
expect(store.get().mcp.injectIntoAgents).toBe(false);
|
||||
expect(browserPolicy.isEnabled()).toBe(false);
|
||||
|
||||
// Turning master switch back on restores saved group selections.
|
||||
await store.patch({ tools: { enabled: true } });
|
||||
expect(store.get().tools?.groups).toEqual({
|
||||
orchestration: true,
|
||||
schedules: false,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
});
|
||||
expect(store.get().mcp.injectIntoAgents).toBe(true);
|
||||
expect(browserPolicy.isEnabled()).toBe(true);
|
||||
expect(loadPersistedConfig(home).daemon?.tools).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
schedules: false,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("legacy patches update tools and live reload applies daemon.tools changes without restart", async () => {
|
||||
const home = await createPaseoHome({ version: 1 });
|
||||
const toMutable = (persisted: ReturnType<typeof loadPersistedConfig>) => {
|
||||
const reloaded = resolveReloadableConfig(persisted, { env: {} });
|
||||
const tools = resolveDaemonToolsFromConfigOptions({
|
||||
tools: reloaded.tools,
|
||||
mcpEnabled: reloaded.mcpEnabled,
|
||||
mcpInjectIntoAgents: reloaded.mcpInjectIntoAgents,
|
||||
browserToolsEnabled: reloaded.browserToolsEnabled,
|
||||
});
|
||||
return {
|
||||
mutable: {
|
||||
relay: { enabled: false },
|
||||
tools,
|
||||
mcp: { enabled: reloaded.mcpEnabled ?? true, injectIntoAgents: tools.enabled },
|
||||
browserTools: { enabled: tools.groups.browser },
|
||||
providers: {},
|
||||
metadataGeneration: { providers: [] },
|
||||
autoArchiveAfterMerge: false,
|
||||
enableTerminalAgentHooks: false,
|
||||
appendSystemPrompt: "",
|
||||
},
|
||||
overrideControlledPaths: reloaded.overrideControlledPaths,
|
||||
};
|
||||
};
|
||||
const initial = loadPersistedConfig(home);
|
||||
const store = new DaemonConfigStore(home, toMutable(initial).mutable, undefined, {
|
||||
startupPersisted: initial,
|
||||
reloadSource: { resolve: toMutable },
|
||||
});
|
||||
|
||||
await store.patch({ mcp: { injectIntoAgents: false }, browserTools: { enabled: true } });
|
||||
expect(store.get().tools).toEqual({
|
||||
enabled: false,
|
||||
groups: {
|
||||
orchestration: true,
|
||||
schedules: true,
|
||||
changeRequests: true,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
|
||||
await store.patch({ tools: { enabled: false, groups: { browser: true } } });
|
||||
const persistedAfterPatch = loadPersistedConfig(home);
|
||||
await writeFile(
|
||||
path.join(home, "config.json"),
|
||||
JSON.stringify({
|
||||
...persistedAfterPatch,
|
||||
daemon: {
|
||||
...persistedAfterPatch.daemon,
|
||||
tools: {
|
||||
enabled: true,
|
||||
groups: { orchestration: false, schedules: true, changeRequests: false, browser: true },
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const reloadResult = await store.reload();
|
||||
expect(reloadResult.restartRequiredPaths).toEqual([]);
|
||||
expect(reloadResult.appliedPaths).toEqual([
|
||||
"daemon.tools.enabled",
|
||||
"daemon.tools.groups.changeRequests",
|
||||
"daemon.tools.groups.orchestration",
|
||||
]);
|
||||
expect(store.get().tools).toEqual({
|
||||
enabled: true,
|
||||
groups: {
|
||||
orchestration: false,
|
||||
schedules: true,
|
||||
changeRequests: false,
|
||||
browser: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -25,7 +25,6 @@ import { resolveSpeechConfig } from "./speech/speech-config-resolver.js";
|
||||
import { readSpeechSettings } from "./speech/speech-settings.js";
|
||||
import { mergeHostnames, parseHostnamesEnv, type HostnamesConfig } from "./hostnames.js";
|
||||
import { resolveGitProcessPolicy } from "../utils/git-process-scheduler.js";
|
||||
import { normalizeDaemonToolGroups, type ResolvedDaemonToolsConfig } from "./tools-config.js";
|
||||
|
||||
export {
|
||||
loadPersistedConfig,
|
||||
@@ -115,8 +114,6 @@ export type CliConfigOverrides = Partial<{
|
||||
listen: string;
|
||||
relayEnabled: boolean;
|
||||
relayUseTls: boolean;
|
||||
toolsEnabled: boolean;
|
||||
// COMPAT(legacyMcpCliFlags): added in v0.18.2, remove after 2027-06-01.
|
||||
mcpEnabled: boolean;
|
||||
mcpInjectIntoAgents: boolean;
|
||||
webUiEnabled: boolean;
|
||||
@@ -531,37 +528,8 @@ function resolveUsageEnabled(persisted: ReturnType<typeof loadPersistedConfig>):
|
||||
return persisted.daemon?.usage?.enabled !== false;
|
||||
}
|
||||
|
||||
function resolveToolsEnabledFromCli(cli: CliConfigOverrides | undefined): boolean | undefined {
|
||||
if (cli?.toolsEnabled !== undefined) return cli.toolsEnabled;
|
||||
// COMPAT(legacyMcpCliFlags): added in v0.18.2, remove after 2027-06-01.
|
||||
if (cli?.mcpEnabled === false || cli?.mcpInjectIntoAgents === false) return false;
|
||||
if (cli?.mcpInjectIntoAgents === true) return true;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function resolveToolsEnabledFromPersisted(
|
||||
persisted: ReturnType<typeof loadPersistedConfig>,
|
||||
): boolean {
|
||||
const explicit = persisted.daemon?.tools?.enabled;
|
||||
if (explicit !== undefined) return explicit;
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
const legacyMcp = persisted.daemon?.mcp;
|
||||
if (legacyMcp?.enabled === false || legacyMcp?.injectIntoAgents === false) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function resolveToolsConfig(
|
||||
cli: CliConfigOverrides | undefined,
|
||||
persisted: ReturnType<typeof loadPersistedConfig>,
|
||||
): ResolvedDaemonToolsConfig {
|
||||
const enabled = resolveToolsEnabledFromCli(cli) ?? resolveToolsEnabledFromPersisted(persisted);
|
||||
return {
|
||||
enabled,
|
||||
groups: normalizeDaemonToolGroups(
|
||||
persisted.daemon?.tools?.groups,
|
||||
persisted.daemon?.browserTools?.enabled,
|
||||
),
|
||||
};
|
||||
function resolveBrowserToolsEnabled(persisted: ReturnType<typeof loadPersistedConfig>): boolean {
|
||||
return persisted.daemon?.browserTools?.enabled ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -581,18 +549,12 @@ function resolveStaticLoadConfigSettings(
|
||||
cli: CliConfigOverrides | undefined,
|
||||
persisted: ReturnType<typeof loadPersistedConfig>,
|
||||
) {
|
||||
const tools = resolveToolsConfig(cli, persisted);
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
const mcpEnabled =
|
||||
cli?.mcpEnabled ??
|
||||
(persisted.daemon?.tools?.enabled !== undefined ? true : persisted.daemon?.mcp?.enabled) ??
|
||||
true;
|
||||
return {
|
||||
tools,
|
||||
mcpEnabled,
|
||||
mcpInjectIntoAgents: tools.enabled,
|
||||
mcpEnabled: cli?.mcpEnabled ?? persisted.daemon?.mcp?.enabled ?? true,
|
||||
mcpInjectIntoAgents:
|
||||
cli?.mcpInjectIntoAgents ?? persisted.daemon?.mcp?.injectIntoAgents ?? false,
|
||||
usageEnabled: resolveUsageEnabled(persisted),
|
||||
browserToolsEnabled: tools.groups.browser,
|
||||
browserToolsEnabled: resolveBrowserToolsEnabled(persisted),
|
||||
autoArchiveAfterMerge: persisted.daemon?.autoArchiveAfterMerge ?? false,
|
||||
appendSystemPrompt: resolveAppendSystemPrompt(persisted),
|
||||
...resolveProfileLists(persisted),
|
||||
@@ -618,7 +580,6 @@ export type ResolvedDaemonSettings = Pick<
|
||||
| "corsAllowedOrigins"
|
||||
| "hostnames"
|
||||
| "trustedProxies"
|
||||
| "tools"
|
||||
| "mcpEnabled"
|
||||
| "mcpInjectIntoAgents"
|
||||
| "usageEnabled"
|
||||
@@ -782,7 +743,6 @@ function resolveCoreDaemonOverridePaths(
|
||||
if (cli?.listen !== undefined || env.PASEO_LISTEN !== undefined) {
|
||||
paths.push("daemon.listen");
|
||||
}
|
||||
if (cli?.toolsEnabled !== undefined) paths.push("daemon.tools.enabled");
|
||||
if (cli?.mcpEnabled !== undefined) paths.push("daemon.mcp.enabled");
|
||||
if (cli?.mcpInjectIntoAgents !== undefined) paths.push("daemon.mcp.injectIntoAgents");
|
||||
// Hostname sources append instead of replacing one another, so a launch value
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
import type { AgentSkillSelection } from "@getpaseo/protocol/messages";
|
||||
import type { SpeechSettingsPatch } from "@getpaseo/protocol/speech/rpc-schemas";
|
||||
import { mergeSpeechSettingsPatch, type SpeechSettingsOwner } from "./speech/speech-settings.js";
|
||||
import { resolveDaemonToolsFromMutableConfig } from "./tools-config.js";
|
||||
|
||||
export type { MutableDaemonConfig, MutableDaemonConfigPatch } from "@getpaseo/protocol/messages";
|
||||
|
||||
@@ -31,19 +30,8 @@ type ProviderOverride = import("./agent/provider-launch-config.js").ProviderOver
|
||||
|
||||
interface SupportedMutableConfigPatch {
|
||||
relay?: { enabled?: boolean; requireProtectedSecurity?: boolean };
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
mcp?: { injectIntoAgents?: boolean };
|
||||
tools?: {
|
||||
enabled?: boolean;
|
||||
groups?: {
|
||||
orchestration?: boolean;
|
||||
schedules?: boolean;
|
||||
changeRequests?: boolean;
|
||||
browser?: boolean;
|
||||
};
|
||||
};
|
||||
usage?: { enabled: boolean };
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
browserTools?: { enabled?: boolean };
|
||||
providers?: MutableDaemonConfig["providers"];
|
||||
removeProviders?: string[];
|
||||
@@ -301,11 +289,6 @@ const RELOADABLE_PATHS = [
|
||||
"daemon.relay.requireProtectedSecurity",
|
||||
"daemon.mcp.enabled",
|
||||
"daemon.mcp.injectIntoAgents",
|
||||
"daemon.tools.enabled",
|
||||
"daemon.tools.groups.orchestration",
|
||||
"daemon.tools.groups.schedules",
|
||||
"daemon.tools.groups.changeRequests",
|
||||
"daemon.tools.groups.browser",
|
||||
"daemon.usage.enabled",
|
||||
"daemon.browserTools.enabled",
|
||||
"daemon.hostnames",
|
||||
@@ -334,11 +317,6 @@ const PERSISTED_TO_MUTABLE_PATH = new Map<string, string>([
|
||||
["daemon.relay.requireProtectedSecurity", "relay.requireProtectedSecurity"],
|
||||
["daemon.mcp.enabled", "mcp.enabled"],
|
||||
["daemon.mcp.injectIntoAgents", "mcp.injectIntoAgents"],
|
||||
["daemon.tools.enabled", "tools.enabled"],
|
||||
["daemon.tools.groups.orchestration", "tools.groups.orchestration"],
|
||||
["daemon.tools.groups.schedules", "tools.groups.schedules"],
|
||||
["daemon.tools.groups.changeRequests", "tools.groups.changeRequests"],
|
||||
["daemon.tools.groups.browser", "tools.groups.browser"],
|
||||
["daemon.usage.enabled", "usage.enabled"],
|
||||
["daemon.browserTools.enabled", "browserTools.enabled"],
|
||||
["daemon.hostnames", "hostnames"],
|
||||
@@ -362,17 +340,6 @@ const PERSISTED_TO_MUTABLE_PATH = new Map<string, string>([
|
||||
["pluginsEnabled", "pluginsEnabled"],
|
||||
]);
|
||||
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
// Legacy mcp/browserTools paths mirror into daemon.tools on the mutable snapshot;
|
||||
// only report the persisted leaf that actually changed on disk during reload.
|
||||
const ALIASED_TOOL_RELOAD_PATHS = new Set<string>([
|
||||
"daemon.mcp.enabled",
|
||||
"daemon.mcp.injectIntoAgents",
|
||||
"daemon.browserTools.enabled",
|
||||
"daemon.tools.enabled",
|
||||
"daemon.tools.groups.browser",
|
||||
]);
|
||||
|
||||
function pathBelongsTo(path: string, owner: string): boolean {
|
||||
return path === owner || path.startsWith(`${owner}.`);
|
||||
}
|
||||
@@ -434,95 +401,9 @@ function pickMetadataGenerationPatch(
|
||||
return Object.keys(picked).length > 0 ? { metadataGeneration: picked } : {};
|
||||
}
|
||||
|
||||
function mergePatchedToolGroups(
|
||||
currentGroups: ReturnType<typeof resolveDaemonToolsFromMutableConfig>["groups"],
|
||||
patch: Pick<SupportedMutableConfigPatch, "tools" | "browserTools">,
|
||||
) {
|
||||
const patchGroups = patch.tools?.groups;
|
||||
return {
|
||||
orchestration: patchGroups?.orchestration ?? currentGroups.orchestration,
|
||||
schedules: patchGroups?.schedules ?? currentGroups.schedules,
|
||||
changeRequests: patchGroups?.changeRequests ?? currentGroups.changeRequests,
|
||||
browser: patchGroups?.browser ?? patch.browserTools?.enabled ?? currentGroups.browser,
|
||||
};
|
||||
}
|
||||
|
||||
function syncToolsConfigOnMerged(
|
||||
merged: MutableDaemonConfig,
|
||||
current: MutableDaemonConfig,
|
||||
patch: Pick<SupportedMutableConfigPatch, "tools" | "mcp" | "browserTools">,
|
||||
): void {
|
||||
const hasToolsChange =
|
||||
patch.tools !== undefined ||
|
||||
patch.mcp?.injectIntoAgents !== undefined ||
|
||||
patch.browserTools?.enabled !== undefined;
|
||||
if (!hasToolsChange) return;
|
||||
const currentTools = resolveDaemonToolsFromMutableConfig(current);
|
||||
const nextTools = {
|
||||
enabled: patch.tools?.enabled ?? patch.mcp?.injectIntoAgents ?? currentTools.enabled,
|
||||
groups: mergePatchedToolGroups(currentTools.groups, patch),
|
||||
};
|
||||
merged.tools = nextTools;
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, keep legacy wire fields synced for older clients.
|
||||
merged.mcp = { ...merged.mcp, injectIntoAgents: nextTools.enabled };
|
||||
merged.browserTools = { ...merged.browserTools, enabled: nextTools.groups.browser };
|
||||
}
|
||||
|
||||
function mergeToolsDaemonPatch(
|
||||
next: NonNullable<PersistedConfig["daemon"]>,
|
||||
patch: Pick<SupportedMutableConfigPatch, "tools" | "mcp" | "browserTools">,
|
||||
): void {
|
||||
if (patch.tools !== undefined) {
|
||||
next.tools = {
|
||||
...next.tools,
|
||||
...(patch.tools.enabled !== undefined ? { enabled: patch.tools.enabled } : {}),
|
||||
...(patch.tools.groups ? { groups: { ...next.tools?.groups, ...patch.tools.groups } } : {}),
|
||||
};
|
||||
}
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
if (patch.mcp?.injectIntoAgents !== undefined) {
|
||||
next.mcp = { ...next.mcp, injectIntoAgents: patch.mcp.injectIntoAgents };
|
||||
if (patch.tools?.enabled === undefined && next.tools !== undefined) {
|
||||
next.tools = { ...next.tools, enabled: patch.mcp.injectIntoAgents };
|
||||
}
|
||||
}
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
if (patch.browserTools?.enabled !== undefined) {
|
||||
next.browserTools = { ...next.browserTools, enabled: patch.browserTools.enabled };
|
||||
if (patch.tools?.groups?.browser === undefined && next.tools?.groups?.browser !== undefined) {
|
||||
next.tools = {
|
||||
...next.tools,
|
||||
groups: { ...next.tools.groups, browser: patch.browserTools.enabled },
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pickToolsPatch(
|
||||
tools: MutableDaemonConfigPatch["tools"],
|
||||
): Pick<SupportedMutableConfigPatch, "tools"> {
|
||||
if (!tools) return {};
|
||||
const groups: NonNullable<NonNullable<SupportedMutableConfigPatch["tools"]>["groups"]> = {
|
||||
...(tools.groups?.orchestration !== undefined
|
||||
? { orchestration: tools.groups.orchestration }
|
||||
: {}),
|
||||
...(tools.groups?.schedules !== undefined ? { schedules: tools.groups.schedules } : {}),
|
||||
...(tools.groups?.changeRequests !== undefined
|
||||
? { changeRequests: tools.groups.changeRequests }
|
||||
: {}),
|
||||
...(tools.groups?.browser !== undefined ? { browser: tools.groups.browser } : {}),
|
||||
};
|
||||
const picked: NonNullable<SupportedMutableConfigPatch["tools"]> = {
|
||||
...(tools.enabled !== undefined ? { enabled: tools.enabled } : {}),
|
||||
...(Object.keys(groups).length > 0 ? { groups } : {}),
|
||||
};
|
||||
return Object.keys(picked).length > 0 ? { tools: picked } : {};
|
||||
}
|
||||
|
||||
function pickSupportedPatchFields(patch: MutableDaemonConfigPatch): SupportedMutableConfigPatch {
|
||||
return {
|
||||
...pickRelayPatch(patch.relay),
|
||||
...pickToolsPatch(patch.tools),
|
||||
usage: patch.usage,
|
||||
...(patch.mcp?.injectIntoAgents !== undefined
|
||||
? { mcp: { injectIntoAgents: patch.mcp.injectIntoAgents } }
|
||||
@@ -693,7 +574,6 @@ export class DaemonConfigStore {
|
||||
const removedProviders = Array.from(new Set(removeProviders));
|
||||
const merged = deepMerge(this.current, configPatch);
|
||||
merged.providers = withNormalizedProvidersShownModels(merged.providers);
|
||||
syncToolsConfigOnMerged(merged, this.current, patch);
|
||||
if (speechPatch !== undefined) Object.assign(merged, this.readPatchedSpeech(speechPatch));
|
||||
if (parsedPatch.skills?.selection !== undefined) {
|
||||
merged.skills = { selection: parsedPatch.skills.selection };
|
||||
@@ -832,12 +712,6 @@ export class DaemonConfigStore {
|
||||
if (resolved.overrideControlledPaths.some((owner) => pathBelongsTo(persistedPath, owner))) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
ALIASED_TOOL_RELOAD_PATHS.has(persistedPath) &&
|
||||
!changedSinceLastApply.some((path) => pathBelongsTo(path, persistedPath))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
const mutablePath = PERSISTED_TO_MUTABLE_PATH.get(persistedPath);
|
||||
return (
|
||||
mutablePath !== undefined &&
|
||||
@@ -1101,8 +975,13 @@ function mergeMutableDaemonPatch(
|
||||
if (patch.relay?.requireProtectedSecurity !== undefined) {
|
||||
next.relay = { ...next.relay, requireProtectedSecurity: patch.relay.requireProtectedSecurity };
|
||||
}
|
||||
mergeToolsDaemonPatch(next, patch);
|
||||
if (patch.mcp?.injectIntoAgents !== undefined) {
|
||||
next.mcp = { ...next.mcp, injectIntoAgents: patch.mcp.injectIntoAgents };
|
||||
}
|
||||
if (patch.usage) next.usage = patch.usage;
|
||||
if (patch.browserTools?.enabled !== undefined) {
|
||||
next.browserTools = { ...next.browserTools, enabled: patch.browserTools.enabled };
|
||||
}
|
||||
if (patch.autoArchiveAfterMerge !== undefined) {
|
||||
next.autoArchiveAfterMerge = patch.autoArchiveAfterMerge;
|
||||
}
|
||||
|
||||
@@ -111,13 +111,11 @@ function applyCliFlagOverrides(config: ReturnType<typeof loadConfig>): void {
|
||||
}
|
||||
if (process.argv.includes("--no-mcp")) {
|
||||
config.mcpEnabled = false;
|
||||
if (config.tools) config.tools = { ...config.tools, enabled: false };
|
||||
cli.mcpEnabled = false;
|
||||
override("daemon.mcp.enabled");
|
||||
}
|
||||
if (process.argv.includes("--no-inject-mcp")) {
|
||||
config.mcpInjectIntoAgents = false;
|
||||
if (config.tools) config.tools = { ...config.tools, enabled: false };
|
||||
cli.mcpInjectIntoAgents = false;
|
||||
override("daemon.mcp.injectIntoAgents");
|
||||
}
|
||||
|
||||
@@ -274,7 +274,6 @@ export const PersistedConfigSchema = z
|
||||
.describe(
|
||||
'Express trusted proxy setting for X-Forwarded-* headers. Defaults to ["loopback"]. Use true only when the final trusted proxy overwrites client-supplied forwarded headers.',
|
||||
),
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
mcp: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
@@ -282,23 +281,7 @@ export const PersistedConfigSchema = z
|
||||
})
|
||||
.passthrough()
|
||||
.optional(),
|
||||
tools: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
groups: z
|
||||
.object({
|
||||
orchestration: z.boolean().optional(),
|
||||
schedules: z.boolean().optional(),
|
||||
changeRequests: z.boolean().optional(),
|
||||
browser: z.boolean().optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
usage: z.object({ enabled: z.boolean().optional() }).optional(),
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
browserTools: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
|
||||
@@ -203,7 +203,6 @@ import {
|
||||
setProjectCustomIcon,
|
||||
} from "../utils/project-custom-icon.js";
|
||||
import { VoiceSessions } from "./session/voice/index.js";
|
||||
import { resolveDaemonToolsFromMutableConfig } from "./tools-config.js";
|
||||
import { CheckoutSession } from "./session/checkout/checkout-session.js";
|
||||
import {
|
||||
createWorkspaceGitObserverService,
|
||||
@@ -1468,10 +1467,6 @@ export class Session {
|
||||
tts,
|
||||
stt,
|
||||
voice,
|
||||
isAgentToolsEnabled: () =>
|
||||
this.daemonConfigStore && typeof this.daemonConfigStore.get === "function"
|
||||
? resolveDaemonToolsFromMutableConfig(this.daemonConfigStore.get()).enabled
|
||||
: true,
|
||||
voiceBridge,
|
||||
dictation,
|
||||
},
|
||||
|
||||
@@ -82,10 +82,7 @@ function createFakeHost(): FakeVoiceHost {
|
||||
};
|
||||
}
|
||||
|
||||
function createVoiceSession(
|
||||
tts: TextToSpeechProvider | null = null,
|
||||
options: { isAgentToolsEnabled?: () => boolean } = {},
|
||||
) {
|
||||
function createVoiceSession(tts: TextToSpeechProvider | null = null) {
|
||||
let speakHandler: VoiceSpeakHandler | undefined;
|
||||
const detector = new FakeVoiceTurnDetectionSession();
|
||||
const sttSession = new FakeVoiceSttSession();
|
||||
@@ -104,7 +101,6 @@ function createVoiceSession(
|
||||
sessionId: "voice-session-test",
|
||||
sttLanguage: "en",
|
||||
tts,
|
||||
isAgentToolsEnabled: options.isAgentToolsEnabled,
|
||||
voiceBridge: {
|
||||
registerVoiceSpeakHandler: (_id, handler) => {
|
||||
speakHandler = handler;
|
||||
@@ -329,32 +325,4 @@ describe("VoiceSession streaming transcription", () => {
|
||||
|
||||
await voiceSession.cleanup();
|
||||
});
|
||||
|
||||
test("refuses voice mode with an actionable error when agent tools are disabled", async () => {
|
||||
const reloadAgentSession = vi.fn(
|
||||
async (agentId: string) => ({ id: agentId }) as unknown as ManagedAgent,
|
||||
);
|
||||
const { voiceSession, host } = createVoiceSession(null, {
|
||||
isAgentToolsEnabled: () => false,
|
||||
});
|
||||
host.reloadAgentSession = reloadAgentSession;
|
||||
|
||||
await voiceSession.handleSetVoiceMode(true, VOICE_AGENT_ID, "req-tools-off");
|
||||
|
||||
expect(reloadAgentSession).not.toHaveBeenCalled();
|
||||
expect(voiceSession.isActiveForAgent(VOICE_AGENT_ID)).toBe(false);
|
||||
expect(host.emitted).toContainEqual({
|
||||
type: "set_voice_mode_response",
|
||||
payload: {
|
||||
requestId: "req-tools-off",
|
||||
enabled: false,
|
||||
agentId: null,
|
||||
accepted: false,
|
||||
error: "Voice mode requires agent tools. Turn on Enable tools in Settings > Tools.",
|
||||
reasonCode: "tools_disabled",
|
||||
retryable: false,
|
||||
missingModelIds: [],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,10 +21,6 @@ import type { AgentSessionConfig } from "../../agent/agent-sdk-types.js";
|
||||
import type { LocalSpeechModelId } from "../../speech/providers/local/models.js";
|
||||
import { toResolver, type Resolvable } from "../../speech/provider-resolver.js";
|
||||
import type { SpeechReadinessSnapshot, SpeechReadinessState } from "../../speech/speech-runtime.js";
|
||||
import {
|
||||
VOICE_REQUIRES_TOOLS_MESSAGE,
|
||||
VOICE_REQUIRES_TOOLS_REASON_CODE,
|
||||
} from "../../tools-config.js";
|
||||
|
||||
const PCM_SAMPLE_RATE = 16000;
|
||||
const PCM_CHANNELS = 1;
|
||||
@@ -61,25 +57,21 @@ interface VoiceTranscriptionResultPayload {
|
||||
debugRecordingPath?: string;
|
||||
}
|
||||
|
||||
type VoiceFeatureUnavailableReasonCode =
|
||||
| SpeechReadinessSnapshot["voiceFeature"]["reasonCode"]
|
||||
| typeof VOICE_REQUIRES_TOOLS_REASON_CODE;
|
||||
|
||||
interface VoiceFeatureUnavailableContext {
|
||||
reasonCode: VoiceFeatureUnavailableReasonCode;
|
||||
reasonCode: SpeechReadinessSnapshot["voiceFeature"]["reasonCode"];
|
||||
message: string;
|
||||
retryable: boolean;
|
||||
missingModelIds: LocalSpeechModelId[];
|
||||
}
|
||||
|
||||
interface VoiceFeatureUnavailableResponseMetadata {
|
||||
reasonCode?: VoiceFeatureUnavailableReasonCode;
|
||||
reasonCode?: SpeechReadinessSnapshot["voiceFeature"]["reasonCode"];
|
||||
retryable?: boolean;
|
||||
missingModelIds?: LocalSpeechModelId[];
|
||||
}
|
||||
|
||||
class VoiceFeatureUnavailableError extends Error {
|
||||
readonly reasonCode: VoiceFeatureUnavailableReasonCode;
|
||||
readonly reasonCode: SpeechReadinessSnapshot["voiceFeature"]["reasonCode"];
|
||||
readonly retryable: boolean;
|
||||
readonly missingModelIds: LocalSpeechModelId[];
|
||||
|
||||
@@ -150,7 +142,6 @@ export interface VoiceSessionOptions {
|
||||
voice?: {
|
||||
turnDetection?: Resolvable<TurnDetectionProvider | null>;
|
||||
};
|
||||
isAgentToolsEnabled?: () => boolean;
|
||||
voiceBridge?: {
|
||||
registerVoiceSpeakHandler?: (agentId: string, handler: VoiceSpeakHandler) => void;
|
||||
unregisterVoiceSpeakHandler?: (agentId: string) => void;
|
||||
@@ -215,24 +206,13 @@ export class VoiceSession {
|
||||
) => void;
|
||||
private readonly unregisterVoiceCallerContext?: (agentId: string) => void;
|
||||
private readonly getSpeechReadiness?: () => SpeechReadinessSnapshot;
|
||||
private readonly isAgentToolsEnabled?: () => boolean;
|
||||
|
||||
private voiceModeAgentId: string | null = null;
|
||||
private voiceModeBaseConfig: VoiceModeBaseConfig | null = null;
|
||||
|
||||
constructor(options: VoiceSessionOptions) {
|
||||
const {
|
||||
host,
|
||||
logger,
|
||||
sessionId,
|
||||
sttLanguage,
|
||||
tts,
|
||||
stt,
|
||||
voice,
|
||||
isAgentToolsEnabled,
|
||||
voiceBridge,
|
||||
dictation,
|
||||
} = options;
|
||||
const { host, logger, sessionId, sttLanguage, tts, stt, voice, voiceBridge, dictation } =
|
||||
options;
|
||||
this.host = host;
|
||||
this.onIdle = options.onIdle;
|
||||
this.sessionLogger = logger;
|
||||
@@ -241,7 +221,6 @@ export class VoiceSession {
|
||||
this.abortController = new AbortController();
|
||||
|
||||
this.resolveVoiceTurnDetection = toResolver(voice?.turnDetection ?? null);
|
||||
this.isAgentToolsEnabled = isAgentToolsEnabled;
|
||||
this.registerVoiceSpeakHandler = voiceBridge?.registerVoiceSpeakHandler;
|
||||
this.unregisterVoiceSpeakHandler = voiceBridge?.unregisterVoiceSpeakHandler;
|
||||
this.registerVoiceCallerContext = voiceBridge?.registerVoiceCallerContext;
|
||||
@@ -352,21 +331,14 @@ export class VoiceSession {
|
||||
mode: "voice_mode" | "dictation",
|
||||
): VoiceFeatureUnavailableContext | null {
|
||||
const readiness = this.getSpeechReadiness?.();
|
||||
const modeReadiness = readiness ? this.resolveModeReadinessState(readiness, mode) : null;
|
||||
if (modeReadiness && !modeReadiness.enabled) {
|
||||
return this.toVoiceFeatureUnavailableContext(modeReadiness);
|
||||
}
|
||||
if (mode === "voice_mode" && this.isAgentToolsEnabled && !this.isAgentToolsEnabled()) {
|
||||
return {
|
||||
reasonCode: VOICE_REQUIRES_TOOLS_REASON_CODE,
|
||||
message: VOICE_REQUIRES_TOOLS_MESSAGE,
|
||||
retryable: false,
|
||||
missingModelIds: [],
|
||||
};
|
||||
}
|
||||
if (!readiness || !modeReadiness) {
|
||||
if (!readiness) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const modeReadiness = this.resolveModeReadinessState(readiness, mode);
|
||||
if (!modeReadiness.enabled) {
|
||||
return this.toVoiceFeatureUnavailableContext(modeReadiness);
|
||||
}
|
||||
if (!readiness.voiceFeature.available) {
|
||||
return this.toVoiceFeatureUnavailableContext(readiness.voiceFeature);
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import type { MutableDaemonConfig, MutableDaemonToolGroups } from "@getpaseo/protocol/messages";
|
||||
import { DEFAULT_DAEMON_TOOL_GROUPS, type BuiltInToolGroup } from "@getpaseo/protocol/tool-groups";
|
||||
|
||||
export type ResolvedDaemonToolGroups = Record<BuiltInToolGroup, boolean>;
|
||||
|
||||
export interface ResolvedDaemonToolsConfig {
|
||||
enabled: boolean;
|
||||
groups: ResolvedDaemonToolGroups;
|
||||
}
|
||||
|
||||
export const VOICE_REQUIRES_TOOLS_REASON_CODE = "tools_disabled" as const;
|
||||
export const VOICE_REQUIRES_TOOLS_MESSAGE =
|
||||
"Voice mode requires agent tools. Turn on Enable tools in Settings > Tools.";
|
||||
|
||||
export function normalizeDaemonToolGroups(
|
||||
groups?: MutableDaemonToolGroups,
|
||||
legacyBrowserEnabled?: boolean,
|
||||
): ResolvedDaemonToolGroups {
|
||||
return {
|
||||
orchestration: groups?.orchestration ?? DEFAULT_DAEMON_TOOL_GROUPS.orchestration,
|
||||
schedules: groups?.schedules ?? DEFAULT_DAEMON_TOOL_GROUPS.schedules,
|
||||
changeRequests: groups?.changeRequests ?? DEFAULT_DAEMON_TOOL_GROUPS.changeRequests,
|
||||
// COMPAT(legacyBrowserToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
browser: groups?.browser ?? legacyBrowserEnabled ?? DEFAULT_DAEMON_TOOL_GROUPS.browser,
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveDaemonToolsFromMutableConfig(
|
||||
config: Pick<MutableDaemonConfig, "tools" | "mcp" | "browserTools">,
|
||||
): ResolvedDaemonToolsConfig {
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
const enabled =
|
||||
config.tools?.enabled ??
|
||||
(config.mcp.enabled !== false && config.mcp.injectIntoAgents !== false);
|
||||
const groups = normalizeDaemonToolGroups(config.tools?.groups, config.browserTools?.enabled);
|
||||
return { enabled, groups };
|
||||
}
|
||||
|
||||
export function resolveDaemonToolsFromConfigOptions(options: {
|
||||
tools?: { enabled?: boolean; groups?: MutableDaemonToolGroups };
|
||||
mcpEnabled?: boolean;
|
||||
mcpInjectIntoAgents?: boolean;
|
||||
browserToolsEnabled?: boolean;
|
||||
}): ResolvedDaemonToolsConfig {
|
||||
// COMPAT(legacyToolsConfig): added in v0.18.2, remove after 2027-06-01.
|
||||
const enabled =
|
||||
options.tools?.enabled ??
|
||||
(options.mcpEnabled !== false && options.mcpInjectIntoAgents !== false);
|
||||
const groups = normalizeDaemonToolGroups(options.tools?.groups, options.browserToolsEnabled);
|
||||
return { enabled, groups };
|
||||
}
|
||||
@@ -292,7 +292,6 @@ function createVoiceAssistantWebSocketServer(params: {
|
||||
}),
|
||||
};
|
||||
const daemonConfigStore = {
|
||||
get: () => ({ tools: { enabled: true }, mcp: { injectIntoAgents: true } }),
|
||||
onApply: () => () => {},
|
||||
onChange: () => () => {},
|
||||
};
|
||||
|
||||
@@ -120,7 +120,6 @@ function createServer(
|
||||
...agentManagerOverrides,
|
||||
};
|
||||
const daemonConfigStore = {
|
||||
get: () => ({ tools: { enabled: true }, mcp: { injectIntoAgents: true } }),
|
||||
onApply: vi.fn(() => () => {}),
|
||||
onChange: vi.fn(() => () => {}),
|
||||
};
|
||||
|
||||
@@ -253,34 +253,14 @@ function createWorkspaceAutoNameStub(): WorkspaceAutoName {
|
||||
|
||||
function createServer(options?: {
|
||||
speechReadiness?: SpeechReadinessSnapshot | null;
|
||||
toolsEnabled?: boolean;
|
||||
logger?: ReturnType<typeof createLogger>;
|
||||
startPaused?: boolean;
|
||||
auth?: { password: string; localCredential: () => string | null };
|
||||
}) {
|
||||
const speechReadiness = options?.speechReadiness ?? null;
|
||||
let toolsEnabled = options?.toolsEnabled ?? true;
|
||||
const changeListeners = new Set<(config: unknown) => void>();
|
||||
const daemonConfigStore = {
|
||||
get: () => ({
|
||||
tools: { enabled: toolsEnabled },
|
||||
mcp: { enabled: true, injectIntoAgents: toolsEnabled },
|
||||
browserTools: { enabled: false },
|
||||
}),
|
||||
setToolsEnabled: (next: boolean) => {
|
||||
toolsEnabled = next;
|
||||
const config = daemonConfigStore.get();
|
||||
for (const listener of changeListeners) {
|
||||
listener(config);
|
||||
}
|
||||
},
|
||||
onApply: vi.fn(() => () => {}),
|
||||
onChange: vi.fn((listener: (config: unknown) => void) => {
|
||||
changeListeners.add(listener);
|
||||
return () => {
|
||||
changeListeners.delete(listener);
|
||||
};
|
||||
}),
|
||||
onChange: vi.fn(() => () => {}),
|
||||
};
|
||||
const logger = options?.logger ?? createLogger();
|
||||
return new VoiceAssistantWebSocketServer(
|
||||
@@ -1268,38 +1248,6 @@ describe("relay external socket reconnect behavior", () => {
|
||||
await server.close();
|
||||
});
|
||||
|
||||
test("marks voice mode unavailable while keeping dictation ready when agent tools are disabled", async () => {
|
||||
const speechReadiness = createReadySpeechReadinessSnapshot();
|
||||
const server = createServer({ speechReadiness, toolsEnabled: false });
|
||||
|
||||
const socket = new MockSocket();
|
||||
const serverInfo = (await attachRelayAndHello({
|
||||
server,
|
||||
socket,
|
||||
clientId: "cid-server-info-tools-disabled-voice",
|
||||
})) as {
|
||||
features?: { daemonToolsConfig?: unknown };
|
||||
capabilities?: {
|
||||
voice?: {
|
||||
dictation?: { enabled?: unknown; reason?: unknown };
|
||||
voice?: { enabled?: unknown; reason?: unknown };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
expect(serverInfo.features?.daemonToolsConfig).toBe(true);
|
||||
expect(serverInfo.capabilities?.voice?.dictation).toEqual({
|
||||
enabled: true,
|
||||
reason: "",
|
||||
});
|
||||
expect(serverInfo.capabilities?.voice?.voice).toEqual({
|
||||
enabled: true,
|
||||
reason: "Voice mode requires agent tools. Turn on Enable tools in Settings > Tools.",
|
||||
});
|
||||
|
||||
await server.close();
|
||||
});
|
||||
|
||||
test("routes inbound terminal frames to session.handleBinaryFrame", async () => {
|
||||
const server = createServer();
|
||||
|
||||
|
||||
@@ -152,7 +152,6 @@ function createServer(
|
||||
})),
|
||||
};
|
||||
const daemonConfigStore = {
|
||||
get: () => ({ tools: { enabled: true }, mcp: { injectIntoAgents: true } }),
|
||||
onApply: vi.fn(() => () => {}),
|
||||
onChange: vi.fn(() => () => {}),
|
||||
};
|
||||
|
||||
@@ -33,10 +33,6 @@ import { randomUUID } from "node:crypto";
|
||||
import { monitorEventLoopDelay } from "node:perf_hooks";
|
||||
import type { AgentManager, AgentMetricsSnapshot } from "./agent/agent-manager.js";
|
||||
import type { AgentStorage } from "./agent/agent-storage.js";
|
||||
import {
|
||||
resolveDaemonToolsFromMutableConfig,
|
||||
VOICE_REQUIRES_TOOLS_MESSAGE,
|
||||
} from "./tools-config.js";
|
||||
import type { DownloadTokenStore } from "./file-download/token-store.js";
|
||||
import type { TerminalManager } from "../terminal/terminal-manager.js";
|
||||
import type pino from "pino";
|
||||
@@ -431,14 +427,11 @@ function resolveCapabilityReason(params: {
|
||||
|
||||
function buildServerCapabilities(params: {
|
||||
readiness: SpeechReadinessSnapshot | null;
|
||||
agentToolsEnabled?: boolean;
|
||||
}): ServerCapabilities | undefined {
|
||||
const readiness = params.readiness;
|
||||
if (!readiness) {
|
||||
return undefined;
|
||||
}
|
||||
const voiceToolsUnavailable =
|
||||
readiness.realtimeVoice.enabled && params.agentToolsEnabled === false;
|
||||
return {
|
||||
voice: {
|
||||
dictation: toServerCapabilityState({
|
||||
@@ -448,18 +441,13 @@ function buildServerCapabilities(params: {
|
||||
readiness,
|
||||
}),
|
||||
}),
|
||||
voice: voiceToolsUnavailable
|
||||
? {
|
||||
enabled: true,
|
||||
reason: VOICE_REQUIRES_TOOLS_MESSAGE,
|
||||
}
|
||||
: toServerCapabilityState({
|
||||
state: readiness.realtimeVoice,
|
||||
reason: resolveCapabilityReason({
|
||||
state: readiness.realtimeVoice,
|
||||
readiness,
|
||||
}),
|
||||
}),
|
||||
voice: toServerCapabilityState({
|
||||
state: readiness.realtimeVoice,
|
||||
reason: resolveCapabilityReason({
|
||||
state: readiness.realtimeVoice,
|
||||
readiness,
|
||||
}),
|
||||
}),
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -883,7 +871,6 @@ export class VoiceAssistantWebSocketServer {
|
||||
this.providerSnapshotManager = providerSnapshotManager;
|
||||
this.serverCapabilities = buildServerCapabilities({
|
||||
readiness: this.speech?.getReadiness() ?? null,
|
||||
agentToolsEnabled: this.isAgentToolsEnabled(),
|
||||
});
|
||||
this.unsubscribeSpeechReadiness =
|
||||
this.speech?.onReadinessChange((snapshot) => {
|
||||
@@ -896,7 +883,6 @@ export class VoiceAssistantWebSocketServer {
|
||||
});
|
||||
const unsubscribeChange = this.daemonConfigStore.onChange((config) => {
|
||||
this.broadcastDaemonConfigChanged(config);
|
||||
this.publishSpeechReadiness(this.speech?.getReadiness() ?? null);
|
||||
});
|
||||
this.unsubscribeDaemonConfigChange = () => {
|
||||
unsubscribeProviderConfig();
|
||||
@@ -1170,17 +1156,8 @@ export class VoiceAssistantWebSocketServer {
|
||||
}
|
||||
}
|
||||
|
||||
private isAgentToolsEnabled(): boolean {
|
||||
return resolveDaemonToolsFromMutableConfig(this.daemonConfigStore.get()).enabled;
|
||||
}
|
||||
|
||||
public publishSpeechReadiness(readiness: SpeechReadinessSnapshot | null): void {
|
||||
this.updateServerCapabilities(
|
||||
buildServerCapabilities({
|
||||
readiness,
|
||||
agentToolsEnabled: this.isAgentToolsEnabled(),
|
||||
}),
|
||||
);
|
||||
this.updateServerCapabilities(buildServerCapabilities({ readiness }));
|
||||
}
|
||||
|
||||
public updateServerCapabilities(capabilities: ServerCapabilities | null | undefined): void {
|
||||
@@ -2152,8 +2129,6 @@ export class VoiceAssistantWebSocketServer {
|
||||
relayProtectedSecurity: true,
|
||||
usageSetting: true,
|
||||
usageSources: true,
|
||||
// COMPAT(daemonToolsConfig): added in v0.18.2, remove gate after 2027-06-01.
|
||||
daemonToolsConfig: true,
|
||||
providerInstallation: true,
|
||||
ownedSubscriptions: true,
|
||||
providerOptionControls: true,
|
||||
|
||||
@@ -70,33 +70,6 @@
|
||||
},
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"tools": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"groups": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"orchestration": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"schedules": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"changeRequests": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"browser": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"usage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -25,23 +25,20 @@ Because you share the browser with the agent, you can watch it work — and step
|
||||
|
||||
Browser tools are off by default. Turn them on per host:
|
||||
|
||||
- **In the app:** open **Settings → Host → Tools & prompts**. Turn on **Enable tools**, expand it, and turn on **Browser**.
|
||||
- **In the app:** open **Settings → Host → Tools & prompts** and turn on **Browser tools**.
|
||||
- **In `config.json`** (`~/.paseo/config.json`):
|
||||
|
||||
```json
|
||||
{
|
||||
"daemon": {
|
||||
"tools": {
|
||||
"enabled": true,
|
||||
"groups": {
|
||||
"browser": true
|
||||
}
|
||||
"browserTools": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The tools are part of the [Paseo toolset](/docs/mcp). Start a new agent or reload an existing one to pick up new tools.
|
||||
The tools are part of the [Paseo MCP toolset](/docs/mcp), so **Enable Paseo tools** on the same page must also be on for agents to receive them. Existing agents may need a reload to pick up new tools.
|
||||
|
||||
> Browser tools let agents access and control Paseo browser tabs, including logged-in browser state. Only enable this for agents you trust.
|
||||
|
||||
|
||||
@@ -23,23 +23,20 @@ Paseo 中的 Agent 可以操作真实的浏览器标签页,也就是你在 Pas
|
||||
|
||||
浏览器工具默认关闭。按主机开启:
|
||||
|
||||
- **在应用中**:打开 **设置 → 主机 → 工具与提示词**。开启 **启用工具**,展开它,然后开启 **浏览器**。
|
||||
- **在应用中**:打开 **设置 → 主机 → 工具与提示词**,开启 **Browser tools**。
|
||||
- **在 `config.json` 中**(`~/.paseo/config.json`):
|
||||
|
||||
```json
|
||||
{
|
||||
"daemon": {
|
||||
"tools": {
|
||||
"enabled": true,
|
||||
"groups": {
|
||||
"browser": true
|
||||
}
|
||||
"browserTools": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
这些工具属于 [Paseo 工具集](/docs/mcp)。启动新的 Agent 或重新加载已有的 Agent 以获得新工具。
|
||||
这些工具属于 [Paseo MCP 工具集](/docs/mcp),因此同一页面上的 **启用 Paseo tools** 也必须开启,Agent 才能获得它们。已有的 Agent 可能需要重新加载才能获得新工具。
|
||||
|
||||
> 浏览器工具允许 Agent 访问和控制 Paseo 浏览器标签页,包括已登录的浏览器状态。只为你信任的 Agent 启用。
|
||||
|
||||
|
||||
+11
-17
@@ -12,32 +12,26 @@ category: Orchestration
|
||||
|
||||
## Configuration
|
||||
|
||||
| Setting | Default | Purpose |
|
||||
| ------------------------------------ | ------- | ------------------------------------------------------------------------------ |
|
||||
| `daemon.tools.enabled` | `true` | Give agents launched by Paseo access to its tools. Voice mode also needs this. |
|
||||
| `daemon.tools.groups.orchestration` | `true` | Hosts, workspaces, agents, providers, scripts, and terminals. |
|
||||
| `daemon.tools.groups.schedules` | `true` | Schedules and heartbeats. |
|
||||
| `daemon.tools.groups.changeRequests` | `true` | Watching pull requests and merge requests. |
|
||||
| `daemon.tools.groups.browser` | `false` | [Browser automation](/docs/browser). |
|
||||
| Setting | Default | Purpose |
|
||||
| ----------------------------- | ------- | -------------------------------------------------- |
|
||||
| `daemon.mcp.enabled` | `true` | Run the MCP server. |
|
||||
| `daemon.mcp.injectIntoAgents` | `false` | Give agents launched by Paseo access to its tools. |
|
||||
|
||||
In the app, open **Settings → Host → Tools & prompts**. Turn on **Enable tools**, then expand it to turn each group on or off. Tools added by plugins follow **Enable tools**.
|
||||
|
||||
Depending on the provider, Paseo delivers tools through its native tool interface or MCP. The capabilities are the same. Start a new agent or reload an existing one after changing tool settings.
|
||||
|
||||
If `daemon.tools` is absent, Paseo reads the older `daemon.mcp.injectIntoAgents` and `daemon.browserTools.enabled` settings.
|
||||
Depending on the provider, Paseo delivers tools through its native tool interface or MCP. The capabilities are the same. Start a new agent or reload an existing one after changing injection settings.
|
||||
|
||||
## Limit Paseo tools by provider
|
||||
|
||||
Use provider policies when different agent profiles should receive different Paseo tools. Keep
|
||||
`daemon.tools.enabled` on, then add `paseoTools` to the exact provider IDs you launch:
|
||||
Use provider policies when different agent profiles should receive different Paseo tools. Enable
|
||||
tool injection globally, then add `paseoTools` to the exact provider IDs you launch:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://paseo.sh/schemas/paseo.config.v1.json",
|
||||
"version": 1,
|
||||
"daemon": {
|
||||
"tools": {
|
||||
"enabled": true
|
||||
"mcp": {
|
||||
"enabled": true,
|
||||
"injectIntoAgents": true
|
||||
}
|
||||
},
|
||||
"agents": {
|
||||
@@ -72,7 +66,7 @@ Omitting `paseoTools` enables the complete catalog. Set `enabled` to `false` to
|
||||
or list exact tool IDs in `disabledTools` to remove selected tools. Custom profiles do not inherit
|
||||
this policy from `extends`; configure each custom provider ID separately.
|
||||
|
||||
Browser tools still require the `browser` tool group and a connected browser host. The
|
||||
Browser tools still require browser tools to be enabled and a connected browser host. The
|
||||
voice-only `speak` tool is separate from this policy.
|
||||
|
||||
This setting limits the catalog presented to an agent. It is not a security boundary for an agent
|
||||
|
||||
+10
-16
@@ -10,31 +10,25 @@ nav: MCP 参考
|
||||
|
||||
## 配置 {#configuration}
|
||||
|
||||
| 设置 | 默认值 | 用途 |
|
||||
| ------------------------------------ | ------- | -------------------------------------------------------- |
|
||||
| `daemon.tools.enabled` | `true` | 让 Paseo 启动的 Agent 可以使用它的工具。语音模式也需要。 |
|
||||
| `daemon.tools.groups.orchestration` | `true` | 主机、工作区、Agent、Provider、脚本和终端。 |
|
||||
| `daemon.tools.groups.schedules` | `true` | 计划任务和心跳。 |
|
||||
| `daemon.tools.groups.changeRequests` | `true` | 监控 Pull Request 和 Merge Request。 |
|
||||
| `daemon.tools.groups.browser` | `false` | [浏览器自动化](/docs/browser)。 |
|
||||
| 设置 | 默认值 | 用途 |
|
||||
| ----------------------------- | ------- | ---------------------------------------- |
|
||||
| `daemon.mcp.enabled` | `true` | 运行 MCP 服务器。 |
|
||||
| `daemon.mcp.injectIntoAgents` | `false` | 让 Paseo 启动的 Agent 可以使用它的工具。 |
|
||||
|
||||
在应用中,打开 **设置 → 主机 → 工具与提示词**。开启 **启用工具**,然后展开它来开关各个工具组。插件提供的工具同样受 **启用工具** 控制。
|
||||
|
||||
根据 Provider 的不同,Paseo 通过其原生工具接口或 MCP 提供工具,能力是相同的。修改工具设置后,请启动新的 Agent 或重新加载已有的 Agent。
|
||||
|
||||
如果没有 `daemon.tools`,Paseo 会读取旧的 `daemon.mcp.injectIntoAgents` 和 `daemon.browserTools.enabled` 设置。
|
||||
根据 Provider 的不同,Paseo 通过其原生工具接口或 MCP 提供工具,能力是相同的。修改注入设置后,请启动新的 Agent 或重新加载已有的 Agent。
|
||||
|
||||
## 按 Provider 限制 Paseo 工具 {#limit-paseo-tools-by-provider}
|
||||
|
||||
当不同的 Agent 配置应获得不同的 Paseo 工具时,请使用 Provider 策略。保持 `daemon.tools.enabled` 开启,然后在你启动所用的确切 Provider ID 上添加 `paseoTools`:
|
||||
当不同的 Agent 配置应获得不同的 Paseo 工具时,请使用 Provider 策略。先全局启用工具注入,然后在你启动所用的确切 Provider ID 上添加 `paseoTools`:
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://paseo.sh/schemas/paseo.config.v1.json",
|
||||
"version": 1,
|
||||
"daemon": {
|
||||
"tools": {
|
||||
"enabled": true
|
||||
"mcp": {
|
||||
"enabled": true,
|
||||
"injectIntoAgents": true
|
||||
}
|
||||
},
|
||||
"agents": {
|
||||
@@ -66,7 +60,7 @@ nav: MCP 参考
|
||||
|
||||
省略 `paseoTools` 会启用完整的工具目录。把 `enabled` 设为 `false` 会移除整个目录,在 `disabledTools` 中列出确切的工具 ID 则只移除所选的工具。自定义配置不会从 `extends` 继承这一策略;请为每个自定义 Provider ID 分别配置。
|
||||
|
||||
浏览器工具仍然需要开启 `browser` 工具组并连接一个浏览器主机。仅用于语音的 `speak` 工具不受此策略控制。
|
||||
浏览器工具仍然需要启用浏览器工具并连接一个浏览器主机。仅用于语音的 `speak` 工具不受此策略控制。
|
||||
|
||||
这项设置限制的是呈现给 Agent 的工具目录。对于可以通过 shell 访问主机的 Agent,它不是安全边界。
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ Use built-in Paseo tools or the CLI. Both let an agent launch and coordinate wor
|
||||
Enable Paseo tools so agents running inside Paseo can manage agents and workspaces on their host directly.
|
||||
|
||||
1. Open **Settings → Host → Tools & prompts**.
|
||||
2. Make sure that **Enable tools** is on. It is on by default.
|
||||
2. Turn on **Enable Paseo tools**. Tool injection is off by default.
|
||||
3. Start a new agent, or reload an existing agent so it receives the tools.
|
||||
4. Ask:
|
||||
|
||||
@@ -45,7 +45,7 @@ See the [MCP reference](/docs/mcp) for tool configuration and the full catalog.
|
||||
|
||||
### CLI
|
||||
|
||||
Agents with shell access can also use the Paseo CLI. This route does not require **Enable tools**. With Paseo installed, a running host, and Codex configured:
|
||||
Agents with shell access can also use the Paseo CLI. This route does not require enabling tool injection. With Paseo installed, a running host, and Codex configured:
|
||||
|
||||
```bash
|
||||
paseo run --provider codex --no-wait \
|
||||
|
||||
@@ -31,7 +31,7 @@ Paseo 让你的编程 Agent 协调其他 Agent,把工作分配到不同的 Pro
|
||||
启用 Paseo 工具后,在 Paseo 中运行的 Agent 可以直接管理其主机上的 Agent 和工作区。
|
||||
|
||||
1. 打开 **设置 → 主机 → 工具与提示词**。
|
||||
2. 确认 **启用工具** 已开启。它默认开启。
|
||||
2. 打开 **启用 Paseo tools**。工具注入默认关闭。
|
||||
3. 启动一个新的 Agent,或重新加载已有的 Agent,让它获得这些工具。
|
||||
4. 提出要求:
|
||||
|
||||
@@ -43,7 +43,7 @@ Paseo 让你的编程 Agent 协调其他 Agent,把工作分配到不同的 Pro
|
||||
|
||||
### CLI {#cli}
|
||||
|
||||
有 shell 访问权限的 Agent 也可以使用 Paseo CLI。这种方式不需要开启 **启用工具**。在已安装 Paseo、主机正在运行并且配置了 Codex 的情况下:
|
||||
有 shell 访问权限的 Agent 也可以使用 Paseo CLI。这种方式不需要启用工具注入。在已安装 Paseo、主机正在运行并且配置了 Codex 的情况下:
|
||||
|
||||
```bash
|
||||
paseo run --provider codex --no-wait \
|
||||
|
||||
Reference in New Issue
Block a user