@canonry/canonry 7.51.4 → 7.51.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.
- package/assets/assets/AccessControls-B5TqDgeq.js +1 -0
- package/assets/assets/AuditHistoryPanel-DgxiizOW.js +1 -0
- package/assets/assets/BacklinksPage-Ay6pdphx.js +1 -0
- package/assets/assets/ChartPrimitives-DIEeZdrs.js +1 -0
- package/assets/assets/Hint-Cn4lh0Do.js +1 -0
- package/assets/assets/HistoryPage-B11eFH21.js +1 -0
- package/assets/assets/InfoTooltip-TIx9qM5h.js +1 -0
- package/assets/assets/MeasurementPropertyPage-1UYI7mzP.js +4 -0
- package/assets/assets/ProjectPage-DoY0hftd.js +8 -0
- package/assets/assets/RunsPage-BPBmuQAS.js +1 -0
- package/assets/assets/SettingsPage-ClKnP8xy.js +1 -0
- package/assets/assets/SiteHealthSection-PWjKMmEn.js +2 -0
- package/assets/assets/TrafficPage-DkfGiJXR.js +40 -0
- package/assets/assets/TrafficSourceDetailPage-DQu0YNt2.js +1 -0
- package/assets/assets/async-handler-Bj3TnIRw.js +1 -0
- package/assets/assets/card-DYMyvhB9.js +60 -0
- package/assets/assets/extract-error-message-BRM1I_3L.js +1 -0
- package/assets/assets/format-helpers-DrkFERj3.js +3 -0
- package/assets/assets/index-CG1Jox52.js +39 -0
- package/assets/assets/index-CsPsaUr7.css +1 -0
- package/assets/assets/query-client-gRFnU4VF.js +1 -0
- package/assets/assets/react-query-lH82FULK.js +1 -0
- package/assets/assets/react-sigma_core.esm.min-D09H4byP.js +3225 -0
- package/assets/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/assets/assets/service-Cx0HSnE9.js +1 -0
- package/assets/assets/vendor-lucide-BjvO55Hk.js +1 -0
- package/assets/assets/vendor-markdown-DWjffpgb.js +29 -0
- package/assets/assets/vendor-radix-BU76HM0G.js +41 -0
- package/assets/assets/vendor-recharts-CsHBXoK8.js +59 -0
- package/assets/assets/vendor-tanstack-QhOrDhIL.js +2 -0
- package/assets/assets/vendor-yaml-Y43rmNgW.js +105 -0
- package/assets/index.html +16 -8
- package/dist/ads-ABAT3K4K.js +544 -0
- package/dist/agent-5G4DRLYX.js +70 -0
- package/dist/agent-ask-UDVCZRO7.js +139 -0
- package/dist/agent-conversations-5E4JP2QZ.js +52 -0
- package/dist/agent-memory-7IIJ4HGZ.js +92 -0
- package/dist/agent-providers-BOXPUXZ4.js +55 -0
- package/dist/agent-transcript-4O56G6PQ.js +77 -0
- package/dist/analytics-PKMWX5XL.js +240 -0
- package/dist/apply-OK4XEBDA.js +175 -0
- package/dist/backfill-2OT56CX2.js +41 -0
- package/dist/backlinks-547WCHND.js +303 -0
- package/dist/bing-ZVBV4ZD5.js +418 -0
- package/dist/bootstrap-HUB7XQ73.js +326 -0
- package/dist/cdp-KQKQ4PWJ.js +162 -0
- package/dist/chunk-2G6IP3MO.js +517 -0
- package/dist/chunk-42D2LE2B.js +1273 -0
- package/dist/chunk-4MJYGB56.js +124 -0
- package/dist/chunk-63ISSSGX.js +9150 -0
- package/dist/{chunk-HHRM3H3L.js → chunk-6G6FTDWC.js} +8082 -13941
- package/dist/chunk-6GO5VVAC.js +15 -0
- package/dist/{chunk-6GNV6VF4.js → chunk-73P65KPW.js} +2 -2
- package/dist/chunk-7B2Q4NJE.js +133 -0
- package/dist/{chunk-KU4TPVZV.js → chunk-7WZ2FPB4.js} +2 -13
- package/dist/chunk-AOJU5LKX.js +8 -0
- package/dist/chunk-B2FR2ZQ4.js +420 -0
- package/dist/chunk-B5J675KK.js +6557 -0
- package/dist/{chunk-YOGHHIGE.js → chunk-D6COIM3U.js} +17155 -17164
- package/dist/{chunk-KUS7M65J.js → chunk-DGVUTH7W.js} +6809 -32243
- package/dist/chunk-ELCLGWUT.js +83 -0
- package/dist/chunk-GO2J7SYT.js +1034 -0
- package/dist/chunk-HACZUMGM.js +145 -0
- package/dist/chunk-HM4NNKLG.js +94 -0
- package/dist/chunk-I3A56PFP.js +58 -0
- package/dist/chunk-I77PLCWG.js +961 -0
- package/dist/chunk-ISOQPVPY.js +232 -0
- package/dist/chunk-KFT5LOP2.js +610 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-MMEO22MF.js +38 -0
- package/dist/chunk-NHQ2U5I4.js +78 -0
- package/dist/chunk-PCXRFT3N.js +530 -0
- package/dist/chunk-PITHTCAX.js +15376 -0
- package/dist/chunk-QWKPSFGL.js +30 -0
- package/dist/chunk-RKIXES2B.js +609 -0
- package/dist/chunk-TSENU4GG.js +18 -0
- package/dist/{chunk-P6D6P337.js → chunk-TUTKNUMV.js} +7 -5
- package/dist/chunk-U3AHE2RT.js +1160 -0
- package/dist/chunk-UQ3MOZGC.js +644 -0
- package/dist/{chunk-35QQMVO6.js → chunk-VBCE4CLX.js} +6 -4
- package/dist/chunk-VJWDBFSL.js +69 -0
- package/dist/chunk-VYMZ3QXG.js +8264 -0
- package/dist/chunk-WAULJDKO.js +2686 -0
- package/dist/chunk-WDFI5YMD.js +204 -0
- package/dist/chunk-XEBKF4N5.js +8 -0
- package/dist/chunk-Z7IUAJOF.js +13 -0
- package/dist/{chunk-RUWELF3K.js → chunk-ZWJRY5UI.js} +358 -581
- package/dist/chunk-ZXUAWVWM.js +15 -0
- package/dist/citations-UYB2RU5U.js +106 -0
- package/dist/{cli-catalog-KTQ6BHEU.js → cli-catalog-F6FI7NB2.js} +5 -3
- package/dist/cli-commands-ZG5ILKDA.js +19 -0
- package/dist/cli.js +35 -29
- package/dist/competitor-EKP4R7YY.js +561 -0
- package/dist/content-DREE6JF3.js +257 -0
- package/dist/dashboard-ZALEOLLU.js +71 -0
- package/dist/demo-JG4Y22O4.js +75 -0
- package/dist/{demo-server-26UUDUM7.js → demo-server-3A4J2C65.js} +22 -9
- package/dist/discover-W6GMD2HS.js +372 -0
- package/dist/discover-eval-CKFZHRBW.js +282 -0
- package/dist/doctor-TNGBSUMA.js +152 -0
- package/dist/evidence-3H2GFQBZ.js +57 -0
- package/dist/export-cmd-WUIKU5GK.js +49 -0
- package/dist/ga-JI6REFO4.js +911 -0
- package/dist/gbp-4ENDM5NS.js +370 -0
- package/dist/google-HKQSCLOC.js +946 -0
- package/dist/google-marketing-KQR5J2S4.js +403 -0
- package/dist/health-cmd-TS7EMMCS.js +64 -0
- package/dist/history-MSD5DK6K.js +90 -0
- package/dist/index.d.ts +194 -60
- package/dist/index.js +29 -6
- package/dist/init-L6WAEOWX.js +432 -0
- package/dist/insights-RTZ3IZTD.js +63 -0
- package/dist/intelligence-service-TH52PCNJ.js +15 -0
- package/dist/keys-625DZBRM.js +116 -0
- package/dist/keyword-CW46RNRR.js +164 -0
- package/dist/logs-V33SHBIW.js +30 -0
- package/dist/mcp-DFEDPSEG.js +14 -0
- package/dist/mcp.js +14 -5
- package/dist/measurement-plan-6W37RUOP.js +42 -0
- package/dist/notify-DSUOT7WO.js +125 -0
- package/dist/organic-evidence-BMN6L4OB.js +53 -0
- package/dist/overview-WRRMBZ6S.js +213 -0
- package/dist/project-2GJIU3FE.js +460 -0
- package/dist/query-3XPMGJUA.js +211 -0
- package/dist/research-V433CKJ4.js +200 -0
- package/dist/results-export-RGBU7QQQ.js +27 -0
- package/dist/run-NIAC6OJN.js +31 -0
- package/dist/schedule-KDWXRIE7.js +177 -0
- package/dist/search-626MPUJN.js +42 -0
- package/dist/serve-73SMMASI.js +557 -0
- package/dist/session-7WWOETZB.js +47 -0
- package/dist/settings-VKFQO6F2.js +107 -0
- package/dist/skills-5HC5H7TE.js +33 -0
- package/dist/snapshot-BSJUHFBC.js +538 -0
- package/dist/src-F6HM73TN.js +316 -0
- package/dist/status-V4OWP7LZ.js +126 -0
- package/dist/support-ARF4HER7.js +24 -0
- package/dist/technical-aeo-TG7CGU3F.js +625 -0
- package/dist/telemetry-O2IUNUBW.js +118 -0
- package/dist/tools-2GJIDKND.js +41 -0
- package/dist/traffic-XV4I3UPH.js +1295 -0
- package/dist/users-VGBLDL5K.js +170 -0
- package/dist/visibility-stats-UKJYJ6PP.js +241 -0
- package/dist/wordpress-JZA7CGC6.js +600 -0
- package/package.json +30 -30
- package/assets/assets/AuditHistoryPanel-CtWNkC6F.js +0 -1
- package/assets/assets/BacklinksPage-Cs3_j55C.js +0 -1
- package/assets/assets/ChartPrimitives-B6ryduMN.js +0 -1
- package/assets/assets/Hint-DICI5Jq9.js +0 -1
- package/assets/assets/HistoryPage-_5Vwj01m.js +0 -1
- package/assets/assets/MeasurementPropertyPage-B2yBTUZd.js +0 -4
- package/assets/assets/ProjectPage-hs-9PcoS.js +0 -8
- package/assets/assets/RunsPage-B_mhz9vj.js +0 -1
- package/assets/assets/SettingsPage-D1Lzcw03.js +0 -1
- package/assets/assets/SiteHealthSection-CGlrPdrk.js +0 -4
- package/assets/assets/TrafficPage-C27a0rQp.js +0 -40
- package/assets/assets/TrafficSourceDetailPage-DOSoQySv.js +0 -1
- package/assets/assets/extract-error-message-itBoiivg.js +0 -1
- package/assets/assets/index-Br2WtEIO.css +0 -1
- package/assets/assets/index-CdAuyP-X.js +0 -86
- package/assets/assets/react-sigma_core.esm.min-CPYhSQFc.js +0 -312
- package/assets/assets/v2-overview-adapter-DQXWmK0B.js +0 -1
- package/assets/assets/vendor-lucide-Y6jANGfG.js +0 -1
- package/assets/assets/vendor-markdown-B4giJcws.js +0 -29
- package/assets/assets/vendor-radix-twS1M3FF.js +0 -45
- package/assets/assets/vendor-recharts-D_R6YxjS.js +0 -36
- package/assets/assets/vendor-tanstack-ZXXkndVj.js +0 -1
- package/assets/assets/vendor-yaml-GWJz5H2G.js +0 -131
- package/dist/chunk-EQTVQIM2.js +0 -23082
- package/dist/chunk-GZPJ7TSE.js +0 -10872
- package/dist/cli-commands-5ZODWR4I.js +0 -15
- package/dist/intelligence-service-ZGDBVFDE.js +0 -9
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-B5J675KK.js";
|
|
4
|
+
import "./chunk-UQ3MOZGC.js";
|
|
5
|
+
import {
|
|
6
|
+
emitJsonl
|
|
7
|
+
} from "./chunk-Z7IUAJOF.js";
|
|
8
|
+
import "./chunk-AOJU5LKX.js";
|
|
9
|
+
import {
|
|
10
|
+
CliError,
|
|
11
|
+
isMachineFormat,
|
|
12
|
+
usageError
|
|
13
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
14
|
+
import {
|
|
15
|
+
CitationStates,
|
|
16
|
+
ResearchRunStatuses,
|
|
17
|
+
researchBatchCreateSchema
|
|
18
|
+
} from "./chunk-D6COIM3U.js";
|
|
19
|
+
import "./chunk-MLKGABMK.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/research.ts
|
|
22
|
+
import { readFileSync } from "fs";
|
|
23
|
+
var TERMINAL_RESEARCH_STATUSES = /* @__PURE__ */ new Set([
|
|
24
|
+
ResearchRunStatuses.completed,
|
|
25
|
+
ResearchRunStatuses.partial,
|
|
26
|
+
ResearchRunStatuses.failed
|
|
27
|
+
]);
|
|
28
|
+
var POLL_INTERVAL_MS = 2e3;
|
|
29
|
+
var POLL_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
30
|
+
function getClient() {
|
|
31
|
+
return createApiClient();
|
|
32
|
+
}
|
|
33
|
+
async function researchRun(project, opts) {
|
|
34
|
+
const client = getClient();
|
|
35
|
+
const request = {
|
|
36
|
+
queries: opts.queries,
|
|
37
|
+
provider: opts.provider,
|
|
38
|
+
model: opts.model,
|
|
39
|
+
scope: opts.scope,
|
|
40
|
+
template: opts.template,
|
|
41
|
+
location: opts.location,
|
|
42
|
+
idempotencyKey: opts.idempotencyKey
|
|
43
|
+
};
|
|
44
|
+
const started = await client.startResearchRun(project, request);
|
|
45
|
+
if (!opts.wait) {
|
|
46
|
+
if (opts.format === "jsonl") {
|
|
47
|
+
emitJsonl([{ project, ...started }]);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (opts.format === "json") {
|
|
51
|
+
console.log(JSON.stringify(started, null, 2));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
printStarted(project, started);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const detail = await pollResearchRun(client, project, started.id, isMachineFormat(opts.format));
|
|
58
|
+
printDetail(project, detail, opts.format);
|
|
59
|
+
}
|
|
60
|
+
async function researchBatch(project, source, opts) {
|
|
61
|
+
let raw;
|
|
62
|
+
try {
|
|
63
|
+
raw = JSON.parse(readFileSync(source === "-" ? 0 : source, "utf8"));
|
|
64
|
+
} catch {
|
|
65
|
+
throw usageError("Research batch input must be a readable JSON file (or - for stdin).", {
|
|
66
|
+
message: "Research batch input must be a readable JSON file (or - for stdin).",
|
|
67
|
+
details: { command: "research.batch" }
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const parsed = researchBatchCreateSchema.safeParse(raw);
|
|
71
|
+
if (!parsed.success) {
|
|
72
|
+
const message = parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
73
|
+
throw usageError(`Invalid research batch: ${message}`, {
|
|
74
|
+
message: `Invalid research batch: ${message}`,
|
|
75
|
+
details: { command: "research.batch" }
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const client = getClient();
|
|
79
|
+
const started = await client.startResearchBatch(project, parsed.data);
|
|
80
|
+
const runs = opts.wait ? await Promise.all(started.runs.map((run) => TERMINAL_RESEARCH_STATUSES.has(run.status) ? Promise.resolve(run) : pollResearchRun(client, project, run.id, true))) : started.runs;
|
|
81
|
+
if (opts.format === "jsonl") {
|
|
82
|
+
emitJsonl(runs.map((run) => ({ project, ...run })));
|
|
83
|
+
} else if (opts.format === "json") {
|
|
84
|
+
console.log(JSON.stringify({ runs }, null, 2));
|
|
85
|
+
} else {
|
|
86
|
+
console.log(`Research saved for ${runs.length} destinations (${runs.reduce((count, run) => count + run.totalQueries, 0)} queries).`);
|
|
87
|
+
for (const run of runs) {
|
|
88
|
+
if (opts.wait) printDetail(project, run);
|
|
89
|
+
else printStarted(project, run);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function researchList(project, opts) {
|
|
94
|
+
const client = getClient();
|
|
95
|
+
const result = await client.listResearchRuns(project, opts.limit === void 0 && opts.cursor === void 0 ? void 0 : { limit: opts.limit, cursor: opts.cursor });
|
|
96
|
+
const { runs } = result;
|
|
97
|
+
if (opts.format === "json") {
|
|
98
|
+
console.log(JSON.stringify(result, null, 2));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (opts.format === "jsonl") {
|
|
102
|
+
emitJsonl(runs.map((run) => ({ project, ...run })));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (runs.length === 0) {
|
|
106
|
+
console.log(`No saved research runs for "${project}".`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
console.log(`Research history for "${project}" (${runs.length}):
|
|
110
|
+
`);
|
|
111
|
+
console.log(" ID STATUS QUERIES PROVIDER / MODEL SCOPE CREATED");
|
|
112
|
+
console.log(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
113
|
+
for (const run of runs) {
|
|
114
|
+
const model = run.resolvedModel ? `${run.provider} / ${run.resolvedModel}` : run.provider;
|
|
115
|
+
console.log(` ${run.id.padEnd(36)} ${run.status.padEnd(10)} ${String(run.totalQueries).padStart(7)} ${model.slice(0, 32).padEnd(32)} ${formatScope(run.scope).slice(0, 24).padEnd(24)} ${run.createdAt}`);
|
|
116
|
+
}
|
|
117
|
+
if (result.nextCursor) console.log(`
|
|
118
|
+
Next page: canonry research list ${project} --cursor ${result.nextCursor}`);
|
|
119
|
+
}
|
|
120
|
+
async function researchShow(project, runId, opts) {
|
|
121
|
+
const detail = await getClient().getResearchRun(project, runId);
|
|
122
|
+
printDetail(project, detail, opts.format);
|
|
123
|
+
}
|
|
124
|
+
async function pollResearchRun(client, project, runId, quiet) {
|
|
125
|
+
if (!quiet) process.stderr.write(`Waiting for research run ${runId}`);
|
|
126
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
127
|
+
for (; ; ) {
|
|
128
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
129
|
+
if (Date.now() > deadline) {
|
|
130
|
+
throw new CliError({
|
|
131
|
+
code: "RESEARCH_TIMEOUT",
|
|
132
|
+
message: `Timed out waiting for research run ${runId} after ${POLL_TIMEOUT_MS / 1e3}s`
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const detail = await client.getResearchRun(project, runId);
|
|
136
|
+
if (!quiet) process.stderr.write(".");
|
|
137
|
+
if (TERMINAL_RESEARCH_STATUSES.has(detail.status)) {
|
|
138
|
+
if (!quiet) process.stderr.write("\n");
|
|
139
|
+
return detail;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function printStarted(project, run) {
|
|
144
|
+
console.log(`Research run saved: ${run.id}`);
|
|
145
|
+
console.log(` Status: ${run.status}`);
|
|
146
|
+
console.log(` Queries: ${run.totalQueries}`);
|
|
147
|
+
console.log(` Scope: ${formatScope(run.scope)}`);
|
|
148
|
+
console.log(` Location: ${run.location?.label ?? "No location context"}`);
|
|
149
|
+
console.log(` Provider: ${run.provider}${run.resolvedModel ? ` / ${run.resolvedModel}` : ""}`);
|
|
150
|
+
console.log(` Inspect: canonry research show ${project} ${run.id}`);
|
|
151
|
+
console.log(" Nothing was added to tracked queries.");
|
|
152
|
+
}
|
|
153
|
+
function printDetail(project, detail, format) {
|
|
154
|
+
if (format === "json") {
|
|
155
|
+
console.log(JSON.stringify(detail, null, 2));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (format === "jsonl") {
|
|
159
|
+
emitJsonl(detail.queries.map((query) => ({ project, runId: detail.id, ...query })));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
console.log(`Research run: ${detail.id}`);
|
|
163
|
+
console.log(` Status: ${detail.status}`);
|
|
164
|
+
console.log(` Scope: ${formatScope(detail.scope)}`);
|
|
165
|
+
console.log(` Provider: ${detail.provider}${detail.resolvedModel ? ` / ${detail.resolvedModel}` : ""}`);
|
|
166
|
+
if (detail.location) console.log(` Location: ${detail.location.label}`);
|
|
167
|
+
console.log(` Results: ${detail.completedQueries} completed, ${detail.failedQueries} failed, ${detail.totalQueries} total`);
|
|
168
|
+
if (detail.error) console.log(` Error: ${detail.error}`);
|
|
169
|
+
console.log(" Nothing was added to tracked queries.");
|
|
170
|
+
if (detail.queries.length === 0) return;
|
|
171
|
+
console.log("\n QUERY STATUS CITED MENTIONED");
|
|
172
|
+
for (const query of detail.queries) {
|
|
173
|
+
const cited = query.citationState === CitationStates.cited ? "yes" : query.citationState ? "no" : "\u2013";
|
|
174
|
+
const mentioned = query.answerMentioned === null ? "\u2013" : query.answerMentioned ? "yes" : "no";
|
|
175
|
+
console.log(` ${query.query.slice(0, 58).padEnd(58)} ${query.status.padEnd(10)} ${cited.padEnd(5)} ${mentioned}`);
|
|
176
|
+
if (query.error) console.log(` Error: ${query.error}`);
|
|
177
|
+
if (query.answerText) console.log(` Answer: ${query.answerText}`);
|
|
178
|
+
if (query.namedCompetitors.length > 0) {
|
|
179
|
+
console.log(` Named competitors: ${query.namedCompetitors.join(", ")}`);
|
|
180
|
+
}
|
|
181
|
+
if (query.citedCompetitorDomains.length > 0) {
|
|
182
|
+
console.log(` Cited competitor domains: ${query.citedCompetitorDomains.join(", ")}`);
|
|
183
|
+
}
|
|
184
|
+
if (query.groundingSources.length > 0) {
|
|
185
|
+
console.log(" Sources:");
|
|
186
|
+
for (const source of query.groundingSources) {
|
|
187
|
+
console.log(` - ${source.title ? `${source.title}: ` : ""}${source.uri}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function formatScope(scope) {
|
|
193
|
+
return scope ? `${scope.label} (${scope.kind})` : "Project-wide";
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
researchBatch,
|
|
197
|
+
researchList,
|
|
198
|
+
researchRun,
|
|
199
|
+
researchShow
|
|
200
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-B5J675KK.js";
|
|
4
|
+
import "./chunk-UQ3MOZGC.js";
|
|
5
|
+
import "./chunk-AOJU5LKX.js";
|
|
6
|
+
import "./chunk-HGMYEDAQ.js";
|
|
7
|
+
import "./chunk-D6COIM3U.js";
|
|
8
|
+
import "./chunk-MLKGABMK.js";
|
|
9
|
+
|
|
10
|
+
// src/commands/results-export.ts
|
|
11
|
+
import fs from "fs";
|
|
12
|
+
import path from "path";
|
|
13
|
+
async function exportResults(project, opts) {
|
|
14
|
+
const { output, ...request } = opts;
|
|
15
|
+
const artifact = await createApiClient().downloadResultsExport(project, request);
|
|
16
|
+
if (output === "-") {
|
|
17
|
+
process.stdout.write(artifact.content);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const target = output ? path.resolve(output) : path.resolve(process.cwd(), path.basename(artifact.filename));
|
|
21
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
22
|
+
fs.writeFileSync(target, artifact.content, "utf8");
|
|
23
|
+
console.log(`Results export written to ${target}`);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
exportResults
|
|
27
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cancelRun,
|
|
3
|
+
fillRun,
|
|
4
|
+
listRuns,
|
|
5
|
+
printRunDetail,
|
|
6
|
+
providerAccountStreakLine,
|
|
7
|
+
runAdmissionLines,
|
|
8
|
+
showRun,
|
|
9
|
+
showRunCompleteness,
|
|
10
|
+
triggerRun,
|
|
11
|
+
triggerRunAll
|
|
12
|
+
} from "./chunk-KFT5LOP2.js";
|
|
13
|
+
import "./chunk-B5J675KK.js";
|
|
14
|
+
import "./chunk-UQ3MOZGC.js";
|
|
15
|
+
import "./chunk-Z7IUAJOF.js";
|
|
16
|
+
import "./chunk-AOJU5LKX.js";
|
|
17
|
+
import "./chunk-HGMYEDAQ.js";
|
|
18
|
+
import "./chunk-D6COIM3U.js";
|
|
19
|
+
import "./chunk-MLKGABMK.js";
|
|
20
|
+
export {
|
|
21
|
+
cancelRun,
|
|
22
|
+
fillRun,
|
|
23
|
+
listRuns,
|
|
24
|
+
printRunDetail,
|
|
25
|
+
providerAccountStreakLine,
|
|
26
|
+
runAdmissionLines,
|
|
27
|
+
showRun,
|
|
28
|
+
showRunCompleteness,
|
|
29
|
+
triggerRun,
|
|
30
|
+
triggerRunAll
|
|
31
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-B5J675KK.js";
|
|
4
|
+
import "./chunk-UQ3MOZGC.js";
|
|
5
|
+
import {
|
|
6
|
+
emitJsonl
|
|
7
|
+
} from "./chunk-Z7IUAJOF.js";
|
|
8
|
+
import "./chunk-AOJU5LKX.js";
|
|
9
|
+
import {
|
|
10
|
+
isMachineFormat
|
|
11
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
12
|
+
import "./chunk-D6COIM3U.js";
|
|
13
|
+
import "./chunk-MLKGABMK.js";
|
|
14
|
+
|
|
15
|
+
// src/commands/schedule.ts
|
|
16
|
+
async function listSchedules(project, format) {
|
|
17
|
+
const schedules = await getClient().listSchedules(project);
|
|
18
|
+
if (format === "jsonl") {
|
|
19
|
+
emitJsonl(schedules);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (format === "json") {
|
|
23
|
+
console.log(JSON.stringify(schedules, null, 2));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!schedules.length) console.log(`No schedules configured for "${project}"`);
|
|
27
|
+
for (const schedule of schedules) printSchedule(schedule);
|
|
28
|
+
}
|
|
29
|
+
function getClient() {
|
|
30
|
+
return createApiClient();
|
|
31
|
+
}
|
|
32
|
+
async function readCurrentSchedule(client, project, kind) {
|
|
33
|
+
try {
|
|
34
|
+
return await client.getSchedule(project, kind);
|
|
35
|
+
} catch {
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function setSchedule(project, opts) {
|
|
40
|
+
const client = getClient();
|
|
41
|
+
const current = await readCurrentSchedule(client, project, opts.kind);
|
|
42
|
+
const body = {};
|
|
43
|
+
if (opts.kind) body.kind = opts.kind;
|
|
44
|
+
else if (current) body.kind = current.kind;
|
|
45
|
+
if (opts.everyDays || opts.startDate || opts.at) {
|
|
46
|
+
body.recurrence = { everyDays: Number(opts.everyDays), startDate: opts.startDate, time: opts.at };
|
|
47
|
+
} else if (opts.preset) body.preset = opts.preset;
|
|
48
|
+
else if (opts.cron) body.cron = opts.cron;
|
|
49
|
+
else if (current?.recurrence) body.recurrence = current.recurrence;
|
|
50
|
+
else if (current?.preset) body.preset = current.preset;
|
|
51
|
+
else if (current?.cronExpr) body.cron = current.cronExpr;
|
|
52
|
+
if (opts.timezone) body.timezone = opts.timezone;
|
|
53
|
+
else if (current) body.timezone = current.timezone;
|
|
54
|
+
if (opts.providers?.length) body.providers = opts.providers;
|
|
55
|
+
else if (current?.providers.length) body.providers = current.providers;
|
|
56
|
+
if (opts.sourceId) body.sourceId = opts.sourceId;
|
|
57
|
+
else if (current?.sourceId) body.sourceId = current.sourceId;
|
|
58
|
+
if (current) body.expectedUpdatedAt = current.updatedAt;
|
|
59
|
+
const result = await client.putSchedule(project, body);
|
|
60
|
+
if (isMachineFormat(opts.format)) {
|
|
61
|
+
console.log(JSON.stringify(result, null, 2));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
console.log(`Schedule set for "${project}" (kind: ${result.kind}):`);
|
|
65
|
+
printSchedule(result);
|
|
66
|
+
}
|
|
67
|
+
async function showSchedule(project, format, kind) {
|
|
68
|
+
const client = getClient();
|
|
69
|
+
const result = await client.getSchedule(project, kind);
|
|
70
|
+
if (isMachineFormat(format)) {
|
|
71
|
+
console.log(JSON.stringify(result, null, 2));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
printSchedule(result);
|
|
75
|
+
}
|
|
76
|
+
async function enableSchedule(project, format, kind) {
|
|
77
|
+
const client = getClient();
|
|
78
|
+
const current = await client.getSchedule(project, kind);
|
|
79
|
+
const body = { kind: current.kind, timezone: current.timezone, enabled: true, expectedUpdatedAt: current.updatedAt };
|
|
80
|
+
if (current.recurrence) body.recurrence = current.recurrence;
|
|
81
|
+
else if (current.preset) body.preset = current.preset;
|
|
82
|
+
else body.cron = current.cronExpr;
|
|
83
|
+
if (current.providers.length) body.providers = current.providers;
|
|
84
|
+
if (current.sourceId) body.sourceId = current.sourceId;
|
|
85
|
+
const result = await client.putSchedule(project, body);
|
|
86
|
+
if (isMachineFormat(format)) {
|
|
87
|
+
console.log(JSON.stringify(result, null, 2));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
console.log(`Schedule enabled for "${project}" (kind: ${result.kind})`);
|
|
91
|
+
}
|
|
92
|
+
async function disableSchedule(project, format, kind) {
|
|
93
|
+
const client = getClient();
|
|
94
|
+
const current = await client.getSchedule(project, kind);
|
|
95
|
+
const body = { kind: current.kind, timezone: current.timezone, enabled: false, expectedUpdatedAt: current.updatedAt };
|
|
96
|
+
if (current.recurrence) body.recurrence = current.recurrence;
|
|
97
|
+
else if (current.preset) body.preset = current.preset;
|
|
98
|
+
else body.cron = current.cronExpr;
|
|
99
|
+
if (current.providers.length) body.providers = current.providers;
|
|
100
|
+
if (current.sourceId) body.sourceId = current.sourceId;
|
|
101
|
+
const result = await client.putSchedule(project, body);
|
|
102
|
+
if (isMachineFormat(format)) {
|
|
103
|
+
console.log(JSON.stringify(result, null, 2));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
console.log(`Schedule disabled for "${project}" (kind: ${result.kind})`);
|
|
107
|
+
}
|
|
108
|
+
async function removeSchedule(project, format, kind) {
|
|
109
|
+
const client = getClient();
|
|
110
|
+
await client.deleteSchedule(project, kind);
|
|
111
|
+
const resolvedKind = kind ?? "answer-visibility";
|
|
112
|
+
if (isMachineFormat(format)) {
|
|
113
|
+
console.log(JSON.stringify({ project, kind: resolvedKind, removed: true }, null, 2));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
console.log(`Schedule removed for "${project}" (kind: ${resolvedKind})`);
|
|
117
|
+
}
|
|
118
|
+
function formatNextRun(nextRunAt, timezone) {
|
|
119
|
+
const at = new Date(nextRunAt);
|
|
120
|
+
if (Number.isNaN(at.getTime())) return nextRunAt;
|
|
121
|
+
try {
|
|
122
|
+
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
123
|
+
timeZone: timezone,
|
|
124
|
+
year: "numeric",
|
|
125
|
+
month: "2-digit",
|
|
126
|
+
day: "2-digit",
|
|
127
|
+
hour: "2-digit",
|
|
128
|
+
minute: "2-digit",
|
|
129
|
+
hour12: false,
|
|
130
|
+
timeZoneName: "longOffset"
|
|
131
|
+
}).formatToParts(at);
|
|
132
|
+
const get = (type) => parts.find((part) => part.type === type)?.value ?? "";
|
|
133
|
+
const offset = get("timeZoneName").replace("GMT", "") || "+00:00";
|
|
134
|
+
const local = `${get("year")}-${get("month")}-${get("day")} ${get("hour")}:${get("minute")}`;
|
|
135
|
+
const utc = `${String(at.getUTCHours()).padStart(2, "0")}:${String(at.getUTCMinutes()).padStart(2, "0")}Z`;
|
|
136
|
+
return `${local} (${offset}) / ${utc}`;
|
|
137
|
+
} catch {
|
|
138
|
+
return nextRunAt;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function printSchedule(s) {
|
|
142
|
+
console.log(` Kind: ${s.kind}`);
|
|
143
|
+
if (s.preset) {
|
|
144
|
+
console.log(` Preset: ${s.preset}`);
|
|
145
|
+
}
|
|
146
|
+
if (s.recurrence) {
|
|
147
|
+
console.log(` Every: ${s.recurrence.everyDays} day(s)`);
|
|
148
|
+
console.log(` Start: ${s.recurrence.startDate}`);
|
|
149
|
+
console.log(` At: ${s.recurrence.time}`);
|
|
150
|
+
} else {
|
|
151
|
+
console.log(` Cron: ${s.cronExpr}`);
|
|
152
|
+
}
|
|
153
|
+
console.log(` Timezone: ${s.timezone}`);
|
|
154
|
+
console.log(` Enabled: ${s.enabled ? "yes" : "no"}`);
|
|
155
|
+
if (s.kind === "traffic-sync" && s.sourceId) {
|
|
156
|
+
console.log(` Source: ${s.sourceId}`);
|
|
157
|
+
}
|
|
158
|
+
if (s.providers.length) {
|
|
159
|
+
console.log(` Providers: ${s.providers.join(", ")}`);
|
|
160
|
+
}
|
|
161
|
+
if (s.lastRunAt) {
|
|
162
|
+
console.log(` Last run: ${s.lastRunAt}`);
|
|
163
|
+
}
|
|
164
|
+
if (s.nextRunAt) {
|
|
165
|
+
console.log(` Next run: ${formatNextRun(s.nextRunAt, s.timezone)}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
disableSchedule,
|
|
170
|
+
enableSchedule,
|
|
171
|
+
formatNextRun,
|
|
172
|
+
listSchedules,
|
|
173
|
+
printSchedule,
|
|
174
|
+
removeSchedule,
|
|
175
|
+
setSchedule,
|
|
176
|
+
showSchedule
|
|
177
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-B5J675KK.js";
|
|
4
|
+
import "./chunk-UQ3MOZGC.js";
|
|
5
|
+
import "./chunk-AOJU5LKX.js";
|
|
6
|
+
import {
|
|
7
|
+
isMachineFormat
|
|
8
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
9
|
+
import "./chunk-D6COIM3U.js";
|
|
10
|
+
import "./chunk-MLKGABMK.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/search.ts
|
|
13
|
+
async function searchProject(project, opts) {
|
|
14
|
+
const client = createApiClient();
|
|
15
|
+
const result = await client.searchProject(project, { q: opts.query, limit: opts.limit });
|
|
16
|
+
if (isMachineFormat(opts.format)) {
|
|
17
|
+
console.log(JSON.stringify(result, null, 2));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
console.log(`Search: "${result.query}" \u2014 ${result.totalHits} hit${result.totalHits === 1 ? "" : "s"}${result.truncated ? " (truncated)" : ""}
|
|
21
|
+
`);
|
|
22
|
+
if (result.hits.length === 0) {
|
|
23
|
+
console.log(" No matches.");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (const hit of result.hits) {
|
|
27
|
+
if (hit.kind === "snapshot") {
|
|
28
|
+
console.log(` [snapshot] ${hit.query} (${hit.provider}, ${hit.citationState}) \u2014 ${hit.matchedField}`);
|
|
29
|
+
console.log(` ${hit.snippet}`);
|
|
30
|
+
console.log(` run=${hit.runId} at ${hit.createdAt}`);
|
|
31
|
+
} else {
|
|
32
|
+
const dismissed = hit.dismissed ? " [dismissed]" : "";
|
|
33
|
+
console.log(` [insight ${hit.severity.toUpperCase()}] ${hit.type} \u2014 ${hit.title}${dismissed}`);
|
|
34
|
+
console.log(` ${hit.snippet}`);
|
|
35
|
+
console.log(` query=${hit.query} at ${hit.createdAt}`);
|
|
36
|
+
}
|
|
37
|
+
console.log("");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
searchProject
|
|
42
|
+
};
|