@ainyc/canonry 4.24.1 → 4.26.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/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-BzD9HUxc.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-X1r0qycv.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="./assets/index-rPok6yk8.css">
17
17
  </head>
18
18
  <body>
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  AGENT_MEMORY_KEY_MAX_LENGTH,
3
3
  AGENT_MEMORY_VALUE_MAX_BYTES,
4
+ DISCOVERY_MAX_PROBES_CAP,
4
5
  competitorBatchRequestSchema,
6
+ discoveryRunRequestSchema,
5
7
  keywordBatchRequestSchema,
6
8
  keywordGenerateRequestSchema,
7
9
  notificationCreateRequestSchema,
@@ -16,7 +18,7 @@ import {
16
18
  trafficConnectCloudRunRequestSchema,
17
19
  trafficConnectWordpressRequestSchema,
18
20
  trafficEventKindSchema
19
- } from "./chunk-EUGCQSFC.js";
21
+ } from "./chunk-HVW665A4.js";
20
22
 
21
23
  // src/config.ts
22
24
  import fs from "fs";
@@ -819,6 +821,32 @@ var ApiClient = class {
819
821
  `/projects/${encodeURIComponent(project)}/traffic/events${qs}`
820
822
  );
821
823
  }
824
+ async triggerDiscoveryRun(project, body) {
825
+ return this.request(
826
+ "POST",
827
+ `/projects/${encodeURIComponent(project)}/discover/run`,
828
+ body ?? {}
829
+ );
830
+ }
831
+ async listDiscoverySessions(project, opts) {
832
+ const qs = opts?.limit ? `?limit=${encodeURIComponent(String(opts.limit))}` : "";
833
+ return this.request(
834
+ "GET",
835
+ `/projects/${encodeURIComponent(project)}/discover/sessions${qs}`
836
+ );
837
+ }
838
+ async getDiscoverySession(project, sessionId) {
839
+ return this.request(
840
+ "GET",
841
+ `/projects/${encodeURIComponent(project)}/discover/sessions/${encodeURIComponent(sessionId)}`
842
+ );
843
+ }
844
+ async previewDiscoveryPromote(project, sessionId) {
845
+ return this.request(
846
+ "GET",
847
+ `/projects/${encodeURIComponent(project)}/discover/sessions/${encodeURIComponent(sessionId)}/promote`
848
+ );
849
+ }
822
850
  async wordpressConnect(project, body) {
823
851
  return this.request("POST", `/projects/${encodeURIComponent(project)}/wordpress/connect`, body);
824
852
  }
@@ -1226,6 +1254,24 @@ var trafficSourceIdInputSchema = z2.object({
1226
1254
  project: projectNameSchema,
1227
1255
  sourceId: z2.string().min(1).describe("Traffic source ID.")
1228
1256
  });
1257
+ var discoveryRunInputSchema = z2.object({
1258
+ project: projectNameSchema,
1259
+ request: discoveryRunRequestSchema.extend({
1260
+ // Stronger descriptions for the LLM. The base Zod schema enforces the
1261
+ // upper bound; this just clarifies the meaning of each knob.
1262
+ icpDescription: z2.string().min(1).optional().describe("Free-text ICP description. If omitted, the project must already have spec.icpDescription stored."),
1263
+ dedupThreshold: z2.number().min(0).max(1).optional().describe("Cosine similarity threshold for clustering seed candidates. Defaults to 0.85. Lower values dedupe more aggressively."),
1264
+ maxProbes: z2.number().int().positive().max(DISCOVERY_MAX_PROBES_CAP).optional().describe(`Max canonical queries to probe in this session. Default 100, hard cap ${DISCOVERY_MAX_PROBES_CAP}.`)
1265
+ }).optional()
1266
+ });
1267
+ var discoverySessionsListInputSchema = z2.object({
1268
+ project: projectNameSchema,
1269
+ limit: z2.number().int().positive().max(200).optional().describe("Max sessions returned. Default 50.")
1270
+ });
1271
+ var discoverySessionIdInputSchema = z2.object({
1272
+ project: projectNameSchema,
1273
+ sessionId: z2.string().min(1).describe("Discovery session ID returned by canonry_discover_run_start.")
1274
+ });
1229
1275
  var AGENT_WEBHOOK_EVENTS = [
1230
1276
  notificationEventSchema.enum["run.completed"],
1231
1277
  notificationEventSchema.enum["insight.critical"],
@@ -1908,7 +1954,7 @@ var canonryMcpTools = [
1908
1954
  defineTool({
1909
1955
  name: "canonry_run_trigger",
1910
1956
  title: "Trigger run",
1911
- description: "Trigger an answer-visibility run for a Canonry project.",
1957
+ description: "Trigger an answer-visibility run for a Canonry project. Pass request.queries[] to scope the sweep to a subset of the project's tracked queries; omit for a full sweep.",
1912
1958
  access: "write",
1913
1959
  tier: "core",
1914
1960
  inputSchema: runTriggerInputSchema,
@@ -2130,6 +2176,50 @@ var canonryMcpTools = [
2130
2176
  await client.deleteNotification(input.project, agentNotification.id);
2131
2177
  return { status: "detached", project: input.project };
2132
2178
  }
2179
+ }),
2180
+ defineTool({
2181
+ name: "canonry_discover_run_start",
2182
+ title: "Start discovery run",
2183
+ description: 'Kick off a discovery session for a project: ICP \u2192 seed (Gemini grounded prompt) \u2192 embed + cluster + pick representative \u2192 probe each canonical \u2192 classify into cited / aspirational / wasted-surface \u2192 aggregate competitor map. Returns {runId, sessionId, status:"running"} immediately; the work runs in the background. Poll canonry_discover_session_get with the returned sessionId until status is "completed" or "failed". Costs roughly $1 / session at default budget; budget capped at 500 probes / session.',
2184
+ access: "write",
2185
+ tier: "discovery",
2186
+ inputSchema: discoveryRunInputSchema,
2187
+ annotations: writeAnnotations({ idempotentHint: false, openWorldHint: true }),
2188
+ openApiOperations: ["POST /api/v1/projects/{name}/discover/run"],
2189
+ handler: (client, input) => client.triggerDiscoveryRun(input.project, input.request)
2190
+ }),
2191
+ defineTool({
2192
+ name: "canonry_discover_sessions_list",
2193
+ title: "List discovery sessions",
2194
+ description: "List recent discovery sessions for a project, newest first. Returns the session-level summary (status, seed counts, bucket counts, competitor map). Use canonry_discover_session_get to drill into per-query probe rows.",
2195
+ access: "read",
2196
+ tier: "discovery",
2197
+ inputSchema: discoverySessionsListInputSchema,
2198
+ annotations: readAnnotations(),
2199
+ openApiOperations: ["GET /api/v1/projects/{name}/discover/sessions"],
2200
+ handler: (client, input) => client.listDiscoverySessions(input.project, input.limit !== void 0 ? { limit: input.limit } : void 0)
2201
+ }),
2202
+ defineTool({
2203
+ name: "canonry_discover_session_get",
2204
+ title: "Get discovery session",
2205
+ description: 'Get one discovery session with the full probe list (per-query bucket + cited domains). Use after canonry_discover_run_start to inspect what the discovery pipeline produced; this is the canonical read for "what did discovery find" before PR 2 lands `canonry discover promote`.',
2206
+ access: "read",
2207
+ tier: "discovery",
2208
+ inputSchema: discoverySessionIdInputSchema,
2209
+ annotations: readAnnotations(),
2210
+ openApiOperations: ["GET /api/v1/projects/{name}/discover/sessions/{id}"],
2211
+ handler: (client, input) => client.getDiscoverySession(input.project, input.sessionId)
2212
+ }),
2213
+ defineTool({
2214
+ name: "canonry_discover_promote_preview",
2215
+ title: "Preview discovery promotion",
2216
+ description: "Read-only preview of what `canonry discover promote` (PR 2) would persist for a session: bucketed query lists and suggested new competitor domains (those not already in the project's tracked competitor list). v1 returns the preview only; use it to confirm a basket before PR 2 ships the merge step.",
2217
+ access: "read",
2218
+ tier: "discovery",
2219
+ inputSchema: discoverySessionIdInputSchema,
2220
+ annotations: readAnnotations(),
2221
+ openApiOperations: ["GET /api/v1/projects/{name}/discover/sessions/{id}/promote"],
2222
+ handler: (client, input) => client.previewDiscoveryPromote(input.project, input.sessionId)
2133
2223
  })
2134
2224
  ];
2135
2225
  var CANONRY_MCP_TOOL_COUNT = canonryMcpTools.length;