@ainyc/canonry 1.48.2 → 2.0.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/README.md +42 -27
- package/assets/agent-workspace/AGENTS.md +3 -4
- package/assets/agent-workspace/skills/aero/SKILL.md +7 -10
- package/assets/agent-workspace/skills/aero/references/memory-patterns.md +35 -25
- package/assets/agent-workspace/skills/aero/references/orchestration.md +5 -0
- package/assets/agent-workspace/skills/aero/references/regression-playbook.md +5 -0
- package/assets/agent-workspace/skills/aero/references/reporting.md +5 -0
- package/assets/agent-workspace/skills/aero/references/wordpress-elementor-mcp.md +5 -0
- package/assets/agent-workspace/skills/aero/soul.md +30 -0
- package/assets/agent-workspace/skills/canonry-setup/SKILL.md +1 -1
- package/assets/agent-workspace/skills/canonry-setup/references/canonry-cli.md +39 -39
- package/assets/assets/index-DnlDoqE-.js +301 -0
- package/assets/assets/{index--ev1Bjls.css → index-yF1fs-OW.css} +1 -1
- package/assets/index.html +2 -2
- package/dist/{chunk-JTKHPNGL.js → chunk-GH6WGN5B.js} +122 -1
- package/dist/{chunk-YPTVJRJY.js → chunk-YZKLIUH4.js} +1975 -855
- package/dist/cli.js +281 -773
- package/dist/index.d.ts +2 -8
- package/dist/index.js +2 -2
- package/dist/{intelligence-service-Q4WX46MJ.js → intelligence-service-LHWXONQJ.js} +1 -1
- package/package.json +7 -4
- package/assets/agent-workspace/SOUL.md +0 -54
- package/assets/assets/index-CVk23m8J.js +0 -282
package/assets/index.html
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
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-
|
|
16
|
-
<link rel="stylesheet" crossorigin href="./assets/index
|
|
15
|
+
<script type="module" crossorigin src="./assets/index-DnlDoqE-.js"></script>
|
|
16
|
+
<link rel="stylesheet" crossorigin href="./assets/index-yF1fs-OW.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
19
19
|
<div id="root"></div>
|
|
@@ -16,6 +16,7 @@ import { drizzle } from "drizzle-orm/better-sqlite3";
|
|
|
16
16
|
// ../db/src/schema.ts
|
|
17
17
|
var schema_exports = {};
|
|
18
18
|
__export(schema_exports, {
|
|
19
|
+
agentSessions: () => agentSessions,
|
|
19
20
|
apiKeys: () => apiKeys,
|
|
20
21
|
auditLog: () => auditLog,
|
|
21
22
|
bingConnections: () => bingConnections,
|
|
@@ -410,6 +411,20 @@ var healthSnapshots = sqliteTable("health_snapshots", {
|
|
|
410
411
|
index("idx_health_snapshots_run").on(table.runId),
|
|
411
412
|
index("idx_health_snapshots_created").on(table.createdAt)
|
|
412
413
|
]);
|
|
414
|
+
var agentSessions = sqliteTable("agent_sessions", {
|
|
415
|
+
id: text("id").primaryKey(),
|
|
416
|
+
projectId: text("project_id").notNull().unique().references(() => projects.id, { onDelete: "cascade" }),
|
|
417
|
+
systemPrompt: text("system_prompt").notNull(),
|
|
418
|
+
modelProvider: text("model_provider").notNull(),
|
|
419
|
+
modelId: text("model_id").notNull(),
|
|
420
|
+
messages: text("messages").notNull().default("[]"),
|
|
421
|
+
followUpQueue: text("follow_up_queue").notNull().default("[]"),
|
|
422
|
+
createdAt: text("created_at").notNull(),
|
|
423
|
+
updatedAt: text("updated_at").notNull()
|
|
424
|
+
}, (table) => [
|
|
425
|
+
index("idx_agent_sessions_project").on(table.projectId),
|
|
426
|
+
index("idx_agent_sessions_updated").on(table.updatedAt)
|
|
427
|
+
]);
|
|
413
428
|
|
|
414
429
|
// ../db/src/client.ts
|
|
415
430
|
function createClient(databasePath) {
|
|
@@ -851,9 +866,35 @@ var MIGRATIONS = [
|
|
|
851
866
|
`DROP INDEX IF EXISTS idx_bing_coverage_snap_project_date`,
|
|
852
867
|
`CREATE UNIQUE INDEX IF NOT EXISTS idx_bing_coverage_snap_project_date_unique ON bing_coverage_snapshots(project_id, date)`,
|
|
853
868
|
// v35: Add missing index for query_snapshots createdAt for time-series filtering
|
|
854
|
-
`CREATE INDEX IF NOT EXISTS idx_snapshots_created_at ON query_snapshots(created_at)
|
|
869
|
+
`CREATE INDEX IF NOT EXISTS idx_snapshots_created_at ON query_snapshots(created_at)`,
|
|
855
870
|
// v36: Transaction handling and SQL injection review: verified all strings use SQLite ? binding via Drizzle.
|
|
856
871
|
// No changes required for parameterization.
|
|
872
|
+
// v37: The legacy credential columns (private_key on ga_connections; access_token,
|
|
873
|
+
// refresh_token, token_expires_at on google_connections) are removed by the
|
|
874
|
+
// extractLegacyCredentials / dropLegacyCredentialColumns pair below. Callers
|
|
875
|
+
// read the rows, persist them to config.yaml, and only then drop the columns
|
|
876
|
+
// so a failed config write doesn't permanently lose credentials. Keeping the
|
|
877
|
+
// DROPs as raw SQL here would race with that read.
|
|
878
|
+
// v38: Aero session registry — one rolling session per project.
|
|
879
|
+
`CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
880
|
+
id TEXT PRIMARY KEY,
|
|
881
|
+
project_id TEXT NOT NULL UNIQUE REFERENCES projects(id) ON DELETE CASCADE,
|
|
882
|
+
system_prompt TEXT NOT NULL,
|
|
883
|
+
model_provider TEXT NOT NULL,
|
|
884
|
+
model_id TEXT NOT NULL,
|
|
885
|
+
messages TEXT NOT NULL DEFAULT '[]',
|
|
886
|
+
follow_up_queue TEXT NOT NULL DEFAULT '[]',
|
|
887
|
+
created_at TEXT NOT NULL,
|
|
888
|
+
updated_at TEXT NOT NULL
|
|
889
|
+
)`,
|
|
890
|
+
`CREATE INDEX IF NOT EXISTS idx_agent_sessions_project ON agent_sessions(project_id)`,
|
|
891
|
+
`CREATE INDEX IF NOT EXISTS idx_agent_sessions_updated ON agent_sessions(updated_at)`,
|
|
892
|
+
// v39: Align Aero provider IDs with sweep naming — anthropic→claude, google→gemini.
|
|
893
|
+
// Old rows predating the rename would fail to rehydrate because the canonical
|
|
894
|
+
// registry no longer recognizes 'anthropic'/'google'. Safe to re-run: the
|
|
895
|
+
// UPDATE is a no-op once the rename has been applied.
|
|
896
|
+
`UPDATE agent_sessions SET model_provider = 'claude' WHERE model_provider = 'anthropic'`,
|
|
897
|
+
`UPDATE agent_sessions SET model_provider = 'gemini' WHERE model_provider = 'google'`
|
|
857
898
|
];
|
|
858
899
|
function isDuplicateColumnError(err) {
|
|
859
900
|
if (!(err instanceof Error)) return false;
|
|
@@ -861,6 +902,83 @@ function isDuplicateColumnError(err) {
|
|
|
861
902
|
if (err.cause instanceof Error && err.cause.message.includes("duplicate column name")) return true;
|
|
862
903
|
return false;
|
|
863
904
|
}
|
|
905
|
+
function columnExists(db, table, column) {
|
|
906
|
+
const rows = db.all(sql.raw(
|
|
907
|
+
`SELECT COUNT(*) as c FROM pragma_table_info('${table}') WHERE name = '${column}'`
|
|
908
|
+
));
|
|
909
|
+
return (rows[0]?.c ?? 0) > 0;
|
|
910
|
+
}
|
|
911
|
+
function dropColumnIfExists(db, table, column) {
|
|
912
|
+
try {
|
|
913
|
+
db.run(sql.raw(`ALTER TABLE ${table} DROP COLUMN ${column}`));
|
|
914
|
+
} catch (err) {
|
|
915
|
+
if (!(err instanceof Error)) throw err;
|
|
916
|
+
const msg = err.message;
|
|
917
|
+
const causeMsg = err.cause instanceof Error ? err.cause.message : "";
|
|
918
|
+
const expected = `no such column: "${column}"`;
|
|
919
|
+
const expectedAlt = `no such column: ${column}`;
|
|
920
|
+
if (msg.includes(expected) || msg.includes(expectedAlt)) return;
|
|
921
|
+
if (causeMsg.includes(expected) || causeMsg.includes(expectedAlt)) return;
|
|
922
|
+
throw err;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function extractLegacyCredentials(db) {
|
|
926
|
+
const out = { google: [], ga4: [] };
|
|
927
|
+
if (columnExists(db, "google_connections", "access_token")) {
|
|
928
|
+
const rows = db.all(sql.raw(
|
|
929
|
+
`SELECT domain, connection_type, property_id, sitemap_url, access_token, refresh_token, token_expires_at, scopes, created_at, updated_at
|
|
930
|
+
FROM google_connections
|
|
931
|
+
WHERE refresh_token IS NOT NULL AND refresh_token != ''`
|
|
932
|
+
));
|
|
933
|
+
for (const row of rows) {
|
|
934
|
+
out.google.push({
|
|
935
|
+
domain: row.domain,
|
|
936
|
+
connectionType: row.connection_type,
|
|
937
|
+
propertyId: row.property_id,
|
|
938
|
+
sitemapUrl: row.sitemap_url,
|
|
939
|
+
accessToken: row.access_token,
|
|
940
|
+
refreshToken: row.refresh_token,
|
|
941
|
+
tokenExpiresAt: row.token_expires_at,
|
|
942
|
+
scopes: parseJsonColumn(row.scopes, []),
|
|
943
|
+
createdAt: row.created_at,
|
|
944
|
+
updatedAt: row.updated_at
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (columnExists(db, "ga_connections", "private_key")) {
|
|
949
|
+
const rows = db.all(sql.raw(
|
|
950
|
+
`SELECT p.name AS project_name, ga.property_id, ga.client_email, ga.private_key, ga.created_at, ga.updated_at
|
|
951
|
+
FROM ga_connections ga
|
|
952
|
+
INNER JOIN projects p ON p.id = ga.project_id
|
|
953
|
+
WHERE ga.private_key IS NOT NULL AND ga.private_key != ''`
|
|
954
|
+
));
|
|
955
|
+
for (const row of rows) {
|
|
956
|
+
out.ga4.push({
|
|
957
|
+
projectName: row.project_name,
|
|
958
|
+
propertyId: row.property_id,
|
|
959
|
+
clientEmail: row.client_email,
|
|
960
|
+
privateKey: row.private_key,
|
|
961
|
+
createdAt: row.created_at,
|
|
962
|
+
updatedAt: row.updated_at
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
return out;
|
|
967
|
+
}
|
|
968
|
+
function dropLegacyCredentialColumns(db) {
|
|
969
|
+
if (columnExists(db, "google_connections", "access_token")) {
|
|
970
|
+
dropColumnIfExists(db, "google_connections", "access_token");
|
|
971
|
+
}
|
|
972
|
+
if (columnExists(db, "google_connections", "refresh_token")) {
|
|
973
|
+
dropColumnIfExists(db, "google_connections", "refresh_token");
|
|
974
|
+
}
|
|
975
|
+
if (columnExists(db, "google_connections", "token_expires_at")) {
|
|
976
|
+
dropColumnIfExists(db, "google_connections", "token_expires_at");
|
|
977
|
+
}
|
|
978
|
+
if (columnExists(db, "ga_connections", "private_key")) {
|
|
979
|
+
dropColumnIfExists(db, "ga_connections", "private_key");
|
|
980
|
+
}
|
|
981
|
+
}
|
|
864
982
|
function migrate(db) {
|
|
865
983
|
const statements = MIGRATION_SQL.split(";").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
866
984
|
for (const statement of statements) {
|
|
@@ -1306,8 +1424,11 @@ export {
|
|
|
1306
1424
|
usageCounters,
|
|
1307
1425
|
insights,
|
|
1308
1426
|
healthSnapshots,
|
|
1427
|
+
agentSessions,
|
|
1309
1428
|
createClient,
|
|
1310
1429
|
parseJsonColumn,
|
|
1430
|
+
extractLegacyCredentials,
|
|
1431
|
+
dropLegacyCredentialColumns,
|
|
1311
1432
|
migrate,
|
|
1312
1433
|
createLogger,
|
|
1313
1434
|
IntelligenceService
|