nomoreide 0.1.46 → 0.1.48
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/dist/core/config-store.d.ts +2 -0
- package/dist/core/config-store.js +12 -0
- package/dist/core/config-store.js.map +1 -1
- package/dist/core/db/driver.d.ts +59 -1
- package/dist/core/db/driver.js +60 -0
- package/dist/core/db/driver.js.map +1 -1
- package/dist/core/db/mysql-driver.d.ts +11 -5
- package/dist/core/db/mysql-driver.js +60 -4
- package/dist/core/db/mysql-driver.js.map +1 -1
- package/dist/core/db/postgres-driver.d.ts +12 -5
- package/dist/core/db/postgres-driver.js +55 -6
- package/dist/core/db/postgres-driver.js.map +1 -1
- package/dist/core/db/sqlite-driver.d.ts +8 -3
- package/dist/core/db/sqlite-driver.js +64 -3
- package/dist/core/db/sqlite-driver.js.map +1 -1
- package/dist/core/db-peek.d.ts +7 -1
- package/dist/core/db-peek.js +8 -0
- package/dist/core/db-peek.js.map +1 -1
- package/dist/core/db-write.d.ts +34 -0
- package/dist/core/db-write.js +72 -0
- package/dist/core/db-write.js.map +1 -0
- package/dist/core/types.d.ts +5 -0
- package/dist/core/workflows.d.ts +76 -6
- package/dist/core/workflows.js +18 -2
- package/dist/core/workflows.js.map +1 -1
- package/dist/mcp/tools/database.d.ts +4 -3
- package/dist/mcp/tools/database.js +67 -2
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +1 -1
- package/dist/web/agent-info.d.ts +12 -0
- package/dist/web/agent-info.js +101 -2
- package/dist/web/agent-info.js.map +1 -1
- package/dist/web/client/assets/{code-editor-o1tS7fpw.js → code-editor-DH7Sl3iw.js} +1 -1
- package/dist/web/client/assets/index-DWPlVWVN.js +211 -0
- package/dist/web/client/assets/index-vGzOmeUL.css +1 -0
- package/dist/web/client/index.html +2 -2
- package/dist/web/routes/context.d.ts +2 -0
- package/dist/web/routes/context.js.map +1 -1
- package/dist/web/routes/database-routes.js +57 -2
- package/dist/web/routes/database-routes.js.map +1 -1
- package/dist/web/server.js +3 -0
- package/dist/web/server.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/index-CFZyk7FD.js +0 -201
- package/dist/web/client/assets/index-Dcqu3Z0L.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertSafeIdentifier, clampLimit, clampOffset, normalizeRow, } from "./driver.js";
|
|
1
|
+
import { assertSafeIdentifier, clampLimit, clampOffset, columnsFromNames, isReadStatement, normalizeRow, prepareUserQuery, } from "./driver.js";
|
|
2
2
|
/**
|
|
3
3
|
* SQLite driver backed by Node's built-in `node:sqlite`. The file is opened
|
|
4
4
|
* read-only, so the connection itself cannot mutate the database.
|
|
@@ -7,8 +7,10 @@ export class SqliteDriver {
|
|
|
7
7
|
file;
|
|
8
8
|
engine = "sqlite";
|
|
9
9
|
dbPromise = null;
|
|
10
|
-
|
|
10
|
+
writable;
|
|
11
|
+
constructor(file, options = {}) {
|
|
11
12
|
this.file = file;
|
|
13
|
+
this.writable = options.writable ?? false;
|
|
12
14
|
}
|
|
13
15
|
async db() {
|
|
14
16
|
if (!this.dbPromise) {
|
|
@@ -20,7 +22,9 @@ export class SqliteDriver {
|
|
|
20
22
|
catch {
|
|
21
23
|
throw new Error(`SQLite browsing requires Node >=22.5 (uses the built-in node:sqlite module); you're on ${process.version}. Upgrade Node, or use a Postgres/MySQL connection instead.`);
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
// Read-only handles can't mutate the file at all; writable handles back
|
|
26
|
+
// the guarded executeWrite path only.
|
|
27
|
+
return new DatabaseSync(this.file, { readOnly: !this.writable });
|
|
24
28
|
})();
|
|
25
29
|
}
|
|
26
30
|
return this.dbPromise;
|
|
@@ -60,6 +64,63 @@ export class SqliteDriver {
|
|
|
60
64
|
offset: skip,
|
|
61
65
|
};
|
|
62
66
|
}
|
|
67
|
+
async runQuery(sql, maxRows) {
|
|
68
|
+
const statement = prepareUserQuery(sql);
|
|
69
|
+
const cap = clampLimit(maxRows);
|
|
70
|
+
const db = await this.db();
|
|
71
|
+
// The connection is opened read-only, so a write statement throws here.
|
|
72
|
+
const rows = db
|
|
73
|
+
.prepare(`SELECT * FROM (${statement}) LIMIT ?`)
|
|
74
|
+
.all(cap + 1);
|
|
75
|
+
const truncated = rows.length > cap;
|
|
76
|
+
const capped = truncated ? rows.slice(0, cap) : rows;
|
|
77
|
+
// node:sqlite exposes columns only via row keys; the wrap guarantees at
|
|
78
|
+
// least one synthesized column name per result field when rows exist.
|
|
79
|
+
const names = capped.length > 0 ? Object.keys(capped[0]) : [];
|
|
80
|
+
return {
|
|
81
|
+
columns: columnsFromNames(names),
|
|
82
|
+
rows: capped.map((row) => normalizeRow(row)),
|
|
83
|
+
rowCount: capped.length,
|
|
84
|
+
truncated,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async executeWrite(sql, commit) {
|
|
88
|
+
if (!this.writable)
|
|
89
|
+
throw new Error("This connection is read-only.");
|
|
90
|
+
const statement = prepareUserQuery(sql);
|
|
91
|
+
const db = await this.db();
|
|
92
|
+
db.exec("BEGIN");
|
|
93
|
+
try {
|
|
94
|
+
// SELECT / RETURNING produce rows; other statements report `changes`.
|
|
95
|
+
const returnsRows = isReadStatement(statement) || /\breturning\b/i.test(statement);
|
|
96
|
+
let result;
|
|
97
|
+
if (returnsRows) {
|
|
98
|
+
const rows = db.prepare(statement).all();
|
|
99
|
+
const names = rows.length > 0 ? Object.keys(rows[0]) : [];
|
|
100
|
+
result = {
|
|
101
|
+
affectedRows: rows.length,
|
|
102
|
+
rows: rows.map((row) => normalizeRow(row)),
|
|
103
|
+
columns: columnsFromNames(names),
|
|
104
|
+
committed: commit,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const info = db.prepare(statement).run();
|
|
109
|
+
result = {
|
|
110
|
+
affectedRows: Number(info.changes),
|
|
111
|
+
rows: [],
|
|
112
|
+
columns: [],
|
|
113
|
+
committed: commit,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
db.exec(commit ? "COMMIT" : "ROLLBACK");
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
db.exec("ROLLBACK");
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
63
124
|
async close() {
|
|
64
125
|
if (this.dbPromise) {
|
|
65
126
|
const db = await this.dbPromise;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-driver.js","sourceRoot":"","sources":["../../../src/core/db/sqlite-driver.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,YAAY,
|
|
1
|
+
{"version":3,"file":"sqlite-driver.js","sourceRoot":"","sources":["../../../src/core/db/sqlite-driver.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAQjB,MAAM,aAAa,CAAC;AASrB;;;GAGG;AACH,MAAM,OAAO,YAAY;IAKM;IAJpB,MAAM,GAAmB,QAAQ,CAAC;IACnC,SAAS,GAAiC,IAAI,CAAC;IACtC,QAAQ,CAAU;IAEnC,YAA6B,IAAY,EAAE,UAAkC,EAAE;QAAlD,SAAI,GAAJ,IAAI,CAAQ;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;IAC5C,CAAC;IAEO,KAAK,CAAC,EAAE;QACd,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,IAAI,EAAE;gBAC3B,IAAI,YAAuD,CAAC;gBAC5D,IAAI,CAAC;oBACH,CAAC,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;gBACnD,CAAC;gBAAC,MAAM,CAAC;oBACP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C,CAAC;oBAC1C,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC;oBAChC,SAAS,EAAE,MAAM;iBAClB,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;gBACzC,MAAM,GAAG;oBACP,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;oBAClC,IAAI,EAAE,EAAE;oBACR,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,MAAM;iBAClB,CAAC;YACJ,CAAC;YACD,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YACxC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACpB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;YAChC,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
package/dist/core/db-peek.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ConfigStore } from "./config-store.js";
|
|
2
2
|
import type { DatabaseEngine } from "./types.js";
|
|
3
|
-
import type { RowSample, TableRef } from "./db/driver.js";
|
|
3
|
+
import type { QueryResult, RowSample, TableRef } from "./db/driver.js";
|
|
4
4
|
export interface MaskedConnection {
|
|
5
5
|
name: string;
|
|
6
6
|
engine: DatabaseEngine;
|
|
7
7
|
/** Connection URL with any password redacted (path left intact for SQLite). */
|
|
8
8
|
url: string;
|
|
9
|
+
/** Whether the user has unlocked write access for this connection. */
|
|
10
|
+
writeUnlocked: boolean;
|
|
9
11
|
}
|
|
10
12
|
/** A DB connection string discovered in a service's `.env` file. */
|
|
11
13
|
export interface DetectedConnection {
|
|
@@ -33,6 +35,10 @@ export declare class DbPeek {
|
|
|
33
35
|
engine: DatabaseEngine;
|
|
34
36
|
table: TableRef;
|
|
35
37
|
} & RowSample>;
|
|
38
|
+
/** Run a user-authored read-only query against a registered connection. */
|
|
39
|
+
runQuery(name: string, sql: string, maxRows?: number): Promise<{
|
|
40
|
+
engine: DatabaseEngine;
|
|
41
|
+
} & QueryResult>;
|
|
36
42
|
/** Test an unsaved connection without caching it. */
|
|
37
43
|
test(engine: DatabaseEngine, url: string): Promise<void>;
|
|
38
44
|
/** Scan registered services' `.env` files for usable connection strings. */
|
package/dist/core/db-peek.js
CHANGED
|
@@ -20,6 +20,7 @@ export class DbPeek {
|
|
|
20
20
|
name: connection.name,
|
|
21
21
|
engine: connection.engine,
|
|
22
22
|
url: maskConnectionUrl(connection.engine, connection.url),
|
|
23
|
+
writeUnlocked: connection.writeUnlocked ?? false,
|
|
23
24
|
}));
|
|
24
25
|
}
|
|
25
26
|
async listTables(name) {
|
|
@@ -33,6 +34,13 @@ export class DbPeek {
|
|
|
33
34
|
const sample = await driver.sampleRows(table, limit, offset);
|
|
34
35
|
return { engine: connection.engine, table, ...sample };
|
|
35
36
|
}
|
|
37
|
+
/** Run a user-authored read-only query against a registered connection. */
|
|
38
|
+
async runQuery(name, sql, maxRows = 100) {
|
|
39
|
+
const connection = await this.resolve(name);
|
|
40
|
+
const driver = await this.driverFor(connection);
|
|
41
|
+
const result = await driver.runQuery(sql, maxRows);
|
|
42
|
+
return { engine: connection.engine, ...result };
|
|
43
|
+
}
|
|
36
44
|
/** Test an unsaved connection without caching it. */
|
|
37
45
|
async test(engine, url) {
|
|
38
46
|
const driver = createDriver(engine, url);
|
package/dist/core/db-peek.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-peek.js","sourceRoot":"","sources":["../../src/core/db-peek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"db-peek.js","sourceRoot":"","sources":["../../src/core/db-peek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAwBrD;;;;GAIG;AACH,MAAM,OAAO,MAAM;IACA,WAAW,CAAc;IACzB,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IAEvD,YAAY,OAAsB;QAChC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC7C,OAAO,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAC3C,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,GAAG,EAAE,iBAAiB,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC;YACzD,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,KAA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,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ConfigStore } from "./config-store.js";
|
|
2
|
+
import type { DatabaseEngine } from "./types.js";
|
|
3
|
+
import { type WriteResult } from "./db/driver.js";
|
|
4
|
+
/** A write run, or a flag that the statement could not be safely previewed. */
|
|
5
|
+
export interface WriteOutcome extends Partial<WriteResult> {
|
|
6
|
+
engine: DatabaseEngine;
|
|
7
|
+
/** True when a preview was requested but the engine can't dry-run it. */
|
|
8
|
+
previewUnavailable: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DbWriteOptions {
|
|
11
|
+
configStore: ConfigStore;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Write-capable counterpart to {@link DbPeek}, kept deliberately separate so the
|
|
15
|
+
* read-only browser can never reach a write. Every connection here is gated by
|
|
16
|
+
* a per-connection `writeUnlocked` flag the user sets explicitly — and this
|
|
17
|
+
* surface is never exposed to the agent/MCP layer, only the human web UI.
|
|
18
|
+
*/
|
|
19
|
+
export declare class DbWrite {
|
|
20
|
+
private readonly configStore;
|
|
21
|
+
private readonly drivers;
|
|
22
|
+
constructor(options: DbWriteOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Run a write. With `commit: false` the statement is executed in a
|
|
25
|
+
* transaction and rolled back so the caller can preview the affected-row
|
|
26
|
+
* count; with `commit: true` it is persisted. Throws if the connection is
|
|
27
|
+
* locked.
|
|
28
|
+
*/
|
|
29
|
+
execute(name: string, sql: string, commit: boolean): Promise<WriteOutcome>;
|
|
30
|
+
closeAll(): Promise<void>;
|
|
31
|
+
/** Resolve a connection and assert the user has unlocked writes on it. */
|
|
32
|
+
private resolveUnlocked;
|
|
33
|
+
private driverFor;
|
|
34
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { canPreviewWrite, } from "./db/driver.js";
|
|
2
|
+
import { MysqlDriver } from "./db/mysql-driver.js";
|
|
3
|
+
import { PostgresDriver } from "./db/postgres-driver.js";
|
|
4
|
+
import { SqliteDriver } from "./db/sqlite-driver.js";
|
|
5
|
+
/**
|
|
6
|
+
* Write-capable counterpart to {@link DbPeek}, kept deliberately separate so the
|
|
7
|
+
* read-only browser can never reach a write. Every connection here is gated by
|
|
8
|
+
* a per-connection `writeUnlocked` flag the user sets explicitly — and this
|
|
9
|
+
* surface is never exposed to the agent/MCP layer, only the human web UI.
|
|
10
|
+
*/
|
|
11
|
+
export class DbWrite {
|
|
12
|
+
configStore;
|
|
13
|
+
drivers = new Map();
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.configStore = options.configStore;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Run a write. With `commit: false` the statement is executed in a
|
|
19
|
+
* transaction and rolled back so the caller can preview the affected-row
|
|
20
|
+
* count; with `commit: true` it is persisted. Throws if the connection is
|
|
21
|
+
* locked.
|
|
22
|
+
*/
|
|
23
|
+
async execute(name, sql, commit) {
|
|
24
|
+
const connection = await this.resolveUnlocked(name);
|
|
25
|
+
// A preview that would actually persist (MySQL DDL auto-commits) is unsafe;
|
|
26
|
+
// surface that instead of silently running it.
|
|
27
|
+
if (!commit && !canPreviewWrite(connection.engine, sql)) {
|
|
28
|
+
return { engine: connection.engine, previewUnavailable: true };
|
|
29
|
+
}
|
|
30
|
+
const driver = this.driverFor(connection);
|
|
31
|
+
const result = await driver.executeWrite(sql, commit);
|
|
32
|
+
return { engine: connection.engine, previewUnavailable: false, ...result };
|
|
33
|
+
}
|
|
34
|
+
async closeAll() {
|
|
35
|
+
await Promise.all([...this.drivers.values()].map((driver) => driver.close().catch(() => { })));
|
|
36
|
+
this.drivers.clear();
|
|
37
|
+
}
|
|
38
|
+
/** Resolve a connection and assert the user has unlocked writes on it. */
|
|
39
|
+
async resolveUnlocked(name) {
|
|
40
|
+
const config = await this.configStore.load();
|
|
41
|
+
const connection = config.databases.find((item) => item.name === name);
|
|
42
|
+
if (!connection) {
|
|
43
|
+
throw new Error(`Database connection "${name}" is not registered.`);
|
|
44
|
+
}
|
|
45
|
+
if (!connection.writeUnlocked) {
|
|
46
|
+
throw new Error(`Write access is locked for "${name}". Unlock it before running writes.`);
|
|
47
|
+
}
|
|
48
|
+
return connection;
|
|
49
|
+
}
|
|
50
|
+
driverFor(connection) {
|
|
51
|
+
const key = `${connection.engine}::${connection.url}`;
|
|
52
|
+
let driver = this.drivers.get(key);
|
|
53
|
+
if (!driver) {
|
|
54
|
+
driver = createWriteDriver(connection.engine, connection.url);
|
|
55
|
+
this.drivers.set(key, driver);
|
|
56
|
+
}
|
|
57
|
+
return driver;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function createWriteDriver(engine, url) {
|
|
61
|
+
switch (engine) {
|
|
62
|
+
case "postgres":
|
|
63
|
+
return new PostgresDriver(url, { writable: true });
|
|
64
|
+
case "mysql":
|
|
65
|
+
return new MysqlDriver(url, { writable: true });
|
|
66
|
+
case "sqlite":
|
|
67
|
+
return new SqliteDriver(url, { writable: true });
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(`Unsupported database engine: ${engine}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=db-write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-write.js","sourceRoot":"","sources":["../../src/core/db-write.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,GAGhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAarD;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IACD,WAAW,CAAc;IACzB,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE5D,YAAY,OAAuB;QACjC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;IAED;;;;;OA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|
|
35
35
|
engine: DatabaseEngine;
|
|
36
36
|
url: string;
|
|
37
|
+
/**
|
|
38
|
+
* When true the user has explicitly unlocked write access for this
|
|
39
|
+
* connection's SQL console. Default/absent = read-only (locked).
|
|
40
|
+
*/
|
|
41
|
+
writeUnlocked?: boolean;
|
|
37
42
|
}
|
|
38
43
|
export type LogSourceKind = "file" | "ssh" | "command";
|
|
39
44
|
/**
|
package/dist/core/workflows.d.ts
CHANGED
|
@@ -42,6 +42,23 @@ export declare const workflowStepSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodO
|
|
|
42
42
|
title: z.ZodString;
|
|
43
43
|
/** The instruction handed to the dock agent. */
|
|
44
44
|
prompt: z.ZodString;
|
|
45
|
+
/** Optional user-selected capabilities the runner adds as prompt guidance. */
|
|
46
|
+
capabilities: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
48
|
+
mcpServers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
49
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
50
|
+
hooks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
skills?: string[] | undefined;
|
|
53
|
+
mcpServers?: string[] | undefined;
|
|
54
|
+
plugins?: string[] | undefined;
|
|
55
|
+
hooks?: string[] | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
skills?: string[] | undefined;
|
|
58
|
+
mcpServers?: string[] | undefined;
|
|
59
|
+
plugins?: string[] | undefined;
|
|
60
|
+
hooks?: string[] | undefined;
|
|
61
|
+
}>>;
|
|
45
62
|
/**
|
|
46
63
|
* Real-state check run after the agent's turn before advancing:
|
|
47
64
|
* - `committed` — the working tree is clean (changes were committed).
|
|
@@ -53,12 +70,24 @@ export declare const workflowStepSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodO
|
|
|
53
70
|
id: string;
|
|
54
71
|
title: string;
|
|
55
72
|
prompt: string;
|
|
73
|
+
capabilities?: {
|
|
74
|
+
skills?: string[] | undefined;
|
|
75
|
+
mcpServers?: string[] | undefined;
|
|
76
|
+
plugins?: string[] | undefined;
|
|
77
|
+
hooks?: string[] | undefined;
|
|
78
|
+
} | undefined;
|
|
56
79
|
verify?: "committed" | "pushed" | undefined;
|
|
57
80
|
}, {
|
|
58
81
|
kind: "agent";
|
|
59
82
|
id: string;
|
|
60
83
|
title: string;
|
|
61
84
|
prompt: string;
|
|
85
|
+
capabilities?: {
|
|
86
|
+
skills?: string[] | undefined;
|
|
87
|
+
mcpServers?: string[] | undefined;
|
|
88
|
+
plugins?: string[] | undefined;
|
|
89
|
+
hooks?: string[] | undefined;
|
|
90
|
+
} | undefined;
|
|
62
91
|
verify?: "committed" | "pushed" | undefined;
|
|
63
92
|
}>, z.ZodObject<{
|
|
64
93
|
kind: z.ZodLiteral<"gate">;
|
|
@@ -67,13 +96,13 @@ export declare const workflowStepSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodO
|
|
|
67
96
|
/** Shown at the pause so the user knows what they're approving. */
|
|
68
97
|
message: z.ZodString;
|
|
69
98
|
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
kind: "gate";
|
|
71
99
|
message: string;
|
|
100
|
+
kind: "gate";
|
|
72
101
|
id: string;
|
|
73
102
|
title: string;
|
|
74
103
|
}, {
|
|
75
|
-
kind: "gate";
|
|
76
104
|
message: string;
|
|
105
|
+
kind: "gate";
|
|
77
106
|
id: string;
|
|
78
107
|
title: string;
|
|
79
108
|
}>]>;
|
|
@@ -109,6 +138,23 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
109
138
|
title: z.ZodString;
|
|
110
139
|
/** The instruction handed to the dock agent. */
|
|
111
140
|
prompt: z.ZodString;
|
|
141
|
+
/** Optional user-selected capabilities the runner adds as prompt guidance. */
|
|
142
|
+
capabilities: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
144
|
+
mcpServers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
145
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
146
|
+
hooks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
skills?: string[] | undefined;
|
|
149
|
+
mcpServers?: string[] | undefined;
|
|
150
|
+
plugins?: string[] | undefined;
|
|
151
|
+
hooks?: string[] | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
skills?: string[] | undefined;
|
|
154
|
+
mcpServers?: string[] | undefined;
|
|
155
|
+
plugins?: string[] | undefined;
|
|
156
|
+
hooks?: string[] | undefined;
|
|
157
|
+
}>>;
|
|
112
158
|
/**
|
|
113
159
|
* Real-state check run after the agent's turn before advancing:
|
|
114
160
|
* - `committed` — the working tree is clean (changes were committed).
|
|
@@ -120,12 +166,24 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
120
166
|
id: string;
|
|
121
167
|
title: string;
|
|
122
168
|
prompt: string;
|
|
169
|
+
capabilities?: {
|
|
170
|
+
skills?: string[] | undefined;
|
|
171
|
+
mcpServers?: string[] | undefined;
|
|
172
|
+
plugins?: string[] | undefined;
|
|
173
|
+
hooks?: string[] | undefined;
|
|
174
|
+
} | undefined;
|
|
123
175
|
verify?: "committed" | "pushed" | undefined;
|
|
124
176
|
}, {
|
|
125
177
|
kind: "agent";
|
|
126
178
|
id: string;
|
|
127
179
|
title: string;
|
|
128
180
|
prompt: string;
|
|
181
|
+
capabilities?: {
|
|
182
|
+
skills?: string[] | undefined;
|
|
183
|
+
mcpServers?: string[] | undefined;
|
|
184
|
+
plugins?: string[] | undefined;
|
|
185
|
+
hooks?: string[] | undefined;
|
|
186
|
+
} | undefined;
|
|
129
187
|
verify?: "committed" | "pushed" | undefined;
|
|
130
188
|
}>, z.ZodObject<{
|
|
131
189
|
kind: z.ZodLiteral<"gate">;
|
|
@@ -134,13 +192,13 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
134
192
|
/** Shown at the pause so the user knows what they're approving. */
|
|
135
193
|
message: z.ZodString;
|
|
136
194
|
}, "strip", z.ZodTypeAny, {
|
|
137
|
-
kind: "gate";
|
|
138
195
|
message: string;
|
|
196
|
+
kind: "gate";
|
|
139
197
|
id: string;
|
|
140
198
|
title: string;
|
|
141
199
|
}, {
|
|
142
|
-
kind: "gate";
|
|
143
200
|
message: string;
|
|
201
|
+
kind: "gate";
|
|
144
202
|
id: string;
|
|
145
203
|
title: string;
|
|
146
204
|
}>]>, "many">;
|
|
@@ -157,10 +215,16 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
157
215
|
id: string;
|
|
158
216
|
title: string;
|
|
159
217
|
prompt: string;
|
|
218
|
+
capabilities?: {
|
|
219
|
+
skills?: string[] | undefined;
|
|
220
|
+
mcpServers?: string[] | undefined;
|
|
221
|
+
plugins?: string[] | undefined;
|
|
222
|
+
hooks?: string[] | undefined;
|
|
223
|
+
} | undefined;
|
|
160
224
|
verify?: "committed" | "pushed" | undefined;
|
|
161
225
|
} | {
|
|
162
|
-
kind: "gate";
|
|
163
226
|
message: string;
|
|
227
|
+
kind: "gate";
|
|
164
228
|
id: string;
|
|
165
229
|
title: string;
|
|
166
230
|
})[];
|
|
@@ -179,10 +243,16 @@ export declare const workflowSchema: z.ZodObject<{
|
|
|
179
243
|
id: string;
|
|
180
244
|
title: string;
|
|
181
245
|
prompt: string;
|
|
246
|
+
capabilities?: {
|
|
247
|
+
skills?: string[] | undefined;
|
|
248
|
+
mcpServers?: string[] | undefined;
|
|
249
|
+
plugins?: string[] | undefined;
|
|
250
|
+
hooks?: string[] | undefined;
|
|
251
|
+
} | undefined;
|
|
182
252
|
verify?: "committed" | "pushed" | undefined;
|
|
183
253
|
} | {
|
|
184
|
-
kind: "gate";
|
|
185
254
|
message: string;
|
|
255
|
+
kind: "gate";
|
|
186
256
|
id: string;
|
|
187
257
|
title: string;
|
|
188
258
|
})[];
|
package/dist/core/workflows.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
const workflowCapabilitiesSchema = z.object({
|
|
3
|
+
skills: z.array(z.string().min(1)).optional(),
|
|
4
|
+
mcpServers: z.array(z.string().min(1)).optional(),
|
|
5
|
+
plugins: z.array(z.string().min(1)).optional(),
|
|
6
|
+
hooks: z.array(z.string().min(1)).optional(),
|
|
7
|
+
});
|
|
2
8
|
/**
|
|
3
9
|
* User-owned git/GitHub workflows — the AI-native answer to fixed IDE buttons.
|
|
4
10
|
*
|
|
@@ -34,6 +40,8 @@ export const workflowStepSchema = z.discriminatedUnion("kind", [
|
|
|
34
40
|
title: z.string().min(1),
|
|
35
41
|
/** The instruction handed to the dock agent. */
|
|
36
42
|
prompt: z.string().min(1),
|
|
43
|
+
/** Optional user-selected capabilities the runner adds as prompt guidance. */
|
|
44
|
+
capabilities: workflowCapabilitiesSchema.optional(),
|
|
37
45
|
/**
|
|
38
46
|
* Real-state check run after the agent's turn before advancing:
|
|
39
47
|
* - `committed` — the working tree is clean (changes were committed).
|
|
@@ -57,6 +65,12 @@ export const workflowSchema = z.object({
|
|
|
57
65
|
builtin: z.boolean().optional(),
|
|
58
66
|
steps: z.array(workflowStepSchema).min(1),
|
|
59
67
|
});
|
|
68
|
+
const COMMIT_GATE = {
|
|
69
|
+
kind: "gate",
|
|
70
|
+
id: "gate-commit",
|
|
71
|
+
title: "Approve commit",
|
|
72
|
+
message: "Stage the current changes and create one AI-written commit?",
|
|
73
|
+
};
|
|
60
74
|
/**
|
|
61
75
|
* One lightweight AI pass that writes a real commit message and commits — the
|
|
62
76
|
* balance the user wanted: a thought-through message like the `commit-push`
|
|
@@ -78,9 +92,10 @@ export const BUILTIN_WORKFLOWS = [
|
|
|
78
92
|
{
|
|
79
93
|
id: "commit-push",
|
|
80
94
|
name: "Commit & push",
|
|
81
|
-
description: "
|
|
95
|
+
description: "Pause for approval, make one AI-written commit, then pause again before pushing.",
|
|
82
96
|
builtin: true,
|
|
83
97
|
steps: [
|
|
98
|
+
{ ...COMMIT_GATE },
|
|
84
99
|
COMMIT_STEP,
|
|
85
100
|
{ kind: "gate", id: "gate-push", title: "Approve push", message: "Push to the remote?" },
|
|
86
101
|
{ kind: "action", id: "push", title: "Push", op: "push" },
|
|
@@ -89,9 +104,10 @@ export const BUILTIN_WORKFLOWS = [
|
|
|
89
104
|
{
|
|
90
105
|
id: "ship-it",
|
|
91
106
|
name: "Ship it",
|
|
92
|
-
description: "
|
|
107
|
+
description: "Approve the AI commit, push, then use quick AI turns to open and squash-merge the PR.",
|
|
93
108
|
builtin: true,
|
|
94
109
|
steps: [
|
|
110
|
+
{ ...COMMIT_GATE },
|
|
95
111
|
COMMIT_STEP,
|
|
96
112
|
{ kind: "gate", id: "gate-push", title: "Approve push", message: "Push and open a PR?" },
|
|
97
113
|
{ kind: "action", id: "push", title: "Push", op: "push" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../src/core/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7D,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACzB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB;;;;WAIG;QACH,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KAC/B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EA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OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC;IACxF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACjG,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { FastMCP } from "fastmcp";
|
|
2
2
|
import { type ToolContext } from "./context.js";
|
|
3
|
-
export declare const DATABASE_TOOL_NAMES: readonly ["nomoreide_list_databases", "nomoreide_db_tables", "nomoreide_db_sample"];
|
|
3
|
+
export declare const DATABASE_TOOL_NAMES: readonly ["nomoreide_list_databases", "nomoreide_db_tables", "nomoreide_db_sample", "nomoreide_db_query"];
|
|
4
4
|
/**
|
|
5
|
-
* DB Peek tools: read-only
|
|
6
|
-
* connections. Scoped to connections in ConfigStore
|
|
5
|
+
* DB Peek tools: read-only access to the user's registered database
|
|
6
|
+
* connections. Scoped to connections in ConfigStore; `nomoreide_db_query` runs
|
|
7
|
+
* SQL inside a read-only transaction, so writes are rejected by the server.
|
|
7
8
|
*/
|
|
8
9
|
export declare function registerDatabaseTools(server: FastMCP, ctx: ToolContext): void;
|