@canonry/canonry 5.20.2 → 5.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4483,7 +4483,23 @@ async function withRetry4(fn, options = {}) {
4483
4483
  // ../provider-claude/src/normalize.ts
4484
4484
  var DEFAULT_MODEL3 = "claude-sonnet-4-6";
4485
4485
  var VALIDATION_PATTERN = /^claude-/;
4486
- var CLAUDE_RETRIEVAL_CONTRACT = "search-required-v1";
4486
+ var CLAUDE_RETRIEVAL_CONTRACT = RetrievalContracts["search-required-v1"];
4487
+ var CLAUDE_MODELS_REJECTING_FORCED_TOOL_CHOICE = /* @__PURE__ */ new Set(["claude-opus-5-5", "claude-fable-5-1", "claude-mythos-5-1"]);
4488
+ function claudeModelRejectsForcedToolChoice(model) {
4489
+ return CLAUDE_MODELS_REJECTING_FORCED_TOOL_CHOICE.has(
4490
+ model.trim().toLowerCase()
4491
+ );
4492
+ }
4493
+ function claudeRetrievalContractForModel(model) {
4494
+ return claudeModelRejectsForcedToolChoice(model) ? RetrievalContracts["native-auto-v1"] : CLAUDE_RETRIEVAL_CONTRACT;
4495
+ }
4496
+ var CLAUDE_TOOL_CHOICE_BY_CONTRACT = {
4497
+ [RetrievalContracts["search-required-v1"]]: {
4498
+ type: "tool",
4499
+ name: "web_search"
4500
+ },
4501
+ [RetrievalContracts["native-auto-v1"]]: { type: "auto" }
4502
+ };
4487
4503
  function resolveModel2(config) {
4488
4504
  const m = config.model;
4489
4505
  if (!m) return DEFAULT_MODEL3;
@@ -4498,7 +4514,7 @@ function validateConfig3(config) {
4498
4514
  return { ok: false, provider: "claude", message: "missing api key" };
4499
4515
  }
4500
4516
  const model = resolveModel2(config);
4501
- const warning = config.model && !VALIDATION_PATTERN.test(config.model) ? ` (invalid model "${config.model}" replaced with default)` : "";
4517
+ const warning = config.model && !VALIDATION_PATTERN.test(config.model) ? ` (invalid model "${config.model}" replaced with default)` : claudeModelRejectsForcedToolChoice(model) ? ` (${model} rejects forced tool_choice, so tracked queries run under ${claudeRetrievalContractForModel(model)}: web_search is offered but retrieval is not guaranteed)` : "";
4502
4518
  return {
4503
4519
  ok: true,
4504
4520
  provider: "claude",
@@ -4537,6 +4553,7 @@ async function healthcheck3(config) {
4537
4553
  }
4538
4554
  async function executeTrackedQuery3(input) {
4539
4555
  const model = resolveModel2(input.config);
4556
+ const retrievalContract = claudeRetrievalContractForModel(model);
4540
4557
  const client = new Anthropic({ apiKey: input.config.apiKey });
4541
4558
  const webSearchTool = {
4542
4559
  type: "web_search_20250305",
@@ -4558,9 +4575,11 @@ async function executeTrackedQuery3(input) {
4558
4575
  model,
4559
4576
  max_tokens: 4096,
4560
4577
  tools: [webSearchTool],
4561
- // search-required-v1: retrieval is guaranteed by the API control, so the
4562
- // query text and answer substance stay untouched. See the contract note.
4563
- tool_choice: { type: "tool", name: "web_search" },
4578
+ // search-required-v1 forces web_search, so retrieval is guaranteed by the
4579
+ // API control and the query text and answer substance stay untouched.
4580
+ // native-auto-v1 (models that reject forcing) leaves the search to
4581
+ // Claude. See claudeRetrievalContractForModel.
4582
+ tool_choice: CLAUDE_TOOL_CHOICE_BY_CONTRACT[retrievalContract],
4564
4583
  messages: [{ role: "user", content: input.query }]
4565
4584
  })
4566
4585
  );
@@ -4577,7 +4596,7 @@ async function executeTrackedQuery3(input) {
4577
4596
  groundingSources: parsed.groundingSources,
4578
4597
  searchQueries: parsed.searchQueries,
4579
4598
  retrievalStatus: parsed.retrievalStatus,
4580
- retrievalContract: CLAUDE_RETRIEVAL_CONTRACT
4599
+ retrievalContract
4581
4600
  };
4582
4601
  } catch (err) {
4583
4602
  const msg = describeError(err);
@@ -4859,7 +4878,8 @@ var claudeAdapter = {
4859
4878
  // across this boundary. A reconstruction that predates the field falls
4860
4879
  // back to `unknown` rather than asserting an absence.
4861
4880
  retrievalStatus: raw.retrievalStatus ?? "unknown",
4862
- retrievalContract: raw.retrievalContract ?? CLAUDE_RETRIEVAL_CONTRACT
4881
+ // The contract is decided by the model the request was built for.
4882
+ retrievalContract: raw.retrievalContract ?? claudeRetrievalContractForModel(raw.model)
4863
4883
  };
4864
4884
  const normalized = normalizeResult3(claudeRaw);
4865
4885
  return {
@@ -6628,7 +6648,7 @@ function nonBlank(value) {
6628
6648
  return trimmed ? trimmed : void 0;
6629
6649
  }
6630
6650
  function resolveBuildCommit(env = process.env) {
6631
- const embedded = true ? "b00090f58284f63906eba753cace2b96a166ccfd" : void 0;
6651
+ const embedded = true ? "391e3197a54a3b85226958ac923a021d124eaf60" : void 0;
6632
6652
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
6633
6653
  }
6634
6654
  function resolveInstanceIdentity(env = process.env) {
package/dist/cli.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  trackCliCommandFinished,
36
36
  trackEvent,
37
37
  waitForServerRuntimeStartup
38
- } from "./chunk-RV3PYKXP.js";
38
+ } from "./chunk-H6XSHOS5.js";
39
39
  import {
40
40
  autoSyncSkills,
41
41
  formatAutoSyncNotice
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createGoogleMarketingCredentialStore,
4
4
  createGoogleMarketingRuntime,
5
5
  createServer
6
- } from "./chunk-RV3PYKXP.js";
6
+ } from "./chunk-H6XSHOS5.js";
7
7
  import {
8
8
  loadConfig
9
9
  } from "./chunk-PXVJ3P5G.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonry/canonry",
3
- "version": "5.20.2",
3
+ "version": "5.20.3",
4
4
  "type": "module",
5
5
  "description": "Self-hosted AI visibility (AEO) platform: track how ChatGPT, Claude, Gemini, and Perplexity cite your domain, join it with Search Console, GA4, server-side traffic, and paid media, and fix what you find through agent tools (CLI, REST, MCP). Local SQLite.",
6
6
  "keywords": [
@@ -86,32 +86,32 @@
86
86
  "@types/node-cron": "^3.0.11",
87
87
  "tsup": "^8.5.1",
88
88
  "tsx": "^4.19.0",
89
- "@ainyc/canonry-web": "0.0.0",
90
- "@ainyc/canonry-api-routes": "0.0.0",
91
89
  "@ainyc/canonry-api-client": "0.0.0",
92
90
  "@ainyc/canonry-config": "0.0.0",
91
+ "@ainyc/canonry-web": "0.0.0",
92
+ "@ainyc/canonry-api-routes": "0.0.0",
93
93
  "@ainyc/canonry-contracts": "0.0.0",
94
94
  "@ainyc/canonry-db": "0.0.0",
95
- "@ainyc/canonry-integration-bing": "0.0.0",
96
95
  "@ainyc/canonry-integration-cloud-run": "0.0.0",
96
+ "@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
97
+ "@ainyc/canonry-integration-bing": "0.0.0",
98
+ "@ainyc/canonry-integration-google": "0.0.0",
97
99
  "@ainyc/canonry-integration-cloudflare-queue": "0.0.0",
98
100
  "@ainyc/canonry-integration-commoncrawl": "0.0.0",
99
101
  "@ainyc/canonry-integration-google-ads": "0.0.0",
100
- "@ainyc/canonry-integration-google-business-profile": "0.0.0",
101
- "@ainyc/canonry-integration-google": "0.0.0",
102
- "@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
103
102
  "@ainyc/canonry-integration-google-places": "0.0.0",
103
+ "@ainyc/canonry-integration-google-business-profile": "0.0.0",
104
104
  "@ainyc/canonry-integration-google-tag-manager": "0.0.0",
105
+ "@ainyc/canonry-integration-openai-ads": "0.0.0",
105
106
  "@ainyc/canonry-integration-traffic": "0.0.0",
106
107
  "@ainyc/canonry-integration-wordpress": "0.0.0",
107
- "@ainyc/canonry-provider-cdp": "0.0.0",
108
- "@ainyc/canonry-provider-gemini": "0.0.0",
109
- "@ainyc/canonry-integration-openai-ads": "0.0.0",
110
108
  "@ainyc/canonry-intelligence": "0.0.0",
109
+ "@ainyc/canonry-provider-cdp": "0.0.0",
110
+ "@ainyc/canonry-provider-claude": "0.0.0",
111
111
  "@ainyc/canonry-provider-local": "0.0.0",
112
- "@ainyc/canonry-provider-perplexity": "0.0.0",
112
+ "@ainyc/canonry-provider-gemini": "0.0.0",
113
113
  "@ainyc/canonry-provider-openai": "0.0.0",
114
- "@ainyc/canonry-provider-claude": "0.0.0"
114
+ "@ainyc/canonry-provider-perplexity": "0.0.0"
115
115
  },
116
116
  "scripts": {
117
117
  "build": "pnpm run build:cli && pnpm run build:web",