@canonry/canonry 5.8.0 → 5.9.0

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.
@@ -6476,7 +6476,7 @@ function nonBlank(value) {
6476
6476
  return trimmed ? trimmed : void 0;
6477
6477
  }
6478
6478
  function resolveBuildCommit(env = process.env) {
6479
- const embedded = true ? "6009ba08439de17b373d8958bae95b4794f02af0" : void 0;
6479
+ const embedded = true ? "3bdf995c7b38b778a35e91dc19377f788cc77204" : void 0;
6480
6480
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
6481
6481
  }
6482
6482
  function resolveInstanceIdentity(env = process.env) {
@@ -13996,6 +13996,8 @@ import { Type as Type2 } from "@sinclair/typebox";
13996
13996
  import { randomUUID } from "crypto";
13997
13997
  var MAX_TOOL_RESULT_CHARS = 2e4;
13998
13998
  var TRUNCATION_NOTE = "... (truncated \u2014 result too large)";
13999
+ var MAX_STRUCTURED_TRUNCATION_CHARS = 2e6;
14000
+ var MAX_TRUNCATION_PASSES = 32;
13999
14001
  function serializeResult(value) {
14000
14002
  return JSON.stringify(value, null, 2);
14001
14003
  }
@@ -14013,11 +14015,17 @@ function largestArrayKey(obj) {
14013
14015
  return best;
14014
14016
  }
14015
14017
  function trimRowsToFit(rows, render) {
14016
- let kept = rows.slice();
14017
- while (kept.length > 0 && render(kept).length > MAX_TOOL_RESULT_CHARS) {
14018
- kept = kept.slice(0, -1);
14019
- }
14020
- return kept;
14018
+ if (rows.length === 0) return [];
14019
+ const all = rows.slice();
14020
+ if (render(all).length <= MAX_TOOL_RESULT_CHARS) return all;
14021
+ let low = 0;
14022
+ let high = rows.length - 1;
14023
+ while (low < high) {
14024
+ const middle = Math.ceil((low + high) / 2);
14025
+ if (render(rows.slice(0, middle)).length <= MAX_TOOL_RESULT_CHARS) low = middle;
14026
+ else high = middle - 1;
14027
+ }
14028
+ return rows.slice(0, low);
14021
14029
  }
14022
14030
  function nestedArrayCandidates(root) {
14023
14031
  const candidates = [];
@@ -14054,7 +14062,9 @@ function trimNestedArrays(full) {
14054
14062
  const copy = parsed;
14055
14063
  copy.__truncated = true;
14056
14064
  let out = serializeResult(copy);
14065
+ let passes = 0;
14057
14066
  while (out.length > MAX_TOOL_RESULT_CHARS) {
14067
+ if (++passes > MAX_TRUNCATION_PASSES) return void 0;
14058
14068
  const candidate = nestedArrayCandidates(copy).at(0);
14059
14069
  if (!candidate) return void 0;
14060
14070
  const { owner, key, rows } = candidate;
@@ -14084,6 +14094,9 @@ function trimNestedArrays(full) {
14084
14094
  function truncateToolResult(details) {
14085
14095
  const full = serializeResult(details);
14086
14096
  if (full.length <= MAX_TOOL_RESULT_CHARS) return full;
14097
+ if (full.length > MAX_STRUCTURED_TRUNCATION_CHARS) {
14098
+ return full.slice(0, MAX_TOOL_RESULT_CHARS) + "\n" + TRUNCATION_NOTE;
14099
+ }
14087
14100
  if (Array.isArray(details)) {
14088
14101
  const kept = trimRowsToFit(
14089
14102
  details,
@@ -15053,6 +15066,15 @@ var MAX_HYDRATE_BYTES = 32 * 1024;
15053
15066
  function escapeMemoryFragment(value) {
15054
15067
  return value.replace(/<(\/?)memory>/gi, "<$1\u200Cmemory>");
15055
15068
  }
15069
+ function withoutPersistedToolDetails(messages) {
15070
+ return messages.map((message) => {
15071
+ if (!message || typeof message !== "object") return message;
15072
+ const row = message;
15073
+ if (row.role !== "toolResult" || !("details" in row)) return message;
15074
+ const { details: _omitted, ...rest } = row;
15075
+ return rest;
15076
+ });
15077
+ }
15056
15078
  var SessionRegistry = class {
15057
15079
  live = /* @__PURE__ */ new Map();
15058
15080
  pending = /* @__PURE__ */ new Map();
@@ -15397,7 +15419,7 @@ ${lines.join("\n")}
15397
15419
  if (!agent) return;
15398
15420
  const projectId = this.resolveProjectId(projectName);
15399
15421
  this.updateRow(projectId, {
15400
- messages: JSON.stringify(agent.state.messages)
15422
+ messages: JSON.stringify(withoutPersistedToolDetails(agent.state.messages))
15401
15423
  });
15402
15424
  }
15403
15425
  /**
@@ -15571,7 +15593,7 @@ ${lines.join("\n")}
15571
15593
  systemPrompt: params.systemPrompt,
15572
15594
  modelProvider: params.provider ?? params.modelProvider ?? AgentProviderIds.claude,
15573
15595
  modelId: params.modelId ?? "claude-opus-4-7",
15574
- messages: JSON.stringify(params.messages),
15596
+ messages: JSON.stringify(withoutPersistedToolDetails(params.messages)),
15575
15597
  followUpQueue: JSON.stringify(params.followUpQueue),
15576
15598
  createdAt: now,
15577
15599
  updatedAt: now
package/dist/cli.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  trackCliCommandFinished,
36
36
  trackEvent,
37
37
  waitForServerRuntimeStartup
38
- } from "./chunk-BO53QARL.js";
38
+ } from "./chunk-WTYVSCMP.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-BO53QARL.js";
6
+ } from "./chunk-WTYVSCMP.js";
7
7
  import {
8
8
  loadConfig
9
9
  } from "./chunk-S4DBS5DP.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonry/canonry",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
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": [
@@ -88,29 +88,29 @@
88
88
  "tsx": "^4.19.0",
89
89
  "@ainyc/canonry-web": "0.0.0",
90
90
  "@ainyc/canonry-api-routes": "0.0.0",
91
- "@ainyc/canonry-api-client": "0.0.0",
92
- "@ainyc/canonry-contracts": "0.0.0",
93
91
  "@ainyc/canonry-config": "0.0.0",
92
+ "@ainyc/canonry-contracts": "0.0.0",
93
+ "@ainyc/canonry-api-client": "0.0.0",
94
94
  "@ainyc/canonry-db": "0.0.0",
95
- "@ainyc/canonry-integration-bing": "0.0.0",
95
+ "@ainyc/canonry-integration-cloud-run": "0.0.0",
96
96
  "@ainyc/canonry-integration-cloudflare-queue": "0.0.0",
97
- "@ainyc/canonry-integration-commoncrawl": "0.0.0",
98
97
  "@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
98
+ "@ainyc/canonry-integration-commoncrawl": "0.0.0",
99
99
  "@ainyc/canonry-integration-google": "0.0.0",
100
+ "@ainyc/canonry-integration-google-places": "0.0.0",
100
101
  "@ainyc/canonry-integration-google-business-profile": "0.0.0",
102
+ "@ainyc/canonry-integration-bing": "0.0.0",
103
+ "@ainyc/canonry-integration-openai-ads": "0.0.0",
101
104
  "@ainyc/canonry-integration-google-ads": "0.0.0",
102
- "@ainyc/canonry-integration-google-places": "0.0.0",
103
- "@ainyc/canonry-integration-cloud-run": "0.0.0",
104
105
  "@ainyc/canonry-integration-google-tag-manager": "0.0.0",
105
- "@ainyc/canonry-integration-openai-ads": "0.0.0",
106
106
  "@ainyc/canonry-integration-traffic": "0.0.0",
107
107
  "@ainyc/canonry-intelligence": "0.0.0",
108
108
  "@ainyc/canonry-integration-wordpress": "0.0.0",
109
109
  "@ainyc/canonry-provider-cdp": "0.0.0",
110
110
  "@ainyc/canonry-provider-claude": "0.0.0",
111
111
  "@ainyc/canonry-provider-gemini": "0.0.0",
112
- "@ainyc/canonry-provider-local": "0.0.0",
113
112
  "@ainyc/canonry-provider-perplexity": "0.0.0",
113
+ "@ainyc/canonry-provider-local": "0.0.0",
114
114
  "@ainyc/canonry-provider-openai": "0.0.0"
115
115
  },
116
116
  "scripts": {