@sentropic/track 0.85.14 → 0.85.15
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/mcp/cli.js +3 -5
- package/dist/mcp/cli.js.map +1 -1
- package/dist/mcp/serve.d.ts +27 -0
- package/dist/mcp/serve.d.ts.map +1 -0
- package/dist/mcp/serve.js +58 -0
- package/dist/mcp/serve.js.map +1 -0
- package/package.json +5 -1
package/dist/mcp/cli.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import { createTrackMcpServer } from './server.js';
|
|
2
|
+
import { serveTrackMcpStdio } from './serve.js';
|
|
5
3
|
// Launch/serve alignment: like h2a `mcp-serve`, `track-mcp` BOOTS UNCONDITIONALLY and advertises its
|
|
6
4
|
// read tools without requiring pre-existing project state. The store is resolved LAZILY per read call
|
|
7
5
|
// (`--track-dir`→`TRACK_DIR`→nearest-ancestor `.track`), so a `.track` created AFTER boot is picked up
|
|
@@ -15,9 +13,9 @@ const resolveOpts = {
|
|
|
15
13
|
...(flag !== undefined ? { flag } : {}),
|
|
16
14
|
...(env !== undefined ? { env } : {}),
|
|
17
15
|
};
|
|
18
|
-
const server = createTrackMcpServer(resolveOpts);
|
|
19
16
|
// Keep the transport fatal: a real connect/transport failure must stay loud (rc=1 + stderr).
|
|
20
|
-
|
|
17
|
+
// The bin passes NO abort signal — it serves for the process lifetime (stdin EOF resolves it).
|
|
18
|
+
serveTrackMcpStdio(resolveOpts).catch((error) => {
|
|
21
19
|
process.stderr.write(`track-mcp failed: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
22
20
|
process.exit(1);
|
|
23
21
|
});
|
package/dist/mcp/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/mcp/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/mcp/cli.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,qGAAqG;AACrG,sGAAsG;AACtG,uGAAuG;AACvG,uGAAuG;AACvG,yGAAyG;AACzG,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AACnD,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACnE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AACpC,MAAM,WAAW,GAAmB;IAClC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CACtC,CAAA;AAED,6FAA6F;AAC7F,+FAA+F;AAC/F,kBAAkB,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACvD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACrG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import type { ResolveOptions } from '../cli/resolve.js';
|
|
3
|
+
export { createTrackMcpServer } from './server.js';
|
|
4
|
+
export interface ServeTrackMcpStdioOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Abort to stop serving: the server + its transport are closed and the promise
|
|
7
|
+
* resolves. This is the graceful-shutdown hook an embedding host wires to its
|
|
8
|
+
* SIGTERM/SIGINT/SIGHUP handler (e.g. h2a's `track-mcp` bin.ts branch).
|
|
9
|
+
*/
|
|
10
|
+
readonly signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Await a CONNECTED MCP `server` until it closes — either the peer closed the
|
|
14
|
+
* transport (stdin EOF) or `opts.signal` aborted (we close it). Resolves exactly
|
|
15
|
+
* once; rejects only if a requested close throws. Transport-agnostic, so it is
|
|
16
|
+
* unit-testable over an in-memory pair with no stdio coupling — which is where
|
|
17
|
+
* the graceful-shutdown contract for the in-process host is actually verified.
|
|
18
|
+
*/
|
|
19
|
+
export declare function runServerUntilClosed(server: Server, opts?: ServeTrackMcpStdioOptions): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Serve the read-only track MCP over stdio. Resolves when the transport closes or
|
|
22
|
+
* `opts.signal` aborts; rejects only on a real connect/transport failure (the bin
|
|
23
|
+
* turns that into rc=1 + stderr). The store is resolved LAZILY per read call by
|
|
24
|
+
* the factory, so a `.track` created after boot is picked up without a restart.
|
|
25
|
+
*/
|
|
26
|
+
export declare function serveTrackMcpStdio(source: string | ResolveOptions, opts?: ServeTrackMcpStdioOptions): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=serve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/mcp/serve.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAKvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,IAAI,CAAC,CAwBf;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,cAAc,EAC/B,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// track-mcp — the SHARED stdio serve path, used by BOTH the `track-mcp` bin
|
|
2
|
+
// (./cli.ts) and any in-process host (e.g. h2a's native `track-mcp` verb via the
|
|
3
|
+
// `@sentropic/track/mcp` export). Keeping ONE serve path means the bin and the
|
|
4
|
+
// embedded host can never drift. Exposed additively via package `exports["./mcp"]`.
|
|
5
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
|
+
import { createTrackMcpServer } from './server.js';
|
|
7
|
+
// Re-export the factory so `@sentropic/track/mcp` is the single surface an
|
|
8
|
+
// embedding host imports (server + serve helpers together).
|
|
9
|
+
export { createTrackMcpServer } from './server.js';
|
|
10
|
+
/**
|
|
11
|
+
* Await a CONNECTED MCP `server` until it closes — either the peer closed the
|
|
12
|
+
* transport (stdin EOF) or `opts.signal` aborted (we close it). Resolves exactly
|
|
13
|
+
* once; rejects only if a requested close throws. Transport-agnostic, so it is
|
|
14
|
+
* unit-testable over an in-memory pair with no stdio coupling — which is where
|
|
15
|
+
* the graceful-shutdown contract for the in-process host is actually verified.
|
|
16
|
+
*/
|
|
17
|
+
export async function runServerUntilClosed(server, opts = {}) {
|
|
18
|
+
const { signal } = opts;
|
|
19
|
+
if (signal?.aborted) {
|
|
20
|
+
await server.close();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
return await new Promise((resolve, reject) => {
|
|
24
|
+
let settled = false;
|
|
25
|
+
const finish = (err) => {
|
|
26
|
+
if (settled)
|
|
27
|
+
return;
|
|
28
|
+
settled = true;
|
|
29
|
+
signal?.removeEventListener('abort', onAbort);
|
|
30
|
+
server.onclose = () => { }; // detach (the `settled` guard already dedups re-entry)
|
|
31
|
+
if (err !== undefined)
|
|
32
|
+
reject(err);
|
|
33
|
+
else
|
|
34
|
+
resolve();
|
|
35
|
+
};
|
|
36
|
+
const onAbort = () => {
|
|
37
|
+
// close() also fires onclose → finish(); the `settled` guard dedups.
|
|
38
|
+
server.close().then(() => finish(), (err) => finish(err));
|
|
39
|
+
};
|
|
40
|
+
// Peer-initiated close (stdin EOF) AND our own close() both fire onclose.
|
|
41
|
+
server.onclose = () => finish();
|
|
42
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Serve the read-only track MCP over stdio. Resolves when the transport closes or
|
|
47
|
+
* `opts.signal` aborts; rejects only on a real connect/transport failure (the bin
|
|
48
|
+
* turns that into rc=1 + stderr). The store is resolved LAZILY per read call by
|
|
49
|
+
* the factory, so a `.track` created after boot is picked up without a restart.
|
|
50
|
+
*/
|
|
51
|
+
export async function serveTrackMcpStdio(source, opts = {}) {
|
|
52
|
+
if (opts.signal?.aborted)
|
|
53
|
+
return;
|
|
54
|
+
const server = createTrackMcpServer(source);
|
|
55
|
+
await server.connect(new StdioServerTransport());
|
|
56
|
+
return await runServerUntilClosed(server, opts);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/mcp/serve.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,iFAAiF;AACjF,+EAA+E;AAC/E,oFAAoF;AACpF,OAAO,EAAE,oBAAoB,EAAE,M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AAE,IAAI,EAAE,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAA+B,EAC/B,OAAkC,EAAE;IAEpC,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO;QAAE,OAAM;IAChC,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAC3C,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAA;IAChD,OAAO,MAAM,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/track",
|
|
3
|
-
"version": "0.85.
|
|
3
|
+
"version": "0.85.15",
|
|
4
4
|
"description": "Typed product-backlog and spec/plan/UAT system of record for the sentropic ecosystem (record-only MVP).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabien Antoine",
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
"./report/friendly": {
|
|
42
42
|
"types": "./dist/report/friendly.d.ts",
|
|
43
43
|
"import": "./dist/report/friendly.js"
|
|
44
|
+
},
|
|
45
|
+
"./mcp": {
|
|
46
|
+
"types": "./dist/mcp/serve.d.ts",
|
|
47
|
+
"import": "./dist/mcp/serve.js"
|
|
44
48
|
}
|
|
45
49
|
},
|
|
46
50
|
"files": [
|