@aiwayds/dsh-tui-pi 0.3.0 → 0.4.0
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/agents.js +26 -5
- package/lib/agents.js.map +1 -1
- package/lib/footer.d.ts +43 -5
- package/lib/footer.js +62 -5
- package/lib/footer.js.map +1 -1
- package/lib/index.js +44 -35
- package/lib/index.js.map +1 -1
- package/lib/keymap.d.ts +81 -15
- package/lib/keymap.js +84 -28
- package/lib/keymap.js.map +1 -1
- package/lib/live-widgets.d.ts +34 -29
- package/lib/live-widgets.js +100 -76
- package/lib/live-widgets.js.map +1 -1
- package/lib/session.js +36 -2
- package/lib/session.js.map +1 -1
- package/lib/subagent-policy.d.ts +32 -2
- package/lib/subagent-policy.js +54 -2
- package/lib/subagent-policy.js.map +1 -1
- package/lib/theme-settings.d.ts +41 -14
- package/lib/theme-settings.js +86 -19
- package/lib/theme-settings.js.map +1 -1
- package/lib/tui.js +32 -20
- package/lib/tui.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/ArtyDuck.md +11 -0
- package/templates/agents/oldfox.md +33 -0
- package/templates/agents/workhorse.md +34 -0
package/lib/theme-settings.d.ts
CHANGED
|
@@ -11,21 +11,32 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { Context } from '@deepseek-ai/cordis';
|
|
13
13
|
import { type SettingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
14
|
+
import { type FooterHints } from './footer.ts';
|
|
14
15
|
import { type PanelHeight } from './messages.ts';
|
|
15
16
|
import type { ThemePreference } from './theme/index.ts';
|
|
16
17
|
/** Settings namespace carrying the persisted dsh-tui preferences. */
|
|
17
18
|
export declare const THEME_SETTINGS_NAMESPACE: SettingsNamespace;
|
|
18
|
-
/** Subagent concurrency/rounds knobs read by the subagent policy. */
|
|
19
|
+
/** Subagent concurrency/rounds/tool knobs read by the subagent policy. */
|
|
19
20
|
export interface SubagentLimits {
|
|
20
21
|
/** Concurrent live children allowed; 0 lifts the cap (the guard stays off). */
|
|
21
22
|
maxAgents: number;
|
|
22
23
|
/** Completed turns per child before a summary request is injected; 0 disables. */
|
|
23
24
|
maxRounds: number;
|
|
25
|
+
/**
|
|
26
|
+
* Disable the native `subagent` tool for every agent in the process, so
|
|
27
|
+
* plain ad-hoc delegation goes through a registered agent definition
|
|
28
|
+
* (`~/.dsh/agents/*.md` via `use_agent`) instead. Deliberately narrow:
|
|
29
|
+
* `subagent_fork`, `workflow` and `ralph` stay available (they are not the
|
|
30
|
+
* plain one-shot spawn the TUI's user wants fenced off).
|
|
31
|
+
*/
|
|
32
|
+
disableSubagent: boolean;
|
|
24
33
|
}
|
|
25
34
|
/**
|
|
26
35
|
* Default subagent limits, applied whenever the settings service, namespace,
|
|
27
36
|
* or a field cannot be read. 4 concurrent children and 50 rounds per child are
|
|
28
|
-
* the documented out-of-the-box behavior
|
|
37
|
+
* the documented out-of-the-box behavior; the native `subagent` tool is
|
|
38
|
+
* disabled by default — the TUI's user delegates through registered agents
|
|
39
|
+
* (toggle it in /agents → l limits when the plain tool is needed again).
|
|
29
40
|
*/
|
|
30
41
|
export declare const DEFAULT_SUBAGENT_LIMITS: SubagentLimits;
|
|
31
42
|
/**
|
|
@@ -43,12 +54,12 @@ export declare const DEFAULT_SUBAGENT_LIMITS: SubagentLimits;
|
|
|
43
54
|
* startup.
|
|
44
55
|
*
|
|
45
56
|
* @param ctx - plugin context; does nothing while no settings service is mounted.
|
|
46
|
-
* @param onPreferenceChange - hot-reload sink for committed `dsh-tui` theme
|
|
47
|
-
*
|
|
48
|
-
* registered (a reloaded plugin instance, a second mount of this
|
|
49
|
-
* registration fails.
|
|
57
|
+
* @param onPreferenceChange - hot-reload sink for committed `dsh-tui` theme,
|
|
58
|
+
* panel-height and footer-hints changes; `undefined` when the namespace is
|
|
59
|
+
* already registered (a reloaded plugin instance, a second mount of this
|
|
60
|
+
* bundle) or registration fails.
|
|
50
61
|
*/
|
|
51
|
-
export declare function registerThemeSettings(ctx: Context, onPreferenceChange?: (pref: ThemePreference, panelHeight: PanelHeight) => void): void;
|
|
62
|
+
export declare function registerThemeSettings(ctx: Context, onPreferenceChange?: (pref: ThemePreference, panelHeight: PanelHeight, footerHints: FooterHints) => void): void;
|
|
52
63
|
/**
|
|
53
64
|
* Read the persisted theme preference (the startup snapshot).
|
|
54
65
|
*
|
|
@@ -65,6 +76,22 @@ export declare function readThemePreference(ctx: Context): Promise<ThemePreferen
|
|
|
65
76
|
* when the settings service is absent or the namespace/value cannot be read.
|
|
66
77
|
*/
|
|
67
78
|
export declare function readPanelHeightPreference(ctx: Context): Promise<PanelHeight>;
|
|
79
|
+
/**
|
|
80
|
+
* Read the persisted footer-hint selection (the startup snapshot).
|
|
81
|
+
*
|
|
82
|
+
* @param ctx - plugin context.
|
|
83
|
+
* @returns the resolved `dsh-tui` footerHints object, or DEFAULT_FOOTER_HINTS
|
|
84
|
+
* when the settings service is absent or the namespace/value cannot be read.
|
|
85
|
+
*/
|
|
86
|
+
export declare function readFooterHintsPreference(ctx: Context): Promise<FooterHints>;
|
|
87
|
+
/**
|
|
88
|
+
* Read the currently persisted footer-hint selection, synchronously.
|
|
89
|
+
* Unlike `readFooterHintsPreference` (the startup snapshot), this does not
|
|
90
|
+
* wait for the namespace registration - it describes whatever the settings
|
|
91
|
+
* service exposes right now, so a caller can honor a live change immediately.
|
|
92
|
+
* @returns DEFAULT_FOOTER_HINTS when the service, namespace, or value is absent.
|
|
93
|
+
*/
|
|
94
|
+
export declare function currentFooterHints(ctx: Context): FooterHints;
|
|
68
95
|
/**
|
|
69
96
|
* Read the currently persisted theme preference, synchronously.
|
|
70
97
|
* Unlike `readThemePreference` (the startup snapshot), this does not wait for
|
|
@@ -92,12 +119,12 @@ export declare function writeThemePreference(ctx: Context, pref: ThemePreference
|
|
|
92
119
|
*/
|
|
93
120
|
export declare function readSubagentLimits(ctx: Context): SubagentLimits;
|
|
94
121
|
/**
|
|
95
|
-
* Persist one subagent
|
|
96
|
-
* settings namespace. The namespace is `applies: 'live'`, so
|
|
97
|
-
* hot-applies without a restart — the policy reads
|
|
98
|
-
* the next decision point. Never throws: a deployment
|
|
99
|
-
* provider, or an unregistered namespace, surfaces a
|
|
100
|
-
* caller.
|
|
122
|
+
* Persist one subagent policy knob (maxAgents, maxRounds, or disableSubagent)
|
|
123
|
+
* to the `dsh-tui` settings namespace. The namespace is `applies: 'live'`, so
|
|
124
|
+
* the commit hot-applies without a restart — the policy reads
|
|
125
|
+
* `readSubagentLimits` at the next decision point. Never throws: a deployment
|
|
126
|
+
* without the settings provider, or an unregistered namespace, surfaces a
|
|
127
|
+
* failure message for the caller.
|
|
101
128
|
* @returns undefined on success, the failure message otherwise.
|
|
102
129
|
*/
|
|
103
|
-
export declare function writeSubagentLimit(ctx: Context, key: 'maxAgents' | 'maxRounds', value: number): Promise<string | undefined>;
|
|
130
|
+
export declare function writeSubagentLimit(ctx: Context, key: 'maxAgents' | 'maxRounds' | 'disableSubagent', value: number | boolean): Promise<string | undefined>;
|
package/lib/theme-settings.js
CHANGED
|
@@ -11,15 +11,22 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { SettingsConflictError, settingsNamespace, } from '@deepseek-ai/dsh-settings';
|
|
13
13
|
import z from '@deepseek-ai/schemastery';
|
|
14
|
+
import { DEFAULT_FOOTER_HINTS } from "./footer.js";
|
|
14
15
|
import { DEFAULT_PANEL_HEIGHT } from "./messages.js";
|
|
15
16
|
/** Settings namespace carrying the persisted dsh-tui preferences. */
|
|
16
17
|
export const THEME_SETTINGS_NAMESPACE = settingsNamespace('dsh-tui');
|
|
17
18
|
/**
|
|
18
19
|
* Default subagent limits, applied whenever the settings service, namespace,
|
|
19
20
|
* or a field cannot be read. 4 concurrent children and 50 rounds per child are
|
|
20
|
-
* the documented out-of-the-box behavior
|
|
21
|
+
* the documented out-of-the-box behavior; the native `subagent` tool is
|
|
22
|
+
* disabled by default — the TUI's user delegates through registered agents
|
|
23
|
+
* (toggle it in /agents → l limits when the plain tool is needed again).
|
|
21
24
|
*/
|
|
22
|
-
export const DEFAULT_SUBAGENT_LIMITS = Object.freeze({
|
|
25
|
+
export const DEFAULT_SUBAGENT_LIMITS = Object.freeze({
|
|
26
|
+
maxAgents: 4,
|
|
27
|
+
maxRounds: 50,
|
|
28
|
+
disableSubagent: true,
|
|
29
|
+
});
|
|
23
30
|
/** Schema of the `dsh-tui` settings section. */
|
|
24
31
|
const THEME_SETTINGS_SCHEMA = z.object({
|
|
25
32
|
theme: z
|
|
@@ -42,6 +49,23 @@ const THEME_SETTINGS_SCHEMA = z.object({
|
|
|
42
49
|
.natural()
|
|
43
50
|
.default(DEFAULT_SUBAGENT_LIMITS.maxRounds)
|
|
44
51
|
.description('Max rounds per subagent before the TUI sends a summary request (0 = unlimited)'),
|
|
52
|
+
disableSubagent: z
|
|
53
|
+
.boolean()
|
|
54
|
+
.default(DEFAULT_SUBAGENT_LIMITS.disableSubagent)
|
|
55
|
+
.description('Disable the native subagent tool (delegation goes through registered '
|
|
56
|
+
+ 'agents, ~/.dsh/agents/*.md via use_agent); subagent_fork/workflow/'
|
|
57
|
+
+ 'ralph stay available'),
|
|
58
|
+
footerHints: z
|
|
59
|
+
.object({
|
|
60
|
+
send: z.boolean().default(true).description('Show "Enter: send" in the footer hint bar'),
|
|
61
|
+
stop: z.boolean().default(true).description('Show "Esc ×2: stop" in the footer hint bar'),
|
|
62
|
+
quit: z.boolean().default(true).description('Show "Ctrl+C ×2: quit" in the footer hint bar'),
|
|
63
|
+
quitEmpty: z.boolean().default(true).description('Show "Ctrl+D: quit (empty)" in the footer hint bar'),
|
|
64
|
+
subagents: z.boolean().default(true).description('Show "Ctrl+G: subagents" in the footer hint bar'),
|
|
65
|
+
history: z.boolean().default(true).description('Show "↑↓: history" in the footer hint bar'),
|
|
66
|
+
})
|
|
67
|
+
.default({ ...DEFAULT_FOOTER_HINTS })
|
|
68
|
+
.description('Footer shortcut hints to display (toggle each one on/off)'),
|
|
45
69
|
});
|
|
46
70
|
/** Composition entry below the user layer: fall back to the defaults. */
|
|
47
71
|
const THEME_SETTINGS_ENTRY = {
|
|
@@ -49,6 +73,8 @@ const THEME_SETTINGS_ENTRY = {
|
|
|
49
73
|
panelHeight: DEFAULT_PANEL_HEIGHT,
|
|
50
74
|
maxAgents: DEFAULT_SUBAGENT_LIMITS.maxAgents,
|
|
51
75
|
maxRounds: DEFAULT_SUBAGENT_LIMITS.maxRounds,
|
|
76
|
+
disableSubagent: DEFAULT_SUBAGENT_LIMITS.disableSubagent,
|
|
77
|
+
footerHints: { ...DEFAULT_FOOTER_HINTS },
|
|
52
78
|
};
|
|
53
79
|
/**
|
|
54
80
|
* In-flight namespace registration. The registration rides the settings
|
|
@@ -72,10 +98,10 @@ let registrationPromise;
|
|
|
72
98
|
* startup.
|
|
73
99
|
*
|
|
74
100
|
* @param ctx - plugin context; does nothing while no settings service is mounted.
|
|
75
|
-
* @param onPreferenceChange - hot-reload sink for committed `dsh-tui` theme
|
|
76
|
-
*
|
|
77
|
-
* registered (a reloaded plugin instance, a second mount of this
|
|
78
|
-
* registration fails.
|
|
101
|
+
* @param onPreferenceChange - hot-reload sink for committed `dsh-tui` theme,
|
|
102
|
+
* panel-height and footer-hints changes; `undefined` when the namespace is
|
|
103
|
+
* already registered (a reloaded plugin instance, a second mount of this
|
|
104
|
+
* bundle) or registration fails.
|
|
79
105
|
*/
|
|
80
106
|
export function registerThemeSettings(ctx, onPreferenceChange) {
|
|
81
107
|
registrationPromise = new Promise(resolve => {
|
|
@@ -98,12 +124,12 @@ export function registerThemeSettings(ctx, onPreferenceChange) {
|
|
|
98
124
|
});
|
|
99
125
|
if (onPreferenceChange !== undefined) {
|
|
100
126
|
scope.watch((next) => {
|
|
101
|
-
// The resolved section is `{ theme: ..., panelHeight:
|
|
102
|
-
// narrow the unknown to the
|
|
127
|
+
// The resolved section is `{ theme: ..., panelHeight: ...,
|
|
128
|
+
// footerHints: {...} }` — narrow the unknown to the observed fields.
|
|
103
129
|
const section = next;
|
|
104
130
|
const theme = section.theme;
|
|
105
131
|
const panelHeight = section.panelHeight;
|
|
106
|
-
onPreferenceChange(theme === 'light' || theme === 'dark' ? theme : 'auto', panelHeight === '7' || panelHeight === '10' || panelHeight === 'all' ? panelHeight : DEFAULT_PANEL_HEIGHT);
|
|
132
|
+
onPreferenceChange(theme === 'light' || theme === 'dark' ? theme : 'auto', panelHeight === '7' || panelHeight === '10' || panelHeight === 'all' ? panelHeight : DEFAULT_PANEL_HEIGHT, narrowFooterHints(section.footerHints));
|
|
107
133
|
});
|
|
108
134
|
}
|
|
109
135
|
}
|
|
@@ -117,6 +143,18 @@ export function registerThemeSettings(ctx, onPreferenceChange) {
|
|
|
117
143
|
});
|
|
118
144
|
});
|
|
119
145
|
}
|
|
146
|
+
/** Validate an unknown `footerHints` value into the typed shape (defaults win). */
|
|
147
|
+
function narrowFooterHints(value) {
|
|
148
|
+
if (value === null || typeof value !== 'object')
|
|
149
|
+
return { ...DEFAULT_FOOTER_HINTS };
|
|
150
|
+
const section = value;
|
|
151
|
+
const hints = { ...DEFAULT_FOOTER_HINTS };
|
|
152
|
+
for (const key of Object.keys(DEFAULT_FOOTER_HINTS)) {
|
|
153
|
+
if (typeof section[key] === 'boolean')
|
|
154
|
+
hints[key] = section[key];
|
|
155
|
+
}
|
|
156
|
+
return hints;
|
|
157
|
+
}
|
|
120
158
|
/**
|
|
121
159
|
* The resolved `dsh-tui` section as read from the settings provider, after
|
|
122
160
|
* waiting for the in-flight registration.
|
|
@@ -146,8 +184,8 @@ async function readResolvedSection(ctx) {
|
|
|
146
184
|
if (settings === undefined)
|
|
147
185
|
return undefined;
|
|
148
186
|
// The descriptor's `value` is the whole resolved section
|
|
149
|
-
// (`{ theme: ..., panelHeight: ... }`), not the field
|
|
150
|
-
// unknown to the
|
|
187
|
+
// (`{ theme: ..., panelHeight: ..., footerHints: {...} }`), not the field
|
|
188
|
+
// itself — narrow the unknown to the three observed fields.
|
|
151
189
|
return settings
|
|
152
190
|
.describe()
|
|
153
191
|
.find((descriptor) => descriptor.ns === THEME_SETTINGS_NAMESPACE)?.value;
|
|
@@ -178,6 +216,32 @@ export async function readPanelHeightPreference(ctx) {
|
|
|
178
216
|
return height;
|
|
179
217
|
return DEFAULT_PANEL_HEIGHT;
|
|
180
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Read the persisted footer-hint selection (the startup snapshot).
|
|
221
|
+
*
|
|
222
|
+
* @param ctx - plugin context.
|
|
223
|
+
* @returns the resolved `dsh-tui` footerHints object, or DEFAULT_FOOTER_HINTS
|
|
224
|
+
* when the settings service is absent or the namespace/value cannot be read.
|
|
225
|
+
*/
|
|
226
|
+
export async function readFooterHintsPreference(ctx) {
|
|
227
|
+
return narrowFooterHints((await readResolvedSection(ctx))?.footerHints);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Read the currently persisted footer-hint selection, synchronously.
|
|
231
|
+
* Unlike `readFooterHintsPreference` (the startup snapshot), this does not
|
|
232
|
+
* wait for the namespace registration - it describes whatever the settings
|
|
233
|
+
* service exposes right now, so a caller can honor a live change immediately.
|
|
234
|
+
* @returns DEFAULT_FOOTER_HINTS when the service, namespace, or value is absent.
|
|
235
|
+
*/
|
|
236
|
+
export function currentFooterHints(ctx) {
|
|
237
|
+
const settings = ctx.get('settings');
|
|
238
|
+
if (settings === undefined)
|
|
239
|
+
return { ...DEFAULT_FOOTER_HINTS };
|
|
240
|
+
const hints = settings
|
|
241
|
+
.describe()
|
|
242
|
+
.find((descriptor) => descriptor.ns === THEME_SETTINGS_NAMESPACE)?.value?.footerHints;
|
|
243
|
+
return narrowFooterHints(hints);
|
|
244
|
+
}
|
|
181
245
|
/**
|
|
182
246
|
* Read the currently persisted theme preference, synchronously.
|
|
183
247
|
* Unlike `readThemePreference` (the startup snapshot), this does not wait for
|
|
@@ -254,8 +318,8 @@ export function readSubagentLimits(ctx) {
|
|
|
254
318
|
if (settings === undefined)
|
|
255
319
|
return { ...DEFAULT_SUBAGENT_LIMITS };
|
|
256
320
|
// The descriptor's `value` is the whole resolved section
|
|
257
|
-
// (`{ theme: ..., panelHeight: ..., maxAgents: ..., maxRounds:
|
|
258
|
-
// the unknown to the
|
|
321
|
+
// (`{ theme: ..., panelHeight: ..., maxAgents: ..., maxRounds: ...,
|
|
322
|
+
// disableSubagent: ... }`) — narrow the unknown to the observed fields.
|
|
259
323
|
const section = settings
|
|
260
324
|
.describe()
|
|
261
325
|
.find((descriptor) => descriptor.ns === THEME_SETTINGS_NAMESPACE)?.value;
|
|
@@ -263,15 +327,18 @@ export function readSubagentLimits(ctx) {
|
|
|
263
327
|
return {
|
|
264
328
|
maxAgents: natural(section?.maxAgents, DEFAULT_SUBAGENT_LIMITS.maxAgents),
|
|
265
329
|
maxRounds: natural(section?.maxRounds, DEFAULT_SUBAGENT_LIMITS.maxRounds),
|
|
330
|
+
disableSubagent: typeof section?.disableSubagent === 'boolean'
|
|
331
|
+
? section.disableSubagent
|
|
332
|
+
: DEFAULT_SUBAGENT_LIMITS.disableSubagent,
|
|
266
333
|
};
|
|
267
334
|
}
|
|
268
335
|
/**
|
|
269
|
-
* Persist one subagent
|
|
270
|
-
* settings namespace. The namespace is `applies: 'live'`, so
|
|
271
|
-
* hot-applies without a restart — the policy reads
|
|
272
|
-
* the next decision point. Never throws: a deployment
|
|
273
|
-
* provider, or an unregistered namespace, surfaces a
|
|
274
|
-
* caller.
|
|
336
|
+
* Persist one subagent policy knob (maxAgents, maxRounds, or disableSubagent)
|
|
337
|
+
* to the `dsh-tui` settings namespace. The namespace is `applies: 'live'`, so
|
|
338
|
+
* the commit hot-applies without a restart — the policy reads
|
|
339
|
+
* `readSubagentLimits` at the next decision point. Never throws: a deployment
|
|
340
|
+
* without the settings provider, or an unregistered namespace, surfaces a
|
|
341
|
+
* failure message for the caller.
|
|
275
342
|
* @returns undefined on success, the failure message otherwise.
|
|
276
343
|
*/
|
|
277
344
|
export async function writeSubagentLimit(ctx, key, value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-settings.js","sourceRoot":"","sources":["../src/theme-settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAIlB,MAAM,2BAA2B,CAAA;AAClC,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAE,oBAAoB,EAAoB,MAAM,eAAe,CAAA;AAGtE,qEAAqE;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAsB,iBAAiB,CAAC,SAAS,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"theme-settings.js","sourceRoot":"","sources":["../src/theme-settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAIlB,MAAM,2BAA2B,CAAA;AAClC,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAE,oBAAoB,EAAoB,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAoB,MAAM,eAAe,CAAA;AAGtE,qEAAqE;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAsB,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAkBvF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmB,MAAM,CAAC,MAAM,CAAC;IACnE,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,eAAe,EAAE,IAAI;CACtB,CAAC,CAAA;AAEF,gDAAgD;AAChD,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;SAChC,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,6CAA6C,CAAC;IAC7D,WAAW,EAAE,CAAC;SACX,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SAC9B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,GAAG,CAAC,UAAU,CAAiC,CAAA;IACpE,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,uBAAuB,EAAE,CAAA;IACjE,yDAAyD;IACzD,oEAAoE;IACpE,wEAAwE;IACxE,MAAM,OAAO,GAAG,QAAQ;SACrB,QAAQ,EAAE;SACV,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,wBAAwB,CAAC,EAAE,KAExD,CAAA;IACb,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,QAAgB,EAAU,EAAE,CAC3D,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAA;IACvF,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,SAAS,CAAC;QACzE,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,SAAS,CAAC;QACzE,eAAe,EAAE,OAAO,OAAO,EAAE,eAAe,KAAK,SAAS;YAC5D,CAAC,CAAC,OAAO,CAAC,eAAe;YACzB,CAAC,CAAC,uBAAuB,CAAC,eAAe;KAC5C,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAY,EACZ,GAAkD,EAClD,KAAuB;IAEvB,OAAO,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AAC/C,CAAC"}
|
package/lib/tui.js
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* session log during render; all session-derived state (messages, usage,
|
|
19
19
|
* counts) is maintained incrementally by event listeners and read O(1) here.
|
|
20
20
|
*/
|
|
21
|
-
import { Container, ProcessTerminal, ScrollView, Spacer, Text, TuiAltScreen, VStack, } from '@earendil-works/pi-tui';
|
|
21
|
+
import { Container, matchesKey, ProcessTerminal, ScrollView, Spacer, Text, TuiAltScreen, VStack, } from '@earendil-works/pi-tui';
|
|
22
22
|
import { CwdBorderEditor } from "./editor.js";
|
|
23
|
-
import { resolveKeyAction } from "./keymap.js";
|
|
23
|
+
import { mergeKeyBindings, resolveKeyAction } from "./keymap.js";
|
|
24
24
|
import { ansiBg, ansiFg, RESET, resolveTheme } from "./theme/index.js";
|
|
25
25
|
export function startTui(options = {}) {
|
|
26
26
|
const terminal = new ProcessTerminal();
|
|
@@ -209,9 +209,11 @@ export function startTui(options = {}) {
|
|
|
209
209
|
let lastEscPress = 0;
|
|
210
210
|
let lastRunningEscPress = 0;
|
|
211
211
|
let lastCtrlCPress = 0;
|
|
212
|
+
let lastOverlayEscPress = 0;
|
|
212
213
|
const isRunning = options.isRunning ?? (() => false);
|
|
213
214
|
const getRunningAgents = options.getRunningAgents ?? (() => 0);
|
|
214
215
|
tui.addInputListener((data) => {
|
|
216
|
+
const now = Date.now();
|
|
215
217
|
const action = resolveKeyAction(data, {
|
|
216
218
|
running: isRunning(),
|
|
217
219
|
overlayOpen: tui.hasOverlay(),
|
|
@@ -221,39 +223,49 @@ export function startTui(options = {}) {
|
|
|
221
223
|
lastEscPress,
|
|
222
224
|
lastRunningEscPress,
|
|
223
225
|
lastCtrlCPress,
|
|
224
|
-
|
|
226
|
+
lastOverlayEscPress,
|
|
227
|
+
}, now, keyBindingsRef);
|
|
225
228
|
// Advance the double-press windows for the keys this chain owns. Two
|
|
226
229
|
// separate Esc windows keep their own clocks: the running-stop arm
|
|
227
|
-
// (`interrupt-arm-stop`
|
|
228
|
-
// (`interrupt-arm`
|
|
230
|
+
// (`interrupt-arm-stop` -> `interrupt-cancel`) and the idle double-Esc
|
|
231
|
+
// (`interrupt-arm` -> `interrupt-double`), so an Esc that armed a stop
|
|
229
232
|
// never pops /session once the turn settles inside the window, and vice
|
|
230
|
-
// versa. A fired stop re-arms the running clock at the cancel timestamp
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
233
|
+
// versa. A fired stop re-arms the running clock at the cancel timestamp:
|
|
234
|
+
// lashes of held-key Esc after the cancel land <80ms later and resolve as
|
|
235
|
+
// swallowable `key-repeat` instead of re-noticing another arm. Esc
|
|
236
|
+
// `key-repeat` never advances an Esc window - a held key must not arm or
|
|
237
|
+
// complete an Esc double press. A popup-owned Esc (`overlay-esc`) arms
|
|
238
|
+
// ONLY the post-popup guard clock - never the stop/idle windows.
|
|
236
239
|
if (action.kind === 'interrupt-arm' || action.kind === 'interrupt-double') {
|
|
237
|
-
lastEscPress =
|
|
240
|
+
lastEscPress = now;
|
|
238
241
|
}
|
|
239
242
|
else if (action.kind === 'interrupt-arm-stop' || action.kind === 'interrupt-cancel') {
|
|
240
|
-
lastRunningEscPress =
|
|
243
|
+
lastRunningEscPress = now;
|
|
241
244
|
}
|
|
242
|
-
else if (action.kind === '
|
|
243
|
-
|
|
245
|
+
else if (action.kind === 'overlay-esc') {
|
|
246
|
+
lastOverlayEscPress = now;
|
|
247
|
+
}
|
|
248
|
+
// The ctrl+c clock advances on EVERY arrival (press, swallowed repeat,
|
|
249
|
+
// popup-owned - anything but a key-release) so the quit gap measures
|
|
250
|
+
// CONSECUTIVE key events: a held key's repeats keep the gap small and can
|
|
251
|
+
// never reach the QUIT_MIN_GAP_MS floor (see resolveCtrlC in keymap.ts).
|
|
252
|
+
if (action.kind !== 'key-release' && matchesKey(data, mergeKeyBindings(keyBindingsRef).ctrlC)) {
|
|
253
|
+
lastCtrlCPress = now;
|
|
244
254
|
}
|
|
245
255
|
// Pass-through outcomes (popup, autocomplete, unbound keys) let the
|
|
246
|
-
// focused component handle the key;
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
|
|
256
|
+
// focused component handle the key; inert swallows (key-release,
|
|
257
|
+
// overlay-esc, esc-after-overlay) go nowhere; actionable ones
|
|
258
|
+
// (key-repeat included, so the executor can abort a pending quit
|
|
259
|
+
// confirmation on it) go to the caller.
|
|
260
|
+
if (action.kind !== 'overlay' && action.kind !== 'autocomplete-close' && action.kind !== 'noop'
|
|
261
|
+
&& action.kind !== 'key-release' && action.kind !== 'overlay-esc' && action.kind !== 'esc-after-overlay') {
|
|
250
262
|
if (options.onKeyAction !== undefined) {
|
|
251
263
|
options.onKeyAction(action);
|
|
252
264
|
}
|
|
253
265
|
else if (action.kind === 'ctrl-c-cancel' || action.kind === 'ctrl-c-clear'
|
|
254
266
|
|| action.kind === 'ctrl-c-quit' || action.kind === 'ctrl-d-quit') {
|
|
255
267
|
// Smoke-test fallback: any Ctrl+C family press, or an empty-editor
|
|
256
|
-
// Ctrl+D, exits
|
|
268
|
+
// Ctrl+D, exits - Ctrl+C behaves like the pre-keymap build. (key-repeat
|
|
257
269
|
// deliberately excluded: no terminal is attached in smoke mode, but a
|
|
258
270
|
// repeat must never be an exit path by itself.)
|
|
259
271
|
handle.dispose();
|
package/lib/tui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,SAAS,EACT,eAAe,EACf,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,GAGP,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAoC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,GAGP,MAAM,wBAAwB,CAAA;AAC/B,OAAO,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,wEAAwE;gBACxE,sEAAsE;gBACtE,gDAAgD;gBAChD,MAAM,CAAC,OAAO,EAAE,CAAA;gBAChB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IACxD,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IAEvB,IAAI,CAAC;QACH,GAAG,CAAC,KAAK,EAAE,CAAA;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gEAAgE;QAChE,IAAI,CAAC;YAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAA;IACb,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwayds/dsh-tui-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oldfox
|
|
3
|
+
display_name: 老法师
|
|
4
|
+
description: "老法师:解决难题的顾问。分析、trouble shooting、review、审核、挑刺,保证功能的健壮性、稳定性、安全性。不做架构设计、不做 proposal。plan、design、code review 及其他方案改动都应由其 review 把关。"
|
|
5
|
+
color: red
|
|
6
|
+
model: volc-ark-plan/glm-5.3
|
|
7
|
+
deep: 0
|
|
8
|
+
thinking: high
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
你是「老法师」(oldfox)——顾问角色,不干「牛马狗」的活(不写实现代码、不部署、不做日常调查)。你的价值在于**发现问题**:
|
|
12
|
+
|
|
13
|
+
## 核心职责
|
|
14
|
+
|
|
15
|
+
1. **分析**:深入理解方案/代码的上下文,识别风险、缺陷、遗漏。
|
|
16
|
+
2. **Trouble shooting**:面对疑难问题,找出根因,给出准确的诊断。
|
|
17
|
+
3. **Review 与审核**:审查 plan、design、code、改动、方案,逐条挑刺。
|
|
18
|
+
4. **健壮性/稳定性/安全性把关**:指出边界条件、错误处理、安全风险、并发问题。
|
|
19
|
+
5. **建议**:针对每个发现给出具体、可执行的改进建议。
|
|
20
|
+
|
|
21
|
+
## 工作原则
|
|
22
|
+
|
|
23
|
+
- **不做牛马狗的活**:不写实现代码、不执行部署、不做常规调查——只做分析、审查、建议。
|
|
24
|
+
- **不做架构设计、不做 proposal**:不产出新方案设计文档,只对已有方案/改动提意见。
|
|
25
|
+
- **审核一切**:plan、design、code review 及其他方案改动,都应该过你的眼。
|
|
26
|
+
- **证据优先**:每个问题都要有依据(file:line 引用、逻辑推演),不空泛批评。
|
|
27
|
+
- **分级输出**:按严重程度(blocker / concern / suggestion)组织发现,让执行者能直接处理。
|
|
28
|
+
- **少幻觉**:对不确定的事实明确说不确定,不编造引用。
|
|
29
|
+
|
|
30
|
+
## 输出习惯
|
|
31
|
+
|
|
32
|
+
- 审查结论结构化:问题清单 + 依据 + 建议,优先级排序。
|
|
33
|
+
- 结论明确:哪些必须改、哪些建议改、哪些可忽略,不模棱两可。
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workhorse
|
|
3
|
+
display_name: 牛马狗
|
|
4
|
+
description: "牛马狗:干活的主力。写代码、调查、测试、部署、实现功能,所有脏活累活都干。默认模型 deepseek-v4-flash(正式版),思考强度 high。受 workhorse-gate 扩展保护:禁止修改 $HOME 之外的文件、禁止危险命令(sudo/rm -rf/chmod 777 等)、禁止写 ~/.pi/agent 配置目录。"
|
|
5
|
+
extensions: ["*", "workhorse-gate"]
|
|
6
|
+
model: volc-ark-plan/deepseek-v4-flash
|
|
7
|
+
thinking: high
|
|
8
|
+
deep: 0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
你是「牛马狗」(workhorse)——干活的主力 sub agent。你的职责是执行,不是决策:
|
|
12
|
+
|
|
13
|
+
## 核心职责
|
|
14
|
+
|
|
15
|
+
1. **写代码**:按用户/编排者的指示实现功能,最小改动,贴合现有代码风格。
|
|
16
|
+
2. **调查**:用 read/grep/find 等工具弄清代码现状再动手,先理解后修改。
|
|
17
|
+
3. **测试**:改动后运行相关测试,确保不破坏现有功能。
|
|
18
|
+
4. **部署**:执行部署相关命令(构建、发布、环境操作)。
|
|
19
|
+
5. **实现功能**:把需求变成可运行的代码,遇到障碍自行排查解决。
|
|
20
|
+
|
|
21
|
+
## 工作原则
|
|
22
|
+
|
|
23
|
+
- **先读后写**:改动前必须读目标文件与相关代码,禁止盲改。
|
|
24
|
+
- **最小改动**:只改需要改的,不顺手重构、不添加未要求的功能。
|
|
25
|
+
- **验证闭环**:任何改动都要有验证动作(测试/构建/检查),验证失败要修复而不是跳过。
|
|
26
|
+
- **证据优先**:结论要有依据(file:line 引用、命令输出),不猜测。
|
|
27
|
+
- **错误自愈**:出错先自己排查修复,修复不了再报告明确的错误信息和已尝试的方案。
|
|
28
|
+
|
|
29
|
+
## 边界约束(由 workhorse-gate 强制,无需自行判断)
|
|
30
|
+
|
|
31
|
+
- 你的文件操作权限限制在用户 home 目录($HOME)内。
|
|
32
|
+
- 禁止执行危险命令(sudo/su、rm -rf、chmod/chown 777 等)。
|
|
33
|
+
- 禁止修改 ~/.pi/agent 配置目录。
|
|
34
|
+
- 在这些边界内,工具使用不受任何限制——大胆干活。
|