agent-discover 1.0.20 → 1.0.23
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/agent-desk-plugin.json
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Db } from 'agent-common';
|
|
2
|
+
export type { Db } from 'agent-common';
|
|
2
3
|
export interface DbOptions {
|
|
3
4
|
/** Use ':memory:' for tests, or a file path. Defaults to ~/.claude/agent-discover.db */
|
|
4
5
|
path?: string;
|
|
5
6
|
/** Enable verbose logging to stderr */
|
|
6
7
|
verbose?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export interface Db {
|
|
9
|
-
readonly raw: Database.Database;
|
|
10
|
-
run(sql: string, params?: unknown[]): Database.RunResult;
|
|
11
|
-
queryAll<T>(sql: string, params?: unknown[]): T[];
|
|
12
|
-
queryOne<T>(sql: string, params?: unknown[]): T | null;
|
|
13
|
-
transaction<T>(fn: () => T): T;
|
|
14
|
-
close(): void;
|
|
15
|
-
}
|
|
16
9
|
export declare function createDb(options?: DbOptions): Db;
|
|
17
10
|
//# sourceMappingURL=database.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/storage/database.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/storage/database.ts"],"names":[],"mappings":"AAeA,OAAO,EAIL,KAAK,EAAE,EAER,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,WAAW,SAAS;IACxB,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,QAAQ,CAAC,OAAO,GAAE,SAAc,GAAG,EAAE,CAGpD"}
|
package/dist/storage/database.js
CHANGED
|
@@ -1,51 +1,20 @@
|
|
|
1
1
|
// =============================================================================
|
|
2
2
|
// agent-discover — Storage layer
|
|
3
3
|
//
|
|
4
|
-
// Thin wrapper around
|
|
5
|
-
//
|
|
4
|
+
// Thin wrapper around agent-common's createDb. Uses adoptUserVersion so
|
|
5
|
+
// existing installations that previously tracked schema via `pragma
|
|
6
|
+
// user_version` migrate cleanly to agent-common's _meta-table runner without
|
|
7
|
+
// re-running migrations against tables that already have the columns. All
|
|
8
|
+
// ALTER TABLE statements in v2/v3 use addColumnIfMissing to stay idempotent
|
|
9
|
+
// on partially-migrated DBs.
|
|
6
10
|
// =============================================================================
|
|
7
|
-
import Database from 'better-sqlite3';
|
|
8
11
|
import { homedir } from 'os';
|
|
9
12
|
import { join } from 'path';
|
|
10
13
|
import { mkdirSync } from 'fs';
|
|
11
|
-
|
|
14
|
+
import { createDb as createKitDb, addColumnIfMissing, hasColumn, } from 'agent-common';
|
|
12
15
|
export function createDb(options = {}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
verbose: options.verbose ? (msg) => process.stderr.write(`[sql] ${msg}\n`) : undefined,
|
|
16
|
-
});
|
|
17
|
-
raw.pragma('journal_mode = WAL');
|
|
18
|
-
raw.pragma('busy_timeout = 5000');
|
|
19
|
-
raw.pragma('synchronous = NORMAL');
|
|
20
|
-
raw.pragma('foreign_keys = ON');
|
|
21
|
-
applySchema(raw);
|
|
22
|
-
return {
|
|
23
|
-
raw,
|
|
24
|
-
run(sql, params) {
|
|
25
|
-
const stmt = raw.prepare(sql);
|
|
26
|
-
return params?.length ? stmt.run(...params) : stmt.run();
|
|
27
|
-
},
|
|
28
|
-
queryAll(sql, params) {
|
|
29
|
-
const stmt = raw.prepare(sql);
|
|
30
|
-
return (params?.length ? stmt.all(...params) : stmt.all());
|
|
31
|
-
},
|
|
32
|
-
queryOne(sql, params) {
|
|
33
|
-
const stmt = raw.prepare(sql);
|
|
34
|
-
const row = params?.length ? stmt.get(...params) : stmt.get();
|
|
35
|
-
return row ?? null;
|
|
36
|
-
},
|
|
37
|
-
transaction(fn) {
|
|
38
|
-
return raw.transaction(fn)();
|
|
39
|
-
},
|
|
40
|
-
close() {
|
|
41
|
-
try {
|
|
42
|
-
raw.close();
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
/* ignore */
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
};
|
|
16
|
+
const path = resolveDbPath(options.path);
|
|
17
|
+
return createKitDb({ path, migrations, verbose: options.verbose, adoptUserVersion: true });
|
|
49
18
|
}
|
|
50
19
|
function resolveDbPath(path) {
|
|
51
20
|
if (path)
|
|
@@ -57,13 +26,16 @@ function resolveDbPath(path) {
|
|
|
57
26
|
mkdirSync(dir, { recursive: true });
|
|
58
27
|
return join(dir, 'agent-discover.db');
|
|
59
28
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Migrations — version-ordered, applied by agent-common's runner.
|
|
31
|
+
// All ALTER TABLE statements are guarded so they're safe to re-run on DBs
|
|
32
|
+
// that legacy pragma-user_version code already touched.
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
const migrations = [
|
|
35
|
+
{
|
|
36
|
+
version: 1,
|
|
37
|
+
up: (db) => {
|
|
38
|
+
db.exec(`
|
|
67
39
|
CREATE TABLE IF NOT EXISTS servers (
|
|
68
40
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
69
41
|
name TEXT NOT NULL UNIQUE,
|
|
@@ -98,7 +70,6 @@ function applySchema(raw) {
|
|
|
98
70
|
content=servers, content_rowid=id
|
|
99
71
|
);
|
|
100
72
|
|
|
101
|
-
-- FTS triggers
|
|
102
73
|
CREATE TRIGGER IF NOT EXISTS servers_ai AFTER INSERT ON servers BEGIN
|
|
103
74
|
INSERT INTO servers_fts(rowid, name, description, tags)
|
|
104
75
|
VALUES (new.id, new.name, new.description, new.tags);
|
|
@@ -116,53 +87,48 @@ function applySchema(raw) {
|
|
|
116
87
|
VALUES (new.id, new.name, new.description, new.tags);
|
|
117
88
|
END;
|
|
118
89
|
`);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
`);
|
|
164
|
-
}
|
|
165
|
-
function migrateV3(raw) {
|
|
166
|
-
raw.exec(`ALTER TABLE servers DROP COLUMN approval_status;`);
|
|
167
|
-
}
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
version: 2,
|
|
94
|
+
up: (db) => {
|
|
95
|
+
addColumnIfMissing(db, 'servers', 'approval_status', "TEXT DEFAULT 'experimental'");
|
|
96
|
+
addColumnIfMissing(db, 'servers', 'latest_version', 'TEXT');
|
|
97
|
+
addColumnIfMissing(db, 'servers', 'last_health_check', 'TEXT');
|
|
98
|
+
addColumnIfMissing(db, 'servers', 'health_status', "TEXT DEFAULT 'unknown'");
|
|
99
|
+
addColumnIfMissing(db, 'servers', 'error_count', 'INTEGER DEFAULT 0');
|
|
100
|
+
db.exec(`
|
|
101
|
+
CREATE TABLE IF NOT EXISTS server_secrets (
|
|
102
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
103
|
+
server_id INTEGER NOT NULL REFERENCES servers(id) ON DELETE CASCADE,
|
|
104
|
+
key TEXT NOT NULL,
|
|
105
|
+
value TEXT NOT NULL,
|
|
106
|
+
masked BOOLEAN DEFAULT 1,
|
|
107
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
108
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
109
|
+
UNIQUE(server_id, key)
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
CREATE TABLE IF NOT EXISTS server_metrics (
|
|
113
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
114
|
+
server_id INTEGER NOT NULL REFERENCES servers(id) ON DELETE CASCADE,
|
|
115
|
+
tool_name TEXT NOT NULL,
|
|
116
|
+
call_count INTEGER DEFAULT 0,
|
|
117
|
+
error_count INTEGER DEFAULT 0,
|
|
118
|
+
total_latency_ms INTEGER DEFAULT 0,
|
|
119
|
+
last_called_at TEXT,
|
|
120
|
+
UNIQUE(server_id, tool_name)
|
|
121
|
+
);
|
|
122
|
+
`);
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
version: 3,
|
|
127
|
+
up: (db) => {
|
|
128
|
+
if (hasColumn(db, 'servers', 'approval_status')) {
|
|
129
|
+
db.exec(`ALTER TABLE servers DROP COLUMN approval_status`);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
];
|
|
168
134
|
//# sourceMappingURL=database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/storage/database.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iCAAiC;AACjC,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/storage/database.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iCAAiC;AACjC,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AAC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,CAAC;QACL,CAAC;KACF;IACD;QACE,OAAO,EAAE,CAAC;QACV,EAAE,EAAE,CAAC,EAAqB,EAAE,EAAE;YAC5B,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,6BAA6B,CAAC,CAAC;YACpF,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;YAC5D,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;YAC/D,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,wBAAwB,CAAC,CAAC;YAC7E,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;YAEtE,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;OAsBP,CAAC,CAAC;QACL,CAAC;KACF;IACD;QACE,OAAO,EAAE,CAAC;QACV,EAAE,EAAE,CAAC,EAAqB,EAAE,EAAE;YAC5B,IAAI,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,iBAAiB,CAAC,EAAE,CAAC;gBAChD,EAAE,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-discover",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"mcpName": "io.github.keshrath/agent-discover",
|
|
5
5
|
"description": "MCP server registry and marketplace — discover, install, activate, and manage MCP tools on demand",
|
|
6
6
|
"type": "module",
|
|
@@ -49,13 +49,14 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
52
|
-
"agent-common": "^1.0
|
|
52
|
+
"agent-common": "^1.1.0",
|
|
53
53
|
"better-sqlite3": "12.8.0",
|
|
54
54
|
"morphdom": "^2.7.8",
|
|
55
55
|
"ws": "8.20.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@eslint/js": "^10.0.1",
|
|
59
|
+
"@playwright/test": "^1.59.1",
|
|
59
60
|
"@types/better-sqlite3": "^7.6.13",
|
|
60
61
|
"@types/node": "^22.0.0",
|
|
61
62
|
"@types/ws": "^8.18.1",
|