




















@@ -33,34 +33,32 @@ function collectLegacyExtendedLevelIds(levels: readonly { id: string }[] | undef
3333return ids;
3434}
353536+function levelIds(levels: readonly { id: string }[] | undefined): string[] {
37+return (levels ?? []).map((level) => level.id);
38+}
39+3640describe("anthropic provider policy public artifact", () => {
3741it("normalizes Anthropic provider config", () => {
38-expect(
39-normalizeConfig({
40-provider: "anthropic",
41-providerConfig: {
42-baseUrl: "https://api.anthropic.com",
43-models: [createModel("claude-sonnet-4-6", "Claude Sonnet 4.6")],
44-},
45-}),
46-).toMatchObject({
47-api: "anthropic-messages",
48-baseUrl: "https://api.anthropic.com",
42+const normalized = normalizeConfig({
43+provider: "anthropic",
44+providerConfig: {
45+baseUrl: "https://api.anthropic.com",
46+models: [createModel("claude-sonnet-4-6", "Claude Sonnet 4.6")],
47+},
4948});
49+expect(normalized.api).toBe("anthropic-messages");
50+expect(normalized.baseUrl).toBe("https://api.anthropic.com");
5051});
51525253it("normalizes Claude CLI provider config", () => {
53-expect(
54-normalizeConfig({
55-provider: "claude-cli",
56-providerConfig: {
57-baseUrl: "https://api.anthropic.com",
58-models: [createModel("claude-sonnet-4-6", "Claude Sonnet 4.6")],
59-},
60-}),
61-).toMatchObject({
62-api: "anthropic-messages",
54+const normalized = normalizeConfig({
55+provider: "claude-cli",
56+providerConfig: {
57+baseUrl: "https://api.anthropic.com",
58+models: [createModel("claude-sonnet-4-6", "Claude Sonnet 4.6")],
59+},
6360});
61+expect(normalized.api).toBe("anthropic-messages");
6462});
65636664it("does not normalize non-Anthropic provider config", () => {
@@ -96,22 +94,20 @@ describe("anthropic provider policy public artifact", () => {
9694env: {},
9795});
989699-expect(nextConfig.agents?.defaults?.contextPruning).toMatchObject({
100-mode: "cache-ttl",
101-ttl: "1h",
102-});
97+expect(nextConfig.agents?.defaults?.contextPruning?.mode).toBe("cache-ttl");
98+expect(nextConfig.agents?.defaults?.contextPruning?.ttl).toBe("1h");
10399});
104100105101it("exposes Claude Opus 4.7 thinking levels without loading the full provider plugin", () => {
106-expect(
107-resolveThinkingProfile({
108-provider: "anthropic",
109-modelId: "claude-opus-4-7",
110-}),
111-).toMatchObject({
112-levels: expect.arrayContaining([{ id: "xhigh" }, { id: "adaptive" }, { id: "max" }]),
113-defaultLevel: "off",
102+const profile = resolveThinkingProfile({
103+provider: "anthropic",
104+modelId: "claude-opus-4-7",
114105});
106+const ids = levelIds(profile?.levels);
107+expect(ids).toContain("xhigh");
108+expect(ids).toContain("adaptive");
109+expect(ids).toContain("max");
110+expect(profile?.defaultLevel).toBe("off");
115111});
116112117113it("keeps adaptive-only Claude profiles aligned with the runtime provider", () => {
@@ -120,13 +116,11 @@ describe("anthropic provider policy public artifact", () => {
120116modelId: "claude-opus-4-6",
121117});
122118123-expect(profile).toMatchObject({
124-levels: expect.arrayContaining([{ id: "adaptive" }]),
125-defaultLevel: "adaptive",
126-});
127119if (!profile) {
128120throw new Error("Expected Anthropic policy profile");
129121}
122+expect(levelIds(profile.levels)).toContain("adaptive");
123+expect(profile.defaultLevel).toBe("adaptive");
130124expect(collectLegacyExtendedLevelIds(profile.levels)).toStrictEqual([]);
131125});
132126此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。