@chance722/dsh-inbox 0.2.0 → 0.2.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/lib/cli.js CHANGED
@@ -125,23 +125,42 @@ function dshHome() {
125
125
  const configured = process.env.DSH_HOME;
126
126
  return configured !== void 0 && configured.length > 0 ? configured : join(homedir(), ".dsh");
127
127
  }
128
- function shippedStandard(profileDir) {
128
+ function shippedStandard(home, profileDir) {
129
129
  const candidates = [];
130
+ const roster = (moduleRoot) => join(moduleRoot, "@deepseek-ai", "dsh-agent-presets");
131
+ const nestedRoster = (moduleRoot) => join(moduleRoot, "@deepseek-ai", "dsh", "node_modules", "@deepseek-ai", "dsh-agent-presets");
130
132
  try {
131
133
  const require2 = createRequire(join(profileDir, "package.json"));
132
134
  candidates.push(dirname(require2.resolve("@deepseek-ai/dsh-agent-presets/package.json")));
133
135
  } catch {
134
136
  }
135
137
  candidates.push(
136
- join(profileDir, "node_modules", "@deepseek-ai", "dsh-agent-presets"),
137
- join(profileDir, "node_modules", "@deepseek-ai", "dsh", "node_modules", "@deepseek-ai", "dsh-agent-presets")
138
+ roster(join(profileDir, "node_modules")),
139
+ nestedRoster(join(profileDir, "node_modules")),
140
+ roster(join(home, "profiles", "node_modules")),
141
+ nestedRoster(join(home, "profiles", "node_modules"))
138
142
  );
143
+ for (const prefix of dshPrefixes()) {
144
+ candidates.push(nestedRoster(join(prefix, "node_modules")), roster(join(prefix, "node_modules")));
145
+ }
139
146
  for (const candidate of candidates) {
140
147
  const standard = join(candidate, "presets", "standard");
141
148
  if (existsSync(join(standard, "agent.cordis.yml"))) return standard;
142
149
  }
143
150
  return void 0;
144
151
  }
152
+ function dshPrefixes() {
153
+ const found = spawnSync(process.platform === "win32" ? "where" : "which", ["dsh"], {
154
+ encoding: "utf8",
155
+ shell: process.platform === "win32"
156
+ });
157
+ const prefixes = [];
158
+ for (const line of (found.stdout ?? "").split(/\r?\n/)) {
159
+ const bin = line.trim();
160
+ if (bin.length > 0) prefixes.push(dirname(bin));
161
+ }
162
+ return prefixes;
163
+ }
145
164
  function setDefaultPreset(settingsPath, id) {
146
165
  const original = existsSync(settingsPath) ? readFileSync(settingsPath, "utf8") : "";
147
166
  const commit = (next, note) => {
@@ -205,6 +224,7 @@ function main(argv) {
205
224
  const profileDir = join(home, "profiles", profile);
206
225
  if (!existsSync(join(profileDir, "package.json"))) {
207
226
  const hint = `\u5148\u5EFA\u4E00\u4E2A\uFF1Adsh --profile ${profile} --from-default-profile web --dump-config
227
+ \uFF08profile \u540D\u662F dsh \u81EA\u5E26\u6A21\u677F\u65F6\u7528\uFF1Adsh --profile ${profile} --dump-config\uFF09
208
228
  \uFF08\u6216\u8005\u91CD\u8DD1\u65F6\u52A0\u4E0A --create-profile\uFF0C\u8BA9\u8FD9\u4E00\u6B65\u81EA\u5DF1\u53D1\u751F\uFF09
209
229
  `;
210
230
  if (!options.createProfile) {
@@ -212,22 +232,14 @@ function main(argv) {
212
232
  ${hint}`);
213
233
  return 1;
214
234
  }
215
- process.stdout.write(`\u24EA profile \u300C${profile}\u300D\u4E0D\u5B58\u5728\uFF0C\u7528 dsh \u7684 web \u6A21\u677F\u5EFA\u4E00\u4E2A\u2026
235
+ process.stdout.write(`\u24EA profile \u300C${profile}\u300D\u4E0D\u5B58\u5728\uFF0C\u7528 dsh \u81EA\u5E26\u7684\u6A21\u677F\u5EFA\u4E00\u4E2A\u2026
216
236
  `);
217
- const created = spawnSync(
218
- "dsh",
219
- ["--profile", profile, "--from-default-profile", "web", "--dump-config"],
220
- { encoding: "utf8", shell: process.platform === "win32" }
221
- );
222
- if (created.error !== void 0 || created.status !== 0 || !existsSync(join(profileDir, "package.json"))) {
223
- for (const stream of [created.stdout, created.stderr]) {
224
- if (typeof stream === "string" && stream.trim().length > 0) process.stderr.write(`${stream.trimEnd()}
237
+ const created = createProfile(profile);
238
+ if (!created.ok || !existsSync(join(profileDir, "package.json"))) {
239
+ if (created.output.trim().length > 0) process.stderr.write(`${created.output.trimEnd()}
225
240
  `);
226
- }
227
- process.stderr.write(
228
- `\u5EFA profile \u5931\u8D25${created.error === void 0 ? "" : `\uFF08${created.error.message}\uFF09`}\u3002
229
- ${hint}`
230
- );
241
+ process.stderr.write(`\u5EFA profile \u5931\u8D25\u3002
242
+ ${hint}`);
231
243
  return 1;
232
244
  }
233
245
  process.stdout.write(` \u5EFA\u597D\u4E86 ${profileDir}
@@ -247,7 +259,7 @@ ${hint}`
247
259
  );
248
260
  return 1;
249
261
  }
250
- const standard = shippedStandard(profileDir);
262
+ const standard = shippedStandard(home, profileDir);
251
263
  if (standard === void 0) {
252
264
  process.stderr.write("\u627E\u4E0D\u5230\u968F dsh \u9644\u5E26\u7684 standard preset\uFF0C\u65E0\u6CD5\u521B\u5EFA agent preset\u3002\n");
253
265
  return 1;
@@ -304,6 +316,24 @@ ${hint}`
304
316
  );
305
317
  return 0;
306
318
  }
319
+ function profileCreationAttempts(profile) {
320
+ return [
321
+ ["--profile", profile, "--from-default-profile", "web", "--dump-config"],
322
+ ["--profile", profile, "--dump-config"]
323
+ ];
324
+ }
325
+ function createProfile(profile) {
326
+ let output = "";
327
+ for (const args of profileCreationAttempts(profile)) {
328
+ const run = spawnSync("dsh", [...args], {
329
+ encoding: "utf8",
330
+ shell: process.platform === "win32"
331
+ });
332
+ output = `${run.stdout ?? ""}${run.stderr ?? ""}`;
333
+ if (run.error === void 0 && run.status === 0) return { ok: true, output };
334
+ }
335
+ return { ok: false, output };
336
+ }
307
337
  if (isEntryPoint(import.meta.url, process.argv[1])) {
308
338
  process.exitCode = main(process.argv.slice(2));
309
339
  }
@@ -312,5 +342,6 @@ export {
312
342
  ensurePresetRow,
313
343
  isEntryPoint,
314
344
  listProfiles,
315
- parse
345
+ parse,
346
+ profileCreationAttempts
316
347
  };
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ import { defineTool as defineTool2 } from "@deepseek-ai/dsh-tools";
3
3
 
4
4
  // src/shared/constants.ts
5
5
  var PACKAGE_NAME = "@chance722/dsh-inbox";
6
- var VERSION = true ? "0.2.0" : "0.0.0-dev";
6
+ var VERSION = true ? "0.2.1" : "0.0.0-dev";
7
7
  var DEFAULT_USER_AGENT = "dsh-inbox";
8
8
 
9
9
  // src/shared/vocabulary.ts
@@ -99,3 +99,22 @@ export declare function chooseProfile(options: Pick<Options, 'profile' | 'create
99
99
  * @returns true when `entry` is this very file.
100
100
  */
101
101
  export declare function isEntryPoint(moduleUrl: string, entry: string | undefined): boolean;
102
+ /**
103
+ * The commands that can create a missing profile, in the order to try them.
104
+ *
105
+ * A *shipped* template cannot be the target of `--from-default-profile`: dsh
106
+ * refuses with `profile "web" is shipped and cannot be a custom profile target;
107
+ * omit --from-default-profile to use it`. `init --profile web --create-profile`
108
+ * on a machine that has never run dsh is exactly that case — and since choosing
109
+ * `web` is what this installer now does by default, that would have been the
110
+ * *first* thing a new user hit (measured 2026-09-20, on a fresh `%DSH_HOME%`,
111
+ * before 0.2.0 shipped). The bare form is also the one that initializes a
112
+ * shipped profile at all, so it is the fallback rather than the first choice.
113
+ *
114
+ * Both forms are tried instead of special-casing `web`: `headless` is shipped
115
+ * too, and a future template should not need this file to change.
116
+ *
117
+ * @param profile - the profile to create.
118
+ * @returns argv lists for `dsh`, most specific first.
119
+ */
120
+ export declare function profileCreationAttempts(profile: string): readonly (readonly string[])[];
package/package.json CHANGED
@@ -1,101 +1,101 @@
1
- {
2
- "name": "@chance722/dsh-inbox",
3
- "version": "0.2.0",
4
- "private": false,
5
- "description": "Personal paste inbox for DeepSeek Harness (dsh): capture, classify, browse and retrieve.",
6
- "keywords": [
7
- "dsh",
8
- "dsh-plugin",
9
- "deepseek-harness",
10
- "inbox",
11
- "clipboard",
12
- "vault"
13
- ],
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/Chance722/dsh-inbox.git"
17
- },
18
- "homepage": "https://github.com/Chance722/dsh-inbox#readme",
19
- "bugs": {
20
- "url": "https://github.com/Chance722/dsh-inbox/issues"
21
- },
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
- "type": "module",
26
- "license": "MIT",
27
- "main": "lib/index.js",
28
- "types": "lib/types/host/index.d.ts",
29
- "exports": {
30
- ".": {
31
- "types": "./lib/types/host/index.d.ts",
32
- "default": "./lib/index.js"
33
- },
34
- "./client": {
35
- "types": "./lib/types/client/index.d.ts",
36
- "default": "./lib/client.js"
37
- },
38
- "./package.json": "./package.json"
39
- },
40
- "files": [
41
- "lib/index.js",
42
- "lib/client.js",
43
- "lib/cli.js",
44
- "cordis.patch.yml",
45
- "lib/types/**/*.d.ts"
46
- ],
47
- "bin": {
48
- "dsh-inbox": "./lib/cli.js"
49
- },
50
- "dsh": {
51
- "bundle": {
52
- "patch": "./cordis.patch.yml"
53
- },
54
- "client": {
55
- "platform": "web",
56
- "inject": [
57
- "@deepseek-ai/dsh-client-connection",
58
- "@deepseek-ai/dsh-client-ui-layout",
59
- "@deepseek-ai/dsh-client-ui-sidebar"
60
- ]
61
- }
62
- },
63
- "scripts": {
64
- "build": "node scripts/build.mjs && tsc -p tsconfig.build.json",
65
- "typecheck": "tsc --noEmit",
66
- "test": "vitest run",
1
+ {
2
+ "name": "@chance722/dsh-inbox",
3
+ "version": "0.2.1",
4
+ "private": false,
5
+ "description": "Personal paste inbox for DeepSeek Harness (dsh): capture, classify, browse and retrieve.",
6
+ "keywords": [
7
+ "dsh",
8
+ "dsh-plugin",
9
+ "deepseek-harness",
10
+ "inbox",
11
+ "clipboard",
12
+ "vault"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/Chance722/dsh-inbox.git"
17
+ },
18
+ "homepage": "https://github.com/Chance722/dsh-inbox#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/Chance722/dsh-inbox/issues"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "type": "module",
26
+ "license": "MIT",
27
+ "main": "lib/index.js",
28
+ "types": "lib/types/host/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./lib/types/host/index.d.ts",
32
+ "default": "./lib/index.js"
33
+ },
34
+ "./client": {
35
+ "types": "./lib/types/client/index.d.ts",
36
+ "default": "./lib/client.js"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "files": [
41
+ "lib/index.js",
42
+ "lib/client.js",
43
+ "lib/cli.js",
44
+ "cordis.patch.yml",
45
+ "lib/types/**/*.d.ts"
46
+ ],
47
+ "bin": {
48
+ "dsh-inbox": "./lib/cli.js"
49
+ },
50
+ "dsh": {
51
+ "bundle": {
52
+ "patch": "./cordis.patch.yml"
53
+ },
54
+ "client": {
55
+ "platform": "web",
56
+ "inject": [
57
+ "@deepseek-ai/dsh-client-connection",
58
+ "@deepseek-ai/dsh-client-ui-layout",
59
+ "@deepseek-ai/dsh-client-ui-sidebar"
60
+ ]
61
+ }
62
+ },
63
+ "scripts": {
64
+ "build": "node scripts/build.mjs && tsc -p tsconfig.build.json",
65
+ "typecheck": "tsc --noEmit",
66
+ "test": "vitest run",
67
67
  "prepublishOnly": "npm run build"
68
- },
69
- "dependencies": {
70
- "lucide-react": "^1.47.0",
71
- "zod": "^4.4.3"
72
- },
73
- "peerDependencies": {
74
- "@deepseek-ai/cordis": "^4.0.2",
75
- "@deepseek-ai/dsh-attachment": "^0.1.5-rc.2",
76
- "@deepseek-ai/dsh-client-connection": "^0.1.5-rc.2",
77
- "@deepseek-ai/dsh-commands": "^0.1.5-rc.2",
78
- "@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.2",
79
- "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
80
- "@deepseek-ai/dsh-web": "^0.1.5-rc.2"
81
- },
82
- "devDependencies": {
83
- "@deepseek-ai/cordis": "^4.0.2",
84
- "@deepseek-ai/dsh-attachment": "^0.1.5-rc.2",
85
- "@deepseek-ai/dsh-client-connection": "^0.1.5-rc.2",
86
- "@deepseek-ai/dsh-commands": "^0.1.5-rc.2",
87
- "@deepseek-ai/dsh-storage": "^0.1.5-rc.2",
88
- "@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.2",
89
- "@deepseek-ai/dsh-storage-json": "^0.1.5-rc.2",
90
- "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
91
- "@deepseek-ai/dsh-web": "0.1.5-rc.2",
92
- "@deepseek-ai/schemastery": "3.18.2",
93
- "@types/node": "^22.10.0",
94
- "@types/react": "~18.3.1",
95
- "esbuild": "^0.25.0",
96
- "react": "^18.2.0",
97
- "typescript": "^5.7.0",
98
- "vitest": "^3.0.0",
99
- "zod": "^4.4.3"
100
- }
101
- }
68
+ },
69
+ "dependencies": {
70
+ "lucide-react": "^1.47.0",
71
+ "zod": "^4.4.3"
72
+ },
73
+ "peerDependencies": {
74
+ "@deepseek-ai/cordis": "^4.0.2",
75
+ "@deepseek-ai/dsh-attachment": "^0.1.5-rc.2",
76
+ "@deepseek-ai/dsh-client-connection": "^0.1.5-rc.2",
77
+ "@deepseek-ai/dsh-commands": "^0.1.5-rc.2",
78
+ "@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.2",
79
+ "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
80
+ "@deepseek-ai/dsh-web": "^0.1.5-rc.2"
81
+ },
82
+ "devDependencies": {
83
+ "@deepseek-ai/cordis": "^4.0.2",
84
+ "@deepseek-ai/dsh-attachment": "^0.1.5-rc.2",
85
+ "@deepseek-ai/dsh-client-connection": "^0.1.5-rc.2",
86
+ "@deepseek-ai/dsh-commands": "^0.1.5-rc.2",
87
+ "@deepseek-ai/dsh-storage": "^0.1.5-rc.2",
88
+ "@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.2",
89
+ "@deepseek-ai/dsh-storage-json": "^0.1.5-rc.2",
90
+ "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
91
+ "@deepseek-ai/dsh-web": "0.1.5-rc.2",
92
+ "@deepseek-ai/schemastery": "3.18.2",
93
+ "@types/node": "^22.10.0",
94
+ "@types/react": "~18.3.1",
95
+ "esbuild": "^0.25.0",
96
+ "react": "^18.2.0",
97
+ "typescript": "^5.7.0",
98
+ "vitest": "^3.0.0",
99
+ "zod": "^4.4.3"
100
+ }
101
+ }