@ainyc/canonry 4.186.2 → 4.186.6
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.
|
@@ -158,7 +158,7 @@ import {
|
|
|
158
158
|
siteCrawlSnapshots,
|
|
159
159
|
toAlertView,
|
|
160
160
|
usageCounters
|
|
161
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-PF5QRORD.js";
|
|
162
162
|
import {
|
|
163
163
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
164
164
|
AGENT_PROVIDER_IDS,
|
|
@@ -3400,7 +3400,7 @@ import crypto27 from "crypto";
|
|
|
3400
3400
|
import fs7 from "fs";
|
|
3401
3401
|
import path8 from "path";
|
|
3402
3402
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3403
|
-
import { and as
|
|
3403
|
+
import { and as and20, eq as eq26 } from "drizzle-orm";
|
|
3404
3404
|
import Fastify from "fastify";
|
|
3405
3405
|
import os4 from "os";
|
|
3406
3406
|
|
|
@@ -7714,7 +7714,7 @@ async function refreshSelectedLocationProfiles(db, projectId, accessToken, locat
|
|
|
7714
7714
|
|
|
7715
7715
|
// src/ads-sync.ts
|
|
7716
7716
|
import crypto10 from "crypto";
|
|
7717
|
-
import { eq as eq6 } from "drizzle-orm";
|
|
7717
|
+
import { and as and6, eq as eq6, inArray as inArray3, notInArray } from "drizzle-orm";
|
|
7718
7718
|
|
|
7719
7719
|
// ../integration-openai-ads/src/constants.ts
|
|
7720
7720
|
var OPENAI_ADS_API_BASE = "https://api.ads.openai.com/v1";
|
|
@@ -8394,8 +8394,13 @@ async function executeAdsSync(db, runId, projectId, opts) {
|
|
|
8394
8394
|
(c) => (c.conversion_event_setting_ids?.length ?? 0) > 0
|
|
8395
8395
|
);
|
|
8396
8396
|
const insertNow = (/* @__PURE__ */ new Date()).toISOString();
|
|
8397
|
+
const upstreamIds = campaigns.map((c) => c.id);
|
|
8398
|
+
const refreshedIds = syncedCampaigns.map((c) => c.id);
|
|
8397
8399
|
db.transaction((tx) => {
|
|
8398
|
-
tx.delete(adsCampaigns).where(eq6(adsCampaigns.projectId, projectId)).run();
|
|
8400
|
+
tx.delete(adsCampaigns).where(upstreamIds.length === 0 ? eq6(adsCampaigns.projectId, projectId) : and6(eq6(adsCampaigns.projectId, projectId), notInArray(adsCampaigns.id, upstreamIds))).run();
|
|
8401
|
+
if (refreshedIds.length > 0) {
|
|
8402
|
+
tx.delete(adsCampaigns).where(and6(eq6(adsCampaigns.projectId, projectId), inArray3(adsCampaigns.id, refreshedIds))).run();
|
|
8403
|
+
}
|
|
8399
8404
|
for (const campaign of syncedCampaigns) {
|
|
8400
8405
|
tx.insert(adsCampaigns).values({
|
|
8401
8406
|
id: campaign.id,
|
|
@@ -8477,6 +8482,7 @@ async function executeAdsSync(db, runId, projectId, opts) {
|
|
|
8477
8482
|
}
|
|
8478
8483
|
}).run();
|
|
8479
8484
|
}
|
|
8485
|
+
const entitySnapshotRefreshed = errors.size === 0 || syncedCampaigns.length > 0;
|
|
8480
8486
|
tx.update(adsConnections).set({
|
|
8481
8487
|
adAccountId: account.id,
|
|
8482
8488
|
displayName: account.name,
|
|
@@ -8487,7 +8493,7 @@ async function executeAdsSync(db, runId, projectId, opts) {
|
|
|
8487
8493
|
integrityReviewStatus: account.account_integrity_review?.review?.status ?? null,
|
|
8488
8494
|
integrityDecision: account.account_integrity_review?.details?.decision ?? null,
|
|
8489
8495
|
conversionTrackingConfigured,
|
|
8490
|
-
lastSyncedAt: insertNow,
|
|
8496
|
+
...entitySnapshotRefreshed ? { lastSyncedAt: insertNow } : {},
|
|
8491
8497
|
updatedAt: insertNow
|
|
8492
8498
|
}).where(eq6(adsConnections.projectId, projectId)).run();
|
|
8493
8499
|
});
|
|
@@ -9080,7 +9086,7 @@ async function executeBingInspectSitemap(db, runId, projectId, opts) {
|
|
|
9080
9086
|
|
|
9081
9087
|
// src/coverage-refresh.ts
|
|
9082
9088
|
import crypto14 from "crypto";
|
|
9083
|
-
import { and as
|
|
9089
|
+
import { and as and7, desc as desc4, eq as eq9, inArray as inArray4 } from "drizzle-orm";
|
|
9084
9090
|
var log9 = createLogger("CoverageRefresh");
|
|
9085
9091
|
var COVERAGE_REFRESH_MIN_INTERVAL_MS = 60 * 60 * 1e3;
|
|
9086
9092
|
var COVERAGE_REFRESH_MANUAL_MIN_INTERVAL_MS = 2 * 60 * 1e3;
|
|
@@ -9104,10 +9110,10 @@ async function maybeRefreshGscCoverage(db, config, projectId, deps = defaultDeps
|
|
|
9104
9110
|
const conn = getGoogleConnection(config, project.canonicalDomain, "gsc");
|
|
9105
9111
|
if (!conn?.refreshToken || !conn.propertyId) return null;
|
|
9106
9112
|
const inFlight2 = db.select({ createdAt: runs.createdAt }).from(runs).where(
|
|
9107
|
-
|
|
9113
|
+
and7(
|
|
9108
9114
|
eq9(runs.projectId, projectId),
|
|
9109
9115
|
eq9(runs.kind, RunKinds["inspect-sitemap"]),
|
|
9110
|
-
|
|
9116
|
+
inArray4(runs.status, IN_FLIGHT_STATUSES)
|
|
9111
9117
|
)
|
|
9112
9118
|
).orderBy(desc4(runs.createdAt)).limit(1).get();
|
|
9113
9119
|
if (inFlight2) {
|
|
@@ -9116,10 +9122,10 @@ async function maybeRefreshGscCoverage(db, config, projectId, deps = defaultDeps
|
|
|
9116
9122
|
}
|
|
9117
9123
|
const windowMs = opts.userInitiated ? COVERAGE_REFRESH_MANUAL_MIN_INTERVAL_MS : COVERAGE_REFRESH_MIN_INTERVAL_MS;
|
|
9118
9124
|
const recent = db.select({ createdAt: runs.createdAt }).from(runs).where(
|
|
9119
|
-
|
|
9125
|
+
and7(
|
|
9120
9126
|
eq9(runs.projectId, projectId),
|
|
9121
9127
|
eq9(runs.kind, RunKinds["inspect-sitemap"]),
|
|
9122
|
-
|
|
9128
|
+
inArray4(runs.status, ACTIVE_OR_DONE_STATUSES)
|
|
9123
9129
|
)
|
|
9124
9130
|
).orderBy(desc4(runs.createdAt)).limit(1).get();
|
|
9125
9131
|
if (recent) {
|
|
@@ -9154,7 +9160,7 @@ async function maybeRefreshGscCoverage(db, config, projectId, deps = defaultDeps
|
|
|
9154
9160
|
// src/commoncrawl-sync.ts
|
|
9155
9161
|
import crypto15 from "crypto";
|
|
9156
9162
|
import path4 from "path";
|
|
9157
|
-
import { and as
|
|
9163
|
+
import { and as and8, eq as eq10, sql as sql4 } from "drizzle-orm";
|
|
9158
9164
|
var log10 = createLogger("CommonCrawlSync");
|
|
9159
9165
|
var INSERT_CHUNK_SIZE = 1e4;
|
|
9160
9166
|
function defaultDeps2() {
|
|
@@ -9346,7 +9352,7 @@ function computeSummary(rows) {
|
|
|
9346
9352
|
// src/backlink-extract.ts
|
|
9347
9353
|
import crypto16 from "crypto";
|
|
9348
9354
|
import fs3 from "fs";
|
|
9349
|
-
import { and as
|
|
9355
|
+
import { and as and9, desc as desc5, eq as eq11 } from "drizzle-orm";
|
|
9350
9356
|
var log11 = createLogger("BacklinkExtract");
|
|
9351
9357
|
function defaultDeps3() {
|
|
9352
9358
|
return {
|
|
@@ -9392,7 +9398,7 @@ async function executeBacklinkExtract(db, runId, projectId, opts = {}) {
|
|
|
9392
9398
|
const targetDomain = project.canonicalDomain;
|
|
9393
9399
|
db.transaction((tx) => {
|
|
9394
9400
|
tx.delete(backlinkDomains).where(
|
|
9395
|
-
|
|
9401
|
+
and9(
|
|
9396
9402
|
eq11(backlinkDomains.projectId, projectId),
|
|
9397
9403
|
eq11(backlinkDomains.source, BacklinkSources.commoncrawl),
|
|
9398
9404
|
eq11(backlinkDomains.release, release)
|
|
@@ -9458,7 +9464,7 @@ function computeSummary2(rows) {
|
|
|
9458
9464
|
|
|
9459
9465
|
// src/discovery-run.ts
|
|
9460
9466
|
import crypto17 from "crypto";
|
|
9461
|
-
import { and as
|
|
9467
|
+
import { and as and10, eq as eq12 } from "drizzle-orm";
|
|
9462
9468
|
var log12 = createLogger("DiscoveryRun");
|
|
9463
9469
|
var DEFAULT_SEED_COUNT = 30;
|
|
9464
9470
|
var EMBED_RETRY_MAX_RETRIES = 3;
|
|
@@ -9806,7 +9812,7 @@ function writeDiscoveryInsight(db, input) {
|
|
|
9806
9812
|
totalProbes
|
|
9807
9813
|
});
|
|
9808
9814
|
db.transaction((tx) => {
|
|
9809
|
-
tx.update(insights).set({ dismissed: true }).where(
|
|
9815
|
+
tx.update(insights).set({ dismissed: true }).where(and10(
|
|
9810
9816
|
eq12(insights.projectId, input.projectId),
|
|
9811
9817
|
eq12(insights.type, "discovery.basket-divergence"),
|
|
9812
9818
|
eq12(insights.dismissed, false)
|
|
@@ -9849,7 +9855,7 @@ function buildDiscoveryInsightTitle(input) {
|
|
|
9849
9855
|
|
|
9850
9856
|
// src/execute-site-audit.ts
|
|
9851
9857
|
import crypto19 from "crypto";
|
|
9852
|
-
import { and as
|
|
9858
|
+
import { and as and13, eq as eq15, sql as sql6 } from "drizzle-orm";
|
|
9853
9859
|
import { runSiteCrawl } from "@canonry/aeo-audit";
|
|
9854
9860
|
|
|
9855
9861
|
// src/site-audit-root.ts
|
|
@@ -10040,7 +10046,7 @@ async function requestPinnedSiteAuditRoot(target, options) {
|
|
|
10040
10046
|
import crypto18 from "crypto";
|
|
10041
10047
|
import { createRequire as createRequire3 } from "module";
|
|
10042
10048
|
import { Worker } from "worker_threads";
|
|
10043
|
-
import { and as
|
|
10049
|
+
import { and as and11, asc, count, desc as desc6, eq as eq13, isNull, ne as ne2, or, sql as sql5 } from "drizzle-orm";
|
|
10044
10050
|
import { alias } from "drizzle-orm/sqlite-core";
|
|
10045
10051
|
var SITE_CRAWL_GRAPH_LAYOUT_TIMEOUT_MS = 15e3;
|
|
10046
10052
|
var SITE_CRAWL_GRAPH_SEED_SCALE = 100;
|
|
@@ -10469,11 +10475,11 @@ function loadPriorSiteCrawlGraphPositions(db, scope) {
|
|
|
10469
10475
|
const prior = db.select({
|
|
10470
10476
|
runId: siteCrawlSnapshots.runId,
|
|
10471
10477
|
attemptId: siteCrawlSnapshots.attemptId
|
|
10472
|
-
}).from(siteCrawlSnapshots).innerJoin(siteCrawlGraphLayouts,
|
|
10478
|
+
}).from(siteCrawlSnapshots).innerJoin(siteCrawlGraphLayouts, and11(
|
|
10473
10479
|
eq13(siteCrawlGraphLayouts.projectId, siteCrawlSnapshots.projectId),
|
|
10474
10480
|
eq13(siteCrawlGraphLayouts.runId, siteCrawlSnapshots.runId),
|
|
10475
10481
|
eq13(siteCrawlGraphLayouts.attemptId, siteCrawlSnapshots.attemptId)
|
|
10476
|
-
)).where(
|
|
10482
|
+
)).where(and11(
|
|
10477
10483
|
eq13(siteCrawlSnapshots.projectId, scope.projectId),
|
|
10478
10484
|
ne2(siteCrawlSnapshots.runId, scope.runId),
|
|
10479
10485
|
eq13(siteCrawlSnapshots.complete, true),
|
|
@@ -10485,7 +10491,7 @@ function loadPriorSiteCrawlGraphPositions(db, scope) {
|
|
|
10485
10491
|
nodeKey: siteCrawlGraphNodes.nodeKey,
|
|
10486
10492
|
x: siteCrawlGraphNodes.x,
|
|
10487
10493
|
y: siteCrawlGraphNodes.y
|
|
10488
|
-
}).from(siteCrawlGraphNodes).where(
|
|
10494
|
+
}).from(siteCrawlGraphNodes).where(and11(
|
|
10489
10495
|
eq13(siteCrawlGraphNodes.projectId, scope.projectId),
|
|
10490
10496
|
eq13(siteCrawlGraphNodes.runId, prior.runId),
|
|
10491
10497
|
eq13(siteCrawlGraphNodes.attemptId, prior.attemptId)
|
|
@@ -10510,19 +10516,19 @@ async function prepareSiteCrawlGraphLayout(db, scope, options = {}) {
|
|
|
10510
10516
|
eq13(siteCrawlEdges.internal, true),
|
|
10511
10517
|
eq13(siteCrawlEdges.relation, "anchor")
|
|
10512
10518
|
];
|
|
10513
|
-
totalNodes = db.select({ value: count() }).from(siteCrawlPages).where(
|
|
10519
|
+
totalNodes = db.select({ value: count() }).from(siteCrawlPages).where(and11(...pageScope)).get()?.value ?? 0;
|
|
10514
10520
|
assertNotAborted();
|
|
10515
|
-
const countGraphCompatibleEdges = (...extra) => db.select({ value: count() }).from(siteCrawlEdges).innerJoin(graphSourcePage,
|
|
10521
|
+
const countGraphCompatibleEdges = (...extra) => db.select({ value: count() }).from(siteCrawlEdges).innerJoin(graphSourcePage, and11(
|
|
10516
10522
|
eq13(graphSourcePage.projectId, scope.projectId),
|
|
10517
10523
|
eq13(graphSourcePage.runId, scope.runId),
|
|
10518
10524
|
eq13(graphSourcePage.attemptId, scope.attemptId),
|
|
10519
10525
|
eq13(graphSourcePage.nodeKey, siteCrawlEdges.sourceNodeKey)
|
|
10520
|
-
)).innerJoin(graphTargetPage,
|
|
10526
|
+
)).innerJoin(graphTargetPage, and11(
|
|
10521
10527
|
eq13(graphTargetPage.projectId, scope.projectId),
|
|
10522
10528
|
eq13(graphTargetPage.runId, scope.runId),
|
|
10523
10529
|
eq13(graphTargetPage.attemptId, scope.attemptId),
|
|
10524
10530
|
eq13(graphTargetPage.nodeKey, siteCrawlEdges.targetNodeKey)
|
|
10525
|
-
)).where(
|
|
10531
|
+
)).where(and11(...edgeScope, ...extra)).get()?.value ?? 0;
|
|
10526
10532
|
totalEdges = countGraphCompatibleEdges();
|
|
10527
10533
|
assertNotAborted();
|
|
10528
10534
|
totalTemplateEdges = countGraphCompatibleEdges(eq13(siteCrawlEdges.isTemplate, true));
|
|
@@ -10532,15 +10538,15 @@ async function prepareSiteCrawlGraphLayout(db, scope, options = {}) {
|
|
|
10532
10538
|
path: siteCrawlPages.path,
|
|
10533
10539
|
depth: siteCrawlPages.depth
|
|
10534
10540
|
};
|
|
10535
|
-
const rootRows = db.select(graphSeedColumns).from(siteCrawlPages).where(
|
|
10541
|
+
const rootRows = db.select(graphSeedColumns).from(siteCrawlPages).where(and11(...pageScope, eq13(siteCrawlPages.url, scope.rootUrl))).orderBy(asc(siteCrawlPages.nodeKey)).limit(1).all();
|
|
10536
10542
|
assertNotAborted();
|
|
10537
10543
|
const retainedRows = [...rootRows];
|
|
10538
10544
|
if (retainedRows.length < SITE_CRAWL_GRAPH_MAX_NODES) {
|
|
10539
|
-
retainedRows.push(...db.select(graphSeedColumns).from(siteCrawlPages).where(
|
|
10545
|
+
retainedRows.push(...db.select(graphSeedColumns).from(siteCrawlPages).where(and11(...pageScope, eq13(siteCrawlPages.depth, 0), ne2(siteCrawlPages.url, scope.rootUrl))).orderBy(asc(siteCrawlPages.nodeKey)).limit(SITE_CRAWL_GRAPH_MAX_NODES - retainedRows.length).all());
|
|
10540
10546
|
}
|
|
10541
10547
|
assertNotAborted();
|
|
10542
10548
|
if (retainedRows.length < SITE_CRAWL_GRAPH_MAX_NODES) {
|
|
10543
|
-
retainedRows.push(...db.select(graphSeedColumns).from(siteCrawlPages).where(
|
|
10549
|
+
retainedRows.push(...db.select(graphSeedColumns).from(siteCrawlPages).where(and11(
|
|
10544
10550
|
...pageScope,
|
|
10545
10551
|
or(isNull(siteCrawlPages.depth), ne2(siteCrawlPages.depth, 0)),
|
|
10546
10552
|
ne2(siteCrawlPages.url, scope.rootUrl)
|
|
@@ -10605,7 +10611,7 @@ async function prepareSiteCrawlGraphLayout(db, scope, options = {}) {
|
|
|
10605
10611
|
}
|
|
10606
10612
|
function persistSiteCrawlGraphLayout(db, scope, layout, now = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
10607
10613
|
db.transaction((tx) => {
|
|
10608
|
-
tx.delete(siteCrawlGraphLayouts).where(
|
|
10614
|
+
tx.delete(siteCrawlGraphLayouts).where(and11(
|
|
10609
10615
|
eq13(siteCrawlGraphLayouts.projectId, scope.projectId),
|
|
10610
10616
|
eq13(siteCrawlGraphLayouts.runId, scope.runId),
|
|
10611
10617
|
eq13(siteCrawlGraphLayouts.attemptId, scope.attemptId)
|
|
@@ -10661,7 +10667,7 @@ function persistSiteCrawlGraphLayout(db, scope, layout, now = (/* @__PURE__ */ n
|
|
|
10661
10667
|
});
|
|
10662
10668
|
}
|
|
10663
10669
|
function deleteSiteCrawlGraphLayout(db, scope) {
|
|
10664
|
-
db.delete(siteCrawlGraphLayouts).where(
|
|
10670
|
+
db.delete(siteCrawlGraphLayouts).where(and11(
|
|
10665
10671
|
eq13(siteCrawlGraphLayouts.projectId, scope.projectId),
|
|
10666
10672
|
eq13(siteCrawlGraphLayouts.runId, scope.runId),
|
|
10667
10673
|
eq13(siteCrawlGraphLayouts.attemptId, scope.attemptId)
|
|
@@ -10669,7 +10675,7 @@ function deleteSiteCrawlGraphLayout(db, scope) {
|
|
|
10669
10675
|
}
|
|
10670
10676
|
|
|
10671
10677
|
// src/site-crawl-template-links.ts
|
|
10672
|
-
import { and as
|
|
10678
|
+
import { and as and12, asc as asc2, eq as eq14, gt, inArray as inArray5 } from "drizzle-orm";
|
|
10673
10679
|
var TEMPLATE_LINK_READ_BATCH = 2e3;
|
|
10674
10680
|
var TEMPLATE_LINK_WRITE_BATCH = 500;
|
|
10675
10681
|
function placementOccurrencesOf(row) {
|
|
@@ -10691,7 +10697,7 @@ function* streamAttemptEdges(db, scope) {
|
|
|
10691
10697
|
placementNavigationOccurrences: siteCrawlEdges.placementNavigationOccurrences,
|
|
10692
10698
|
placementContentOccurrences: siteCrawlEdges.placementContentOccurrences,
|
|
10693
10699
|
placementUnknownOccurrences: siteCrawlEdges.placementUnknownOccurrences
|
|
10694
|
-
}).from(siteCrawlEdges).where(
|
|
10700
|
+
}).from(siteCrawlEdges).where(and12(
|
|
10695
10701
|
eq14(siteCrawlEdges.projectId, scope.projectId),
|
|
10696
10702
|
eq14(siteCrawlEdges.runId, scope.runId),
|
|
10697
10703
|
eq14(siteCrawlEdges.attemptId, scope.attemptId),
|
|
@@ -10719,7 +10725,7 @@ function writeGroupKey(isTemplate, templateRatio) {
|
|
|
10719
10725
|
return `${isTemplate ? "1" : "0"}${templateRatio ?? ""}`;
|
|
10720
10726
|
}
|
|
10721
10727
|
function classifySiteCrawlTemplateLinks(db, scope, pagesFetched, placementRulesetVersion) {
|
|
10722
|
-
const scopeFilter =
|
|
10728
|
+
const scopeFilter = and12(
|
|
10723
10729
|
eq14(siteCrawlEdges.projectId, scope.projectId),
|
|
10724
10730
|
eq14(siteCrawlEdges.runId, scope.runId),
|
|
10725
10731
|
eq14(siteCrawlEdges.attemptId, scope.attemptId)
|
|
@@ -10757,7 +10763,7 @@ function classifySiteCrawlTemplateLinks(db, scope, pagesFetched, placementRulese
|
|
|
10757
10763
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
10758
10764
|
for (const group of edgeKeysByValue.values()) {
|
|
10759
10765
|
for (const chunk of chunked(group.edgeKeys)) {
|
|
10760
|
-
db.update(siteCrawlEdges).set({ isTemplate: group.isTemplate, templateRatio: group.templateRatio, updatedAt: now }).where(
|
|
10766
|
+
db.update(siteCrawlEdges).set({ isTemplate: group.isTemplate, templateRatio: group.templateRatio, updatedAt: now }).where(and12(scopeFilter, inArray5(siteCrawlEdges.edgeKey, chunk))).run();
|
|
10761
10767
|
}
|
|
10762
10768
|
}
|
|
10763
10769
|
return {
|
|
@@ -10918,7 +10924,7 @@ function deadLinkCheckedCount(edges, pages) {
|
|
|
10918
10924
|
}
|
|
10919
10925
|
async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
10920
10926
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
10921
|
-
const claim = db.update(runs).set({ status: "running", startedAt }).where(
|
|
10927
|
+
const claim = db.update(runs).set({ status: "running", startedAt }).where(and13(eq15(runs.id, runId), eq15(runs.projectId, projectId), eq15(runs.status, "queued"))).run();
|
|
10922
10928
|
if (claim.changes === 0) return;
|
|
10923
10929
|
const attemptNumber = (db.select({ value: sql6`coalesce(max(${siteCrawlAttempts.attemptNumber}), 0)` }).from(siteCrawlAttempts).where(eq15(siteCrawlAttempts.runId, runId)).get()?.value ?? 0) + 1;
|
|
10924
10930
|
const attemptId = crypto19.randomUUID();
|
|
@@ -10959,11 +10965,11 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
10959
10965
|
eq15(siteCrawlEdges.runId, runId),
|
|
10960
10966
|
eq15(siteCrawlEdges.attemptId, attemptId)
|
|
10961
10967
|
];
|
|
10962
|
-
tx.update(siteCrawlEdges).set({ sourceNodeKey: nodeKey, updatedAt: now }).where(
|
|
10968
|
+
tx.update(siteCrawlEdges).set({ sourceNodeKey: nodeKey, updatedAt: now }).where(and13(
|
|
10963
10969
|
...scope,
|
|
10964
10970
|
eq15(siteCrawlEdges.sourceUrl, url)
|
|
10965
10971
|
)).run();
|
|
10966
|
-
tx.update(siteCrawlEdges).set({ targetNodeKey: nodeKey, updatedAt: now }).where(
|
|
10972
|
+
tx.update(siteCrawlEdges).set({ targetNodeKey: nodeKey, updatedAt: now }).where(and13(
|
|
10967
10973
|
...scope,
|
|
10968
10974
|
eq15(siteCrawlEdges.targetUrl, url)
|
|
10969
10975
|
)).run();
|
|
@@ -10978,7 +10984,7 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
10978
10984
|
fetchState: siteCrawlPages.fetchState,
|
|
10979
10985
|
indexabilityState: siteCrawlPages.indexabilityState,
|
|
10980
10986
|
indexabilityReasons: siteCrawlPages.indexabilityReasons
|
|
10981
|
-
}).from(siteCrawlPages).where(
|
|
10987
|
+
}).from(siteCrawlPages).where(and13(...pageScope, eq15(siteCrawlPages.canonicalUrl, url))).all();
|
|
10982
10988
|
for (const target of canonicalTargets) {
|
|
10983
10989
|
tx.update(siteCrawlPages).set({
|
|
10984
10990
|
canonicalNodeKey: nodeKey,
|
|
@@ -11138,7 +11144,7 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
11138
11144
|
linkScoreRaw: metrics.linkScoreRaw,
|
|
11139
11145
|
linkScoreNormalized: metrics.linkScore,
|
|
11140
11146
|
updatedAt: now
|
|
11141
|
-
}).where(
|
|
11147
|
+
}).where(and13(
|
|
11142
11148
|
eq15(siteCrawlPages.projectId, projectId),
|
|
11143
11149
|
eq15(siteCrawlPages.runId, runId),
|
|
11144
11150
|
eq15(siteCrawlPages.attemptId, attemptId),
|
|
@@ -11148,7 +11154,7 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
11148
11154
|
const persistEvent = async (event) => {
|
|
11149
11155
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
11150
11156
|
db.transaction((tx) => {
|
|
11151
|
-
const receipt = tx.select({ checksum: siteCrawlEventReceipts.checksum }).from(siteCrawlEventReceipts).where(
|
|
11157
|
+
const receipt = tx.select({ checksum: siteCrawlEventReceipts.checksum }).from(siteCrawlEventReceipts).where(and13(
|
|
11152
11158
|
eq15(siteCrawlEventReceipts.attemptId, attemptId),
|
|
11153
11159
|
eq15(siteCrawlEventReceipts.sequence, event.sequence),
|
|
11154
11160
|
eq15(siteCrawlEventReceipts.batchId, event.batchId)
|
|
@@ -11291,7 +11297,7 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
11291
11297
|
}
|
|
11292
11298
|
}
|
|
11293
11299
|
const published = db.transaction((tx) => {
|
|
11294
|
-
const claim2 = tx.update(runs).set({ status: terminalStatus, finishedAt }).where(
|
|
11300
|
+
const claim2 = tx.update(runs).set({ status: terminalStatus, finishedAt }).where(and13(eq15(runs.id, runId), eq15(runs.status, "running"))).run();
|
|
11295
11301
|
if (claim2.changes === 0) return false;
|
|
11296
11302
|
if (hasAuditedPages) {
|
|
11297
11303
|
tx.insert(siteAuditSnapshots).values({
|
|
@@ -11431,7 +11437,7 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
11431
11437
|
status: cancelled ? "cancelled" : "failed",
|
|
11432
11438
|
error: message,
|
|
11433
11439
|
finishedAt
|
|
11434
|
-
}).where(
|
|
11440
|
+
}).where(and13(eq15(runs.id, runId), eq15(runs.status, "running"))).run();
|
|
11435
11441
|
});
|
|
11436
11442
|
log13.error("failed", { runId, projectId, cancelled, error: message });
|
|
11437
11443
|
throw error;
|
|
@@ -11439,7 +11445,7 @@ async function executeSiteAudit(db, runId, projectId, opts = {}) {
|
|
|
11439
11445
|
}
|
|
11440
11446
|
|
|
11441
11447
|
// src/commands/backfill.ts
|
|
11442
|
-
import { and as
|
|
11448
|
+
import { and as and14, eq as eq16, inArray as inArray6, isNull as isNull2, sql as sql7 } from "drizzle-orm";
|
|
11443
11449
|
var SNAPSHOT_BATCH_SIZE = 500;
|
|
11444
11450
|
async function backfillAnswerVisibilityCommand(opts) {
|
|
11445
11451
|
const config = loadConfig();
|
|
@@ -11455,9 +11461,9 @@ async function backfillAnswerVisibilityCommand(opts) {
|
|
|
11455
11461
|
let reparsed = 0;
|
|
11456
11462
|
let providerErrors = 0;
|
|
11457
11463
|
if (scopedProjects.length > 0) {
|
|
11458
|
-
const runRows = projectFilter ? db.select({ id: runs.id, projectId: runs.projectId }).from(runs).where(
|
|
11464
|
+
const runRows = projectFilter ? db.select({ id: runs.id, projectId: runs.projectId }).from(runs).where(and14(
|
|
11459
11465
|
eq16(runs.kind, RunKinds["answer-visibility"]),
|
|
11460
|
-
|
|
11466
|
+
inArray6(runs.projectId, scopedProjects.map((project) => project.id))
|
|
11461
11467
|
)).all() : db.select({ id: runs.id, projectId: runs.projectId }).from(runs).where(eq16(runs.kind, RunKinds["answer-visibility"])).all();
|
|
11462
11468
|
const runIdsByProject = /* @__PURE__ */ new Map();
|
|
11463
11469
|
for (const run of runRows) {
|
|
@@ -11489,7 +11495,7 @@ async function backfillAnswerVisibilityCommand(opts) {
|
|
|
11489
11495
|
competitorOverlap: querySnapshots.competitorOverlap,
|
|
11490
11496
|
recommendedCompetitors: querySnapshots.recommendedCompetitors,
|
|
11491
11497
|
rawResponse: querySnapshots.rawResponse
|
|
11492
|
-
}).from(querySnapshots).where(
|
|
11498
|
+
}).from(querySnapshots).where(inArray6(querySnapshots.runId, batchRunIds)).all();
|
|
11493
11499
|
const pendingUpdates = [];
|
|
11494
11500
|
for (const snapshot of snapshotRows) {
|
|
11495
11501
|
examined++;
|
|
@@ -11614,7 +11620,7 @@ function backfillNormalizedPaths(db, opts) {
|
|
|
11614
11620
|
id: gaTrafficSnapshots.id,
|
|
11615
11621
|
landingPage: gaTrafficSnapshots.landingPage,
|
|
11616
11622
|
landingPageNormalized: gaTrafficSnapshots.landingPageNormalized
|
|
11617
|
-
}).from(gaTrafficSnapshots).where(baseConditions.length > 0 ?
|
|
11623
|
+
}).from(gaTrafficSnapshots).where(baseConditions.length > 0 ? and14(...baseConditions) : void 0).all();
|
|
11618
11624
|
let updated = 0;
|
|
11619
11625
|
let unchanged = 0;
|
|
11620
11626
|
if (rows.length > 0) {
|
|
@@ -11686,7 +11692,7 @@ function backfillAiReferralPaths(db, opts) {
|
|
|
11686
11692
|
id: gaAiReferrals.id,
|
|
11687
11693
|
landingPage: gaAiReferrals.landingPage,
|
|
11688
11694
|
landingPageNormalized: gaAiReferrals.landingPageNormalized
|
|
11689
|
-
}).from(gaAiReferrals).where(baseConditions.length > 0 ?
|
|
11695
|
+
}).from(gaAiReferrals).where(baseConditions.length > 0 ? and14(...baseConditions) : void 0).all();
|
|
11690
11696
|
let updated = 0;
|
|
11691
11697
|
let unchanged = 0;
|
|
11692
11698
|
if (rows.length > 0) {
|
|
@@ -11754,7 +11760,7 @@ function backfillProjectAnswerMentions(db, projectId, opts) {
|
|
|
11754
11760
|
const project = db.select().from(projects).where(eq16(projects.id, projectId)).get();
|
|
11755
11761
|
if (!project) return { examined: 0, updated: 0, mentioned: 0 };
|
|
11756
11762
|
const competitorDomains = db.select({ domain: competitors.domain }).from(competitors).where(eq16(competitors.projectId, projectId)).all().map((row) => row.domain);
|
|
11757
|
-
const runRows = db.select({ id: runs.id }).from(runs).where(
|
|
11763
|
+
const runRows = db.select({ id: runs.id }).from(runs).where(and14(eq16(runs.kind, RunKinds["answer-visibility"]), eq16(runs.projectId, projectId))).all();
|
|
11758
11764
|
const runIds = runRows.map((r) => r.id);
|
|
11759
11765
|
let examined = 0;
|
|
11760
11766
|
let updated = 0;
|
|
@@ -11782,7 +11788,7 @@ function backfillProjectAnswerMentions(db, projectId, opts) {
|
|
|
11782
11788
|
competitorOverlap: querySnapshots.competitorOverlap,
|
|
11783
11789
|
recommendedCompetitors: querySnapshots.recommendedCompetitors,
|
|
11784
11790
|
rawResponse: querySnapshots.rawResponse
|
|
11785
|
-
}).from(querySnapshots).where(
|
|
11791
|
+
}).from(querySnapshots).where(inArray6(querySnapshots.runId, batchRunIds)).all();
|
|
11786
11792
|
const pendingUpdates = [];
|
|
11787
11793
|
for (const snapshot of snapshotRows) {
|
|
11788
11794
|
examined++;
|
|
@@ -11903,7 +11909,7 @@ function readStoredGroundingSources(rawResponse) {
|
|
|
11903
11909
|
return result;
|
|
11904
11910
|
}
|
|
11905
11911
|
async function backfillInsightsCommand(project, opts) {
|
|
11906
|
-
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-
|
|
11912
|
+
const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-OVTSUKZS.js");
|
|
11907
11913
|
const config = loadConfig();
|
|
11908
11914
|
const db = createClient(config.database);
|
|
11909
11915
|
migrate(db);
|
|
@@ -12073,16 +12079,16 @@ async function backfillSnapshotAttributionCommand(opts) {
|
|
|
12073
12079
|
process.stderr.write(`Recovering orphan snapshot attribution for "${project.name}"${mode}...
|
|
12074
12080
|
`);
|
|
12075
12081
|
}
|
|
12076
|
-
const events = db.select({ createdAt: auditLog.createdAt, action: auditLog.action, diff: auditLog.diff }).from(auditLog).where(
|
|
12082
|
+
const events = db.select({ createdAt: auditLog.createdAt, action: auditLog.action, diff: auditLog.diff }).from(auditLog).where(and14(
|
|
12077
12083
|
eq16(auditLog.projectId, project.id),
|
|
12078
|
-
|
|
12084
|
+
inArray6(auditLog.action, ["keywords.appended", "keywords.deleted", "queries.appended", "queries.deleted", "queries.replaced"])
|
|
12079
12085
|
)).orderBy(auditLog.createdAt).all();
|
|
12080
12086
|
const history = replayQueryAuditLog(events);
|
|
12081
12087
|
const orphanRuns = db.select({
|
|
12082
12088
|
runId: runs.id,
|
|
12083
12089
|
createdAt: runs.createdAt,
|
|
12084
12090
|
location: runs.location
|
|
12085
|
-
}).from(runs).innerJoin(querySnapshots, eq16(querySnapshots.runId, runs.id)).where(
|
|
12091
|
+
}).from(runs).innerJoin(querySnapshots, eq16(querySnapshots.runId, runs.id)).where(and14(
|
|
12086
12092
|
eq16(runs.projectId, project.id),
|
|
12087
12093
|
isNull2(querySnapshots.queryId),
|
|
12088
12094
|
isNull2(querySnapshots.queryText)
|
|
@@ -12105,7 +12111,7 @@ async function backfillSnapshotAttributionCommand(opts) {
|
|
|
12105
12111
|
provider: querySnapshots.provider,
|
|
12106
12112
|
createdAt: querySnapshots.createdAt,
|
|
12107
12113
|
answerText: querySnapshots.answerText
|
|
12108
|
-
}).from(querySnapshots).where(
|
|
12114
|
+
}).from(querySnapshots).where(and14(
|
|
12109
12115
|
eq16(querySnapshots.runId, run.runId),
|
|
12110
12116
|
isNull2(querySnapshots.queryId),
|
|
12111
12117
|
isNull2(querySnapshots.queryText)
|
|
@@ -12271,9 +12277,9 @@ async function backfillTrafficClassificationCommand(opts) {
|
|
|
12271
12277
|
dryRun: isDryRun,
|
|
12272
12278
|
byBot: {}
|
|
12273
12279
|
};
|
|
12274
|
-
const unknownCountRow = db.select({ n: sql7`count(*)` }).from(rawEventSamples).where(
|
|
12280
|
+
const unknownCountRow = db.select({ n: sql7`count(*)` }).from(rawEventSamples).where(and14(
|
|
12275
12281
|
eq16(rawEventSamples.eventType, "unknown"),
|
|
12276
|
-
|
|
12282
|
+
inArray6(rawEventSamples.projectId, projectIds)
|
|
12277
12283
|
)).get();
|
|
12278
12284
|
result.unknownBefore = Number(unknownCountRow?.n ?? 0);
|
|
12279
12285
|
const unknownSamples = db.select({
|
|
@@ -12284,9 +12290,9 @@ async function backfillTrafficClassificationCommand(opts) {
|
|
|
12284
12290
|
userAgent: rawEventSamples.userAgent,
|
|
12285
12291
|
pathNormalized: rawEventSamples.pathNormalized,
|
|
12286
12292
|
status: rawEventSamples.status
|
|
12287
|
-
}).from(rawEventSamples).where(
|
|
12293
|
+
}).from(rawEventSamples).where(and14(
|
|
12288
12294
|
eq16(rawEventSamples.eventType, "unknown"),
|
|
12289
|
-
|
|
12295
|
+
inArray6(rawEventSamples.projectId, projectIds)
|
|
12290
12296
|
)).all();
|
|
12291
12297
|
result.examined = unknownSamples.length;
|
|
12292
12298
|
if (unknownSamples.length === 0) {
|
|
@@ -12392,9 +12398,9 @@ async function backfillTrafficClassificationCommand(opts) {
|
|
|
12392
12398
|
});
|
|
12393
12399
|
}
|
|
12394
12400
|
if (!isDryRun) {
|
|
12395
|
-
const afterRow = db.select({ n: sql7`count(*)` }).from(rawEventSamples).where(
|
|
12401
|
+
const afterRow = db.select({ n: sql7`count(*)` }).from(rawEventSamples).where(and14(
|
|
12396
12402
|
eq16(rawEventSamples.eventType, "unknown"),
|
|
12397
|
-
|
|
12403
|
+
inArray6(rawEventSamples.projectId, projectIds)
|
|
12398
12404
|
)).get();
|
|
12399
12405
|
result.unknownAfter = Number(afterRow?.n ?? 0);
|
|
12400
12406
|
} else {
|
|
@@ -12481,7 +12487,7 @@ var ProviderRegistry = class {
|
|
|
12481
12487
|
// src/scheduler.ts
|
|
12482
12488
|
import crypto20 from "crypto";
|
|
12483
12489
|
import cron from "node-cron";
|
|
12484
|
-
import { and as
|
|
12490
|
+
import { and as and15, eq as eq17, inArray as inArray7, notExists, sql as sql8 } from "drizzle-orm";
|
|
12485
12491
|
var log14 = createLogger("Scheduler");
|
|
12486
12492
|
var DEFAULT_HEALTH_CRON = "0 */6 * * *";
|
|
12487
12493
|
function ensureDefaultHealthSchedule(db, projectId, now = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
@@ -12528,7 +12534,7 @@ var Scheduler = class {
|
|
|
12528
12534
|
*/
|
|
12529
12535
|
ensureHealthSchedules() {
|
|
12530
12536
|
const projectsWithoutHealth = this.db.select({ id: projects.id }).from(projects).where(notExists(
|
|
12531
|
-
this.db.select({ one: sql8`1` }).from(schedules).where(
|
|
12537
|
+
this.db.select({ one: sql8`1` }).from(schedules).where(and15(
|
|
12532
12538
|
eq17(schedules.projectId, projects.id),
|
|
12533
12539
|
eq17(schedules.kind, SchedulableRunKinds.doctor)
|
|
12534
12540
|
))
|
|
@@ -12603,7 +12609,7 @@ var Scheduler = class {
|
|
|
12603
12609
|
this.stopTask(key, existing, "Stopped");
|
|
12604
12610
|
this.tasks.delete(key);
|
|
12605
12611
|
}
|
|
12606
|
-
const schedule = this.db.select().from(schedules).where(
|
|
12612
|
+
const schedule = this.db.select().from(schedules).where(and15(eq17(schedules.projectId, projectId), eq17(schedules.kind, kind))).get();
|
|
12607
12613
|
if (schedule && schedule.enabled) {
|
|
12608
12614
|
this.registerCronTask(schedule);
|
|
12609
12615
|
}
|
|
@@ -12719,10 +12725,10 @@ var Scheduler = class {
|
|
|
12719
12725
|
log14.warn("ads-sync.no-callback", { scheduleId, projectId, msg: "host did not register onAdsSyncRequested" });
|
|
12720
12726
|
return;
|
|
12721
12727
|
}
|
|
12722
|
-
const activeAdsRun = this.db.select({ id: runs.id }).from(runs).where(
|
|
12728
|
+
const activeAdsRun = this.db.select({ id: runs.id }).from(runs).where(and15(
|
|
12723
12729
|
eq17(runs.projectId, projectId),
|
|
12724
12730
|
eq17(runs.kind, RunKinds["ads-sync"]),
|
|
12725
|
-
|
|
12731
|
+
inArray7(runs.status, [RunStatuses.queued, RunStatuses.running])
|
|
12726
12732
|
)).get();
|
|
12727
12733
|
if (activeAdsRun) {
|
|
12728
12734
|
log14.info("ads-sync.skipped-active", { projectName: project.name, activeRunId: activeAdsRun.id });
|
|
@@ -12790,10 +12796,10 @@ var Scheduler = class {
|
|
|
12790
12796
|
log14.warn("site-audit.no-callback", { scheduleId, projectId, msg: "host did not register onSiteAuditRequested" });
|
|
12791
12797
|
return;
|
|
12792
12798
|
}
|
|
12793
|
-
const active = this.db.select({ id: runs.id }).from(runs).where(
|
|
12799
|
+
const active = this.db.select({ id: runs.id }).from(runs).where(and15(
|
|
12794
12800
|
eq17(runs.projectId, projectId),
|
|
12795
12801
|
eq17(runs.kind, RunKinds["site-audit"]),
|
|
12796
|
-
|
|
12802
|
+
inArray7(runs.status, [RunStatuses.queued, RunStatuses.running])
|
|
12797
12803
|
)).get();
|
|
12798
12804
|
if (active) {
|
|
12799
12805
|
log14.info("site-audit.skipped-active", { projectName: project.name, activeRunId: active.id });
|
|
@@ -12898,7 +12904,7 @@ async function refreshAllIntegrations(client, projectName) {
|
|
|
12898
12904
|
}
|
|
12899
12905
|
|
|
12900
12906
|
// src/notifier.ts
|
|
12901
|
-
import { eq as eq18, desc as desc7, and as
|
|
12907
|
+
import { eq as eq18, desc as desc7, and as and16, inArray as inArray8, or as or2 } from "drizzle-orm";
|
|
12902
12908
|
import crypto21 from "crypto";
|
|
12903
12909
|
var log16 = createLogger("Notifier");
|
|
12904
12910
|
var MATERIAL_MAGNITUDE_DELTA = 20;
|
|
@@ -13173,7 +13179,7 @@ var Notifier = class {
|
|
|
13173
13179
|
});
|
|
13174
13180
|
return [];
|
|
13175
13181
|
}
|
|
13176
|
-
const groupSiblings = this.db.select().from(runs).where(
|
|
13182
|
+
const groupSiblings = this.db.select().from(runs).where(and16(
|
|
13177
13183
|
eq18(runs.projectId, projectId),
|
|
13178
13184
|
eq18(runs.kind, thisRun.kind),
|
|
13179
13185
|
eq18(runs.createdAt, thisRun.createdAt)
|
|
@@ -13199,7 +13205,7 @@ var Notifier = class {
|
|
|
13199
13205
|
);
|
|
13200
13206
|
const RECENT_FETCH_LIMIT = Math.max(8, locationCount * 4);
|
|
13201
13207
|
const recentRuns = this.db.select().from(runs).where(
|
|
13202
|
-
|
|
13208
|
+
and16(
|
|
13203
13209
|
eq18(runs.projectId, projectId),
|
|
13204
13210
|
eq18(runs.kind, thisRun.kind),
|
|
13205
13211
|
or2(eq18(runs.status, "completed"), eq18(runs.status, "partial"))
|
|
@@ -13219,13 +13225,13 @@ var Notifier = class {
|
|
|
13219
13225
|
provider: querySnapshots.provider,
|
|
13220
13226
|
location: querySnapshots.location,
|
|
13221
13227
|
citationState: querySnapshots.citationState
|
|
13222
|
-
}).from(querySnapshots).leftJoin(queries, eq18(querySnapshots.queryId, queries.id)).where(
|
|
13228
|
+
}).from(querySnapshots).leftJoin(queries, eq18(querySnapshots.queryId, queries.id)).where(inArray8(querySnapshots.runId, currentRunIds)).all();
|
|
13223
13229
|
const previousSnapshots = this.db.select({
|
|
13224
13230
|
queryId: querySnapshots.queryId,
|
|
13225
13231
|
provider: querySnapshots.provider,
|
|
13226
13232
|
location: querySnapshots.location,
|
|
13227
13233
|
citationState: querySnapshots.citationState
|
|
13228
|
-
}).from(querySnapshots).where(
|
|
13234
|
+
}).from(querySnapshots).where(inArray8(querySnapshots.runId, previousRunIds)).all();
|
|
13229
13235
|
const prevMap = /* @__PURE__ */ new Map();
|
|
13230
13236
|
for (const s of previousSnapshots) {
|
|
13231
13237
|
if (s.queryId == null) continue;
|
|
@@ -14645,7 +14651,7 @@ async function loadExternalMcpTools(servers, opts = {}) {
|
|
|
14645
14651
|
|
|
14646
14652
|
// src/agent/memory-store.ts
|
|
14647
14653
|
import crypto24 from "crypto";
|
|
14648
|
-
import { and as
|
|
14654
|
+
import { and as and17, desc as desc8, eq as eq20, like, sql as sql9 } from "drizzle-orm";
|
|
14649
14655
|
var COMPACTION_KEY_PREFIX = "compaction:";
|
|
14650
14656
|
var COMPACTION_NOTES_PER_SESSION = 3;
|
|
14651
14657
|
function rowToDto(row) {
|
|
@@ -14690,12 +14696,12 @@ function upsertMemoryEntry(db, args) {
|
|
|
14690
14696
|
updatedAt: now
|
|
14691
14697
|
}
|
|
14692
14698
|
}).run();
|
|
14693
|
-
const row = db.select().from(agentMemory).where(
|
|
14699
|
+
const row = db.select().from(agentMemory).where(and17(eq20(agentMemory.projectId, args.projectId), eq20(agentMemory.key, args.key))).get();
|
|
14694
14700
|
if (!row) throw new Error("memory upsert produced no row");
|
|
14695
14701
|
return rowToDto(row);
|
|
14696
14702
|
}
|
|
14697
14703
|
function deleteMemoryEntry(db, projectId, key) {
|
|
14698
|
-
const result = db.delete(agentMemory).where(
|
|
14704
|
+
const result = db.delete(agentMemory).where(and17(eq20(agentMemory.projectId, projectId), eq20(agentMemory.key, key))).run();
|
|
14699
14705
|
const changes = result.changes ?? 0;
|
|
14700
14706
|
return changes > 0;
|
|
14701
14707
|
}
|
|
@@ -14724,7 +14730,7 @@ function writeCompactionNote(db, args) {
|
|
|
14724
14730
|
}).run();
|
|
14725
14731
|
const sessionPrefix = `${COMPACTION_KEY_PREFIX}${args.sessionId}:`;
|
|
14726
14732
|
const existing = tx.select({ id: agentMemory.id, updatedAt: agentMemory.updatedAt }).from(agentMemory).where(
|
|
14727
|
-
|
|
14733
|
+
and17(
|
|
14728
14734
|
eq20(agentMemory.projectId, args.projectId),
|
|
14729
14735
|
like(agentMemory.key, `${sessionPrefix}%`)
|
|
14730
14736
|
)
|
|
@@ -14733,7 +14739,7 @@ function writeCompactionNote(db, args) {
|
|
|
14733
14739
|
if (stale.length > 0) {
|
|
14734
14740
|
tx.delete(agentMemory).where(sql9`${agentMemory.id} IN (${sql9.join(stale.map((s) => sql9`${s}`), sql9`, `)})`).run();
|
|
14735
14741
|
}
|
|
14736
|
-
const row = tx.select().from(agentMemory).where(
|
|
14742
|
+
const row = tx.select().from(agentMemory).where(and17(eq20(agentMemory.projectId, args.projectId), eq20(agentMemory.key, key))).get();
|
|
14737
14743
|
if (row) inserted = rowToDto(row);
|
|
14738
14744
|
});
|
|
14739
14745
|
if (!inserted) throw new Error("compaction note write produced no row");
|
|
@@ -16513,20 +16519,20 @@ function clipText(value, length) {
|
|
|
16513
16519
|
}
|
|
16514
16520
|
|
|
16515
16521
|
// src/research-runner.ts
|
|
16516
|
-
import { and as
|
|
16522
|
+
import { and as and18, eq as eq24, inArray as inArray9, sql as sql10 } from "drizzle-orm";
|
|
16517
16523
|
var unfinishedResearchQueryStatuses = [ResearchQueryStatuses.queued, ResearchQueryStatuses.running];
|
|
16518
16524
|
function finalResearchRunStatus(completed, failed) {
|
|
16519
16525
|
if (failed === 0) return ResearchRunStatuses.completed;
|
|
16520
16526
|
return completed > 0 ? ResearchRunStatuses.partial : ResearchRunStatuses.failed;
|
|
16521
16527
|
}
|
|
16522
16528
|
async function executeResearchRun(db, registry, runId, projectId) {
|
|
16523
|
-
const run = db.select().from(researchRuns).where(
|
|
16529
|
+
const run = db.select().from(researchRuns).where(and18(eq24(researchRuns.id, runId), eq24(researchRuns.projectId, projectId))).get();
|
|
16524
16530
|
if (!run || run.status !== ResearchRunStatuses.queued) return;
|
|
16525
16531
|
const project = db.select().from(projects).where(eq24(projects.id, projectId)).get();
|
|
16526
16532
|
if (!project) return;
|
|
16527
16533
|
const provider = registry.get(run.provider);
|
|
16528
16534
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
16529
|
-
const claim = db.update(researchRuns).set({ status: ResearchRunStatuses.running, startedAt: now }).where(
|
|
16535
|
+
const claim = db.update(researchRuns).set({ status: ResearchRunStatuses.running, startedAt: now }).where(and18(eq24(researchRuns.id, runId), eq24(researchRuns.status, ResearchRunStatuses.queued))).run();
|
|
16530
16536
|
if (claim.changes !== 1) return;
|
|
16531
16537
|
let reserved = 0;
|
|
16532
16538
|
let dispatched = 0;
|
|
@@ -16559,7 +16565,7 @@ async function executeResearchRun(db, registry, runId, projectId) {
|
|
|
16559
16565
|
await mapWithConcurrency(rows, Math.max(1, provider.config.quotaPolicy.maxConcurrency), async (row) => {
|
|
16560
16566
|
try {
|
|
16561
16567
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
16562
|
-
db.update(researchRunQueries).set({ status: ResearchQueryStatuses.running, startedAt }).where(
|
|
16568
|
+
db.update(researchRunQueries).set({ status: ResearchQueryStatuses.running, startedAt }).where(and18(eq24(researchRunQueries.id, row.id), eq24(researchRunQueries.status, ResearchQueryStatuses.queued))).run();
|
|
16563
16569
|
const raw = await gate.run(async () => {
|
|
16564
16570
|
dispatched++;
|
|
16565
16571
|
return provider.adapter.executeTrackedQuery({ query: row.queryText, canonicalDomains: domains, competitorDomains, ...run.location ? { location: run.location } : {} }, config);
|
|
@@ -16586,7 +16592,7 @@ async function executeResearchRun(db, registry, runId, projectId) {
|
|
|
16586
16592
|
citationState: determineCitationState(normalized, domains),
|
|
16587
16593
|
rawResponse: raw.rawResponse,
|
|
16588
16594
|
finishedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
16589
|
-
}).where(
|
|
16595
|
+
}).where(and18(eq24(researchRunQueries.id, row.id), eq24(researchRunQueries.status, ResearchQueryStatuses.running))).run();
|
|
16590
16596
|
if (completed.changes === 1) incrementResearchProgress(db, runId, "completedQueries");
|
|
16591
16597
|
} catch (error) {
|
|
16592
16598
|
try {
|
|
@@ -16614,11 +16620,11 @@ function incrementResearchProgress(db, runId, column) {
|
|
|
16614
16620
|
}
|
|
16615
16621
|
function markResearchQueryFailed(db, runId, queryId, error) {
|
|
16616
16622
|
const message = describeError(error);
|
|
16617
|
-
const failed = db.update(researchRunQueries).set({ status: ResearchQueryStatuses.failed, error: message, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(
|
|
16623
|
+
const failed = db.update(researchRunQueries).set({ status: ResearchQueryStatuses.failed, error: message, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(and18(eq24(researchRunQueries.id, queryId), inArray9(researchRunQueries.status, unfinishedResearchQueryStatuses))).run();
|
|
16618
16624
|
if (failed.changes === 1) incrementResearchProgress(db, runId, "failedQueries");
|
|
16619
16625
|
}
|
|
16620
16626
|
function markUnfinishedResearchQueriesFailed(db, runId, error) {
|
|
16621
|
-
db.update(researchRunQueries).set({ status: ResearchQueryStatuses.failed, error, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(
|
|
16627
|
+
db.update(researchRunQueries).set({ status: ResearchQueryStatuses.failed, error, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(and18(eq24(researchRunQueries.researchRunId, runId), inArray9(researchRunQueries.status, unfinishedResearchQueryStatuses))).run();
|
|
16622
16628
|
}
|
|
16623
16629
|
function finalizeResearchRun(db, runId, fatalError) {
|
|
16624
16630
|
const rows = db.select({ status: researchRunQueries.status }).from(researchRunQueries).where(eq24(researchRunQueries.researchRunId, runId)).all();
|
|
@@ -16634,7 +16640,7 @@ function finalizeResearchRun(db, runId, fatalError) {
|
|
|
16634
16640
|
}
|
|
16635
16641
|
|
|
16636
16642
|
// src/google-marketing-sync.ts
|
|
16637
|
-
import { and as
|
|
16643
|
+
import { and as and19, eq as eq25, isNull as isNull3 } from "drizzle-orm";
|
|
16638
16644
|
function safeErrorMessage(error) {
|
|
16639
16645
|
const raw = describeError(error);
|
|
16640
16646
|
return raw.replace(/(["']?authorization["']?\s*[:=]\s*["']?bearer\s+)[^\s,"'}]+/gi, "$1[redacted]").replace(/(["']?(?:developer|access|refresh|client)[_-]?(?:token|secret)["']?\s*[:=]\s*["']?)[^\s,"'}]+/gi, "$1[redacted]").replace(/[\r\n\t]+/g, " ").slice(0, 1e3);
|
|
@@ -16657,7 +16663,7 @@ function assertSnapshotContext(metadata, expected) {
|
|
|
16657
16663
|
}
|
|
16658
16664
|
}
|
|
16659
16665
|
function requireSyncRun(db, runId, projectId, kind) {
|
|
16660
|
-
const run = db.select().from(runs).where(
|
|
16666
|
+
const run = db.select().from(runs).where(and19(
|
|
16661
16667
|
eq25(runs.id, runId),
|
|
16662
16668
|
eq25(runs.projectId, projectId),
|
|
16663
16669
|
eq25(runs.kind, kind)
|
|
@@ -16673,7 +16679,7 @@ function markFailed(db, runId, projectId, kind, expectedStatus, error) {
|
|
|
16673
16679
|
status: RunStatuses.failed,
|
|
16674
16680
|
error: serializeRunError({ message: safeErrorMessage(error) }),
|
|
16675
16681
|
finishedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
16676
|
-
}).where(
|
|
16682
|
+
}).where(and19(
|
|
16677
16683
|
eq25(runs.id, runId),
|
|
16678
16684
|
eq25(runs.projectId, projectId),
|
|
16679
16685
|
eq25(runs.kind, kind),
|
|
@@ -16681,7 +16687,7 @@ function markFailed(db, runId, projectId, kind, expectedStatus, error) {
|
|
|
16681
16687
|
)).run();
|
|
16682
16688
|
}
|
|
16683
16689
|
function claimSyncRun(db, runId, projectId, kind, startedAt) {
|
|
16684
|
-
const claim = db.update(runs).set({ status: RunStatuses.running, startedAt, error: null }).where(
|
|
16690
|
+
const claim = db.update(runs).set({ status: RunStatuses.running, startedAt, error: null }).where(and19(
|
|
16685
16691
|
eq25(runs.id, runId),
|
|
16686
16692
|
eq25(runs.projectId, projectId),
|
|
16687
16693
|
eq25(runs.kind, kind),
|
|
@@ -16746,7 +16752,7 @@ async function executeGoogleAdsMarketingSync(db, runtime, runId, projectId) {
|
|
|
16746
16752
|
status: RunStatuses.completed,
|
|
16747
16753
|
finishedAt,
|
|
16748
16754
|
error: null
|
|
16749
|
-
}).where(
|
|
16755
|
+
}).where(and19(
|
|
16750
16756
|
eq25(runs.id, runId),
|
|
16751
16757
|
eq25(runs.projectId, projectId),
|
|
16752
16758
|
eq25(runs.kind, RunKinds["google-ads-sync"]),
|
|
@@ -16767,7 +16773,7 @@ async function executeGoogleAdsMarketingSync(db, runtime, runId, projectId) {
|
|
|
16767
16773
|
lastMetricsSnapshotAt: result.metrics?.metadata.capturedAt ?? connection.lastMetricsSnapshotAt,
|
|
16768
16774
|
lastMetricsSnapshotId: result.metrics?.metadata.id ?? connection.lastMetricsSnapshotId,
|
|
16769
16775
|
updatedAt: finishedAt
|
|
16770
|
-
}).where(
|
|
16776
|
+
}).where(and19(
|
|
16771
16777
|
eq25(googleAdsConnections.id, connection.id),
|
|
16772
16778
|
eq25(googleAdsConnections.projectId, projectId),
|
|
16773
16779
|
eq25(googleAdsConnections.selectedCustomerId, connection.selectedCustomerId),
|
|
@@ -16836,7 +16842,7 @@ async function executeGtmMarketingSync(db, runtime, runId, projectId) {
|
|
|
16836
16842
|
status: RunStatuses.completed,
|
|
16837
16843
|
finishedAt,
|
|
16838
16844
|
error: null
|
|
16839
|
-
}).where(
|
|
16845
|
+
}).where(and19(
|
|
16840
16846
|
eq25(runs.id, runId),
|
|
16841
16847
|
eq25(runs.projectId, projectId),
|
|
16842
16848
|
eq25(runs.kind, RunKinds["gtm-sync"]),
|
|
@@ -16854,7 +16860,7 @@ async function executeGtmMarketingSync(db, runtime, runId, projectId) {
|
|
|
16854
16860
|
lastSnapshotAt: snapshot.metadata.capturedAt,
|
|
16855
16861
|
lastSnapshotId: snapshot.metadata.id,
|
|
16856
16862
|
updatedAt: finishedAt
|
|
16857
|
-
}).where(
|
|
16863
|
+
}).where(and19(
|
|
16858
16864
|
eq25(gtmConnections.id, connection.id),
|
|
16859
16865
|
eq25(gtmConnections.projectId, projectId),
|
|
16860
16866
|
eq25(gtmConnections.selectedAccountId, connection.selectedAccountId),
|
|
@@ -17801,7 +17807,7 @@ async function createServer(opts) {
|
|
|
17801
17807
|
});
|
|
17802
17808
|
if (!probed) return;
|
|
17803
17809
|
const alreadySynced = opts.db.select().from(ccReleaseSyncs).where(
|
|
17804
|
-
|
|
17810
|
+
and20(
|
|
17805
17811
|
eq26(ccReleaseSyncs.release, probed.release),
|
|
17806
17812
|
eq26(ccReleaseSyncs.status, CcReleaseSyncStatuses.ready)
|
|
17807
17813
|
)
|
|
@@ -63643,37 +63643,46 @@ var amzn_user_default = {
|
|
|
63643
63643
|
// ../integration-traffic/src/ip-ranges/anthropic.json
|
|
63644
63644
|
var anthropic_default = {
|
|
63645
63645
|
_source: "https://claude.com/crawling/bots.json",
|
|
63646
|
-
creationTime: "2026-08-
|
|
63646
|
+
creationTime: "2026-08-18T23:56:36Z",
|
|
63647
63647
|
prefixes: [
|
|
63648
63648
|
{
|
|
63649
|
-
ipv4Prefix: "
|
|
63649
|
+
ipv4Prefix: "136.107.176.208/32"
|
|
63650
63650
|
},
|
|
63651
63651
|
{
|
|
63652
|
-
ipv4Prefix: "
|
|
63652
|
+
ipv4Prefix: "16.58.26.69/32"
|
|
63653
63653
|
},
|
|
63654
63654
|
{
|
|
63655
|
-
ipv4Prefix: "
|
|
63655
|
+
ipv4Prefix: "18.225.238.228/32"
|
|
63656
63656
|
},
|
|
63657
63657
|
{
|
|
63658
|
-
ipv4Prefix: "
|
|
63658
|
+
ipv4Prefix: "18.227.226.255/32"
|
|
63659
63659
|
},
|
|
63660
63660
|
{
|
|
63661
|
-
ipv4Prefix: "
|
|
63661
|
+
ipv4Prefix: "20.102.46.224/28"
|
|
63662
63662
|
},
|
|
63663
63663
|
{
|
|
63664
|
-
ipv4Prefix: "
|
|
63664
|
+
ipv4Prefix: "20.64.57.208/28"
|
|
63665
63665
|
},
|
|
63666
63666
|
{
|
|
63667
|
-
ipv4Prefix: "
|
|
63667
|
+
ipv4Prefix: "216.73.216.0/22"
|
|
63668
63668
|
},
|
|
63669
63669
|
{
|
|
63670
|
-
ipv4Prefix: "34.
|
|
63670
|
+
ipv4Prefix: "34.11.34.31/32"
|
|
63671
63671
|
},
|
|
63672
63672
|
{
|
|
63673
|
-
ipv4Prefix: "34.
|
|
63673
|
+
ipv4Prefix: "34.150.241.79/32"
|
|
63674
63674
|
},
|
|
63675
63675
|
{
|
|
63676
|
-
ipv4Prefix: "
|
|
63676
|
+
ipv4Prefix: "34.162.191.81/32"
|
|
63677
|
+
},
|
|
63678
|
+
{
|
|
63679
|
+
ipv4Prefix: "34.162.230.222/32"
|
|
63680
|
+
},
|
|
63681
|
+
{
|
|
63682
|
+
ipv4Prefix: "34.162.244.71/32"
|
|
63683
|
+
},
|
|
63684
|
+
{
|
|
63685
|
+
ipv4Prefix: "34.182.140.95/32"
|
|
63677
63686
|
},
|
|
63678
63687
|
{
|
|
63679
63688
|
ipv4Prefix: "34.182.161.143/32"
|
|
@@ -63685,13 +63694,10 @@ var anthropic_default = {
|
|
|
63685
63694
|
ipv4Prefix: "34.182.220.85/32"
|
|
63686
63695
|
},
|
|
63687
63696
|
{
|
|
63688
|
-
ipv4Prefix: "34.
|
|
63689
|
-
},
|
|
63690
|
-
{
|
|
63691
|
-
ipv4Prefix: "34.182.140.95/32"
|
|
63697
|
+
ipv4Prefix: "34.182.222.37/32"
|
|
63692
63698
|
},
|
|
63693
63699
|
{
|
|
63694
|
-
ipv4Prefix: "
|
|
63700
|
+
ipv4Prefix: "34.182.225.167/32"
|
|
63695
63701
|
},
|
|
63696
63702
|
{
|
|
63697
63703
|
ipv4Prefix: "34.182.226.151/32"
|
|
@@ -63700,19 +63706,22 @@ var anthropic_default = {
|
|
|
63700
63706
|
ipv4Prefix: "34.182.226.221/32"
|
|
63701
63707
|
},
|
|
63702
63708
|
{
|
|
63703
|
-
ipv4Prefix: "
|
|
63709
|
+
ipv4Prefix: "34.186.108.163/32"
|
|
63704
63710
|
},
|
|
63705
63711
|
{
|
|
63706
|
-
ipv4Prefix: "34.
|
|
63712
|
+
ipv4Prefix: "34.85.172.162/32"
|
|
63707
63713
|
},
|
|
63708
63714
|
{
|
|
63709
|
-
ipv4Prefix: "
|
|
63715
|
+
ipv4Prefix: "35.221.29.174/32"
|
|
63710
63716
|
},
|
|
63711
63717
|
{
|
|
63712
|
-
ipv4Prefix: "
|
|
63718
|
+
ipv4Prefix: "35.245.175.129/32"
|
|
63713
63719
|
},
|
|
63714
63720
|
{
|
|
63715
|
-
ipv4Prefix: "
|
|
63721
|
+
ipv4Prefix: "35.245.89.239/32"
|
|
63722
|
+
},
|
|
63723
|
+
{
|
|
63724
|
+
ipv4Prefix: "40.124.101.48/28"
|
|
63716
63725
|
}
|
|
63717
63726
|
]
|
|
63718
63727
|
};
|
|
@@ -63919,7 +63928,7 @@ var bingbot_default = {
|
|
|
63919
63928
|
// ../integration-traffic/src/ip-ranges/ccbot.json
|
|
63920
63929
|
var ccbot_default = {
|
|
63921
63930
|
_source: "https://index.commoncrawl.org/ccbot.json",
|
|
63922
|
-
creationTime: "2026-08-
|
|
63931
|
+
creationTime: "2026-08-11T13:40:00Z",
|
|
63923
63932
|
prefixes: [
|
|
63924
63933
|
{
|
|
63925
63934
|
ipv4Prefix: "18.97.14.80/29"
|
|
@@ -63933,9 +63942,6 @@ var ccbot_default = {
|
|
|
63933
63942
|
{
|
|
63934
63943
|
ipv4Prefix: "3.41.188.32/29"
|
|
63935
63944
|
},
|
|
63936
|
-
{
|
|
63937
|
-
ipv4Prefix: "98.85.178.216/32"
|
|
63938
|
-
},
|
|
63939
63945
|
{
|
|
63940
63946
|
ipv6Prefix: "2600:1f28:365:8000::/56"
|
|
63941
63947
|
}
|
|
@@ -63945,7 +63951,7 @@ var ccbot_default = {
|
|
|
63945
63951
|
// ../integration-traffic/src/ip-ranges/chatgpt-connectors.json
|
|
63946
63952
|
var chatgpt_connectors_default = {
|
|
63947
63953
|
_source: "https://openai.com/chatgpt-connectors.json",
|
|
63948
|
-
creationTime: "2026-
|
|
63954
|
+
creationTime: "2026-09-04T18:11:32.523266",
|
|
63949
63955
|
prefixes: [
|
|
63950
63956
|
{
|
|
63951
63957
|
ipv4Prefix: "100.31.168.162/32"
|
|
@@ -64193,9 +64199,15 @@ var chatgpt_connectors_default = {
|
|
|
64193
64199
|
{
|
|
64194
64200
|
ipv4Prefix: "184.73.124.134/32"
|
|
64195
64201
|
},
|
|
64202
|
+
{
|
|
64203
|
+
ipv4Prefix: "191.232.238.96/28"
|
|
64204
|
+
},
|
|
64196
64205
|
{
|
|
64197
64206
|
ipv4Prefix: "191.233.251.27/32"
|
|
64198
64207
|
},
|
|
64208
|
+
{
|
|
64209
|
+
ipv4Prefix: "191.234.167.144/28"
|
|
64210
|
+
},
|
|
64199
64211
|
{
|
|
64200
64212
|
ipv4Prefix: "191.237.249.64/28"
|
|
64201
64213
|
},
|
|
@@ -64571,9 +64583,6 @@ var chatgpt_connectors_default = {
|
|
|
64571
64583
|
{
|
|
64572
64584
|
ipv4Prefix: "52.242.132.240/28"
|
|
64573
64585
|
},
|
|
64574
|
-
{
|
|
64575
|
-
ipv4Prefix: "52.255.109.112/28"
|
|
64576
|
-
},
|
|
64577
64586
|
{
|
|
64578
64587
|
ipv4Prefix: "52.255.109.144/28"
|
|
64579
64588
|
},
|
|
@@ -64736,7 +64745,7 @@ var chatgpt_connectors_default = {
|
|
|
64736
64745
|
// ../integration-traffic/src/ip-ranges/chatgpt-user.json
|
|
64737
64746
|
var chatgpt_user_default = {
|
|
64738
64747
|
_source: "https://openai.com/chatgpt-user.json",
|
|
64739
|
-
creationTime: "2026-
|
|
64748
|
+
creationTime: "2026-09-04T18:03:29.248484",
|
|
64740
64749
|
prefixes: [
|
|
64741
64750
|
{
|
|
64742
64751
|
ipv4Prefix: "104.208.184.192/28"
|
|
@@ -64870,9 +64879,21 @@ var chatgpt_user_default = {
|
|
|
64870
64879
|
{
|
|
64871
64880
|
ipv4Prefix: "172.215.215.32/28"
|
|
64872
64881
|
},
|
|
64882
|
+
{
|
|
64883
|
+
ipv4Prefix: "191.232.238.96/28"
|
|
64884
|
+
},
|
|
64885
|
+
{
|
|
64886
|
+
ipv4Prefix: "191.233.197.0/28"
|
|
64887
|
+
},
|
|
64873
64888
|
{
|
|
64874
64889
|
ipv4Prefix: "191.233.199.160/28"
|
|
64875
64890
|
},
|
|
64891
|
+
{
|
|
64892
|
+
ipv4Prefix: "191.234.167.144/28"
|
|
64893
|
+
},
|
|
64894
|
+
{
|
|
64895
|
+
ipv4Prefix: "191.235.99.160/28"
|
|
64896
|
+
},
|
|
64876
64897
|
{
|
|
64877
64898
|
ipv4Prefix: "191.237.249.64/28"
|
|
64878
64899
|
},
|
|
@@ -65215,9 +65236,6 @@ var chatgpt_user_default = {
|
|
|
65215
65236
|
{
|
|
65216
65237
|
ipv4Prefix: "52.242.132.240/28"
|
|
65217
65238
|
},
|
|
65218
|
-
{
|
|
65219
|
-
ipv4Prefix: "52.255.109.112/28"
|
|
65220
|
-
},
|
|
65221
65239
|
{
|
|
65222
65240
|
ipv4Prefix: "52.255.109.144/28"
|
|
65223
65241
|
},
|
|
@@ -65356,7 +65374,7 @@ var chatgpt_user_default = {
|
|
|
65356
65374
|
// ../integration-traffic/src/ip-ranges/duckassistbot.json
|
|
65357
65375
|
var duckassistbot_default = {
|
|
65358
65376
|
_source: "https://duckduckgo.com/duckassistbot.json",
|
|
65359
|
-
creationTime: "2026-
|
|
65377
|
+
creationTime: "2026-09-01T12:44:58.000000",
|
|
65360
65378
|
prefixes: [
|
|
65361
65379
|
{
|
|
65362
65380
|
ipv4Prefix: "104.43.54.127/32"
|
|
@@ -65421,6 +65439,9 @@ var duckassistbot_default = {
|
|
|
65421
65439
|
{
|
|
65422
65440
|
ipv4Prefix: "134.33.207.189/32"
|
|
65423
65441
|
},
|
|
65442
|
+
{
|
|
65443
|
+
ipv4Prefix: "135.171.251.169/32"
|
|
65444
|
+
},
|
|
65424
65445
|
{
|
|
65425
65446
|
ipv4Prefix: "135.233.63.237/32"
|
|
65426
65447
|
},
|
|
@@ -65511,6 +65532,9 @@ var duckassistbot_default = {
|
|
|
65511
65532
|
{
|
|
65512
65533
|
ipv4Prefix: "172.179.128.118/32"
|
|
65513
65534
|
},
|
|
65535
|
+
{
|
|
65536
|
+
ipv4Prefix: "172.188.250.220/32"
|
|
65537
|
+
},
|
|
65514
65538
|
{
|
|
65515
65539
|
ipv4Prefix: "172.189.40.18/32"
|
|
65516
65540
|
},
|
|
@@ -66135,9 +66159,18 @@ var duckassistbot_default = {
|
|
|
66135
66159
|
{
|
|
66136
66160
|
ipv4Prefix: "20.99.255.235/32"
|
|
66137
66161
|
},
|
|
66162
|
+
{
|
|
66163
|
+
ipv4Prefix: "4.144.148.23/32"
|
|
66164
|
+
},
|
|
66138
66165
|
{
|
|
66139
66166
|
ipv4Prefix: "4.144.182.50/32"
|
|
66140
66167
|
},
|
|
66168
|
+
{
|
|
66169
|
+
ipv4Prefix: "4.144.227.142/32"
|
|
66170
|
+
},
|
|
66171
|
+
{
|
|
66172
|
+
ipv4Prefix: "4.144.251.39/32"
|
|
66173
|
+
},
|
|
66141
66174
|
{
|
|
66142
66175
|
ipv4Prefix: "4.149.142.7/32"
|
|
66143
66176
|
},
|
|
@@ -66807,7 +66840,7 @@ var duckassistbot_default = {
|
|
|
66807
66840
|
// ../integration-traffic/src/ip-ranges/duckduckbot.json
|
|
66808
66841
|
var duckduckbot_default = {
|
|
66809
66842
|
_source: "https://duckduckgo.com/duckduckbot.json",
|
|
66810
|
-
creationTime: "2026-
|
|
66843
|
+
creationTime: "2026-09-01T12:44:58.000000",
|
|
66811
66844
|
prefixes: [
|
|
66812
66845
|
{
|
|
66813
66846
|
ipv4Prefix: "104.43.54.127/32"
|
|
@@ -66872,6 +66905,9 @@ var duckduckbot_default = {
|
|
|
66872
66905
|
{
|
|
66873
66906
|
ipv4Prefix: "134.33.207.189/32"
|
|
66874
66907
|
},
|
|
66908
|
+
{
|
|
66909
|
+
ipv4Prefix: "135.171.251.169/32"
|
|
66910
|
+
},
|
|
66875
66911
|
{
|
|
66876
66912
|
ipv4Prefix: "135.233.63.237/32"
|
|
66877
66913
|
},
|
|
@@ -66962,6 +66998,9 @@ var duckduckbot_default = {
|
|
|
66962
66998
|
{
|
|
66963
66999
|
ipv4Prefix: "172.179.128.118/32"
|
|
66964
67000
|
},
|
|
67001
|
+
{
|
|
67002
|
+
ipv4Prefix: "172.188.250.220/32"
|
|
67003
|
+
},
|
|
66965
67004
|
{
|
|
66966
67005
|
ipv4Prefix: "172.189.40.18/32"
|
|
66967
67006
|
},
|
|
@@ -67586,9 +67625,18 @@ var duckduckbot_default = {
|
|
|
67586
67625
|
{
|
|
67587
67626
|
ipv4Prefix: "20.99.255.235/32"
|
|
67588
67627
|
},
|
|
67628
|
+
{
|
|
67629
|
+
ipv4Prefix: "4.144.148.23/32"
|
|
67630
|
+
},
|
|
67589
67631
|
{
|
|
67590
67632
|
ipv4Prefix: "4.144.182.50/32"
|
|
67591
67633
|
},
|
|
67634
|
+
{
|
|
67635
|
+
ipv4Prefix: "4.144.227.142/32"
|
|
67636
|
+
},
|
|
67637
|
+
{
|
|
67638
|
+
ipv4Prefix: "4.144.251.39/32"
|
|
67639
|
+
},
|
|
67592
67640
|
{
|
|
67593
67641
|
ipv4Prefix: "4.149.142.7/32"
|
|
67594
67642
|
},
|
|
@@ -68326,7 +68374,7 @@ var google_user_triggered_agents_default = {
|
|
|
68326
68374
|
// ../integration-traffic/src/ip-ranges/google-user-triggered-fetchers.json
|
|
68327
68375
|
var google_user_triggered_fetchers_default = {
|
|
68328
68376
|
_source: "https://developers.google.com/static/crawling/ipranges/user-triggered-fetchers-google.json",
|
|
68329
|
-
creationTime: "2026-
|
|
68377
|
+
creationTime: "2026-09-08T14:45:44.000000",
|
|
68330
68378
|
prefixes: [
|
|
68331
68379
|
{
|
|
68332
68380
|
ipv4Prefix: "142.250.32.0/27"
|
|
@@ -68835,6 +68883,9 @@ var google_user_triggered_fetchers_default = {
|
|
|
68835
68883
|
{
|
|
68836
68884
|
ipv4Prefix: "66.249.84.32/27"
|
|
68837
68885
|
},
|
|
68886
|
+
{
|
|
68887
|
+
ipv4Prefix: "66.249.84.64/27"
|
|
68888
|
+
},
|
|
68838
68889
|
{
|
|
68839
68890
|
ipv4Prefix: "66.249.84.96/27"
|
|
68840
68891
|
},
|
|
@@ -69285,6 +69336,9 @@ var google_user_triggered_fetchers_default = {
|
|
|
69285
69336
|
{
|
|
69286
69337
|
ipv6Prefix: "2001:4860:4801:4062::/64"
|
|
69287
69338
|
},
|
|
69339
|
+
{
|
|
69340
|
+
ipv6Prefix: "2001:4860:4801:4063::/64"
|
|
69341
|
+
},
|
|
69288
69342
|
{
|
|
69289
69343
|
ipv6Prefix: "2001:4860:4801:4064::/64"
|
|
69290
69344
|
},
|
|
@@ -69816,7 +69870,7 @@ var google_user_triggered_fetchers_default = {
|
|
|
69816
69870
|
// ../integration-traffic/src/ip-ranges/googlebot.json
|
|
69817
69871
|
var googlebot_default = {
|
|
69818
69872
|
_source: "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
|
|
69819
|
-
creationTime: "2026-
|
|
69873
|
+
creationTime: "2026-09-08T14:45:40.000000",
|
|
69820
69874
|
prefixes: [
|
|
69821
69875
|
{
|
|
69822
69876
|
ipv4Prefix: "192.178.4.0/27"
|
|
@@ -70055,6 +70109,9 @@ var googlebot_default = {
|
|
|
70055
70109
|
{
|
|
70056
70110
|
ipv4Prefix: "66.249.68.192/27"
|
|
70057
70111
|
},
|
|
70112
|
+
{
|
|
70113
|
+
ipv4Prefix: "66.249.68.224/27"
|
|
70114
|
+
},
|
|
70058
70115
|
{
|
|
70059
70116
|
ipv4Prefix: "66.249.68.32/27"
|
|
70060
70117
|
},
|
|
@@ -70481,6 +70538,9 @@ var googlebot_default = {
|
|
|
70481
70538
|
{
|
|
70482
70539
|
ipv6Prefix: "2001:4860:4801:42::/64"
|
|
70483
70540
|
},
|
|
70541
|
+
{
|
|
70542
|
+
ipv6Prefix: "2001:4860:4801:43::/64"
|
|
70543
|
+
},
|
|
70484
70544
|
{
|
|
70485
70545
|
ipv6Prefix: "2001:4860:4801:44::/64"
|
|
70486
70546
|
},
|
package/dist/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
trackCliCommandFinished,
|
|
29
29
|
trackEvent,
|
|
30
30
|
waitForServerRuntimeStartup
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-KPNNUEM5.js";
|
|
32
32
|
import {
|
|
33
33
|
autoSyncSkills,
|
|
34
34
|
formatAutoSyncNotice
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
projects,
|
|
73
73
|
queries,
|
|
74
74
|
renderReportHtml
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-PF5QRORD.js";
|
|
76
76
|
import {
|
|
77
77
|
AdsDeliverySnapshotStatuses,
|
|
78
78
|
AdsHistoricalCampaignRollupStatuses,
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
createGoogleMarketingCredentialStore,
|
|
4
4
|
createGoogleMarketingRuntime,
|
|
5
5
|
createServer
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KPNNUEM5.js";
|
|
7
7
|
import {
|
|
8
8
|
loadConfig
|
|
9
9
|
} from "./chunk-V7LWMC2C.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-PF5QRORD.js";
|
|
11
11
|
import "./chunk-PXGN7BY7.js";
|
|
12
12
|
export {
|
|
13
13
|
GoogleMarketingRuntimeError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainyc/canonry",
|
|
3
|
-
"version": "4.186.
|
|
3
|
+
"version": "4.186.6",
|
|
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
|
"license": "FSL-1.1-ALv2",
|
|
@@ -70,35 +70,37 @@
|
|
|
70
70
|
"@types/node-cron": "^3.0.11",
|
|
71
71
|
"tsup": "^8.5.1",
|
|
72
72
|
"tsx": "^4.19.0",
|
|
73
|
-
"@ainyc/canonry-
|
|
73
|
+
"@ainyc/canonry-web": "0.0.0",
|
|
74
74
|
"@ainyc/canonry-api-routes": "0.0.0",
|
|
75
|
+
"@ainyc/canonry-api-client": "0.0.0",
|
|
75
76
|
"@ainyc/canonry-config": "0.0.0",
|
|
76
|
-
"@ainyc/canonry-db": "0.0.0",
|
|
77
77
|
"@ainyc/canonry-contracts": "0.0.0",
|
|
78
|
+
"@ainyc/canonry-db": "0.0.0",
|
|
78
79
|
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
79
|
-
"@ainyc/canonry-integration-cloudflare-queue": "0.0.0",
|
|
80
80
|
"@ainyc/canonry-integration-cloud-run": "0.0.0",
|
|
81
|
+
"@ainyc/canonry-integration-cloudflare-queue": "0.0.0",
|
|
81
82
|
"@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
|
|
82
83
|
"@ainyc/canonry-integration-commoncrawl": "0.0.0",
|
|
83
84
|
"@ainyc/canonry-integration-google": "0.0.0",
|
|
84
85
|
"@ainyc/canonry-integration-google-ads": "0.0.0",
|
|
85
86
|
"@ainyc/canonry-integration-google-places": "0.0.0",
|
|
86
|
-
"@ainyc/canonry-integration-google-
|
|
87
|
+
"@ainyc/canonry-integration-google-tag-manager": "0.0.0",
|
|
87
88
|
"@ainyc/canonry-integration-openai-ads": "0.0.0",
|
|
88
89
|
"@ainyc/canonry-integration-traffic": "0.0.0",
|
|
90
|
+
"@ainyc/canonry-integration-google-business-profile": "0.0.0",
|
|
91
|
+
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
89
92
|
"@ainyc/canonry-intelligence": "0.0.0",
|
|
90
|
-
"@ainyc/canonry-integration-google-tag-manager": "0.0.0",
|
|
91
|
-
"@ainyc/canonry-provider-cdp": "0.0.0",
|
|
92
|
-
"@ainyc/canonry-provider-claude": "0.0.0",
|
|
93
93
|
"@ainyc/canonry-provider-gemini": "0.0.0",
|
|
94
|
+
"@ainyc/canonry-provider-claude": "0.0.0",
|
|
94
95
|
"@ainyc/canonry-provider-local": "0.0.0",
|
|
95
96
|
"@ainyc/canonry-provider-openai": "0.0.0",
|
|
96
|
-
"@ainyc/canonry-
|
|
97
|
-
"@ainyc/canonry-provider-
|
|
97
|
+
"@ainyc/canonry-provider-perplexity": "0.0.0",
|
|
98
|
+
"@ainyc/canonry-provider-cdp": "0.0.0"
|
|
98
99
|
},
|
|
99
100
|
"scripts": {
|
|
100
|
-
"build": "
|
|
101
|
-
"build:
|
|
101
|
+
"build": "pnpm run build:cli && pnpm run build:web",
|
|
102
|
+
"build:cli": "node --import tsx scripts/copy-agent-assets.ts && tsup",
|
|
103
|
+
"build:web": "node --import tsx build-web.ts",
|
|
102
104
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
103
105
|
"test": "vitest run --config ../../vitest.package.config.ts",
|
|
104
106
|
"lint": "eslint src/ test/"
|