@dotdotgod/context 0.3.11 → 0.4.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 +3 -3
- package/package.json +2 -2
- package/src/server.mjs +3 -5
- package/src/store.mjs +10 -4
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ The runtime policies apply to dotdotgod execution and retrieval tools. Each host
|
|
|
28
28
|
|
|
29
29
|
## Tool Surface
|
|
30
30
|
|
|
31
|
-
- `execute`, `
|
|
31
|
+
- `execute`, `execute_file`
|
|
32
32
|
- `index`, `search`, `fetch_and_index`
|
|
33
33
|
- `session_resume`, `ingestion_job_start`, `ingestion_job_status`, `ingestion_job_cancel`
|
|
34
34
|
- `context_heal`, `stats`, `doctor`, `purge`
|
|
@@ -55,9 +55,9 @@ The dotdotgod execution tools support four output modes:
|
|
|
55
55
|
|
|
56
56
|
Each command has one **10 MiB combined capture ceiling** shared by stdout and stderr. If either stream exceeds the remaining shared budget, the runtime terminates the process and reports `captureLimitExceeded`. A direct response is capped at **1 MiB per stream**, even if a caller requests more. Automatically indexed command output defaults to session scope and a 24-hour expiry.
|
|
57
57
|
|
|
58
|
-
`
|
|
58
|
+
`execute` requires a `commands` array of 1..100 entries and always returns ordered `results`, even for one command. Group independent known commands and separate dependent commands without bypassing safety gates. It accepts up to 100 commands, uses concurrency from 1 through 8, and preserves input order. Execution and explicit shell mode remain write-capable operations subject to the host's approval model.
|
|
59
59
|
|
|
60
|
-
`execute
|
|
60
|
+
`execute` and `execute_file` share an `inherit-filtered-v1` child-environment policy. It preserves compatibility-oriented inheritance while filtering `NODE_OPTIONS`, `PYTHONPATH`, `RUBYOPT`, `LD_PRELOAD`, and supported-platform `DYLD_*` variables. Callers may provide string overrides or remove inherited variables with `null`, but cannot restore reserved variables. Results report filtered names without values. This policy applies only to these dotdotgod tools and does not isolate ordinary inherited credentials.
|
|
61
61
|
|
|
62
62
|
## Local Storage And Retrieval
|
|
63
63
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotdotgod/context",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Local-first MCP execution, indexing, and retrieval runtime for dotdotgod adapters.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Elastic-2.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
30
30
|
"zod": "^3.25.76",
|
|
31
|
-
"@dotdotgod/cli": "0.
|
|
31
|
+
"@dotdotgod/cli": "0.4.0"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=22.5.0"
|
package/src/server.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
2
2
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { ContextStore, contextDbPath, healContextDatabase } from './store.mjs';
|
|
5
|
-
import { executeBatch,
|
|
5
|
+
import { executeBatch, executeFile } from './execute.mjs';
|
|
6
6
|
import { fetchAndIndex, indexFile } from './content.mjs';
|
|
7
7
|
import { runDoctor } from './doctor.mjs';
|
|
8
8
|
import { projectEmbeddingInstall, projectEmbeddingStatus, projectImpact, projectInitialize, projectLoad } from './project.mjs';
|
|
@@ -47,9 +47,7 @@ function register(name, description, inputSchema, handler, annotations) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
register('execute', 'Run
|
|
51
|
-
(input, extra) => executeCommand(input, { root, store: getStore(), sessionId, signal: extra.signal }), { openWorldHint: true, destructiveHint: true });
|
|
52
|
-
register('batch_execute', 'Run labeled local commands sequentially or with bounded concurrency and index large outputs.', {
|
|
50
|
+
register('execute', 'Run 1..100 labeled local commands with bounded concurrency. Group independent known commands; separate commands dependent on earlier results. Inspect every results entry status and indexed.id. Do not bypass permissions or safety gates.', {
|
|
53
51
|
commands: z.array(z.object(commandSchema)).min(1).max(100), concurrency: z.number().int().min(1).max(8).optional(), cwd: z.string().optional(), timeoutMs: z.number().int().positive().optional(),
|
|
54
52
|
}, (input, extra) => executeBatch(input, { root, store: getStore(), sessionId, signal: extra.signal }), { openWorldHint: true, destructiveHint: true });
|
|
55
53
|
register('execute_file', 'Process a local file in an isolated child process; only bounded stdout/stderr is returned.', {
|
|
@@ -60,7 +58,7 @@ register('index', 'Index a local text file or bounded directory into the project
|
|
|
60
58
|
includeExtensions: z.array(z.string()).max(100).optional(), excludePaths: z.array(z.string()).max(500).optional(), followFileSymlinks: z.boolean().optional(),
|
|
61
59
|
maxDepth: z.number().int().nonnegative().optional(), maxVisitedEntries: z.number().int().nonnegative().optional(), maxFiles: z.number().int().nonnegative().optional(), maxAggregateBytes: z.number().int().nonnegative().optional(),
|
|
62
60
|
}, (input, extra) => ({ ok: true, ...indexFile(getStore(), { ...input, root }, sessionId, extra.signal) }), { readOnlyHint: true });
|
|
63
|
-
register('search', 'Search indexed
|
|
61
|
+
register('search', 'Search indexed content for bounded excerpts. For failure diagnostics try fail OR error OR reason. Query * browses bounded excerpts with the same source/scope/session filters and limit; neither no matches nor partial excerpts prove diagnostics are absent.', {
|
|
64
62
|
query: z.string().min(1), scope: scopeSchema, source: z.string().optional(), limit: z.number().int().min(1).max(50).optional(), sessionOnly: z.boolean().optional(),
|
|
65
63
|
}, (input) => ({
|
|
66
64
|
ok: true,
|
package/src/store.mjs
CHANGED
|
@@ -246,7 +246,13 @@ export class ContextStore {
|
|
|
246
246
|
if (source) { filters.push('(s.id = ? OR s.label LIKE ?)'); filterParams.push(source, `%${source}%`); }
|
|
247
247
|
const filterSql = filters.length ? ` AND ${filters.join(' AND ')}` : '';
|
|
248
248
|
const select = 'SELECT c.source_id, c.ordinal, c.body, s.label, s.kind, s.scope, s.metadata';
|
|
249
|
-
const
|
|
249
|
+
const wildcard = String(query ?? '').trim() === '*';
|
|
250
|
+
const porterRows = wildcard ? this.db.prepare(`
|
|
251
|
+
${select}, 0 AS rank
|
|
252
|
+
FROM chunks c JOIN sources s ON s.id = c.source_id
|
|
253
|
+
WHERE 1 = 1${filterSql}
|
|
254
|
+
ORDER BY s.created_at DESC, s.id, c.ordinal LIMIT ?
|
|
255
|
+
`).all(...filterParams, candidateLimit) : this.db.prepare(`
|
|
250
256
|
${select}, bm25(chunks) AS rank
|
|
251
257
|
FROM chunks c JOIN sources s ON s.id = c.source_id
|
|
252
258
|
WHERE chunks MATCH ?${filterSql}
|
|
@@ -265,7 +271,7 @@ export class ContextStore {
|
|
|
265
271
|
`).all(...labelParams, ...filterParams, candidateLimit);
|
|
266
272
|
const typoWindow = Math.min(500, candidateLimit * 5);
|
|
267
273
|
const typoHalf = Math.max(1, Math.floor(typoWindow / 2));
|
|
268
|
-
const trigramRows = this.db.prepare(`
|
|
274
|
+
const trigramRows = wildcard ? [] : this.db.prepare(`
|
|
269
275
|
SELECT * FROM (
|
|
270
276
|
SELECT ${select.replace('SELECT ', '')}, 0 AS rank
|
|
271
277
|
FROM chunks c JOIN sources s ON s.id = c.source_id
|
|
@@ -290,7 +296,7 @@ export class ContextStore {
|
|
|
290
296
|
return { sourceId: row.source_id, ordinal: Number(row.ordinal), body: row.body, label: row.label, kind: row.kind, scope: row.scope, rank: row.rank, metadata: readProvenanceMetadata(storedMetadata) };
|
|
291
297
|
};
|
|
292
298
|
const fused = reciprocalRankFusion([
|
|
293
|
-
{ name: 'porter-bm25', candidates: porterRows.map(toCandidate) },
|
|
299
|
+
{ name: wildcard ? 'bounded-browse' : 'porter-bm25', candidates: porterRows.map(toCandidate) },
|
|
294
300
|
{ name: 'label-path', candidates: labelRows.map(toCandidate) },
|
|
295
301
|
{ name: 'trigram-v1', candidates: trigramRows.map(toCandidate) },
|
|
296
302
|
], { limit: candidateLimit });
|
|
@@ -303,7 +309,7 @@ export class ContextStore {
|
|
|
303
309
|
scope: row.scope,
|
|
304
310
|
ordinal: row.ordinal,
|
|
305
311
|
rank: row.rank,
|
|
306
|
-
text: excerpt(row.body, query),
|
|
312
|
+
text: excerpt(row.body, wildcard ? '' : query),
|
|
307
313
|
metadata: row.metadata,
|
|
308
314
|
trust: row.metadata.trust,
|
|
309
315
|
sourceType: row.metadata.sourceType,
|