@canonry/canonry 7.128.1 → 7.130.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.
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +3 -3
- package/assets/assets/{AccessControls-QW1RtXqK.js → AccessControls-B1v2FZPP.js} +1 -1
- package/assets/assets/{AgentSetupPage-BFXD__2X.js → AgentSetupPage-DAu_QuMy.js} +1 -1
- package/assets/assets/{AuditHistoryPanel-Cn9Tnnxo.js → AuditHistoryPanel-D_zRZDy7.js} +1 -1
- package/assets/assets/{BacklinksPage-Bv12EM38.js → BacklinksPage-DMZKWIfa.js} +1 -1
- package/assets/assets/{ChartPrimitives-DIAAi1Eq.js → ChartPrimitives-0854i4GX.js} +1 -1
- package/assets/assets/{HistoryPage-Bfn3nVjo.js → HistoryPage-Ci2llyKV.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-BuVvdugZ.js → MeasurementPropertyPage-Bml0yUnY.js} +1 -1
- package/assets/assets/{ProjectPage-er2nBpgg.js → ProjectPage-DQgRsgAv.js} +3 -3
- package/assets/assets/{RunsPage-wtzz8XIJ.js → RunsPage-BihA-xXz.js} +1 -1
- package/assets/assets/{ServerTrafficSection-oViiKz3j.js → ServerTrafficSection-B4FdP2Yn.js} +3 -3
- package/assets/assets/{SettingsPage-CVL6mVTM.js → SettingsPage-DuheQKDg.js} +1 -1
- package/assets/assets/{ToneBadge-DSr49xyr.js → ToneBadge-CvjNM6Ls.js} +1 -1
- package/assets/assets/{TrafficPage-drK_F4xY.js → TrafficPage-DiG_i3h4.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-BdvprrAg.js → TrafficSourceDetailPage-BRlxEdMd.js} +1 -1
- package/assets/assets/{account-context-CRwUczVQ.js → account-context-DBJg_gVV.js} +1 -1
- package/assets/assets/{agent-trust-copy-DduiTpc0.js → agent-trust-copy-DELKG03R.js} +1 -1
- package/assets/assets/{card-DtN_FyC4.js → card-WjxG7OUP.js} +1 -1
- package/assets/assets/{index-Bh4Hdh7M.js → index-DxQlUSXe.js} +3 -3
- package/assets/assets/{preload-helper-CqQPtzI4.js → preload-helper-CkO9IcjS.js} +1 -1
- package/assets/assets/{query-client-DTIKbVqE.js → query-client-BuEx84KK.js} +1 -1
- package/assets/assets/{react-query-Bt-PaSFW.js → react-query-DF9z4xIx.js} +1 -1
- package/assets/assets/{react-sigma_core.esm.min-DLmrzL1s.js → react-sigma_core.esm.min-C1O8GFwj.js} +1 -1
- package/assets/assets/{server-traffic-BApvbZVl.js → server-traffic-s9vqPEWz.js} +1 -1
- package/assets/assets/{service--wSlHsiA.js → service-ZGP6b4iE.js} +1 -1
- package/assets/index.html +9 -9
- package/dist/activity-VIJVNTMK.js +13 -0
- package/dist/{ads-MMIVXXYK.js → ads-PLZRG4BQ.js} +4 -4
- package/dist/{agent-3N6J7AP5.js → agent-RFRMOTLE.js} +8 -8
- package/dist/{agent-ask-V5NBRKWB.js → agent-ask-CB756SUB.js} +4 -4
- package/dist/{agent-conversations-6ZKNOOGK.js → agent-conversations-RRI7T74B.js} +4 -4
- package/dist/{agent-journeys-R3TB7RS6.js → agent-journeys-PLYAVLGB.js} +4 -4
- package/dist/{agent-memory-VKNEXDCF.js → agent-memory-R5Q7DLRZ.js} +4 -4
- package/dist/{agent-providers-HV3LM656.js → agent-providers-HNMGZ7GY.js} +4 -4
- package/dist/{agent-transcript-5B7ZSNQO.js → agent-transcript-N6ZBTF72.js} +4 -4
- package/dist/{analytics-NRYYKO3D.js → analytics-W6B2FQSA.js} +4 -4
- package/dist/{answerability-BMPIAEV4.js → answerability-BDOOPOJF.js} +4 -4
- package/dist/{apply-52VDVYIV.js → apply-LCANKKT5.js} +4 -4
- package/dist/{backfill-QIXONSLO.js → backfill-E3EVDP2O.js} +11 -11
- package/dist/{backlinks-B4IMH5VN.js → backlinks-ZXSN3XNV.js} +4 -4
- package/dist/{bing-G56ZWW4V.js → bing-FMDKRCXN.js} +4 -4
- package/dist/{bootstrap-74GDJENX.js → bootstrap-IHKKYDBO.js} +11 -11
- package/dist/{cdp-LVPKD5WH.js → cdp-ASPLW35M.js} +8 -8
- package/dist/{chunk-2JW5OBUF.js → chunk-37MF5NMW.js} +5 -5
- package/dist/{chunk-V42NDP4R.js → chunk-4ISL4JNK.js} +4 -4
- package/dist/{chunk-YDVXZWWF.js → chunk-4KITKJPN.js} +5 -5
- package/dist/{chunk-F56XOHE2.js → chunk-52J7GFCK.js} +2 -2
- package/dist/{chunk-4PFBSPFE.js → chunk-5U4HCSI6.js} +4 -4
- package/dist/{chunk-HOR6MC5A.js → chunk-76N4UIAF.js} +387 -378
- package/dist/{chunk-RG5E54VU.js → chunk-7PTUA52C.js} +1 -1
- package/dist/{chunk-KIJCFPN4.js → chunk-ALU56PI7.js} +1 -1
- package/dist/{chunk-PGKT42YN.js → chunk-AP54KLWN.js} +1 -1
- package/dist/{chunk-KZKPWHJA.js → chunk-BERGWPA7.js} +5 -5
- package/dist/{chunk-PM23BRHO.js → chunk-C4JM5HJW.js} +1 -1
- package/dist/{chunk-ETTKN2R4.js → chunk-FGEBFVHB.js} +189 -16
- package/dist/{chunk-DOXBK2KF.js → chunk-FI7HVTO6.js} +13 -5
- package/dist/{chunk-3TCXYRME.js → chunk-GVCL4XBU.js} +3 -3
- package/dist/{chunk-4MEWPJ7A.js → chunk-GXLF45FF.js} +8 -8
- package/dist/{chunk-34CPCOQI.js → chunk-HH6FQW5W.js} +3 -3
- package/dist/{chunk-BHWR4PBF.js → chunk-JMJSAK2H.js} +3 -3
- package/dist/{chunk-YW4K74WM.js → chunk-JUZ4ZCOX.js} +9 -6
- package/dist/{chunk-2GA43I45.js → chunk-KQQERQJ2.js} +3 -3
- package/dist/{chunk-ZXX7DMBJ.js → chunk-LJ65QBRP.js} +1 -1
- package/dist/{chunk-AVLWYL4G.js → chunk-MARIMDMX.js} +4 -4
- package/dist/{chunk-STNPEES2.js → chunk-MI575M4K.js} +59 -42
- package/dist/{chunk-A4NXXWFC.js → chunk-MQFH765X.js} +4 -4
- package/dist/{chunk-WCWWHK7P.js → chunk-NUBJTRIV.js} +352 -223
- package/dist/{chunk-SXLHTMXA.js → chunk-NUYKLS2R.js} +2 -2
- package/dist/{chunk-AT2LRVEB.js → chunk-PABT3HDP.js} +2 -2
- package/dist/{chunk-XTIOFTFS.js → chunk-QHQZ2226.js} +1 -1
- package/dist/{chunk-O6RKXY2P.js → chunk-QRIKJT6Y.js} +1 -1
- package/dist/{chunk-5LBYOWQZ.js → chunk-S6X3HHSN.js} +8 -7
- package/dist/{chunk-UXCNYSAB.js → chunk-VEDGR4LZ.js} +2 -2
- package/dist/{chunk-EOZLVWOC.js → chunk-VON4PHNS.js} +4 -4
- package/dist/{chunk-FQFL223H.js → chunk-VRY5M7CR.js} +2 -2
- package/dist/{chunk-I4ITDPK7.js → chunk-WP76HORO.js} +1 -1
- package/dist/{chunk-G7HRY36G.js → chunk-WZPKPA6I.js} +2 -2
- package/dist/{chunk-7G6PCF4H.js → chunk-XVEPR3ZC.js} +13 -9
- package/dist/{chunk-6RE7O724.js → chunk-Z77D43M5.js} +2 -2
- package/dist/{chunk-5JQHOPNE.js → chunk-ZHWJJVCT.js} +2 -2
- package/dist/{chunk-XMPXMQ5X.js → chunk-ZHXPH7WB.js} +1 -1
- package/dist/{citations-CF7AU3KY.js → citations-YWXR3WBL.js} +5 -5
- package/dist/{cli-catalog-U6WE3BU7.js → cli-catalog-RT3QPDLR.js} +4 -4
- package/dist/cli-commands-6J6A5ULK.js +18 -0
- package/dist/cli.js +14 -14
- package/dist/{competitor-Q7L6HJ5O.js → competitor-6ZTA2SZH.js} +4 -4
- package/dist/{content-5KLBWKCB.js → content-DJYGQ5CP.js} +4 -4
- package/dist/{dashboard-KQ3INTH3.js → dashboard-F7NFKQLL.js} +7 -7
- package/dist/{demo-5YEH32AM.js → demo-653PUOIB.js} +3 -3
- package/dist/{demo-server-25MUI3QS.js → demo-server-PVBLYPC5.js} +13 -13
- package/dist/{discover-ENDRNDS6.js → discover-3E7QM2TL.js} +5 -5
- package/dist/{discover-eval-7LJXSHUM.js → discover-eval-NAZPA6PV.js} +4 -4
- package/dist/{doctor-3N7TEK5G.js → doctor-OFFSPNBK.js} +4 -4
- package/dist/{evidence-MAIUNVWP.js → evidence-VOSSML2G.js} +4 -4
- package/dist/{export-cmd-6FJNHZVJ.js → export-cmd-IVACTDSV.js} +4 -4
- package/dist/{ga-HWFGPMTN.js → ga-BX4C7TPI.js} +4 -4
- package/dist/{gbp-KIPU2NE6.js → gbp-SV3J2VG3.js} +4 -4
- package/dist/{google-PKYUSFRS.js → google-J23OD7TR.js} +5 -5
- package/dist/{google-marketing-NHQ6VSOK.js → google-marketing-TTLXMDMD.js} +2 -2
- package/dist/{health-cmd-OGYIMIFA.js → health-cmd-26AHD5XL.js} +5 -5
- package/dist/{history-5NJOUK2A.js → history-QWBRFDQR.js} +4 -4
- package/dist/index.d.ts +96 -96
- package/dist/index.js +26 -26
- package/dist/{init-3JXUT7VJ.js → init-URQ4E3XR.js} +13 -13
- package/dist/{insights-CWTPGOPF.js → insights-PMTHHZ2H.js} +4 -4
- package/dist/intelligence-service-GPA7IGDX.js +15 -0
- package/dist/{journeys-VP7LL2DS.js → journeys-IA7TF753.js} +4 -4
- package/dist/{keys-VBZG6BWU.js → keys-DOHLZTRI.js} +4 -4
- package/dist/{keyword-M7Y4V5MJ.js → keyword-3C2ZU6OB.js} +4 -4
- package/dist/{logs-NTFQR3S6.js → logs-P7VRVZ5N.js} +4 -4
- package/dist/{mcp-DUN57Q6H.js → mcp-6NA62OAY.js} +5 -5
- package/dist/mcp.js +10 -10
- package/dist/{measurement-plan-SGJ7EDVC.js → measurement-plan-RHKCARVE.js} +6 -6
- package/dist/{notify-4NOHQ6G4.js → notify-ODCY7TD3.js} +4 -4
- package/dist/{organic-evidence-5NWLGCGE.js → organic-evidence-76P5AYB3.js} +4 -4
- package/dist/{overview-EQ3BTXHC.js → overview-5T776SEB.js} +7 -7
- package/dist/{project-J43SI3ZT.js → project-ITMGW45M.js} +4 -4
- package/dist/{project-setup-5WA4RAN3.js → project-setup-A3Q6ZX73.js} +4 -4
- package/dist/{query-NMWKGTJ3.js → query-3QAQITK3.js} +4 -4
- package/dist/{research-UU2JB4JH.js → research-R74N3VRL.js} +4 -4
- package/dist/{results-export-RQMNBKXT.js → results-export-23GY45AY.js} +4 -4
- package/dist/{run-JTIH3ET5.js → run-ID66JYBN.js} +6 -6
- package/dist/{schedule-YVKS4ILU.js → schedule-HZ2CRUAL.js} +4 -4
- package/dist/{search-XCX3SAOT.js → search-DM5WWMTE.js} +4 -4
- package/dist/{serve-GOZOQL67.js → serve-3QDHKCHE.js} +27 -27
- package/dist/{session-H6N6B6RR.js → session-ZN3YZI2D.js} +16 -16
- package/dist/{settings-2GDLWIBA.js → settings-SIEKVYD7.js} +4 -4
- package/dist/{sitemaps-22O75HMK.js → sitemaps-M4IAZLK2.js} +4 -4
- package/dist/{skills-NSUS2XV2.js → skills-J6LWTNU5.js} +3 -3
- package/dist/{snapshot-UCITZQFF.js → snapshot-SM3BVX5M.js} +4 -4
- package/dist/{src-OAVTTKVK.js → src-VGZVLOM3.js} +2 -2
- package/dist/{status-KJZSA6KP.js → status-BHJJOUCK.js} +6 -6
- package/dist/{support-PWLEDLQT.js → support-FPXXXJPZ.js} +2 -2
- package/dist/{technical-aeo-P3R7RR52.js → technical-aeo-4DJWWPUN.js} +4 -4
- package/dist/{telemetry-LA72RJFS.js → telemetry-LKVQUSO7.js} +5 -5
- package/dist/{tools-Q6ITEQ4V.js → tools-Y67PVNIJ.js} +12 -12
- package/dist/{traffic-CRLJJFKS.js → traffic-QSZYZHFW.js} +6 -6
- package/dist/{trends-A7ST3WIY.js → trends-WIHWJVJR.js} +4 -4
- package/dist/{users-4H7IS7WC.js → users-HQOPQRTP.js} +4 -4
- package/dist/{visibility-stats-F2RUTMYR.js → visibility-stats-MCY5CAUC.js} +5 -5
- package/dist/{wordpress-EVNS3SAF.js → wordpress-IB5YOJSM.js} +5 -5
- package/package.json +1 -1
- package/dist/activity-IDVGFHBZ.js +0 -13
- package/dist/cli-commands-DFFJYIZF.js +0 -18
- package/dist/intelligence-service-7DFVBFXY.js +0 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pickProjectCitedDomain
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LJ65QBRP.js";
|
|
4
4
|
import {
|
|
5
5
|
createLogger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VRY5M7CR.js";
|
|
7
7
|
import {
|
|
8
8
|
GBP_INSIGHT_PROVIDER,
|
|
9
9
|
PERSISTENT_GAP_THRESHOLD,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
notScopedRun,
|
|
19
19
|
readGscQueryDailyRows,
|
|
20
20
|
readLatestGscDataDate
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NUBJTRIV.js";
|
|
22
22
|
import {
|
|
23
23
|
competitors,
|
|
24
24
|
gbpDailyMetrics,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
queries,
|
|
37
37
|
querySnapshots,
|
|
38
38
|
runs
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-FI7HVTO6.js";
|
|
40
40
|
import {
|
|
41
41
|
CitationStates,
|
|
42
42
|
RunKinds,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
effectiveDomains,
|
|
46
46
|
isCitationStateMeasured,
|
|
47
47
|
readCitationState
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-FGEBFVHB.js";
|
|
49
49
|
|
|
50
50
|
// src/intelligence-service.ts
|
|
51
51
|
import { eq, desc, asc, and, ne, or, inArray, gte, lte, isNull, sql, exists } from "drizzle-orm";
|
|
@@ -93,6 +93,7 @@ var WILDCARD_SCOPE = "*";
|
|
|
93
93
|
var RESEARCH_RUN_SCOPE = "research.run";
|
|
94
94
|
var SEO_RUN_SCOPE = "seo.run";
|
|
95
95
|
var SEO_WRITE_SCOPE = "seo.write";
|
|
96
|
+
var MEASUREMENT_PLAN_WRITE_SCOPE = "measurement-plan.write";
|
|
96
97
|
var PROJECTS_WRITE_SCOPE = "projects.write";
|
|
97
98
|
var ADS_WRITE_SCOPE = "ads.write";
|
|
98
99
|
var ADS_APPROVE_SCOPE = "ads.approve";
|
|
@@ -630,6 +631,12 @@ function googleBusinessReviewUrl(value) {
|
|
|
630
631
|
}
|
|
631
632
|
}
|
|
632
633
|
|
|
634
|
+
// ../contracts/src/shell.ts
|
|
635
|
+
function shellQuote(value) {
|
|
636
|
+
if (value !== "" && /^[\w./:@%+=,-]+$/.test(value)) return value;
|
|
637
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
638
|
+
}
|
|
639
|
+
|
|
633
640
|
// ../contracts/src/errors.ts
|
|
634
641
|
var AppError = class extends Error {
|
|
635
642
|
code;
|
|
@@ -661,8 +668,8 @@ function alreadyExists(entity, id2) {
|
|
|
661
668
|
function validationError(message, details) {
|
|
662
669
|
return new AppError("VALIDATION_ERROR", message, 400, details);
|
|
663
670
|
}
|
|
664
|
-
function integrationNotConnected(message) {
|
|
665
|
-
return new AppError("INTEGRATION_NOT_CONNECTED", message, 400);
|
|
671
|
+
function integrationNotConnected(message, details) {
|
|
672
|
+
return new AppError("INTEGRATION_NOT_CONNECTED", message, 400, details);
|
|
666
673
|
}
|
|
667
674
|
function authRequired(message = "Authentication required") {
|
|
668
675
|
return new AppError("AUTH_REQUIRED", message, 401);
|
|
@@ -676,8 +683,8 @@ function forbidden(message = "Forbidden", details) {
|
|
|
676
683
|
function storedOnlyRefused(message = "Stored-only mode refuses live or write operations", details) {
|
|
677
684
|
return new AppError("STORED_ONLY_REFUSED", message, 403, details);
|
|
678
685
|
}
|
|
679
|
-
function quotaExceeded(metric, details) {
|
|
680
|
-
return new AppError("QUOTA_EXCEEDED", `Quota exceeded for ${metric}`, 429, details);
|
|
686
|
+
function quotaExceeded(metric, details, message) {
|
|
687
|
+
return new AppError("QUOTA_EXCEEDED", message ?? `Quota exceeded for ${metric}`, 429, details);
|
|
681
688
|
}
|
|
682
689
|
function researchDailyLimitExceeded(projectName, limit, date) {
|
|
683
690
|
return new AppError(
|
|
@@ -693,12 +700,21 @@ function providerError(message, details) {
|
|
|
693
700
|
function providerAuthError(message, details) {
|
|
694
701
|
return new AppError("PROVIDER_AUTH", message, 502, details);
|
|
695
702
|
}
|
|
703
|
+
var PROVIDER_SETUP_STEPS = "Add a provider key in Settings. From the CLI: `canonry settings provider <name> --api-key <key>`.";
|
|
696
704
|
function noProvider(projectName, details) {
|
|
697
705
|
return new AppError(
|
|
698
706
|
"NO_PROVIDER",
|
|
699
|
-
`No runnable answer provider is configured for '${projectName}'.
|
|
707
|
+
`No runnable answer provider is configured for '${projectName}'. ${PROVIDER_SETUP_STEPS}`,
|
|
708
|
+
503,
|
|
709
|
+
{ reason: "provider-not-configured", projectName, remediation: PROVIDER_SETUP_STEPS, ...details }
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
function noSnapshotProvider() {
|
|
713
|
+
return new AppError(
|
|
714
|
+
"NO_PROVIDER",
|
|
715
|
+
`No answer provider that runs snapshots is configured. ${PROVIDER_SETUP_STEPS}`,
|
|
700
716
|
503,
|
|
701
|
-
{
|
|
717
|
+
{ reason: "provider-not-configured", remediation: PROVIDER_SETUP_STEPS }
|
|
702
718
|
);
|
|
703
719
|
}
|
|
704
720
|
function providersFailing(message, details) {
|
|
@@ -712,14 +728,88 @@ function noQueries(projectName) {
|
|
|
712
728
|
{ projectName }
|
|
713
729
|
);
|
|
714
730
|
}
|
|
731
|
+
function activeRunRemediation(projectName, kind, activeRunId) {
|
|
732
|
+
const project = shellQuote(projectName);
|
|
733
|
+
if (kind === "research") {
|
|
734
|
+
return activeRunId ? `Wait for it to finish, then retry. From the CLI: \`canonry research show ${project} ${shellQuote(activeRunId)}\`.` : `Wait for it to finish, then retry. From the CLI: \`canonry research list ${project}\`.`;
|
|
735
|
+
}
|
|
736
|
+
return activeRunId ? `Wait for it to finish or cancel it, then retry. From the CLI: \`canonry run show ${shellQuote(activeRunId)}\`, or \`canonry run cancel ${project} ${shellQuote(activeRunId)}\`.` : `Wait for it to finish or cancel it, then retry. From the CLI: \`canonry run cancel ${project}\`.`;
|
|
737
|
+
}
|
|
715
738
|
function runInProgress(projectName, kind = "answer-visibility", activeRunId) {
|
|
739
|
+
const remediation = activeRunRemediation(projectName, kind, activeRunId);
|
|
716
740
|
return new AppError(
|
|
717
741
|
"RUN_IN_PROGRESS",
|
|
718
|
-
`A '${kind}' run is already in progress for '${projectName}'`,
|
|
742
|
+
`A '${kind}' run${activeRunId ? ` (${activeRunId})` : ""} is already in progress for '${projectName}'. ${remediation}`,
|
|
719
743
|
409,
|
|
720
|
-
{ projectName, kind, ...activeRunId ? { activeRunId } : {} }
|
|
744
|
+
{ projectName, kind, ...activeRunId ? { activeRunId } : {}, reason: "run-in-progress", remediation }
|
|
721
745
|
);
|
|
722
746
|
}
|
|
747
|
+
function trackedQueriesLockedByRun(projectName, activeRunId) {
|
|
748
|
+
const remediation = activeRunRemediation(projectName, "answer-visibility", activeRunId);
|
|
749
|
+
return new AppError(
|
|
750
|
+
"RUN_IN_PROGRESS",
|
|
751
|
+
`Tracked queries for '${projectName}' can't change while sweep ${activeRunId} is queued or running. ${remediation}`,
|
|
752
|
+
409,
|
|
753
|
+
{ projectName, kind: "answer-visibility", activeRunId, reason: "queries-locked-by-run", remediation }
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
var GOOGLE_OAUTH_CONNECT = {
|
|
757
|
+
gsc: { dashboard: "connect Search Console from the project", cli: "`canonry google connect <project>`" },
|
|
758
|
+
ga4: { dashboard: "connect Google Analytics from the project", cli: "`canonry google connect <project> --type ga4`" },
|
|
759
|
+
gbp: { dashboard: "connect Business Profile from the project", cli: "`canonry gbp connect <project>`" }
|
|
760
|
+
};
|
|
761
|
+
var SET_GOOGLE_CLIENT_COMMAND = "`canonry settings google --client-id <id> --client-secret <secret> --target server`";
|
|
762
|
+
function googleOAuthSetupSteps(target = "gsc") {
|
|
763
|
+
if (!target) return `Set the Google OAuth client in Settings, then retry. From the CLI: ${SET_GOOGLE_CLIENT_COMMAND}.`;
|
|
764
|
+
const connect = GOOGLE_OAUTH_CONNECT[target];
|
|
765
|
+
return `Set the Google OAuth client in Settings, then ${connect.dashboard}. From the CLI: ${SET_GOOGLE_CLIENT_COMMAND}, then ${connect.cli}.`;
|
|
766
|
+
}
|
|
767
|
+
function googleOAuthNotConfigured(target) {
|
|
768
|
+
const remediation = googleOAuthSetupSteps(target);
|
|
769
|
+
return validationError(`Google OAuth is not configured on this instance. ${remediation}`, {
|
|
770
|
+
reason: "google-oauth-not-configured",
|
|
771
|
+
remediation
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
var SERVER_TRAFFIC_TAB = "the project's Server traffic tab";
|
|
775
|
+
var CONNECT_STEPS = {
|
|
776
|
+
gsc: { dashboard: "Connect Google Search Console from the project", cli: (project) => `\`canonry google connect ${project}\`` },
|
|
777
|
+
ga4: {
|
|
778
|
+
dashboard: "Connect Google Analytics 4 from the project",
|
|
779
|
+
cli: (project) => `\`canonry ga connect ${project} --property-id <id> --key-file <path>\` with a service account key, or \`canonry google connect ${project} --type ga4\`, then \`canonry ga connect ${project} --property-id <id>\``
|
|
780
|
+
},
|
|
781
|
+
gbp: { dashboard: "Connect Google Business Profile from the project", cli: (project) => `\`canonry gbp connect ${project}\`` },
|
|
782
|
+
bing: { dashboard: "Connect Bing Webmaster Tools from the project", cli: (project) => `\`canonry bing connect ${project} --api-key <key>\`` },
|
|
783
|
+
"openai-ads": { dashboard: null, cli: (project) => `\`canonry ads connect ${project} --api-key <sdk-key>\`` },
|
|
784
|
+
wordpress: { dashboard: null, cli: (project) => `\`canonry wordpress connect ${project} --url <url> --user <user> --app-password <password>\`` },
|
|
785
|
+
"traffic-cloud-run": { dashboard: `Connect Cloud Run from ${SERVER_TRAFFIC_TAB}`, cli: (project) => `\`canonry traffic connect cloud-run ${project} --gcp-project <id>\`` },
|
|
786
|
+
"traffic-wordpress": {
|
|
787
|
+
dashboard: `Connect WordPress from ${SERVER_TRAFFIC_TAB}`,
|
|
788
|
+
cli: (project) => `\`canonry traffic connect wordpress ${project} --url <wp-site-url> --username <wp-user> --app-password-file <path>\``
|
|
789
|
+
},
|
|
790
|
+
"traffic-vercel": {
|
|
791
|
+
dashboard: `Connect Vercel from ${SERVER_TRAFFIC_TAB}`,
|
|
792
|
+
cli: (project) => `\`canonry traffic connect vercel ${project} --project-id <prj> --team-id <team> --token-file <path>\``
|
|
793
|
+
},
|
|
794
|
+
"traffic-cloudflare": {
|
|
795
|
+
dashboard: `Follow the Cloudflare steps in ${SERVER_TRAFFIC_TAB}`,
|
|
796
|
+
cli: (project) => `\`canonry traffic connect cloudflare ${project} --zone-id <id> --account-id <id>\``
|
|
797
|
+
},
|
|
798
|
+
// Chrome serves the whole instance, and the CLI saves its endpoint to the
|
|
799
|
+
// config file, which the running server reads when it starts.
|
|
800
|
+
cdp: { dashboard: "Connect Chrome in Settings", cli: () => "`canonry cdp connect`, then restart the server" }
|
|
801
|
+
};
|
|
802
|
+
function connectSteps(integration, projectName, options = {}) {
|
|
803
|
+
const step = CONNECT_STEPS[integration];
|
|
804
|
+
const command = step.cli(projectName === void 0 ? "<project>" : shellQuote(projectName));
|
|
805
|
+
if (!step.dashboard) return `${options.reconnect ? "Reconnect" : "Connect"} it from the CLI: ${command}.`;
|
|
806
|
+
const dashboard = options.reconnect ? step.dashboard.replace(/^Connect /, "Reconnect ") : step.dashboard;
|
|
807
|
+
return `${dashboard}. From the CLI: ${command}.`;
|
|
808
|
+
}
|
|
809
|
+
function notConnectedRefusal(factory, cause, integration, projectName) {
|
|
810
|
+
const remediation = connectSteps(integration, projectName);
|
|
811
|
+
return factory(`${cause} ${remediation}`, { reason: "integration-not-connected", integration, remediation });
|
|
812
|
+
}
|
|
723
813
|
function operationInProgress(message, details) {
|
|
724
814
|
return new AppError("OPERATION_IN_PROGRESS", message, 409, details);
|
|
725
815
|
}
|
|
@@ -8054,7 +8144,7 @@ function buildProviderRunError(messages) {
|
|
|
8054
8144
|
}
|
|
8055
8145
|
function skippedProviderRunError(provider, streak) {
|
|
8056
8146
|
return {
|
|
8057
|
-
message: `Not called: ${provider} failed on its account (${streak.code}) in each of its last ${streak.consecutiveRuns} runs. It is called again after ${streak.retryAfter}, or as soon as a new key, model or endpoint is saved for it (canonry settings provider ${provider}). Pass force (canonry run --force)
|
|
8147
|
+
message: `Not called: ${provider} failed on its account (${streak.code}) in each of its last ${streak.consecutiveRuns} runs. It is called again after ${streak.retryAfter}, or as soon as a new key, model or endpoint is saved for it (\`canonry settings provider ${provider} --api-key <key>\`, or \`--model <model>\` or \`--base-url <url>\` in place of the key). Pass force to call it now (\`canonry run <project> --force\`).`,
|
|
8058
8148
|
code: streak.code,
|
|
8059
8149
|
skipped: true
|
|
8060
8150
|
};
|
|
@@ -14793,6 +14883,13 @@ var READ_SEMANTIC_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
14793
14883
|
"POST /api/v1/projects/{name}/measurement-plan/draft/actions/compile-preview",
|
|
14794
14884
|
"POST /api/v1/projects/{name}/measurement-plan/draft/actions/diff-preview"
|
|
14795
14885
|
]);
|
|
14886
|
+
var READ_ONLY_KEY_REFUSED_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
14887
|
+
function readOnlyKeyMaySend(operation) {
|
|
14888
|
+
const separator = operation.indexOf(" ");
|
|
14889
|
+
if (separator < 0) return !READ_ONLY_KEY_REFUSED_METHODS.has(operation.toUpperCase());
|
|
14890
|
+
const method = operation.slice(0, separator).toUpperCase();
|
|
14891
|
+
return !READ_ONLY_KEY_REFUSED_METHODS.has(method) || READ_SEMANTIC_OPERATIONS.has(`${method} ${operation.slice(separator + 1)}`);
|
|
14892
|
+
}
|
|
14796
14893
|
var WRITE_OPERATIONS = /* @__PURE__ */ new Set([
|
|
14797
14894
|
"GET /api/v1/session",
|
|
14798
14895
|
"GET /api/v1/auth/session",
|
|
@@ -14831,6 +14928,8 @@ var STORED_READ_OPERATIONS = new Set(withLegacyAgentReadinessPaths([
|
|
|
14831
14928
|
"GET /api/v1/projects/{name}/agent-readiness/runs/{runId}/page-health-preview",
|
|
14832
14929
|
"POST /api/v1/projects/{name}/competitor-changes/preview",
|
|
14833
14930
|
"POST /api/v1/projects/{name}/queries/replace-preview",
|
|
14931
|
+
// Builds the change and a review token from the stored workspace; only the commit writes.
|
|
14932
|
+
"POST /api/v1/projects/{name}/query-tracking/preview",
|
|
14834
14933
|
"GET /api/v1/projects/{name}/ga/acquisition",
|
|
14835
14934
|
"GET /api/v1/projects/{name}/traffic/referral-assessment",
|
|
14836
14935
|
"GET /api/v1/projects/{name}/traffic/samples",
|
|
@@ -23728,12 +23827,6 @@ var operationalLogListReadSchema = z72.object({
|
|
|
23728
23827
|
retentionPolicy: z72.object(retentionPolicySchema.shape).optional()
|
|
23729
23828
|
});
|
|
23730
23829
|
|
|
23731
|
-
// ../contracts/src/shell.ts
|
|
23732
|
-
function shellQuote(value) {
|
|
23733
|
-
if (value !== "" && /^[\w./:@%+=,-]+$/.test(value)) return value;
|
|
23734
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
23735
|
-
}
|
|
23736
|
-
|
|
23737
23830
|
// ../contracts/src/referral-assessment.ts
|
|
23738
23831
|
import { z as z73 } from "zod";
|
|
23739
23832
|
var referralAssessmentQuerySchema = z73.object({
|
|
@@ -28251,6 +28344,71 @@ function escapeLikePattern(value) {
|
|
|
28251
28344
|
return value.replace(/[\\%_]/g, (match) => `\\${match}`);
|
|
28252
28345
|
}
|
|
28253
28346
|
|
|
28347
|
+
// ../contracts/src/seo-errors.ts
|
|
28348
|
+
function seoBudgetLimitOfScope(scope) {
|
|
28349
|
+
const prefix = scope.slice(0, scope.indexOf(":"));
|
|
28350
|
+
return prefix === "account-day" || prefix === "account-month" || prefix === "project-month" ? prefix : null;
|
|
28351
|
+
}
|
|
28352
|
+
function seoBudgetResetsAt(period) {
|
|
28353
|
+
const day = /^(\d{4})-(\d{2})-(\d{2})$/.exec(period);
|
|
28354
|
+
if (day) return new Date(Date.UTC(Number(day[1]), Number(day[2]) - 1, Number(day[3]) + 1)).toISOString();
|
|
28355
|
+
const month = /^(\d{4})-(\d{2})$/.exec(period);
|
|
28356
|
+
if (month) return new Date(Date.UTC(Number(month[1]), Number(month[2]), 1)).toISOString();
|
|
28357
|
+
return null;
|
|
28358
|
+
}
|
|
28359
|
+
function seoRefusal(message, remediation, details) {
|
|
28360
|
+
return validationError(`${message} ${remediation}`, { ...details, remediation });
|
|
28361
|
+
}
|
|
28362
|
+
var PROFILE_SET_COMMAND = "`canonry seo profile set <project> <profile-id> --file <profile.json>`";
|
|
28363
|
+
function seoRunCostCapExceeded(taskCount) {
|
|
28364
|
+
return seoRefusal(
|
|
28365
|
+
`This SEO profile's estimated cost (${taskCount} provider ${taskCount === 1 ? "request" : "requests"}) is over the host's per-run cost cap.`,
|
|
28366
|
+
`Edit the profile to narrow it (fewer targets, keywords or market searches, or a lower limit or depth), or contact the host operator to raise the cap. From the CLI: ${PROFILE_SET_COMMAND}.`,
|
|
28367
|
+
{ reason: "seo-run-cost-cap", limit: "run-cost-cap", taskCount }
|
|
28368
|
+
);
|
|
28369
|
+
}
|
|
28370
|
+
function seoBudgetExhausted(bucket) {
|
|
28371
|
+
const limit = seoBudgetLimitOfScope(bucket.scope);
|
|
28372
|
+
const resetsAt = seoBudgetResetsAt(bucket.period);
|
|
28373
|
+
const budget = limit === "project-month" ? "this project's monthly SEO budget" : limit ? `the SEO funding account's ${limit === "account-day" ? "daily" : "monthly"} budget, which every project on this funding account shares` : "an SEO budget it reserves against";
|
|
28374
|
+
return seoRefusal(
|
|
28375
|
+
`This refresh's estimated cost is more than is left of ${budget}. Refreshes still queued or awaiting reconciliation count against it.`,
|
|
28376
|
+
`Edit the profile to narrow it (a smaller refresh may still fit), ${resetsAt ? `wait for the budget to reset at ${resetsAt}` : "wait for the budget to reset"}, cancel a queued refresh, or contact the host operator. From the CLI: \`canonry seo runs <project>\`, then \`canonry seo run cancel <project> <run-id>\`.`,
|
|
28377
|
+
{ reason: "seo-budget-exhausted", limit, period: bucket.period, ...resetsAt ? { resetsAt } : {} }
|
|
28378
|
+
);
|
|
28379
|
+
}
|
|
28380
|
+
function seoNothingToFetch() {
|
|
28381
|
+
return seoRefusal(
|
|
28382
|
+
"This SEO profile plans no provider requests: it has no targets, keywords or market searches to fetch.",
|
|
28383
|
+
`Edit the profile to add some. From the CLI: ${PROFILE_SET_COMMAND}.`,
|
|
28384
|
+
{ reason: "seo-nothing-to-fetch" }
|
|
28385
|
+
);
|
|
28386
|
+
}
|
|
28387
|
+
function seoEstimateUnusable() {
|
|
28388
|
+
return seoRefusal(
|
|
28389
|
+
"The SEO provider gave no usable cost estimate for this profile, so it cannot be checked against the host limits.",
|
|
28390
|
+
"Edit the profile to check its inputs against what the connection supports, or contact the host operator to check the SEO connection. From the CLI: `canonry seo context <project>` lists what each connection supports.",
|
|
28391
|
+
{ reason: "seo-estimate-unusable" }
|
|
28392
|
+
);
|
|
28393
|
+
}
|
|
28394
|
+
function seoPlanRevisionStale(pinned, active) {
|
|
28395
|
+
return seoRefusal(
|
|
28396
|
+
pinned === null ? `This SEO profile names no Advanced Measurement revision, but revision ${active} is active.` : `This SEO profile is pinned to Advanced Measurement revision ${pinned}, but revision ${active} is active.`,
|
|
28397
|
+
`Edit the profile and save it again to use revision ${active}. From the CLI: set scope.expectedPlanRevision to ${active} and run ${PROFILE_SET_COMMAND}.`,
|
|
28398
|
+
{ reason: "seo-plan-revision-stale", pinnedPlanRevision: pinned, activePlanRevision: active }
|
|
28399
|
+
);
|
|
28400
|
+
}
|
|
28401
|
+
function seoReconciliationRequired(blocking) {
|
|
28402
|
+
const runId = blocking.sameProject ? blocking.runId ?? null : null;
|
|
28403
|
+
const taskId = blocking.sameProject ? blocking.taskId ?? null : null;
|
|
28404
|
+
const task = taskId ?? "<task-id>";
|
|
28405
|
+
return seoRefusal(
|
|
28406
|
+
"New SEO refreshes are paused: a refresh on this funding account needs operator verification.",
|
|
28407
|
+
`Contact the host operator. Host operators: \`canonry seo operator task ${task}\`, then \`canonry seo operator reconcile ${task} --file <receipt>\`.`,
|
|
28408
|
+
{ reason: "seo-reconciliation-required", sameProject: blocking.sameProject, ...runId ? { runId } : {}, ...taskId ? { taskId } : {} }
|
|
28409
|
+
);
|
|
28410
|
+
}
|
|
28411
|
+
|
|
28254
28412
|
// ../contracts/src/chatgpt.ts
|
|
28255
28413
|
import { z as z97 } from "zod";
|
|
28256
28414
|
var CHATGPT_ISSUER = "https://auth.openai.com";
|
|
@@ -29843,6 +30001,7 @@ export {
|
|
|
29843
30001
|
RESEARCH_RUN_SCOPE,
|
|
29844
30002
|
SEO_RUN_SCOPE,
|
|
29845
30003
|
SEO_WRITE_SCOPE,
|
|
30004
|
+
MEASUREMENT_PLAN_WRITE_SCOPE,
|
|
29846
30005
|
PROJECTS_WRITE_SCOPE,
|
|
29847
30006
|
ADS_WRITE_SCOPE,
|
|
29848
30007
|
ADS_APPROVE_SCOPE,
|
|
@@ -29909,6 +30068,7 @@ export {
|
|
|
29909
30068
|
HEALTH_NO_LONGER_URGENT,
|
|
29910
30069
|
ReviewDeliveryStates,
|
|
29911
30070
|
googleBusinessReviewUrl,
|
|
30071
|
+
shellQuote,
|
|
29912
30072
|
AppError,
|
|
29913
30073
|
notFound,
|
|
29914
30074
|
alreadyExists,
|
|
@@ -29922,10 +30082,17 @@ export {
|
|
|
29922
30082
|
researchDailyLimitExceeded,
|
|
29923
30083
|
providerError,
|
|
29924
30084
|
providerAuthError,
|
|
30085
|
+
PROVIDER_SETUP_STEPS,
|
|
29925
30086
|
noProvider,
|
|
30087
|
+
noSnapshotProvider,
|
|
29926
30088
|
providersFailing,
|
|
29927
30089
|
noQueries,
|
|
29928
30090
|
runInProgress,
|
|
30091
|
+
trackedQueriesLockedByRun,
|
|
30092
|
+
googleOAuthSetupSteps,
|
|
30093
|
+
googleOAuthNotConfigured,
|
|
30094
|
+
connectSteps,
|
|
30095
|
+
notConnectedRefusal,
|
|
29929
30096
|
operationInProgress,
|
|
29930
30097
|
scheduleVersionConflict,
|
|
29931
30098
|
projectRevisionConflict,
|
|
@@ -30437,6 +30604,7 @@ export {
|
|
|
30437
30604
|
OPERATION_ACCESS_HEADER,
|
|
30438
30605
|
STORED_ONLY_HEADER,
|
|
30439
30606
|
READ_SEMANTIC_OPERATIONS,
|
|
30607
|
+
readOnlyKeyMaySend,
|
|
30440
30608
|
operationAccess,
|
|
30441
30609
|
maxOperationAccess,
|
|
30442
30610
|
matchOperationTemplate,
|
|
@@ -31175,6 +31343,12 @@ export {
|
|
|
31175
31343
|
LOCATION_REDIRECT_STATUSES,
|
|
31176
31344
|
isLocationRedirectStatus,
|
|
31177
31345
|
escapeLikePattern,
|
|
31346
|
+
seoRunCostCapExceeded,
|
|
31347
|
+
seoBudgetExhausted,
|
|
31348
|
+
seoNothingToFetch,
|
|
31349
|
+
seoEstimateUnusable,
|
|
31350
|
+
seoPlanRevisionStale,
|
|
31351
|
+
seoReconciliationRequired,
|
|
31178
31352
|
CHATGPT_ISSUER,
|
|
31179
31353
|
CHATGPT_DISCOVERY_URL,
|
|
31180
31354
|
CHATGPT_RESOURCE,
|
|
@@ -31263,7 +31437,6 @@ export {
|
|
|
31263
31437
|
upgradeCommandFor,
|
|
31264
31438
|
upgradeCaveatFor,
|
|
31265
31439
|
updateCheckEnvOptOut,
|
|
31266
|
-
shellQuote,
|
|
31267
31440
|
asRecord,
|
|
31268
31441
|
referralAssessmentQuerySchema,
|
|
31269
31442
|
referralAssessmentSchema,
|
|
@@ -18,10 +18,13 @@ import {
|
|
|
18
18
|
operationalLogEntryDtoSchema,
|
|
19
19
|
redactLogString,
|
|
20
20
|
redactLogValue,
|
|
21
|
+
seoBudgetExhausted,
|
|
22
|
+
seoEstimateUnusable,
|
|
23
|
+
seoReconciliationRequired,
|
|
21
24
|
templateLinkRatio,
|
|
22
25
|
templateLinkUbiquityAvailable,
|
|
23
26
|
validationError
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-FGEBFVHB.js";
|
|
25
28
|
|
|
26
29
|
// ../db/src/client.ts
|
|
27
30
|
import { chmodSync, mkdirSync } from "fs";
|
|
@@ -10853,7 +10856,7 @@ var SentimentRepository = class {
|
|
|
10853
10856
|
|
|
10854
10857
|
// ../db/src/seo-repository.ts
|
|
10855
10858
|
import crypto from "crypto";
|
|
10856
|
-
import { and as and2, asc as asc2, eq as eq3, inArray as inArray2, sql as sql5 } from "drizzle-orm";
|
|
10859
|
+
import { and as and2, asc as asc2, desc, eq as eq3, inArray as inArray2, sql as sql5 } from "drizzle-orm";
|
|
10857
10860
|
function currentSeoTasks(tasks) {
|
|
10858
10861
|
const replaced = new Set(tasks.flatMap((task) => task.retryOf && task.status !== SeoRunStatuses.cancelled ? [task.retryOf] : []));
|
|
10859
10862
|
return tasks.filter((task) => task.retryOf ? task.status !== SeoRunStatuses.cancelled : !replaced.has(task.id));
|
|
@@ -10889,9 +10892,14 @@ var SeoRepository = class {
|
|
|
10889
10892
|
if (!profile || profile.revision !== input.profileRevision) throw validationError("The SEO profile changed. Create a new refresh intent.");
|
|
10890
10893
|
const activePlan = tx.select().from(measurementPlans).where(eq3(measurementPlans.projectId, input.projectId)).get();
|
|
10891
10894
|
if ((activePlan?.activeVersionId ?? null) !== (input.scopeSnapshot.planVersionId ?? null)) throw validationError("The measurement plan changed. Create a new refresh intent.");
|
|
10892
|
-
|
|
10895
|
+
const blocking = tx.select({ id: seoJobs.id, projectId: seoJobs.projectId, runId: seoJobs.runId }).from(seoJobs).where(and2(eq3(seoJobs.accountKey, input.accountKey), eq3(seoJobs.status, SeoRunStatuses["reconciliation-required"]))).orderBy(sql5`CASE WHEN ${seoJobs.projectId} = ${input.projectId} THEN 0 ELSE 1 END`, desc(seoJobs.createdAt), desc(seoJobs.id)).get();
|
|
10896
|
+
if (blocking) {
|
|
10897
|
+
const sameProject = blocking.projectId === input.projectId;
|
|
10898
|
+
const task = sameProject ? tx.select({ id: seoTasks.id }).from(seoTasks).where(and2(eq3(seoTasks.jobId, blocking.id), eq3(seoTasks.status, SeoRunStatuses["reconciliation-required"]))).orderBy(asc2(seoTasks.id)).get() : void 0;
|
|
10899
|
+
throw seoReconciliationRequired({ sameProject, runId: blocking.runId, taskId: task?.id });
|
|
10900
|
+
}
|
|
10893
10901
|
const total = input.tasks.reduce((sum, task) => sum + task.reservedMicros, 0);
|
|
10894
|
-
if (!Number.isSafeInteger(total) || total <= 0) throw
|
|
10902
|
+
if (!Number.isSafeInteger(total) || total <= 0) throw seoEstimateUnusable();
|
|
10895
10903
|
for (const bucket of input.buckets) {
|
|
10896
10904
|
tx.insert(seoBudgets).values({ scope: bucket.scope, period: bucket.period }).onConflictDoNothing().run();
|
|
10897
10905
|
const claim = tx.update(seoBudgets).set({ reservedMicros: sql5`${seoBudgets.reservedMicros} + ${total}` }).where(and2(
|
|
@@ -10899,7 +10907,7 @@ var SeoRepository = class {
|
|
|
10899
10907
|
eq3(seoBudgets.period, bucket.period),
|
|
10900
10908
|
sql5`${seoBudgets.spentMicros} + (SELECT COALESCE(SUM(reserved_micros),0) FROM seo_budgets b WHERE b.scope = ${bucket.scope}) + ${total} <= ${bucket.limit}`
|
|
10901
10909
|
)).run();
|
|
10902
|
-
if (!claim.changes) throw
|
|
10910
|
+
if (!claim.changes) throw seoBudgetExhausted(bucket);
|
|
10903
10911
|
}
|
|
10904
10912
|
tx.insert(runs).values({ id: input.id, projectId: input.projectId, kind: RunKinds["seo-sync"], status: RunStatuses.queued, trigger: input.trigger ?? RunTriggers.manual, createdAt: input.now }).run();
|
|
10905
10913
|
tx.insert(seoJobs).values({ id: input.id, projectId: input.projectId, projectKey: input.projectId, runId: input.id, profileId: input.profileId, profileRevision: input.profileRevision, profile: input.profile, scopeSnapshot: input.scopeSnapshot, requestHash: input.requestHash, idempotencyKey: input.idempotencyKey, principalId: input.principalId, connectionId: input.profile.connectionId, accountKey: input.accountKey, buckets: input.buckets, status: SeoRunStatuses.queued, createdAt: input.now }).run();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KQQERQJ2.js";
|
|
4
4
|
import {
|
|
5
5
|
isMachineFormat
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QRIKJT6Y.js";
|
|
7
7
|
import {
|
|
8
8
|
formatRunErrorOneLine
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FGEBFVHB.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/activity.ts
|
|
12
12
|
function activityLines(activity) {
|
|
@@ -8,24 +8,24 @@ import {
|
|
|
8
8
|
reparseStoredResult4,
|
|
9
9
|
reparseStoredResult5,
|
|
10
10
|
resolveStoredApiResponse
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-37MF5NMW.js";
|
|
12
12
|
import {
|
|
13
13
|
loadConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-52J7GFCK.js";
|
|
15
15
|
import {
|
|
16
16
|
CliError,
|
|
17
17
|
isMachineFormat
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QRIKJT6Y.js";
|
|
19
19
|
import {
|
|
20
20
|
determineCitationState
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LJ65QBRP.js";
|
|
22
22
|
import {
|
|
23
23
|
backfillProjectAnswerMentions,
|
|
24
24
|
competitorIdentityColumns,
|
|
25
25
|
createRunCompetitorResolver,
|
|
26
26
|
readMarketCompetitorNames,
|
|
27
27
|
refreshSnapshotMentionIdentity
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-NUBJTRIV.js";
|
|
29
29
|
import {
|
|
30
30
|
RawEventSampleEventTypes,
|
|
31
31
|
auditLog,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
querySnapshots,
|
|
40
40
|
rawEventSamples,
|
|
41
41
|
runs
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-FI7HVTO6.js";
|
|
43
43
|
import {
|
|
44
44
|
ProviderNames,
|
|
45
45
|
RetrievalContracts,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
extractRecommendedCompetitors,
|
|
53
53
|
normalizeUrlPath,
|
|
54
54
|
openRouterRouteModel
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-FGEBFVHB.js";
|
|
56
56
|
|
|
57
57
|
// src/commands/backfill.ts
|
|
58
58
|
import { setImmediate as yieldToEventLoop } from "timers/promises";
|
|
@@ -430,7 +430,7 @@ No DB writes performed. Re-run without --dry-run to apply.`);
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
async function backfillInsightsCommand(project, opts) {
|
|
433
|
-
const { IntelligenceService } = await import("./intelligence-service-
|
|
433
|
+
const { IntelligenceService } = await import("./intelligence-service-GPA7IGDX.js");
|
|
434
434
|
const config = loadConfig();
|
|
435
435
|
const db = createClient(config.database);
|
|
436
436
|
migrate(db);
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-VJWDBFSL.js";
|
|
5
5
|
import {
|
|
6
6
|
createApiClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KQQERQJ2.js";
|
|
8
8
|
import {
|
|
9
9
|
CliError,
|
|
10
10
|
isMachineFormat
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QRIKJT6Y.js";
|
|
12
12
|
import {
|
|
13
13
|
describeError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FGEBFVHB.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/mcp.ts
|
|
17
17
|
import fs from "fs";
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
configExists,
|
|
3
3
|
loadConfigRaw,
|
|
4
4
|
saveConfigPatch
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-52J7GFCK.js";
|
|
6
6
|
import {
|
|
7
7
|
BUNDLED_SKILL_NAMES,
|
|
8
8
|
installSkills
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Z77D43M5.js";
|
|
10
10
|
import {
|
|
11
11
|
PACKAGE_VERSION
|
|
12
12
|
} from "./chunk-AOJU5LKX.js";
|
|
13
13
|
import {
|
|
14
14
|
SKILL_MANIFEST_FILENAME,
|
|
15
15
|
SkillsClients
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FGEBFVHB.js";
|
|
17
17
|
|
|
18
18
|
// src/skills-autosync.ts
|
|
19
19
|
import fs from "fs";
|
|
@@ -7,25 +7,26 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
createApiClient,
|
|
9
9
|
runWithUsageTags
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KQQERQJ2.js";
|
|
11
11
|
import {
|
|
12
12
|
canonryMcpTools,
|
|
13
13
|
mcpOutputSchema,
|
|
14
14
|
toolOperationAccess
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-S6X3HHSN.js";
|
|
16
16
|
import {
|
|
17
17
|
PACKAGE_VERSION
|
|
18
18
|
} from "./chunk-AOJU5LKX.js";
|
|
19
19
|
import {
|
|
20
20
|
CliError
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QRIKJT6Y.js";
|
|
22
22
|
import {
|
|
23
23
|
OperationAccesses,
|
|
24
24
|
RESEARCH_RUN_SCOPE,
|
|
25
25
|
isReadOnlyKey,
|
|
26
|
+
readOnlyKeyMaySend,
|
|
26
27
|
restrictedWriteScopes,
|
|
27
28
|
upgradeCaveatFor
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-FGEBFVHB.js";
|
|
29
30
|
|
|
30
31
|
// src/mcp/server.ts
|
|
31
32
|
import { randomUUID } from "crypto";
|
|
@@ -674,10 +675,12 @@ function registerMetaTools(server, catalog, opts) {
|
|
|
674
675
|
);
|
|
675
676
|
}
|
|
676
677
|
function getCanonryMcpTools(scope = "all", tiers, credentialScopes, operator = false, connectionProfile = false) {
|
|
677
|
-
const
|
|
678
|
+
const readOnlyCredential = credentialScopes !== void 0 && isReadOnlyKey(credentialScopes);
|
|
679
|
+
const readOnly = scope === "read-only" || readOnlyCredential;
|
|
678
680
|
const restricted = credentialScopes && restrictedWriteScopes(credentialScopes);
|
|
679
681
|
const authorized = canonryMcpTools.filter((tool) => (!tool.requiresOperator || operator) && (!tool.requiresConnectionProfile || connectionProfile));
|
|
680
|
-
const
|
|
682
|
+
const sendable = (tool) => tool.openApiOperations.every(readOnlyKeyMaySend);
|
|
683
|
+
const byScope = scope === "stored-only" ? authorized.filter((tool) => toolOperationAccess(tool) === OperationAccesses.stored && (!readOnlyCredential || sendable(tool))) : readOnly ? authorized.filter((tool) => tool.access === "read" && sendable(tool)) : authorized.filter((tool) => {
|
|
681
684
|
if (!restricted || tool.access === "read") return true;
|
|
682
685
|
if (tool.requiredScope && restricted.includes(tool.requiredScope)) return true;
|
|
683
686
|
return restricted.some((grant) => grant !== RESEARCH_RUN_SCOPE) && tool.tier === "ads";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-52J7GFCK.js";
|
|
4
4
|
import {
|
|
5
5
|
PACKAGE_VERSION
|
|
6
6
|
} from "./chunk-AOJU5LKX.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
CliError,
|
|
9
9
|
EXIT_SYSTEM_ERROR,
|
|
10
10
|
EXIT_USER_ERROR
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QRIKJT6Y.js";
|
|
12
12
|
import {
|
|
13
13
|
CANONRY_NPM_PACKAGE_URL,
|
|
14
14
|
OPERATIONAL_LOG_FIELDS_HEADER,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
sentimentSettingsReadSchema,
|
|
38
38
|
sentimentSummaryReadSchema,
|
|
39
39
|
upgradeCommandFor
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-FGEBFVHB.js";
|
|
41
41
|
|
|
42
42
|
// ../api-client-generated/src/generated/core/bodySerializer.gen.ts
|
|
43
43
|
var jsonBodySerializer = {
|