@ainyc/canonry 2.2.1 → 2.2.3
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-setup/SKILL.md +7 -7
- package/assets/assets/{index-J73csS93.js → index-Bmnz-wvT.js} +54 -54
- package/assets/index.html +1 -1
- package/dist/{chunk-2QNWFP6R.js → chunk-MXUOJWNL.js} +170 -131
- package/dist/cli.js +132 -104
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
getConfigDir,
|
|
18
18
|
getConfigPath,
|
|
19
19
|
getOrCreateAnonymousId,
|
|
20
|
+
isEndpointMissing,
|
|
20
21
|
isFirstRun,
|
|
21
22
|
isTelemetryEnabled,
|
|
22
23
|
listAgentProviders,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
showFirstRunNotice,
|
|
36
37
|
trackEvent,
|
|
37
38
|
usageError
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-MXUOJWNL.js";
|
|
39
40
|
import {
|
|
40
41
|
apiKeys,
|
|
41
42
|
competitors,
|
|
@@ -3327,14 +3328,8 @@ async function exportProject(project, opts) {
|
|
|
3327
3328
|
const client = createApiClient();
|
|
3328
3329
|
const data = await client.getExport(project);
|
|
3329
3330
|
if (opts.includeResults) {
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
if (runs2.length > 0) {
|
|
3333
|
-
const latestRun = await client.getRun(runs2[runs2.length - 1].id);
|
|
3334
|
-
data.results = latestRun;
|
|
3335
|
-
}
|
|
3336
|
-
} catch {
|
|
3337
|
-
}
|
|
3331
|
+
const results = await loadLatestRunForExport(client, project);
|
|
3332
|
+
if (results) data.results = results;
|
|
3338
3333
|
}
|
|
3339
3334
|
if (opts.format === "json") {
|
|
3340
3335
|
console.log(JSON.stringify(data, null, 2));
|
|
@@ -3342,6 +3337,20 @@ async function exportProject(project, opts) {
|
|
|
3342
3337
|
}
|
|
3343
3338
|
console.log(stringify(data));
|
|
3344
3339
|
}
|
|
3340
|
+
async function loadLatestRunForExport(client, project) {
|
|
3341
|
+
try {
|
|
3342
|
+
const latest = await client.getLatestRun(project);
|
|
3343
|
+
return latest.run ?? null;
|
|
3344
|
+
} catch (err) {
|
|
3345
|
+
if (!isEndpointMissing(err)) throw err;
|
|
3346
|
+
}
|
|
3347
|
+
const runs2 = await client.listRuns(project);
|
|
3348
|
+
if (runs2.length === 0) return null;
|
|
3349
|
+
const latestRun = runs2.reduce(
|
|
3350
|
+
(current, candidate) => candidate.createdAt > current.createdAt ? candidate : current
|
|
3351
|
+
);
|
|
3352
|
+
return client.getRun(latestRun.id);
|
|
3353
|
+
}
|
|
3345
3354
|
|
|
3346
3355
|
// src/commands/history.ts
|
|
3347
3356
|
function getClient10() {
|
|
@@ -3389,13 +3398,19 @@ function getClient11() {
|
|
|
3389
3398
|
async function showStatus(project, format) {
|
|
3390
3399
|
const client = getClient11();
|
|
3391
3400
|
const projectData = await client.getProject(project);
|
|
3392
|
-
|
|
3393
|
-
try {
|
|
3394
|
-
runs2 = await client.listRuns(project);
|
|
3395
|
-
} catch {
|
|
3396
|
-
}
|
|
3401
|
+
const latest = await getLatestRunSummary(client, project);
|
|
3397
3402
|
if (format === "json") {
|
|
3398
|
-
|
|
3403
|
+
let runs2 = [];
|
|
3404
|
+
try {
|
|
3405
|
+
runs2 = await client.listRuns(project);
|
|
3406
|
+
} catch {
|
|
3407
|
+
}
|
|
3408
|
+
console.log(JSON.stringify({
|
|
3409
|
+
project: projectData,
|
|
3410
|
+
runs: runs2,
|
|
3411
|
+
latestRun: latest.run,
|
|
3412
|
+
totalRuns: latest.totalRuns
|
|
3413
|
+
}, null, 2));
|
|
3399
3414
|
return;
|
|
3400
3415
|
}
|
|
3401
3416
|
console.log(`Status: ${projectData.displayName ?? projectData.name} (${projectData.name})
|
|
@@ -3403,24 +3418,39 @@ async function showStatus(project, format) {
|
|
|
3403
3418
|
console.log(` Domain: ${projectData.canonicalDomain}`);
|
|
3404
3419
|
console.log(` Country: ${projectData.country}`);
|
|
3405
3420
|
console.log(` Language: ${projectData.language}`);
|
|
3406
|
-
if (
|
|
3407
|
-
const latest = runs2.reduce(
|
|
3408
|
-
(current, candidate) => candidate.createdAt > current.createdAt ? candidate : current
|
|
3409
|
-
);
|
|
3421
|
+
if (latest.run) {
|
|
3410
3422
|
console.log(`
|
|
3411
3423
|
Latest run:`);
|
|
3412
|
-
console.log(` ID: ${latest.id}`);
|
|
3413
|
-
console.log(` Status: ${latest.status}`);
|
|
3414
|
-
console.log(` Created: ${latest.createdAt}`);
|
|
3415
|
-
if (latest.finishedAt) {
|
|
3416
|
-
console.log(` Finished: ${latest.finishedAt}`);
|
|
3424
|
+
console.log(` ID: ${latest.run.id}`);
|
|
3425
|
+
console.log(` Status: ${latest.run.status}`);
|
|
3426
|
+
console.log(` Created: ${latest.run.createdAt}`);
|
|
3427
|
+
if (latest.run.finishedAt) {
|
|
3428
|
+
console.log(` Finished: ${latest.run.finishedAt}`);
|
|
3417
3429
|
}
|
|
3418
3430
|
console.log(`
|
|
3419
|
-
Total runs: ${
|
|
3431
|
+
Total runs: ${latest.totalRuns}`);
|
|
3420
3432
|
} else {
|
|
3421
3433
|
console.log('\n No runs yet. Use "canonry run" to trigger one.');
|
|
3422
3434
|
}
|
|
3423
3435
|
}
|
|
3436
|
+
async function getLatestRunSummary(client, project) {
|
|
3437
|
+
try {
|
|
3438
|
+
return await client.getLatestRun(project);
|
|
3439
|
+
} catch (err) {
|
|
3440
|
+
if (!isEndpointMissing(err)) throw err;
|
|
3441
|
+
const runs2 = await client.listRuns(project);
|
|
3442
|
+
if (runs2.length === 0) {
|
|
3443
|
+
return { totalRuns: 0, run: null };
|
|
3444
|
+
}
|
|
3445
|
+
const latestRun = runs2.reduce(
|
|
3446
|
+
(current, candidate) => candidate.createdAt > current.createdAt ? candidate : current
|
|
3447
|
+
);
|
|
3448
|
+
return {
|
|
3449
|
+
totalRuns: runs2.length,
|
|
3450
|
+
run: latestRun
|
|
3451
|
+
};
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3424
3454
|
|
|
3425
3455
|
// src/cli-commands/operator.ts
|
|
3426
3456
|
var OPERATOR_CLI_COMMANDS = [
|
|
@@ -7519,27 +7549,48 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7519
7549
|
scope: stringOption()
|
|
7520
7550
|
},
|
|
7521
7551
|
run: async (input) => {
|
|
7522
|
-
const
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7552
|
+
const usage = `canonry agent ask <project> "<prompt>" [--provider ${listAgentProviders().join("|")}] [--model <id>] [--scope all|read-only] [--format json]`;
|
|
7553
|
+
const project = requireProject(input, "agent.ask", usage);
|
|
7554
|
+
const prompt2 = input.positionals.slice(1).join(" ").trim();
|
|
7555
|
+
if (!prompt2) {
|
|
7556
|
+
throw usageError(`Error: prompt is required
|
|
7557
|
+
Usage: ${usage}`, {
|
|
7558
|
+
message: "prompt is required",
|
|
7559
|
+
details: {
|
|
7560
|
+
command: "agent.ask",
|
|
7561
|
+
usage
|
|
7562
|
+
}
|
|
7563
|
+
});
|
|
7527
7564
|
}
|
|
7528
7565
|
const providerInput = getString(input.values, "provider");
|
|
7529
7566
|
if (providerInput && !coerceAgentProvider(providerInput)) {
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7567
|
+
throw usageError(`Error: --provider must be one of: ${listAgentProviders().join(", ")}
|
|
7568
|
+
Usage: ${usage}`, {
|
|
7569
|
+
message: `--provider must be one of: ${listAgentProviders().join(", ")}`,
|
|
7570
|
+
details: {
|
|
7571
|
+
command: "agent.ask",
|
|
7572
|
+
usage,
|
|
7573
|
+
provider: providerInput,
|
|
7574
|
+
validProviders: listAgentProviders()
|
|
7575
|
+
}
|
|
7576
|
+
});
|
|
7533
7577
|
}
|
|
7534
7578
|
const scopeInput = getString(input.values, "scope");
|
|
7535
7579
|
if (scopeInput && !AGENT_ASK_SCOPES.includes(scopeInput)) {
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7580
|
+
throw usageError(`Error: --scope must be one of: ${AGENT_ASK_SCOPES.join(", ")}
|
|
7581
|
+
Usage: ${usage}`, {
|
|
7582
|
+
message: `--scope must be one of: ${AGENT_ASK_SCOPES.join(", ")}`,
|
|
7583
|
+
details: {
|
|
7584
|
+
command: "agent.ask",
|
|
7585
|
+
usage,
|
|
7586
|
+
scope: scopeInput,
|
|
7587
|
+
validScopes: AGENT_ASK_SCOPES
|
|
7588
|
+
}
|
|
7589
|
+
});
|
|
7539
7590
|
}
|
|
7540
7591
|
await agentAsk({
|
|
7541
7592
|
project,
|
|
7542
|
-
prompt:
|
|
7593
|
+
prompt: prompt2,
|
|
7543
7594
|
provider: coerceAgentProvider(providerInput),
|
|
7544
7595
|
modelId: getString(input.values, "model"),
|
|
7545
7596
|
scope: scopeInput,
|
|
@@ -7552,12 +7603,7 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7552
7603
|
usage: "canonry agent providers <project> [--format json]",
|
|
7553
7604
|
options: {},
|
|
7554
7605
|
run: async (input) => {
|
|
7555
|
-
const project = input.
|
|
7556
|
-
if (!project) {
|
|
7557
|
-
console.error("Usage: canonry agent providers <project>");
|
|
7558
|
-
process.exitCode = 1;
|
|
7559
|
-
return;
|
|
7560
|
-
}
|
|
7606
|
+
const project = requireProject(input, "agent.providers", "canonry agent providers <project> [--format json]");
|
|
7561
7607
|
await agentProviders({ project, format: input.format });
|
|
7562
7608
|
}
|
|
7563
7609
|
},
|
|
@@ -7568,18 +7614,16 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7568
7614
|
url: stringOption()
|
|
7569
7615
|
},
|
|
7570
7616
|
run: async (input) => {
|
|
7571
|
-
const
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
return;
|
|
7582
|
-
}
|
|
7617
|
+
const usage = "canonry agent attach <project> --url <webhook-url> [--format json]";
|
|
7618
|
+
const project = requireProject(input, "agent.attach", usage);
|
|
7619
|
+
const url = requireStringOption(input, "url", {
|
|
7620
|
+
command: "agent.attach",
|
|
7621
|
+
usage,
|
|
7622
|
+
message: "--url is required",
|
|
7623
|
+
details: {
|
|
7624
|
+
flag: "url"
|
|
7625
|
+
}
|
|
7626
|
+
});
|
|
7583
7627
|
await agentAttach({ project, url, format: input.format });
|
|
7584
7628
|
}
|
|
7585
7629
|
},
|
|
@@ -7588,12 +7632,7 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7588
7632
|
usage: "canonry agent detach <project> [--format json]",
|
|
7589
7633
|
options: {},
|
|
7590
7634
|
run: async (input) => {
|
|
7591
|
-
const project = input.
|
|
7592
|
-
if (!project) {
|
|
7593
|
-
console.error("Usage: canonry agent detach <project>");
|
|
7594
|
-
process.exitCode = 1;
|
|
7595
|
-
return;
|
|
7596
|
-
}
|
|
7635
|
+
const project = requireProject(input, "agent.detach", "canonry agent detach <project> [--format json]");
|
|
7597
7636
|
await agentDetach({ project, format: input.format });
|
|
7598
7637
|
}
|
|
7599
7638
|
},
|
|
@@ -7602,12 +7641,7 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7602
7641
|
usage: "canonry agent transcript <project> [--format json]",
|
|
7603
7642
|
options: {},
|
|
7604
7643
|
run: async (input) => {
|
|
7605
|
-
const project = input.
|
|
7606
|
-
if (!project) {
|
|
7607
|
-
console.error("Usage: canonry agent transcript <project>");
|
|
7608
|
-
process.exitCode = 1;
|
|
7609
|
-
return;
|
|
7610
|
-
}
|
|
7644
|
+
const project = requireProject(input, "agent.transcript", "canonry agent transcript <project> [--format json]");
|
|
7611
7645
|
await agentTranscript({ project, format: input.format });
|
|
7612
7646
|
}
|
|
7613
7647
|
},
|
|
@@ -7616,12 +7650,7 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7616
7650
|
usage: "canonry agent reset <project> [--format json]",
|
|
7617
7651
|
options: {},
|
|
7618
7652
|
run: async (input) => {
|
|
7619
|
-
const project = input.
|
|
7620
|
-
if (!project) {
|
|
7621
|
-
console.error("Usage: canonry agent reset <project>");
|
|
7622
|
-
process.exitCode = 1;
|
|
7623
|
-
return;
|
|
7624
|
-
}
|
|
7653
|
+
const project = requireProject(input, "agent.reset", "canonry agent reset <project> [--format json]");
|
|
7625
7654
|
await agentTranscriptReset({ project, format: input.format });
|
|
7626
7655
|
}
|
|
7627
7656
|
},
|
|
@@ -7630,12 +7659,8 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7630
7659
|
usage: "canonry agent memory list <project> [--format json]",
|
|
7631
7660
|
options: {},
|
|
7632
7661
|
run: async (input) => {
|
|
7633
|
-
const
|
|
7634
|
-
|
|
7635
|
-
throw usageError("Usage: canonry agent memory list <project>", {
|
|
7636
|
-
message: "project name is required"
|
|
7637
|
-
});
|
|
7638
|
-
}
|
|
7662
|
+
const usage = "canonry agent memory list <project> [--format json]";
|
|
7663
|
+
const project = requireProject(input, "agent.memory.list", usage);
|
|
7639
7664
|
await agentMemoryList({ project, format: input.format });
|
|
7640
7665
|
}
|
|
7641
7666
|
},
|
|
@@ -7647,19 +7672,24 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7647
7672
|
value: stringOption()
|
|
7648
7673
|
},
|
|
7649
7674
|
run: async (input) => {
|
|
7650
|
-
const
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7675
|
+
const usage = "canonry agent memory set <project> --key <k> --value <v> [--format json]";
|
|
7676
|
+
const project = requireProject(input, "agent.memory.set", usage);
|
|
7677
|
+
const key = requireStringOption(input, "key", {
|
|
7678
|
+
command: "agent.memory.set",
|
|
7679
|
+
usage,
|
|
7680
|
+
message: "--key is required",
|
|
7681
|
+
details: {
|
|
7682
|
+
flag: "key"
|
|
7683
|
+
}
|
|
7684
|
+
});
|
|
7685
|
+
const value = requireStringOption(input, "value", {
|
|
7686
|
+
command: "agent.memory.set",
|
|
7687
|
+
usage,
|
|
7688
|
+
message: "--value is required",
|
|
7689
|
+
details: {
|
|
7690
|
+
flag: "value"
|
|
7691
|
+
}
|
|
7692
|
+
});
|
|
7663
7693
|
await agentMemorySet({ project, key, value, format: input.format });
|
|
7664
7694
|
}
|
|
7665
7695
|
},
|
|
@@ -7670,18 +7700,16 @@ var AGENT_CLI_COMMANDS = [
|
|
|
7670
7700
|
key: stringOption()
|
|
7671
7701
|
},
|
|
7672
7702
|
run: async (input) => {
|
|
7673
|
-
const
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
});
|
|
7684
|
-
}
|
|
7703
|
+
const usage = "canonry agent memory forget <project> --key <k> [--format json]";
|
|
7704
|
+
const project = requireProject(input, "agent.memory.forget", usage);
|
|
7705
|
+
const key = requireStringOption(input, "key", {
|
|
7706
|
+
command: "agent.memory.forget",
|
|
7707
|
+
usage,
|
|
7708
|
+
message: "--key is required",
|
|
7709
|
+
details: {
|
|
7710
|
+
flag: "key"
|
|
7711
|
+
}
|
|
7712
|
+
});
|
|
7685
7713
|
await agentMemoryForget({ project, key, format: input.format });
|
|
7686
7714
|
}
|
|
7687
7715
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainyc/canonry",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The ultimate open-source AEO monitoring tool - track how answer engines cite your domain",
|
|
6
6
|
"license": "FSL-1.1-ALv2",
|
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
"@ainyc/canonry-contracts": "0.0.0",
|
|
63
63
|
"@ainyc/canonry-db": "0.0.0",
|
|
64
64
|
"@ainyc/canonry-intelligence": "0.0.0",
|
|
65
|
+
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
66
|
+
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
65
67
|
"@ainyc/canonry-integration-google": "0.0.0",
|
|
66
68
|
"@ainyc/canonry-provider-cdp": "0.0.0",
|
|
67
|
-
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
68
69
|
"@ainyc/canonry-provider-claude": "0.0.0",
|
|
69
70
|
"@ainyc/canonry-provider-gemini": "0.0.0",
|
|
70
|
-
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
71
71
|
"@ainyc/canonry-provider-local": "0.0.0",
|
|
72
|
-
"@ainyc/canonry-provider-
|
|
73
|
-
"@ainyc/canonry-provider-
|
|
72
|
+
"@ainyc/canonry-provider-perplexity": "0.0.0",
|
|
73
|
+
"@ainyc/canonry-provider-openai": "0.0.0"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"build": "tsx scripts/copy-agent-assets.ts && tsup && tsx build-web.ts",
|