@ainyc/canonry 4.21.4 → 4.23.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.
@@ -8,7 +8,7 @@ import {
8
8
  categoryLabel,
9
9
  determineAnswerMentioned,
10
10
  normalizeProjectDomain
11
- } from "./chunk-EY63PENL.js";
11
+ } from "./chunk-EUGCQSFC.js";
12
12
 
13
13
  // src/intelligence-service.ts
14
14
  import { eq, desc, asc, and, or, inArray } from "drizzle-orm";
@@ -14,8 +14,9 @@ import {
14
14
  schedulableRunKindSchema,
15
15
  scheduleUpsertRequestSchema,
16
16
  trafficConnectCloudRunRequestSchema,
17
+ trafficConnectWordpressRequestSchema,
17
18
  trafficEventKindSchema
18
- } from "./chunk-EY63PENL.js";
19
+ } from "./chunk-EUGCQSFC.js";
19
20
 
20
21
  // src/config.ts
21
22
  import fs from "fs";
@@ -766,6 +767,13 @@ var ApiClient = class {
766
767
  body
767
768
  );
768
769
  }
770
+ async trafficConnectWordpress(project, body) {
771
+ return this.request(
772
+ "POST",
773
+ `/projects/${encodeURIComponent(project)}/traffic/connect/wordpress`,
774
+ body
775
+ );
776
+ }
769
777
  async trafficSync(project, sourceId, body) {
770
778
  return this.request(
771
779
  "POST",
@@ -1192,6 +1200,10 @@ var trafficConnectCloudRunInputSchema = z2.object({
1192
1200
  project: projectNameSchema,
1193
1201
  request: trafficConnectCloudRunRequestSchema
1194
1202
  });
1203
+ var trafficConnectWordpressInputSchema = z2.object({
1204
+ project: projectNameSchema,
1205
+ request: trafficConnectWordpressRequestSchema
1206
+ });
1195
1207
  var trafficSyncInputSchema = z2.object({
1196
1208
  project: projectNameSchema,
1197
1209
  sourceId: z2.string().min(1).describe("Traffic source ID returned by canonry_traffic_connect_cloud_run or canonry_traffic_sources_list."),
@@ -1789,6 +1801,17 @@ var canonryMcpTools = [
1789
1801
  openApiOperations: ["POST /api/v1/projects/{name}/traffic/connect/cloud-run"],
1790
1802
  handler: (client, input) => client.trafficConnectCloudRun(input.project, input.request)
1791
1803
  }),
1804
+ defineTool({
1805
+ name: "canonry_traffic_connect_wordpress",
1806
+ title: "Connect WordPress traffic-logger source",
1807
+ description: "Connect a WordPress site (running the canonry traffic-logger plugin) as a server-side traffic source. Probes the plugin endpoint with the supplied Application Password before persisting \u2014 a bad credential or unreachable host surfaces as a 502 error. Reconnecting updates the existing active WordPress source in place. The Application Password is stored in ~/.canonry/config.yaml (not the DB) and never echoed back.",
1808
+ access: "write",
1809
+ tier: "traffic",
1810
+ inputSchema: trafficConnectWordpressInputSchema,
1811
+ annotations: writeAnnotations({ idempotentHint: true, openWorldHint: true }),
1812
+ openApiOperations: ["POST /api/v1/projects/{name}/traffic/connect/wordpress"],
1813
+ handler: (client, input) => client.trafficConnectWordpress(input.project, input.request)
1814
+ }),
1792
1815
  defineTool({
1793
1816
  name: "canonry_traffic_sync",
1794
1817
  title: "Sync Cloud Run traffic source",
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  setTelemetrySource,
21
21
  showFirstRunNotice,
22
22
  trackEvent
23
- } from "./chunk-3UGJUNQX.js";
23
+ } from "./chunk-CLVZF3X7.js";
24
24
  import {
25
25
  CliError,
26
26
  EXIT_SYSTEM_ERROR,
@@ -36,7 +36,7 @@ import {
36
36
  saveConfig,
37
37
  saveConfigPatch,
38
38
  usageError
39
- } from "./chunk-VFKGHXVJ.js";
39
+ } from "./chunk-VOSBGXXG.js";
40
40
  import {
41
41
  apiKeys,
42
42
  competitors,
@@ -49,7 +49,7 @@ import {
49
49
  queries,
50
50
  querySnapshots,
51
51
  runs
52
- } from "./chunk-GVQYROIK.js";
52
+ } from "./chunk-OYYFXKRK.js";
53
53
  import {
54
54
  CcReleaseSyncStatuses,
55
55
  CheckScopes,
@@ -69,7 +69,7 @@ import {
69
69
  providerQuotaPolicySchema,
70
70
  resolveProviderInput,
71
71
  skillsClientSchema
72
- } from "./chunk-EY63PENL.js";
72
+ } from "./chunk-EUGCQSFC.js";
73
73
 
74
74
  // src/cli.ts
75
75
  import { pathToFileURL } from "url";
@@ -621,7 +621,7 @@ function readStoredGroundingSources(rawResponse) {
621
621
  return result;
622
622
  }
623
623
  async function backfillInsightsCommand(project, opts) {
624
- const { IntelligenceService } = await import("./intelligence-service-5COCQKXG.js");
624
+ const { IntelligenceService } = await import("./intelligence-service-NVN2PAR7.js");
625
625
  const config = loadConfig();
626
626
  const db = createClient(config.database);
627
627
  migrate(db);
@@ -2722,6 +2722,74 @@ var GA_CLI_COMMANDS = [
2722
2722
  function getClient5() {
2723
2723
  return createApiClient();
2724
2724
  }
2725
+ async function trafficConnectWordpress(project, opts) {
2726
+ if (!opts.url) {
2727
+ throw new CliError({
2728
+ code: "TRAFFIC_WP_URL_REQUIRED",
2729
+ message: "--url is required",
2730
+ displayMessage: "Error: --url is required",
2731
+ details: { project }
2732
+ });
2733
+ }
2734
+ if (!opts.username) {
2735
+ throw new CliError({
2736
+ code: "TRAFFIC_WP_USERNAME_REQUIRED",
2737
+ message: "--username is required",
2738
+ displayMessage: "Error: --username is required",
2739
+ details: { project }
2740
+ });
2741
+ }
2742
+ if (opts.appPassword && opts.appPasswordFile) {
2743
+ throw new CliError({
2744
+ code: "TRAFFIC_WP_APP_PASSWORD_CONFLICT",
2745
+ message: "--app-password and --app-password-file are mutually exclusive",
2746
+ displayMessage: "Error: pass either --app-password <pw> or --app-password-file <path>, not both",
2747
+ details: { project }
2748
+ });
2749
+ }
2750
+ let applicationPassword = opts.appPassword?.trim() ?? "";
2751
+ if (!applicationPassword && opts.appPasswordFile) {
2752
+ const fs13 = await import("fs");
2753
+ try {
2754
+ applicationPassword = fs13.readFileSync(opts.appPasswordFile, "utf-8").trim();
2755
+ } catch (e) {
2756
+ const msg = e instanceof Error ? e.message : String(e);
2757
+ throw new CliError({
2758
+ code: "TRAFFIC_WP_APP_PASSWORD_FILE_READ_ERROR",
2759
+ message: `Failed to read --app-password-file: ${msg}`,
2760
+ displayMessage: `Error: failed to read --app-password-file "${opts.appPasswordFile}": ${msg}`,
2761
+ details: { project, appPasswordFile: opts.appPasswordFile }
2762
+ });
2763
+ }
2764
+ }
2765
+ if (!applicationPassword) {
2766
+ throw new CliError({
2767
+ code: "TRAFFIC_WP_APP_PASSWORD_REQUIRED",
2768
+ message: "--app-password or --app-password-file is required",
2769
+ displayMessage: "Error: pass --app-password <pw> or --app-password-file <path>",
2770
+ details: { project }
2771
+ });
2772
+ }
2773
+ const client = getClient5();
2774
+ const result = await client.trafficConnectWordpress(project, {
2775
+ baseUrl: opts.url,
2776
+ username: opts.username,
2777
+ applicationPassword,
2778
+ displayName: opts.displayName
2779
+ });
2780
+ if (opts.format === "json") {
2781
+ console.log(JSON.stringify(result, null, 2));
2782
+ return;
2783
+ }
2784
+ console.log(`WordPress traffic source connected for project "${project}".`);
2785
+ console.log(` Source ID: ${result.id}`);
2786
+ console.log(` Display name: ${result.displayName}`);
2787
+ console.log(` Status: ${result.status}`);
2788
+ console.log(` Site URL: ${result.config.baseUrl ?? "(unset)"}`);
2789
+ console.log(` Username: ${result.config.username ?? "(unset)"}`);
2790
+ console.log("");
2791
+ console.log(`Next: canonry traffic sync ${project} --source ${result.id}`);
2792
+ }
2725
2793
  async function trafficConnectCloudRun(project, opts) {
2726
2794
  if (!opts.gcpProject) {
2727
2795
  throw new CliError({
@@ -3026,6 +3094,36 @@ var TRAFFIC_CLI_COMMANDS = [
3026
3094
  });
3027
3095
  }
3028
3096
  },
3097
+ {
3098
+ path: ["traffic", "connect", "wordpress"],
3099
+ usage: "canonry traffic connect wordpress <project> --url <wp-site-url> --username <wp-user> (--app-password <pw> | --app-password-file <path>) [--display-name <name>] [--format json]",
3100
+ options: {
3101
+ url: stringOption(),
3102
+ username: stringOption(),
3103
+ "app-password": stringOption(),
3104
+ "app-password-file": stringOption(),
3105
+ "display-name": stringOption()
3106
+ },
3107
+ run: async (input) => {
3108
+ const project = requireProject(
3109
+ input,
3110
+ "traffic.connect.wordpress",
3111
+ "canonry traffic connect wordpress <project> --url <wp-site-url> --username <wp-user> (--app-password <pw> | --app-password-file <path>)"
3112
+ );
3113
+ const url = getString(input.values, "url");
3114
+ if (!url) throw new Error("--url is required");
3115
+ const username = getString(input.values, "username");
3116
+ if (!username) throw new Error("--username is required");
3117
+ await trafficConnectWordpress(project, {
3118
+ url,
3119
+ username,
3120
+ appPassword: getString(input.values, "app-password"),
3121
+ appPasswordFile: getString(input.values, "app-password-file"),
3122
+ displayName: getString(input.values, "display-name"),
3123
+ format: input.format
3124
+ });
3125
+ }
3126
+ },
3029
3127
  {
3030
3128
  path: ["traffic", "connect"],
3031
3129
  usage: "canonry traffic connect <provider> <project> [args]",
@@ -3033,7 +3131,7 @@ var TRAFFIC_CLI_COMMANDS = [
3033
3131
  unknownSubcommand(input.positionals[0], {
3034
3132
  command: "traffic connect",
3035
3133
  usage: "canonry traffic connect <provider> <project> [args]",
3036
- available: ["cloud-run"]
3134
+ available: ["cloud-run", "wordpress"]
3037
3135
  });
3038
3136
  }
3039
3137
  },
package/dist/index.d.ts CHANGED
@@ -91,6 +91,22 @@ interface WordpressConnectionConfigEntry {
91
91
  interface WordpressConfigEntry {
92
92
  connections?: WordpressConnectionConfigEntry[];
93
93
  }
94
+ /**
95
+ * Per-project WordPress traffic-logger connection. Separate from `wordpress.connections`,
96
+ * which is the content-publishing client. Authenticates against the WP traffic plugin's
97
+ * REST endpoint using a WordPress Application Password.
98
+ */
99
+ interface WordpressTrafficConnectionConfigEntry {
100
+ projectName: string;
101
+ baseUrl: string;
102
+ username: string;
103
+ applicationPassword: string;
104
+ createdAt: string;
105
+ updatedAt: string;
106
+ }
107
+ interface WordpressTrafficConfigEntry {
108
+ connections?: WordpressTrafficConnectionConfigEntry[];
109
+ }
94
110
  interface AgentConfigEntry {
95
111
  /** Agent mode. Only 'disabled' is valid until the native loop ships. */
96
112
  mode?: 'disabled';
@@ -113,6 +129,7 @@ interface CanonryConfig {
113
129
  ga4?: Ga4ConfigEntry;
114
130
  cloudRun?: CloudRunConfigEntry;
115
131
  wordpress?: WordpressConfigEntry;
132
+ wordpressTraffic?: WordpressTrafficConfigEntry;
116
133
  dashboardPasswordHash?: string;
117
134
  telemetry?: boolean;
118
135
  anonymousId?: string;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-3UGJUNQX.js";
3
+ } from "./chunk-CLVZF3X7.js";
4
4
  import {
5
5
  loadConfig
6
- } from "./chunk-VFKGHXVJ.js";
7
- import "./chunk-GVQYROIK.js";
8
- import "./chunk-EY63PENL.js";
6
+ } from "./chunk-VOSBGXXG.js";
7
+ import "./chunk-OYYFXKRK.js";
8
+ import "./chunk-EUGCQSFC.js";
9
9
  export {
10
10
  createServer,
11
11
  loadConfig
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  IntelligenceService
3
- } from "./chunk-GVQYROIK.js";
4
- import "./chunk-EY63PENL.js";
3
+ } from "./chunk-OYYFXKRK.js";
4
+ import "./chunk-EUGCQSFC.js";
5
5
  export {
6
6
  IntelligenceService
7
7
  };
package/dist/mcp.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  CliError,
3
3
  canonryMcpTools,
4
4
  createApiClient
5
- } from "./chunk-VFKGHXVJ.js";
6
- import "./chunk-EY63PENL.js";
5
+ } from "./chunk-VOSBGXXG.js";
6
+ import "./chunk-EUGCQSFC.js";
7
7
 
8
8
  // src/mcp/cli.ts
9
9
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainyc/canonry",
3
- "version": "4.21.4",
3
+ "version": "4.23.0",
4
4
  "type": "module",
5
5
  "description": "Agent-first open-source AEO operating platform - track how answer engines cite your domain",
6
6
  "license": "FSL-1.1-ALv2",
@@ -62,20 +62,20 @@
62
62
  "@ainyc/canonry-api-routes": "0.0.0",
63
63
  "@ainyc/canonry-config": "0.0.0",
64
64
  "@ainyc/canonry-db": "0.0.0",
65
- "@ainyc/canonry-integration-bing": "0.0.0",
65
+ "@ainyc/canonry-contracts": "0.0.0",
66
66
  "@ainyc/canonry-intelligence": "0.0.0",
67
- "@ainyc/canonry-integration-commoncrawl": "0.0.0",
68
67
  "@ainyc/canonry-integration-cloud-run": "0.0.0",
68
+ "@ainyc/canonry-integration-bing": "0.0.0",
69
69
  "@ainyc/canonry-integration-google": "0.0.0",
70
- "@ainyc/canonry-contracts": "0.0.0",
71
70
  "@ainyc/canonry-integration-traffic": "0.0.0",
71
+ "@ainyc/canonry-integration-commoncrawl": "0.0.0",
72
72
  "@ainyc/canonry-integration-wordpress": "0.0.0",
73
+ "@ainyc/canonry-provider-cdp": "0.0.0",
73
74
  "@ainyc/canonry-provider-claude": "0.0.0",
74
75
  "@ainyc/canonry-provider-gemini": "0.0.0",
75
76
  "@ainyc/canonry-provider-openai": "0.0.0",
76
77
  "@ainyc/canonry-provider-local": "0.0.0",
77
- "@ainyc/canonry-provider-perplexity": "0.0.0",
78
- "@ainyc/canonry-provider-cdp": "0.0.0"
78
+ "@ainyc/canonry-provider-perplexity": "0.0.0"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsx scripts/copy-agent-assets.ts && tsup && tsx build-web.ts",