test: cover mixed directive fast-lane

This commit is contained in:
Peter Steinberger
2026-01-12 21:56:50 +00:00
parent 877bc61b53
commit 5d83be76c9
2 changed files with 56 additions and 11 deletions

View File

@@ -407,6 +407,54 @@ describe("directive behavior", () => {
});
});
it("applies inline reasoning in mixed messages and acks immediately", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockResolvedValue({
payloads: [{ text: "done" }],
meta: {
durationMs: 5,
agentMeta: { sessionId: "s", provider: "p", model: "m" },
},
});
const blockReplies: string[] = [];
const storePath = path.join(home, "sessions.json");
const res = await getReplyFromConfig(
{
Body: "please reply\n/reasoning on",
From: "+1222",
To: "+1222",
Provider: "whatsapp",
},
{
onBlockReply: (payload) => {
if (payload.text) blockReplies.push(payload.text);
},
},
{
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
},
},
whatsapp: {
allowFrom: ["*"],
},
session: { store: storePath },
},
);
const texts = (Array.isArray(res) ? res : [res])
.map((entry) => entry?.text)
.filter(Boolean);
expect(texts).toContain("done");
expect(runEmbeddedPiAgent).toHaveBeenCalledOnce();
});
});
it("acks verbose directive immediately with system marker", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();

View File

@@ -256,6 +256,14 @@ const TelegramTopicSchema = z.object({
systemPrompt: z.string().optional(),
});
const NativeCommandsSettingSchema = z.union([z.boolean(), z.literal("auto")]);
const ProviderCommandsSchema = z
.object({
native: NativeCommandsSettingSchema.optional(),
})
.optional();
const TelegramGroupSchema = z.object({
requireMention: z.boolean().optional(),
skills: z.array(z.string()).optional(),
@@ -712,17 +720,6 @@ const MessagesSchema = z
})
.optional();
const NativeCommandsSettingSchema = z.union([
z.boolean(),
z.literal("auto"),
]);
const ProviderCommandsSchema = z
.object({
native: NativeCommandsSettingSchema.optional(),
})
.optional();
const CommandsSchema = z
.object({
native: NativeCommandsSettingSchema.optional().default("auto"),