@noirhare/dsh-agent-presets 0.0.2 → 0.0.3

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.
@@ -0,0 +1,6 @@
1
+ import { AgentPreset, AgentPresets } from "@deepseek-ai/dsh-agent-presets";
2
+ export default class NRAgentPresets extends AgentPresets {
3
+ readonly extraRoots: Map<string, string>;
4
+ registerRoot(id: string, dir: string): () => void;
5
+ list(): Promise<AgentPreset[]>;
6
+ }
@@ -0,0 +1,28 @@
1
+ import { AgentPresets, discoverPresets } from "@deepseek-ai/dsh-agent-presets";
2
+ import Path from "node:path";
3
+ import FS from "node:fs";
4
+ export default class NRAgentPresets extends AgentPresets {
5
+ extraRoots = /* @__PURE__ */ new Map();
6
+ registerRoot(id, dir) {
7
+ const path = Path.resolve(dir);
8
+ try {
9
+ if (!FS.statSync(path).isDirectory()) throw new Error(`root "${id}" is not a directory: ${path}`);
10
+ } catch (e) {
11
+ throw new Error(`root "${id}": path not accessible: ${path}`, { cause: e });
12
+ }
13
+ if (this.extraRoots.has(id)) throw new Error(`duplicate root id: ${id}`);
14
+ this.extraRoots.set(id, path);
15
+ return () => {
16
+ this.extraRoots.delete(id);
17
+ };
18
+ }
19
+ async list() {
20
+ const base = await super.list();
21
+ if (this.extraRoots.size === 0) return base;
22
+ const seen = new Set(base.map((preset) => preset.id));
23
+ const extra = await discoverPresets(
24
+ [...new Set(this.extraRoots.values())].map((root) => ({ path: root, trust: "system" }))
25
+ );
26
+ return [...base, ...extra.filter((preset) => !seen.has(preset.id))];
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export * from "@deepseek-ai/dsh-agent-presets/invariant";
@@ -1,2 +1 @@
1
1
  export * from "@deepseek-ai/dsh-agent-presets/invariant";
2
- export {};
package/package.json CHANGED
@@ -1,32 +1,33 @@
1
1
  {
2
2
  "name": "@noirhare/dsh-agent-presets",
3
- "version": "0.0.2",
4
- "author": "NoirHare",
3
+ "version": "0.0.3",
5
4
  "license": "MIT",
5
+ "author": {
6
+ "name": "NoirHare",
7
+ "url": "https://github.com/NoirHare"
8
+ },
6
9
  "repository": {
7
10
  "type": "git",
8
11
  "url": "git+https://github.com/NoirHare/dsh-bundle.git",
9
12
  "directory": "packages/agent-presets"
10
13
  },
11
- "type": "module",
12
- "exports": {
13
- ".": "./lib/index.js",
14
- "./invariant": "./lib/invariant.js",
15
- "./package.json": "./package.json"
16
- },
17
14
  "files": [
18
15
  "lib"
19
16
  ],
20
17
  "publishConfig": {
21
18
  "access": "public"
22
19
  },
20
+ "type": "module",
21
+ "exports": {
22
+ ".": "./lib/host/index.js",
23
+ "./invariant": "./lib/host/invariant.js",
24
+ "./package.json": "./package.json"
25
+ },
23
26
  "peerDependencies": {
24
- "@deepseek-ai/dsh-agent-presets": "^0.1.1-rc.2",
25
- "@deepseek-ai/cordis": "^4.0.1"
27
+ "@deepseek-ai/dsh-agent-presets": "^0.1.1-rc.2"
26
28
  },
27
29
  "scripts": {
28
- "build": "tsdown",
29
- "typecheck": "tsc --noEmit",
30
- "prepublish": "pnpm typecheck && pnpm build"
30
+ "build": "tsc -b && node build.ts",
31
+ "prepublish": "pnpm build"
31
32
  }
32
33
  }
package/lib/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { AgentPreset, AgentPresets } from "@deepseek-ai/dsh-agent-presets";
2
- //#region src/index.d.ts
3
- declare class NRAgentPresets extends AgentPresets {
4
- readonly extraRoots: Map<string, string>;
5
- registerRoot(id: string, dir: string): () => void;
6
- list(): Promise<AgentPreset[]>;
7
- }
8
- //#endregion
9
- export { NRAgentPresets as default };
package/lib/index.js DELETED
@@ -1,32 +0,0 @@
1
- import { AgentPresets, discoverPresets } from "@deepseek-ai/dsh-agent-presets";
2
- import Path from "node:path";
3
- import FS from "node:fs";
4
- //#region src/index.ts
5
- var NRAgentPresets = class extends AgentPresets {
6
- extraRoots = /* @__PURE__ */ new Map();
7
- registerRoot(id, dir) {
8
- const path = Path.resolve(dir);
9
- try {
10
- if (!FS.statSync(path).isDirectory()) throw new Error(`root "${id}" is not a directory: ${path}`);
11
- } catch (e) {
12
- throw new Error(`root "${id}": path not accessible: ${path}`, { cause: e });
13
- }
14
- if (this.extraRoots.has(id)) throw new Error(`duplicate root id: ${id}`);
15
- this.extraRoots.set(id, path);
16
- return () => {
17
- this.extraRoots.delete(id);
18
- };
19
- }
20
- async list() {
21
- const base = await super.list();
22
- if (this.extraRoots.size === 0) return base;
23
- const seen = new Set(base.map((preset) => preset.id));
24
- const extra = await discoverPresets([...new Set(this.extraRoots.values())].map((root) => ({
25
- path: root,
26
- trust: "system"
27
- })));
28
- return [...base, ...extra.filter((preset) => !seen.has(preset.id))];
29
- }
30
- };
31
- //#endregion
32
- export { NRAgentPresets as default };
@@ -1 +0,0 @@
1
- export * from "@deepseek-ai/dsh-agent-presets/invariant";