






























@@ -458,6 +458,51 @@ describe("normalizeCronJobCreate", () => {
458458expect(validateCronAddParams(normalized)).toBe(true);
459459});
460460461+it("promotes implicit text payloads with agentTurn hints for create jobs", () => {
462+const normalized = normalizeCronJobCreate({
463+name: "nested text model",
464+schedule: { kind: "every", everyMs: 60_000 },
465+payload: {
466+text: " summarize issue status ",
467+model: " anthropic/claude-sonnet-4-6 ",
468+thinking: " high ",
469+},
470+}) as unknown as Record<string, unknown>;
471+472+const payload = normalized.payload as Record<string, unknown>;
473+expect(payload).toEqual({
474+kind: "agentTurn",
475+message: "summarize issue status",
476+model: "anthropic/claude-sonnet-4-6",
477+thinking: "high",
478+});
479+expect(normalized.sessionTarget).toBe("isolated");
480+expect(validateCronAddParams(normalized)).toBe(true);
481+});
482+483+it("promotes legacy top-level text with agentTurn hints for create jobs", () => {
484+const normalized = normalizeCronJobCreate({
485+name: "legacy text model",
486+schedule: { kind: "every", everyMs: 60_000 },
487+text: " summarize issue status ",
488+model: " openrouter/deepseek/deepseek-r1 ",
489+fallbacks: [],
490+toolsAllow: [" read "],
491+}) as unknown as Record<string, unknown>;
492+493+const payload = normalized.payload as Record<string, unknown>;
494+expect(payload).toEqual({
495+kind: "agentTurn",
496+message: "summarize issue status",
497+model: "openrouter/deepseek/deepseek-r1",
498+fallbacks: [],
499+toolsAllow: ["read"],
500+});
501+expect(normalized.text).toBeUndefined();
502+expect(normalized.model).toBeUndefined();
503+expect(validateCronAddParams(normalized)).toBe(true);
504+});
505+461506it("preserves timeoutSeconds=0 for no-timeout agentTurn payloads", () => {
462507const normalized = normalizeCronJobCreate({
463508name: "legacy no-timeout",
@@ -678,6 +723,40 @@ describe("normalizeCronJobPatch", () => {
678723expect(payload.model).toBe("anthropic/claude-sonnet-4-6");
679724});
680725726+it("promotes implicit text payloads with agentTurn hints for patches", () => {
727+const normalized = normalizeCronJobPatch({
728+payload: {
729+text: " summarize issue status ",
730+model: "anthropic/claude-sonnet-4-6",
731+},
732+}) as unknown as Record<string, unknown>;
733+734+const payload = normalized.payload as Record<string, unknown>;
735+expect(payload).toEqual({
736+kind: "agentTurn",
737+message: "summarize issue status",
738+model: "anthropic/claude-sonnet-4-6",
739+});
740+expect(validateCronUpdateParams({ id: "job-1", patch: normalized })).toBe(true);
741+});
742+743+it("promotes legacy top-level text with agentTurn hints for patches", () => {
744+const normalized = normalizeCronJobPatch({
745+text: " summarize issue status ",
746+model: "openrouter/deepseek/deepseek-r1",
747+}) as unknown as Record<string, unknown>;
748+749+const payload = normalized.payload as Record<string, unknown>;
750+expect(payload).toEqual({
751+kind: "agentTurn",
752+message: "summarize issue status",
753+model: "openrouter/deepseek/deepseek-r1",
754+});
755+expect(normalized.text).toBeUndefined();
756+expect(normalized.model).toBeUndefined();
757+expect(validateCronUpdateParams({ id: "job-1", patch: normalized })).toBe(true);
758+});
759+681760it("infers agentTurn kind for lightContext-only payload patches", () => {
682761const normalized = normalizeCronJobPatch({
683762payload: {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。