@aiwayds/dsh-tui-pi 0.11.0 → 0.11.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/package.json +1 -1
- package/scripts/link-dsh-closure.mjs +9 -3
- package/lib/instructions.d.ts +0 -29
- package/lib/instructions.js +0 -67
- package/lib/instructions.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwayds/dsh-tui-pi",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "pi-style terminal UI for DeepSeek Harness (dsh) — pi-tui look & feel, dsh slash commands, GitHub light/dark themes, powerline footer",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,11 +52,17 @@ function findDshClosure() {
|
|
|
52
52
|
if (existsSync(join(closure, 'cordis'))) return closure
|
|
53
53
|
}
|
|
54
54
|
} catch { /* dsh not on PATH */ }
|
|
55
|
-
// 2) Fall back to the global node_modules root
|
|
55
|
+
// 2) Fall back to the global node_modules root — the dsh package's own
|
|
56
|
+
// nested closure (what current npm produces for a global install).
|
|
56
57
|
try {
|
|
57
58
|
const root = execFileSync('npm', ['root', '-g'], { encoding: 'utf8' }).trim()
|
|
58
|
-
const
|
|
59
|
-
if (existsSync(join(
|
|
59
|
+
const nested = join(root, '@deepseek-ai', 'dsh', 'node_modules', '@deepseek-ai')
|
|
60
|
+
if (existsSync(join(nested, 'cordis'))) return nested
|
|
61
|
+
// 3) Last resort: npm's flat global layout, where dsh's @deepseek-ai/*
|
|
62
|
+
// deps are hoisted straight into <npm root -g>/@deepseek-ai next to
|
|
63
|
+
// the dsh package itself.
|
|
64
|
+
const flat = join(root, '@deepseek-ai')
|
|
65
|
+
if (existsSync(join(flat, 'cordis'))) return flat
|
|
60
66
|
} catch { /* npm unavailable */ }
|
|
61
67
|
return undefined
|
|
62
68
|
}
|
package/lib/instructions.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User-global workspace instructions (`~/.dsh/AGENTS.md`): dsh reads this
|
|
3
|
-
* file as the fixed user-global baseline for EVERY session
|
|
4
|
-
* (dsh-agent-instructions, mounted by dsh-base) — the native channel to
|
|
5
|
-
* teach the model UI conventions, a real file the user can see and edit,
|
|
6
|
-
* unlike a system-prompt patch. The TUI ensures its todo-lifecycle section
|
|
7
|
-
* exists there, idempotently keyed by an HTML-comment marker: the file is
|
|
8
|
-
* created when absent, the section appended when the marker is missing, and
|
|
9
|
-
* left untouched when already present. The write is atomic (tmp + rename)
|
|
10
|
-
* and best-effort — a failure is contained and reported, never breaks TUI
|
|
11
|
-
* startup.
|
|
12
|
-
*/
|
|
13
|
-
/** Idempotency marker for the TUI-owned section of the instructions file. */
|
|
14
|
-
export declare const TODO_LIFECYCLE_MARKER = "<!-- dsh-tui-pi:todo-lifecycle -->";
|
|
15
|
-
/**
|
|
16
|
-
* The TUI-owned section: the model must clear the todo list when the work is
|
|
17
|
-
* done, because `todo/write` is a whole-list snapshot (last-write-wins) and
|
|
18
|
-
* an all-completed list would stay pinned above the chat input.
|
|
19
|
-
*/
|
|
20
|
-
export declare const TODO_LIFECYCLE_SECTION = "<!-- dsh-tui-pi:todo-lifecycle -->\n## Todo list lifecycle (dsh-tui-pi)\n\nThe UI renders your todo list as a fixed panel above the chat input. Keep\nitems `pending` or `in_progress` while they are not done. When EVERY todo is\ncompleted \u2014 no pending or in-progress items remain \u2014 write an EMPTY todo list\n(`todos: []`) so the panel clears. Never leave a fully-completed list behind.\n";
|
|
21
|
-
/** The user-global instructions file path (`$DSH_HOME` or `~/.dsh`). */
|
|
22
|
-
export declare function userGlobalInstructionsPath(dshHome?: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Ensure the todo-lifecycle section exists in the user-global AGENTS.md.
|
|
25
|
-
* @param path - target file (injectable for tests).
|
|
26
|
-
* @returns an error message on failure, undefined on success (including the
|
|
27
|
-
* no-op case where the marker is already present).
|
|
28
|
-
*/
|
|
29
|
-
export declare function ensureTodoLifecycleInstructions(path?: string): Promise<string | undefined>;
|
package/lib/instructions.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User-global workspace instructions (`~/.dsh/AGENTS.md`): dsh reads this
|
|
3
|
-
* file as the fixed user-global baseline for EVERY session
|
|
4
|
-
* (dsh-agent-instructions, mounted by dsh-base) — the native channel to
|
|
5
|
-
* teach the model UI conventions, a real file the user can see and edit,
|
|
6
|
-
* unlike a system-prompt patch. The TUI ensures its todo-lifecycle section
|
|
7
|
-
* exists there, idempotently keyed by an HTML-comment marker: the file is
|
|
8
|
-
* created when absent, the section appended when the marker is missing, and
|
|
9
|
-
* left untouched when already present. The write is atomic (tmp + rename)
|
|
10
|
-
* and best-effort — a failure is contained and reported, never breaks TUI
|
|
11
|
-
* startup.
|
|
12
|
-
*/
|
|
13
|
-
import { readFile, rename, unlink, writeFile } from 'node:fs/promises';
|
|
14
|
-
import { homedir } from 'node:os';
|
|
15
|
-
import { join } from 'node:path';
|
|
16
|
-
/** Idempotency marker for the TUI-owned section of the instructions file. */
|
|
17
|
-
export const TODO_LIFECYCLE_MARKER = '<!-- dsh-tui-pi:todo-lifecycle -->';
|
|
18
|
-
/**
|
|
19
|
-
* The TUI-owned section: the model must clear the todo list when the work is
|
|
20
|
-
* done, because `todo/write` is a whole-list snapshot (last-write-wins) and
|
|
21
|
-
* an all-completed list would stay pinned above the chat input.
|
|
22
|
-
*/
|
|
23
|
-
export const TODO_LIFECYCLE_SECTION = `${TODO_LIFECYCLE_MARKER}
|
|
24
|
-
## Todo list lifecycle (dsh-tui-pi)
|
|
25
|
-
|
|
26
|
-
The UI renders your todo list as a fixed panel above the chat input. Keep
|
|
27
|
-
items \`pending\` or \`in_progress\` while they are not done. When EVERY todo is
|
|
28
|
-
completed — no pending or in-progress items remain — write an EMPTY todo list
|
|
29
|
-
(\`todos: []\`) so the panel clears. Never leave a fully-completed list behind.
|
|
30
|
-
`;
|
|
31
|
-
/** The user-global instructions file path (`$DSH_HOME` or `~/.dsh`). */
|
|
32
|
-
export function userGlobalInstructionsPath(dshHome = process.env.DSH_HOME ?? join(homedir(), '.dsh')) {
|
|
33
|
-
return join(dshHome, 'AGENTS.md');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Ensure the todo-lifecycle section exists in the user-global AGENTS.md.
|
|
37
|
-
* @param path - target file (injectable for tests).
|
|
38
|
-
* @returns an error message on failure, undefined on success (including the
|
|
39
|
-
* no-op case where the marker is already present).
|
|
40
|
-
*/
|
|
41
|
-
export async function ensureTodoLifecycleInstructions(path = userGlobalInstructionsPath()) {
|
|
42
|
-
let existing;
|
|
43
|
-
try {
|
|
44
|
-
existing = await readFile(path, 'utf8');
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
existing = '';
|
|
48
|
-
}
|
|
49
|
-
if (existing.includes(TODO_LIFECYCLE_MARKER))
|
|
50
|
-
return undefined;
|
|
51
|
-
const next = existing === '' ? TODO_LIFECYCLE_SECTION : `${existing.replace(/\s+$/u, '')}\n\n${TODO_LIFECYCLE_SECTION}`;
|
|
52
|
-
const tmp = `${path}.tmp`;
|
|
53
|
-
try {
|
|
54
|
-
await writeFile(tmp, next, 'utf8');
|
|
55
|
-
await rename(tmp, path);
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
// Best-effort: never leave the tmp file behind, never break startup.
|
|
60
|
-
try {
|
|
61
|
-
await unlink(tmp);
|
|
62
|
-
}
|
|
63
|
-
catch { /* already gone */ }
|
|
64
|
-
return error instanceof Error ? error.message : String(error);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=instructions.js.map
|
package/lib/instructions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],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