diff --git a/src/auto-reply/reply.directive.test.ts b/src/auto-reply/reply.directive.test.ts index d8a7055f5..4b9199a48 100644 --- a/src/auto-reply/reply.directive.test.ts +++ b/src/auto-reply/reply.directive.test.ts @@ -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(); diff --git a/src/config/zod-schema.ts b/src/config/zod-schema.ts index ce928794a..8c1450750 100644 --- a/src/config/zod-schema.ts +++ b/src/config/zod-schema.ts @@ -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"),