@canonry/canonry 4.104.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.
Files changed (52) hide show
  1. package/LICENSE +105 -0
  2. package/README.md +117 -0
  3. package/assets/agent-workspace/AGENTS.md +88 -0
  4. package/assets/agent-workspace/USER.md +23 -0
  5. package/assets/agent-workspace/skills/aero/SKILL.md +72 -0
  6. package/assets/agent-workspace/skills/aero/references/aeo-discovery.md +161 -0
  7. package/assets/agent-workspace/skills/aero/references/memory-patterns.md +66 -0
  8. package/assets/agent-workspace/skills/aero/references/orchestration.md +67 -0
  9. package/assets/agent-workspace/skills/aero/references/regression-playbook.md +58 -0
  10. package/assets/agent-workspace/skills/aero/references/reporting.md +98 -0
  11. package/assets/agent-workspace/skills/aero/references/wordpress-elementor-mcp.md +223 -0
  12. package/assets/agent-workspace/skills/aero/soul.md +30 -0
  13. package/assets/agent-workspace/skills/canonry/SKILL.md +152 -0
  14. package/assets/agent-workspace/skills/canonry/references/aeo-analysis.md +200 -0
  15. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +714 -0
  16. package/assets/agent-workspace/skills/canonry/references/google-business-profile.md +300 -0
  17. package/assets/agent-workspace/skills/canonry/references/indexing.md +163 -0
  18. package/assets/agent-workspace/skills/canonry/references/server-side-traffic.md +372 -0
  19. package/assets/agent-workspace/skills/canonry/references/wordpress-integration.md +61 -0
  20. package/assets/apple-touch-icon.png +0 -0
  21. package/assets/assets/BacklinksPage-CixBvw--.js +1 -0
  22. package/assets/assets/ChartPrimitives-CjX4mQCy.js +1 -0
  23. package/assets/assets/ProjectPage-C09hcd6v.js +7 -0
  24. package/assets/assets/RunRow-Bel7mWgu.js +1 -0
  25. package/assets/assets/RunsPage-wqKWA2Ei.js +1 -0
  26. package/assets/assets/SettingsPage-esOqUkW5.js +1 -0
  27. package/assets/assets/TrafficPage-V0iCV3l4.js +1 -0
  28. package/assets/assets/TrafficSourceDetailPage-DUeuOh2v.js +1 -0
  29. package/assets/assets/arrow-left-CVZPxpW6.js +1 -0
  30. package/assets/assets/extract-error-message-BWAlA7ea.js +1 -0
  31. package/assets/assets/index-LsyRFLMG.css +1 -0
  32. package/assets/assets/index-avJiga1P.js +210 -0
  33. package/assets/assets/trash-2-CA_L6uGC.js +1 -0
  34. package/assets/assets/vendor-markdown-6dwjPOKK.js +14 -0
  35. package/assets/assets/vendor-radix-CQ77EO2y.js +45 -0
  36. package/assets/assets/vendor-recharts-C9EZkgbP.js +36 -0
  37. package/assets/assets/vendor-tanstack-Be8JdV5M.js +1 -0
  38. package/assets/favicon-32.png +0 -0
  39. package/assets/favicon.svg +24 -0
  40. package/assets/index.html +25 -0
  41. package/bin/canonry-mcp.mjs +2 -0
  42. package/bin/canonry.mjs +2 -0
  43. package/dist/chunk-23DCY7DL.js +7030 -0
  44. package/dist/chunk-GIKNEXFE.js +12414 -0
  45. package/dist/chunk-GNMZTR6Y.js +35673 -0
  46. package/dist/chunk-Q7FFDQU4.js +5743 -0
  47. package/dist/cli.js +13344 -0
  48. package/dist/index.d.ts +260 -0
  49. package/dist/index.js +12 -0
  50. package/dist/intelligence-service-GM3RXE2F.js +7 -0
  51. package/dist/mcp.js +442 -0
  52. package/package.json +97 -0
@@ -0,0 +1,260 @@
1
+ import { FastifyInstance } from 'fastify';
2
+ import { DatabaseClient } from '@ainyc/canonry-db';
3
+ import { ProviderQuotaPolicy, EmbedConfigEntry } from '@ainyc/canonry-contracts';
4
+
5
+ type GoogleConnectionType = 'gsc' | 'ga4' | 'gbp';
6
+ interface ProviderConfigEntry {
7
+ apiKey?: string;
8
+ baseUrl?: string;
9
+ model?: string;
10
+ quota?: ProviderQuotaPolicy;
11
+ /** Vertex AI GCP project ID (Gemini provider only) */
12
+ vertexProject?: string;
13
+ /** Vertex AI region, e.g. "us-central1" (Gemini provider only) */
14
+ vertexRegion?: string;
15
+ /** Path to service account JSON for Vertex AI auth (falls back to ADC) */
16
+ vertexCredentials?: string;
17
+ }
18
+ interface CdpConfigEntry {
19
+ host?: string;
20
+ port?: number;
21
+ quota?: ProviderQuotaPolicy;
22
+ }
23
+ interface GoogleConnectionConfigEntry {
24
+ domain: string;
25
+ connectionType: GoogleConnectionType;
26
+ propertyId?: string | null;
27
+ sitemapUrl?: string | null;
28
+ accessToken?: string;
29
+ refreshToken?: string | null;
30
+ tokenExpiresAt?: string | null;
31
+ scopes?: string[];
32
+ /**
33
+ * Project ID that first established this connection. Mirrors the
34
+ * `google_connections.created_by_project_id` DB column — written when the
35
+ * OAuth callback completes from a known project. Null/undefined for legacy
36
+ * connections written before the column existed; the API treats those as
37
+ * unowned (claimable by any project's next connect).
38
+ */
39
+ createdByProjectId?: string | null;
40
+ gbpAccountName?: string | null;
41
+ createdAt: string;
42
+ updatedAt: string;
43
+ }
44
+ interface GoogleConfigEntry {
45
+ clientId?: string;
46
+ clientSecret?: string;
47
+ connections?: GoogleConnectionConfigEntry[];
48
+ }
49
+ interface BingConnectionConfigEntry {
50
+ domain: string;
51
+ apiKey: string;
52
+ siteUrl?: string | null;
53
+ /**
54
+ * Project ID that first established this connection. Mirrors the
55
+ * `bing_connections.created_by_project_id` DB column.
56
+ */
57
+ createdByProjectId?: string | null;
58
+ createdAt: string;
59
+ updatedAt: string;
60
+ }
61
+ interface BingConfigEntry {
62
+ apiKey?: string;
63
+ connections?: BingConnectionConfigEntry[];
64
+ }
65
+ interface Ga4ConnectionConfigEntry {
66
+ projectName: string;
67
+ propertyId: string;
68
+ clientEmail: string;
69
+ privateKey: string;
70
+ createdAt: string;
71
+ updatedAt: string;
72
+ }
73
+ interface Ga4ConfigEntry {
74
+ connections?: Ga4ConnectionConfigEntry[];
75
+ }
76
+ type CloudRunAuthMode = 'oauth' | 'service-account';
77
+ interface CloudRunConnectionConfigEntry {
78
+ projectName: string;
79
+ gcpProjectId: string;
80
+ serviceName?: string;
81
+ location?: string;
82
+ authMode: CloudRunAuthMode;
83
+ clientEmail?: string;
84
+ privateKey?: string;
85
+ refreshToken?: string;
86
+ tokenExpiresAt?: string;
87
+ scopes?: string[];
88
+ createdAt: string;
89
+ updatedAt: string;
90
+ }
91
+ interface CloudRunConfigEntry {
92
+ connections?: CloudRunConnectionConfigEntry[];
93
+ }
94
+ /**
95
+ * Per-project OpenAI Advertiser API (ChatGPT ads) connection. The "SDK key"
96
+ * is minted in OpenAI Ads Manager and scoped to one ad account; ad accounts
97
+ * are not domain-bound, so the connection keys on the project name. The
98
+ * `ads_connections` DB row holds metadata only — the key lives here.
99
+ */
100
+ interface OpenAiAdsConnectionConfigEntry {
101
+ projectName: string;
102
+ apiKey: string;
103
+ adAccountId?: string | null;
104
+ createdAt: string;
105
+ updatedAt: string;
106
+ }
107
+ interface OpenAiAdsConfigEntry {
108
+ connections?: OpenAiAdsConnectionConfigEntry[];
109
+ }
110
+ type WordpressEnv = 'live' | 'staging';
111
+ interface WordpressConnectionConfigEntry {
112
+ projectName: string;
113
+ url: string;
114
+ stagingUrl?: string;
115
+ username: string;
116
+ appPassword: string;
117
+ defaultEnv: WordpressEnv;
118
+ createdAt: string;
119
+ updatedAt: string;
120
+ }
121
+ interface WordpressConfigEntry {
122
+ connections?: WordpressConnectionConfigEntry[];
123
+ }
124
+ /**
125
+ * Per-project WordPress traffic-logger connection. Separate from `wordpress.connections`,
126
+ * which is the content-publishing client. Authenticates against the WP traffic plugin's
127
+ * REST endpoint using a WordPress Application Password.
128
+ */
129
+ interface WordpressTrafficConnectionConfigEntry {
130
+ projectName: string;
131
+ baseUrl: string;
132
+ username: string;
133
+ applicationPassword: string;
134
+ createdAt: string;
135
+ updatedAt: string;
136
+ }
137
+ interface WordpressTrafficConfigEntry {
138
+ connections?: WordpressTrafficConnectionConfigEntry[];
139
+ }
140
+ type VercelTrafficEnvironment = 'production' | 'preview';
141
+ /**
142
+ * Per-project Vercel traffic connection. Authenticates against Vercel's
143
+ * internal `request-logs` endpoint using a Vercel API token. The project id,
144
+ * team id, and environment are non-secret and also mirrored onto the
145
+ * `traffic_sources` row; the token lives only here.
146
+ */
147
+ interface VercelTrafficConnectionConfigEntry {
148
+ projectName: string;
149
+ projectId: string;
150
+ teamId: string;
151
+ token: string;
152
+ environment: VercelTrafficEnvironment;
153
+ createdAt: string;
154
+ updatedAt: string;
155
+ }
156
+ interface VercelTrafficConfigEntry {
157
+ connections?: VercelTrafficConnectionConfigEntry[];
158
+ }
159
+ /**
160
+ * One injected remote MCP server Aero loads read-only tools from (OSS-A).
161
+ * Generic shape: `{ url, token, label? }`. The transport is bearer-gated MCP
162
+ * Streamable HTTP (the contract is frozen in `agent/remote-mcp.ts`). The
163
+ * server is remote, never co-located in the OSS container; per-tenant
164
+ * isolation is the token's responsibility, not the container boundary.
165
+ */
166
+ interface ExternalMcpServerConfig {
167
+ /** Streamable HTTP endpoint of the remote MCP server. */
168
+ url: string;
169
+ /** Bearer token sent as `Authorization: Bearer <token>`. */
170
+ token: string;
171
+ /** Optional human label used in logs. Defaults to `url`. */
172
+ label?: string;
173
+ }
174
+ interface AgentConfigEntry {
175
+ /**
176
+ * Agent mode. `'disabled'` turns the built-in Aero agent OFF entirely — the
177
+ * proactive auto-wake on run completion does not fire, the `SessionRegistry`
178
+ * is not constructed, and the interactive agent routes (`/projects/:name/
179
+ * agent/*`) plus the `canonry agent ask` CLI (a thin client of those routes)
180
+ * are not served. Absent (the default) leaves Aero enabled. Resolved, with
181
+ * the `CANONRY_AGENT_DISABLED` env override, by `resolveAgentEnabled` in
182
+ * agent-config.ts.
183
+ */
184
+ mode?: 'disabled';
185
+ }
186
+ /**
187
+ * Google Places API config — supplemental rendered-listing data for GBP
188
+ * lodging locations (#648). The API key authenticates Place Details calls
189
+ * (`X-Goog-Api-Key`); it is NOT OAuth and is unrelated to `google.clientId`.
190
+ * - `tier`: 'atmosphere' (default; amenity booleans for the cross-reference,
191
+ * 1k free calls/month) | 'pro' (cheaper, accessibility-only) | 'off'.
192
+ * - `refreshIntervalDays`: minimum age before a location's Place Details is
193
+ * re-fetched during gbp-sync (default 7) — the cost lever, since amenities
194
+ * change rarely.
195
+ */
196
+ interface PlacesConfigEntry {
197
+ apiKey?: string;
198
+ tier?: 'atmosphere' | 'pro' | 'off';
199
+ refreshIntervalDays?: number;
200
+ }
201
+ interface CanonryConfig {
202
+ apiUrl: string;
203
+ publicUrl?: string;
204
+ /** Sub-path prefix when canonry is served behind a reverse proxy (e.g. "/canonry/"). */
205
+ basePath?: string;
206
+ database: string;
207
+ apiKey: string;
208
+ port?: number;
209
+ geminiApiKey?: string;
210
+ geminiModel?: string;
211
+ geminiQuota?: ProviderQuotaPolicy;
212
+ providers?: Record<string, ProviderConfigEntry>;
213
+ cdp?: CdpConfigEntry;
214
+ google?: GoogleConfigEntry;
215
+ bing?: BingConfigEntry;
216
+ ga4?: Ga4ConfigEntry;
217
+ cloudRun?: CloudRunConfigEntry;
218
+ wordpress?: WordpressConfigEntry;
219
+ wordpressTraffic?: WordpressTrafficConfigEntry;
220
+ vercelTraffic?: VercelTrafficConfigEntry;
221
+ openaiAds?: OpenAiAdsConfigEntry;
222
+ dashboardPasswordHash?: string;
223
+ telemetry?: boolean;
224
+ anonymousId?: string;
225
+ lastSeenVersion?: string;
226
+ updateCheck?: boolean;
227
+ lastUpdateCheckAt?: string;
228
+ lastKnownLatestVersion?: string;
229
+ agent?: AgentConfigEntry;
230
+ externalMcpServers?: ExternalMcpServerConfig[];
231
+ places?: PlacesConfigEntry;
232
+ embed?: EmbedConfigEntry;
233
+ }
234
+ declare function loadConfig(): CanonryConfig;
235
+
236
+ declare function createServer(opts: {
237
+ config: CanonryConfig;
238
+ db: DatabaseClient;
239
+ open?: boolean;
240
+ logger?: boolean;
241
+ /**
242
+ * The network interface the server will bind to (from `canonry serve`).
243
+ * Used to gate the unauthenticated first-run dashboard password setup: on a
244
+ * loopback bind only local processes can reach `/session/setup`, so claiming
245
+ * the initial password without the API key is safe. On a non-loopback bind
246
+ * (`0.0.0.0`, a LAN IP) the setup endpoint additionally requires a valid
247
+ * bearer key so a remote first-visitor cannot mint a full-access session.
248
+ * Defaults to loopback when unset (programmatic/test callers).
249
+ */
250
+ host?: string;
251
+ /**
252
+ * Override for the directory the pre-built SPA is served from. Defaults to
253
+ * the package's bundled `assets/` (resolved from `import.meta.url`). Exposed
254
+ * so tests can point at a temp dir containing a fixture `index.html` and
255
+ * assert the injected config + framing header on the served document.
256
+ */
257
+ assetsDir?: string;
258
+ }): Promise<FastifyInstance>;
259
+
260
+ export { type CanonryConfig, createServer, loadConfig };
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-GIKNEXFE.js";
4
+ import {
5
+ loadConfig
6
+ } from "./chunk-23DCY7DL.js";
7
+ import "./chunk-GNMZTR6Y.js";
8
+ import "./chunk-Q7FFDQU4.js";
9
+ export {
10
+ createServer,
11
+ loadConfig
12
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ IntelligenceService
3
+ } from "./chunk-GNMZTR6Y.js";
4
+ import "./chunk-Q7FFDQU4.js";
5
+ export {
6
+ IntelligenceService
7
+ };