@canonry/canonry 7.51.1 → 7.51.2
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.
|
@@ -8625,7 +8625,7 @@ function nonBlank(value) {
|
|
|
8625
8625
|
return trimmed ? trimmed : void 0;
|
|
8626
8626
|
}
|
|
8627
8627
|
function resolveBuildCommit(env = process.env) {
|
|
8628
|
-
const embedded = true ? "
|
|
8628
|
+
const embedded = true ? "14928fda66ec37ac07df71e904b4e7ab0354f570" : void 0;
|
|
8629
8629
|
return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
|
|
8630
8630
|
}
|
|
8631
8631
|
function resolveInstanceIdentity(env = process.env) {
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
trackFeatureCompleted,
|
|
32
32
|
trackIntegrationConnection,
|
|
33
33
|
waitForServerRuntimeStartup
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-3YL5TEZQ.js";
|
|
35
35
|
import {
|
|
36
36
|
clearDashboardPassword,
|
|
37
37
|
configExists,
|
|
@@ -18170,18 +18170,33 @@ function isProcessAlive(pid) {
|
|
|
18170
18170
|
return false;
|
|
18171
18171
|
}
|
|
18172
18172
|
}
|
|
18173
|
-
async function
|
|
18174
|
-
|
|
18173
|
+
async function answersHealth(url) {
|
|
18174
|
+
try {
|
|
18175
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(1e3) });
|
|
18176
|
+
return res.ok;
|
|
18177
|
+
} catch {
|
|
18178
|
+
return false;
|
|
18179
|
+
}
|
|
18180
|
+
}
|
|
18181
|
+
var START_READY_TIMEOUT_MS = 3e4;
|
|
18182
|
+
async function waitForReady(url, hasExited, maxMs = START_READY_TIMEOUT_MS) {
|
|
18175
18183
|
const deadline = Date.now() + maxMs;
|
|
18176
18184
|
while (Date.now() < deadline) {
|
|
18177
|
-
|
|
18178
|
-
|
|
18179
|
-
if (res.ok) return true;
|
|
18180
|
-
} catch {
|
|
18181
|
-
}
|
|
18185
|
+
if (hasExited()) return "exited";
|
|
18186
|
+
if (await answersHealth(url)) return "ready";
|
|
18182
18187
|
await new Promise((r) => setTimeout(r, 200));
|
|
18183
18188
|
}
|
|
18184
|
-
return
|
|
18189
|
+
return hasExited() ? "exited" : "timeout";
|
|
18190
|
+
}
|
|
18191
|
+
function serveCommandLine(entry, execArgv, forwardArgs) {
|
|
18192
|
+
if (!entry) {
|
|
18193
|
+
throw new CliError({
|
|
18194
|
+
code: "DAEMON_START_FAILED",
|
|
18195
|
+
message: 'Cannot find the canonry entry point to start the server. Run "canonry serve" instead.',
|
|
18196
|
+
displayMessage: 'Cannot find the canonry entry point to start the server. Run "canonry serve" instead.'
|
|
18197
|
+
});
|
|
18198
|
+
}
|
|
18199
|
+
return [...execArgv, entry, "serve", ...forwardArgs];
|
|
18185
18200
|
}
|
|
18186
18201
|
function resolveDaemonEndpoint(opts, env, configPort) {
|
|
18187
18202
|
const portInput = opts.port || env.CANONRY_PORT;
|
|
@@ -18224,14 +18239,25 @@ async function startDaemon(opts) {
|
|
|
18224
18239
|
const endpoint = resolveDaemonEndpoint(opts, process.env, config.port);
|
|
18225
18240
|
const host = endpoint.host;
|
|
18226
18241
|
const port = String(endpoint.port);
|
|
18227
|
-
const
|
|
18228
|
-
const
|
|
18229
|
-
|
|
18230
|
-
|
|
18242
|
+
const url = operatorHttpUrl(host, port);
|
|
18243
|
+
const healthUrl = `${url}/health`;
|
|
18244
|
+
if (await answersHealth(healthUrl)) {
|
|
18245
|
+
throw new CliError({
|
|
18246
|
+
code: "DAEMON_ALREADY_RUNNING",
|
|
18247
|
+
message: `A server is already running at ${url}`,
|
|
18248
|
+
displayMessage: `A server is already running at ${url}`,
|
|
18249
|
+
details: { host, port }
|
|
18250
|
+
});
|
|
18251
|
+
}
|
|
18252
|
+
const args = serveCommandLine(process.argv[1], process.execArgv, buildServeForwardArgs({ ...opts, host, port }));
|
|
18231
18253
|
const child = spawn2(process.execPath, args, {
|
|
18232
18254
|
detached: true,
|
|
18233
18255
|
stdio: "ignore"
|
|
18234
18256
|
});
|
|
18257
|
+
let exit;
|
|
18258
|
+
child.once("exit", (code, signal) => {
|
|
18259
|
+
exit = { code, signal };
|
|
18260
|
+
});
|
|
18235
18261
|
child.unref();
|
|
18236
18262
|
if (!child.pid) {
|
|
18237
18263
|
throw new CliError({
|
|
@@ -18248,8 +18274,22 @@ async function startDaemon(opts) {
|
|
|
18248
18274
|
if (!isMachineFormat(format)) {
|
|
18249
18275
|
process.stderr.write("Waiting for server to start...");
|
|
18250
18276
|
}
|
|
18251
|
-
const ready = await waitForReady(
|
|
18252
|
-
if (
|
|
18277
|
+
const ready = await waitForReady(healthUrl, () => exit !== void 0);
|
|
18278
|
+
if (ready === "exited") {
|
|
18279
|
+
try {
|
|
18280
|
+
fs16.unlinkSync(pidPath);
|
|
18281
|
+
} catch {
|
|
18282
|
+
}
|
|
18283
|
+
const how = exit?.signal ? `signal ${exit.signal}` : `code ${exit?.code}`;
|
|
18284
|
+
throw new CliError({
|
|
18285
|
+
code: "DAEMON_START_FAILED",
|
|
18286
|
+
message: `Failed to start: the server exited (${how}) before it was ready. Run "canonry serve" to see why.`,
|
|
18287
|
+
displayMessage: `
|
|
18288
|
+
Failed to start: the server exited (${how}) before it was ready. Run "canonry serve" to see why.`,
|
|
18289
|
+
details: { host, port, pid: child.pid, exitCode: exit?.code ?? null, signal: exit?.signal ?? null }
|
|
18290
|
+
});
|
|
18291
|
+
}
|
|
18292
|
+
if (ready === "timeout") {
|
|
18253
18293
|
try {
|
|
18254
18294
|
child.kill("SIGTERM");
|
|
18255
18295
|
} catch {
|
|
@@ -18260,8 +18300,9 @@ async function startDaemon(opts) {
|
|
|
18260
18300
|
}
|
|
18261
18301
|
throw new CliError({
|
|
18262
18302
|
code: "DAEMON_START_TIMEOUT",
|
|
18263
|
-
message:
|
|
18264
|
-
displayMessage:
|
|
18303
|
+
message: `Failed to start: server did not respond within ${START_READY_TIMEOUT_MS / 1e3}s`,
|
|
18304
|
+
displayMessage: `
|
|
18305
|
+
Failed to start: server did not respond within ${START_READY_TIMEOUT_MS / 1e3}s`,
|
|
18265
18306
|
details: {
|
|
18266
18307
|
host,
|
|
18267
18308
|
port,
|
|
@@ -18272,7 +18313,6 @@ async function startDaemon(opts) {
|
|
|
18272
18313
|
if (!isMachineFormat(format)) {
|
|
18273
18314
|
process.stderr.write("\n");
|
|
18274
18315
|
}
|
|
18275
|
-
const url = operatorHttpUrl(host, port);
|
|
18276
18316
|
if (isMachineFormat(format)) {
|
|
18277
18317
|
console.log(JSON.stringify({
|
|
18278
18318
|
started: true,
|
|
@@ -19405,7 +19445,7 @@ var SYSTEM_CLI_COMMANDS = [
|
|
|
19405
19445
|
options: { access: stringOption() },
|
|
19406
19446
|
run: async (input) => {
|
|
19407
19447
|
if (input.positionals.length > 1) throw usageError("Expected at most one command group");
|
|
19408
|
-
const [{ printCliCatalog }, { REGISTERED_CLI_COMMANDS: REGISTERED_CLI_COMMANDS2 }] = await Promise.all([import("./cli-catalog-KTQ6BHEU.js"), import("./cli-commands-
|
|
19448
|
+
const [{ printCliCatalog }, { REGISTERED_CLI_COMMANDS: REGISTERED_CLI_COMMANDS2 }] = await Promise.all([import("./cli-catalog-KTQ6BHEU.js"), import("./cli-commands-NALOZN72.js")]);
|
|
19409
19449
|
printCliCatalog(REGISTERED_CLI_COMMANDS2, input.format, input.positionals[0], getString(input.values, "access"));
|
|
19410
19450
|
}
|
|
19411
19451
|
},
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
buildSetupState,
|
|
14
14
|
consumePendingServeHandoff,
|
|
15
15
|
serveCommand
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JREQHDRK.js";
|
|
17
17
|
import {
|
|
18
18
|
checkLatestVersionForCli,
|
|
19
19
|
cliRuntimeContext,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
showFirstRunNotice,
|
|
28
28
|
trackCliCommandFinished,
|
|
29
29
|
trackEvent
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-3YL5TEZQ.js";
|
|
31
31
|
import "./chunk-GZPJ7TSE.js";
|
|
32
32
|
import {
|
|
33
33
|
resolveCliAccess
|
|
@@ -198,6 +198,12 @@ var TELEMETRY_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
198
198
|
"CLI_USAGE_ERROR",
|
|
199
199
|
"CLI_SYSTEM_ERROR",
|
|
200
200
|
"CONNECTION_ERROR",
|
|
201
|
+
// A doctor run that found failing checks did its job; `start` failures say
|
|
202
|
+
// why the server did not come up. Both used to arrive as CLI_ERROR.
|
|
203
|
+
"DOCTOR_CHECKS_FAILED",
|
|
204
|
+
"DAEMON_ALREADY_RUNNING",
|
|
205
|
+
"DAEMON_START_FAILED",
|
|
206
|
+
"DAEMON_START_TIMEOUT",
|
|
201
207
|
"UNEXPECTED_RESPONSE_FORMAT",
|
|
202
208
|
"STORED_ONLY_REFUSED"
|
|
203
209
|
]);
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonry/canonry",
|
|
3
|
-
"version": "7.51.
|
|
3
|
+
"version": "7.51.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Self-hosted AI visibility (AEO) platform: track how ChatGPT, Claude, Gemini, and Perplexity cite your domain, join it with Search Console, GA4, server-side traffic, and paid media, and fix what you find through agent tools (CLI, REST, MCP). Local SQLite.",
|
|
6
6
|
"keywords": [
|
|
@@ -85,34 +85,34 @@
|
|
|
85
85
|
"@types/node-cron": "^3.0.11",
|
|
86
86
|
"tsup": "^8.5.1",
|
|
87
87
|
"tsx": "^4.19.0",
|
|
88
|
-
"@canonry/canonry-web": "0.0.0",
|
|
89
|
-
"@canonry/canonry-api-client": "0.0.0",
|
|
90
88
|
"@canonry/canonry-api-routes": "0.0.0",
|
|
91
89
|
"@canonry/canonry-config": "0.0.0",
|
|
90
|
+
"@canonry/canonry-web": "0.0.0",
|
|
92
91
|
"@canonry/canonry-contracts": "0.0.0",
|
|
93
92
|
"@canonry/canonry-db": "0.0.0",
|
|
93
|
+
"@canonry/canonry-api-client": "0.0.0",
|
|
94
94
|
"@canonry/canonry-integration-bing": "0.0.0",
|
|
95
|
-
"@canonry/canonry-integration-
|
|
96
|
-
"@canonry/canonry-integration-cloudflare-worker": "0.0.0",
|
|
95
|
+
"@canonry/canonry-integration-cloudflare-queue": "0.0.0",
|
|
97
96
|
"@canonry/canonry-integration-commoncrawl": "0.0.0",
|
|
97
|
+
"@canonry/canonry-integration-cloudflare-worker": "0.0.0",
|
|
98
98
|
"@canonry/canonry-integration-google": "0.0.0",
|
|
99
99
|
"@canonry/canonry-integration-google-business-profile": "0.0.0",
|
|
100
|
-
"@canonry/canonry-integration-
|
|
100
|
+
"@canonry/canonry-integration-cloud-run": "0.0.0",
|
|
101
101
|
"@canonry/canonry-integration-google-places": "0.0.0",
|
|
102
|
-
"@canonry/canonry-integration-
|
|
102
|
+
"@canonry/canonry-integration-google-ads": "0.0.0",
|
|
103
103
|
"@canonry/canonry-integration-google-tag-manager": "0.0.0",
|
|
104
|
+
"@canonry/canonry-integration-traffic": "0.0.0",
|
|
104
105
|
"@canonry/canonry-integration-openai-ads": "0.0.0",
|
|
105
|
-
"@canonry/canonry-intelligence": "0.0.0",
|
|
106
|
-
"@canonry/canonry-provider-cdp": "0.0.0",
|
|
107
106
|
"@canonry/canonry-integration-wordpress": "0.0.0",
|
|
108
|
-
"@canonry/canonry-provider-gemini": "0.0.0",
|
|
109
107
|
"@canonry/canonry-provider-claude": "0.0.0",
|
|
110
|
-
"@canonry/canonry-
|
|
111
|
-
"@canonry/canonry-
|
|
108
|
+
"@canonry/canonry-intelligence": "0.0.0",
|
|
109
|
+
"@canonry/canonry-provider-gemini": "0.0.0",
|
|
110
|
+
"@canonry/canonry-provider-cdp": "0.0.0",
|
|
112
111
|
"@canonry/canonry-provider-local": "0.0.0",
|
|
112
|
+
"@canonry/canonry-provider-muse": "0.0.0",
|
|
113
113
|
"@canonry/canonry-provider-openai": "0.0.0",
|
|
114
|
-
"@canonry/canonry-
|
|
115
|
-
"@canonry/canonry-
|
|
114
|
+
"@canonry/canonry-integration-typesafe": "0.0.0",
|
|
115
|
+
"@canonry/canonry-provider-perplexity": "0.0.0"
|
|
116
116
|
},
|
|
117
117
|
"scripts": {
|
|
118
118
|
"build": "pnpm run build:cli && pnpm run build:web",
|