@xiao-hans/dsh-router 0.0.0-stage → 0.0.1
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 +21 -2
- package/index.js +22 -0
- package/package.json +27 -4
package/README.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @xiao-hans/dsh-router
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Scoped build of the DeepSeek Harness model router. First release in development.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @xiao-hans/dsh-router
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
const { DshRouter } = require('@xiao-hans/dsh-router');
|
|
15
|
+
const router = new DshRouter();
|
|
16
|
+
router.add('draft', async (prompt) => prompt);
|
|
17
|
+
const out = await router.route('draft', 'hello');
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const NAME = require('./package.json').name;
|
|
4
|
+
const VERSION = require('./package.json').version;
|
|
5
|
+
|
|
6
|
+
class DshRouter {
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
this.options = options;
|
|
9
|
+
this.routes = new Map();
|
|
10
|
+
}
|
|
11
|
+
add(name, handler) {
|
|
12
|
+
this.routes.set(name, handler);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
async route(name, ...args) {
|
|
16
|
+
const handler = this.routes.get(name);
|
|
17
|
+
if (!handler) throw new Error('[dsh-router] no route: ' + name);
|
|
18
|
+
return handler(...args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = { DshRouter, NAME, VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiao-hans/dsh-router",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Model router for the DeepSeek Harness (scoped build) - first release in development.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "xiao-hans",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"index.js",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"dsh",
|
|
14
|
+
"dsh-plugin",
|
|
15
|
+
"deepseek-harness",
|
|
16
|
+
"cordis-plugin",
|
|
17
|
+
"router",
|
|
18
|
+
"routing"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/xiao-hans/dsh-router.git"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/xiao-hans/dsh-router#readme",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"registry": "https://registry.npmjs.org"
|
|
28
|
+
}
|
|
29
|
+
}
|