@xth26/dsh-plan-build-mode 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/README.md +146 -175
- package/README.zh.md +143 -160
- package/lib/helpers.d.ts +7 -12
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +9 -13
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +6 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -43
- package/lib/index.js.map +1 -1
- package/lib/invariant.d.ts.map +1 -1
- package/lib/types.d.ts +0 -8
- package/lib/types.d.ts.map +1 -1
- package/package.json +101 -110
- package/lib/client/index.d.ts +0 -86
- package/lib/client/index.d.ts.map +0 -1
- package/lib/client/index.js +0 -139
- package/lib/client/index.js.map +0 -1
- package/lib/client.js +0 -141
package/lib/helpers.d.ts
CHANGED
|
@@ -4,34 +4,29 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
6
6
|
import type { SandboxMode } from '@deepseek-ai/dsh-sandbox';
|
|
7
|
-
import type {
|
|
7
|
+
import type { Session } from '@deepseek-ai/dsh-session';
|
|
8
8
|
import type { ToolExecution } from '@deepseek-ai/dsh-tools';
|
|
9
9
|
/** Default sandbox mode while Plan mode is active. */
|
|
10
10
|
export declare const DEFAULT_PLAN_SANDBOX: SandboxMode;
|
|
11
11
|
/** Default sandbox mode while Build mode is active. */
|
|
12
12
|
export declare const DEFAULT_BUILD_SANDBOX: SandboxMode;
|
|
13
|
-
/**
|
|
14
|
-
* Default keyboard shortcut that toggles Plan/Build mode. Kept deliberately
|
|
15
|
-
* complex (three modifiers) so it collides with no terminal or browser
|
|
16
|
-
* built-in: the TUI reserved set (ctrl+c/d/e/a/u/k/w, ctrl+left/right,
|
|
17
|
-
* ctrl+return, alt+return, alt+up, tab, …) and the built-in actions
|
|
18
|
-
* (ctrl+v/r/g/o/t/a/p/e/l/q, …) are all single-modifier, and no browser or
|
|
19
|
-
* OS binds ctrl+alt+shift+p.
|
|
20
|
-
*/
|
|
21
|
-
export declare const DEFAULT_SHORTCUT = "ctrl+alt+shift+p";
|
|
22
13
|
/** Tools forbidden while in Plan mode. */
|
|
23
14
|
export declare const WRITE_TOOLS: Set<string>;
|
|
24
15
|
/**
|
|
25
16
|
* Return the most recently written sandbox mode for a session, or undefined
|
|
26
17
|
* when the session has never switched.
|
|
18
|
+
*
|
|
19
|
+
* DSH >= 0.1.5 removed the `session.events` snapshot getter; the log is read
|
|
20
|
+
* through `session.snapshotEvents()` instead (an immutable, cached full-log
|
|
21
|
+
* snapshot with the same element shape).
|
|
27
22
|
*/
|
|
28
|
-
export declare function currentSandboxMode(
|
|
23
|
+
export declare function currentSandboxMode(session: Session): SandboxMode | undefined;
|
|
29
24
|
/**
|
|
30
25
|
* Whether the session is currently in OpenCode Plan mode.
|
|
31
26
|
* Plan mode is defined as the current sandbox mode matching the configured
|
|
32
27
|
* planSandbox (read-only by default).
|
|
33
28
|
*/
|
|
34
|
-
export declare function isPlanModeActive(
|
|
29
|
+
export declare function isPlanModeActive(session: Session, planSandbox: SandboxMode): boolean;
|
|
35
30
|
/**
|
|
36
31
|
* Append a `sandbox/mode` event to switch between Plan and Build mode.
|
|
37
32
|
*/
|
package/lib/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAG3D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAG3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D,sDAAsD;AACtD,eAAO,MAAM,oBAAoB,EAAE,WAAyB,CAAA;AAE5D,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,EAAE,WAA+B,CAAA;AAEnE,0CAA0C;AAC1C,eAAO,MAAM,WAAW,aAA6B,CAAA;AAErD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,CAS5E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAEpF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,GAAG,IAAI,CAGhI;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,WAAW,EAAE,WAAW,EACxB,UAAU,GAAE,WAAW,CAAC,MAAM,CAAe,GAC5C,MAAM,GAAG,SAAS,CAQpB"}
|
package/lib/helpers.js
CHANGED
|
@@ -6,22 +6,18 @@
|
|
|
6
6
|
export const DEFAULT_PLAN_SANDBOX = 'read-only';
|
|
7
7
|
/** Default sandbox mode while Build mode is active. */
|
|
8
8
|
export const DEFAULT_BUILD_SANDBOX = 'workspace-write';
|
|
9
|
-
/**
|
|
10
|
-
* Default keyboard shortcut that toggles Plan/Build mode. Kept deliberately
|
|
11
|
-
* complex (three modifiers) so it collides with no terminal or browser
|
|
12
|
-
* built-in: the TUI reserved set (ctrl+c/d/e/a/u/k/w, ctrl+left/right,
|
|
13
|
-
* ctrl+return, alt+return, alt+up, tab, …) and the built-in actions
|
|
14
|
-
* (ctrl+v/r/g/o/t/a/p/e/l/q, …) are all single-modifier, and no browser or
|
|
15
|
-
* OS binds ctrl+alt+shift+p.
|
|
16
|
-
*/
|
|
17
|
-
export const DEFAULT_SHORTCUT = 'ctrl+alt+shift+p';
|
|
18
9
|
/** Tools forbidden while in Plan mode. */
|
|
19
10
|
export const WRITE_TOOLS = new Set(['write', 'edit']);
|
|
20
11
|
/**
|
|
21
12
|
* Return the most recently written sandbox mode for a session, or undefined
|
|
22
13
|
* when the session has never switched.
|
|
14
|
+
*
|
|
15
|
+
* DSH >= 0.1.5 removed the `session.events` snapshot getter; the log is read
|
|
16
|
+
* through `session.snapshotEvents()` instead (an immutable, cached full-log
|
|
17
|
+
* snapshot with the same element shape).
|
|
23
18
|
*/
|
|
24
|
-
export function currentSandboxMode(
|
|
19
|
+
export function currentSandboxMode(session) {
|
|
20
|
+
const events = session.snapshotEvents();
|
|
25
21
|
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
26
22
|
const event = events[i];
|
|
27
23
|
if (event.type === 'sandbox/mode') {
|
|
@@ -35,8 +31,8 @@ export function currentSandboxMode(events) {
|
|
|
35
31
|
* Plan mode is defined as the current sandbox mode matching the configured
|
|
36
32
|
* planSandbox (read-only by default).
|
|
37
33
|
*/
|
|
38
|
-
export function isPlanModeActive(
|
|
39
|
-
return currentSandboxMode(
|
|
34
|
+
export function isPlanModeActive(session, planSandbox) {
|
|
35
|
+
return currentSandboxMode(session) === planSandbox;
|
|
40
36
|
}
|
|
41
37
|
/**
|
|
42
38
|
* Append a `sandbox/mode` event to switch between Plan and Build mode.
|
|
@@ -59,7 +55,7 @@ export function planModeDenial(exec, planSandbox, writeTools = WRITE_TOOLS) {
|
|
|
59
55
|
return undefined;
|
|
60
56
|
if (planSandbox !== 'read-only')
|
|
61
57
|
return undefined;
|
|
62
|
-
if (!isPlanModeActive(exec.agent.session
|
|
58
|
+
if (!isPlanModeActive(exec.agent.session, planSandbox))
|
|
63
59
|
return undefined;
|
|
64
60
|
if (writeTools.has(exec.name)) {
|
|
65
61
|
return `Tool '${exec.name}' is forbidden in Plan Mode. Run /plan-build (or /plan-build switch build) to leave Plan Mode before editing files.`;
|
package/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAgB,WAAW,CAAA;AAE5D,uDAAuD;AACvD,MAAM,CAAC,MAAM,qBAAqB,GAAgB,iBAAiB,CAAA;AAEnE
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAgB,WAAW,CAAA;AAE5D,uDAAuD;AACvD,MAAM,CAAC,MAAM,qBAAqB,GAAgB,iBAAiB,CAAA;AAEnE,0CAA0C;AAC1C,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAA;IACvC,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAE,CAAA;QACxB,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAClC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAA;QACxB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB,EAAE,WAAwB;IACzE,OAAO,kBAAkB,CAAC,OAAO,CAAC,KAAK,WAAW,CAAA;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY,EAAE,IAAsB,EAAE,WAAwB,EAAE,YAAyB;IACxH,MAAM,MAAM,GAAgB,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAA;IACxE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AACxD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAmB,EACnB,WAAwB,EACxB,aAAkC,WAAW;IAE7C,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC9C,IAAI,WAAW,KAAK,WAAW;QAAE,OAAO,SAAS,CAAA;IACjD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC;QAAE,OAAO,SAAS,CAAA;IACxE,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,IAAI,CAAC,IAAI,qHAAqH,CAAA;IAChJ,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -18,21 +18,23 @@ import z from '@deepseek-ai/schemastery';
|
|
|
18
18
|
import type { PlanBuildModeConfig } from './types.ts';
|
|
19
19
|
/** Cordis plugin name. */
|
|
20
20
|
export declare const name = "dsh-plan-build-mode";
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Service dependencies for the host half. `commands` is injected optionally at
|
|
23
|
+
* runtime via ctx.inject(['commands'], ...) so headless assemblies stay
|
|
24
|
+
* unaffected; the hard services are systemPrompt and tools.
|
|
25
|
+
*/
|
|
26
|
+
export declare const inject: readonly ["tools", "systemPrompt"];
|
|
23
27
|
/** Configuration schema. */
|
|
24
28
|
export declare const Config: z<Schemastery.ObjectS<{
|
|
25
29
|
planSandbox: z<"read-only" | "workspace-write" | "danger-full-access", "read-only" | "workspace-write" | "danger-full-access">;
|
|
26
30
|
buildSandbox: z<"read-only" | "workspace-write" | "danger-full-access", "read-only" | "workspace-write" | "danger-full-access">;
|
|
27
31
|
denyWriteTools: z<boolean, boolean>;
|
|
28
32
|
section: z<boolean, boolean>;
|
|
29
|
-
shortcut: z<string | string[], string | string[]>;
|
|
30
33
|
}>, Schemastery.ObjectT<{
|
|
31
34
|
planSandbox: z<"read-only" | "workspace-write" | "danger-full-access", "read-only" | "workspace-write" | "danger-full-access">;
|
|
32
35
|
buildSandbox: z<"read-only" | "workspace-write" | "danger-full-access", "read-only" | "workspace-write" | "danger-full-access">;
|
|
33
36
|
denyWriteTools: z<boolean, boolean>;
|
|
34
37
|
section: z<boolean, boolean>;
|
|
35
|
-
shortcut: z<string | string[], string | string[]>;
|
|
36
38
|
}>>;
|
|
37
39
|
/**
|
|
38
40
|
* Plugin entry point.
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAmBxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,0BAA0B;AAC1B,eAAO,MAAM,IAAI,wBAAwB,CAAA;AACzC;;;;GAIG;AACH,eAAO,MAAM,MAAM,oCAAqC,CAAA;AACxD,4BAA4B;AAC5B,eAAO,MAAM,MAAM;;;;;;;;;;GAajB,CAAA;AAEF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,mBAAwB,GAAG,IAAI,CAgG1E"}
|
package/lib/index.js
CHANGED
|
@@ -14,11 +14,15 @@
|
|
|
14
14
|
* @module dsh-plan-build-mode
|
|
15
15
|
*/
|
|
16
16
|
import z from '@deepseek-ai/schemastery';
|
|
17
|
-
import { DEFAULT_BUILD_SANDBOX, DEFAULT_PLAN_SANDBOX,
|
|
17
|
+
import { DEFAULT_BUILD_SANDBOX, DEFAULT_PLAN_SANDBOX, isPlanModeActive, planModeDenial, setPlanBuildMode, WRITE_TOOLS, } from "./helpers.js";
|
|
18
18
|
/** Cordis plugin name. */
|
|
19
19
|
export const name = 'dsh-plan-build-mode';
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Service dependencies for the host half. `commands` is injected optionally at
|
|
22
|
+
* runtime via ctx.inject(['commands'], ...) so headless assemblies stay
|
|
23
|
+
* unaffected; the hard services are systemPrompt and tools.
|
|
24
|
+
*/
|
|
25
|
+
export const inject = ['tools', 'systemPrompt'];
|
|
22
26
|
/** Configuration schema. */
|
|
23
27
|
export const Config = z.object({
|
|
24
28
|
planSandbox: z.union([
|
|
@@ -33,7 +37,6 @@ export const Config = z.object({
|
|
|
33
37
|
]).required(false),
|
|
34
38
|
denyWriteTools: z.boolean().default(true),
|
|
35
39
|
section: z.boolean().default(true),
|
|
36
|
-
shortcut: z.union([z.string(), z.array(z.string())]).required(false),
|
|
37
40
|
});
|
|
38
41
|
/**
|
|
39
42
|
* Plugin entry point.
|
|
@@ -50,12 +53,9 @@ export function apply(ctx, config = {}) {
|
|
|
50
53
|
const enableSection = config.section !== false;
|
|
51
54
|
ctx.effect(() => {
|
|
52
55
|
const disposers = [];
|
|
53
|
-
// Align existing sessions on load (resumed sessions may already have
|
|
54
|
-
// sandbox/mode events).
|
|
55
|
-
for (const _agent of ctx.agents.list()) {
|
|
56
|
-
// No-op on load: state is already in the log; we only react to commands.
|
|
57
|
-
}
|
|
58
56
|
// Inject a system prompt section describing the current mode.
|
|
57
|
+
// AssembleContext carries `agent?: Agent` (merged by @deepseek-ai/dsh-agent)
|
|
58
|
+
// since the scope-based system-prompt rewrite; it is absent on diagnostics.
|
|
59
59
|
if (enableSection) {
|
|
60
60
|
disposers.push(ctx.systemPrompt.section({
|
|
61
61
|
name: 'plan-build:policy',
|
|
@@ -64,7 +64,7 @@ export function apply(ctx, config = {}) {
|
|
|
64
64
|
const agent = context.agent;
|
|
65
65
|
if (agent === undefined)
|
|
66
66
|
return '';
|
|
67
|
-
return isPlanModeActive(agent.session
|
|
67
|
+
return isPlanModeActive(agent.session, planSandbox)
|
|
68
68
|
? 'You are in OpenCode Plan Mode. You are READ-ONLY. You may read files, search code, browse directories, ask questions, and inspect data or run quick read-only sanity checks. You are encouraged to write short command-line Python snippets (for example, python -B -c "...") to read data files, compute statistics, sample records, or run fast tests that do not modify the filesystem or write caches. Avoid commands that install packages, write files, generate build artifacts, or change the system. If a verification requires writing files, leave it for Build Mode. Present a complete plan and use /plan-build (or /plan-build switch build) to enter Build Mode before implementing.'
|
|
69
69
|
: 'You are in OpenCode Build Mode. You may edit files, run commands, and execute the approved plan. Make minimal changes, run tests/verification after changes, and ask for confirmation before destructive git operations or system-wide changes. Run /plan-build (or /plan-build switch plan) to return to Plan Mode when you need to re-plan.';
|
|
70
70
|
},
|
|
@@ -88,7 +88,7 @@ export function apply(ctx, config = {}) {
|
|
|
88
88
|
input: { hint: '[status | switch [plan|build]]' },
|
|
89
89
|
handler: ({ agent, rawInput }) => {
|
|
90
90
|
const arg = rawInput.trim().toLowerCase();
|
|
91
|
-
const active = isPlanModeActive(agent.session
|
|
91
|
+
const active = isPlanModeActive(agent.session, planSandbox);
|
|
92
92
|
if (arg === '' || arg === 'switch') {
|
|
93
93
|
const next = active ? 'build' : 'plan';
|
|
94
94
|
setPlanBuildMode(agent, next, planSandbox, buildSandbox);
|
|
@@ -126,38 +126,6 @@ export function apply(ctx, config = {}) {
|
|
|
126
126
|
return { kind: 'success', text: `Switched to ${target} mode.` };
|
|
127
127
|
},
|
|
128
128
|
}));
|
|
129
|
-
// dsh-tui keyboard shortcut: toggles through the same /plan-build
|
|
130
|
-
// command, so state, lifecycle events and grants stay single-source.
|
|
131
|
-
// Waits on ctx.tuiShortcuts (the dsh-tui-extensions row); inert in web
|
|
132
|
-
// and headless compositions where that service never mounts. The child
|
|
133
|
-
// fiber is cleaned up with the commands scope (same pattern as the
|
|
134
|
-
// outer ctx.inject).
|
|
135
|
-
commandCtx.inject(['tuiShortcuts'], (tuiCtx) => {
|
|
136
|
-
const tuiShortcuts = tuiCtx.get('tuiShortcuts');
|
|
137
|
-
if (tuiShortcuts === undefined)
|
|
138
|
-
return;
|
|
139
|
-
const combos = config.shortcut === undefined
|
|
140
|
-
? [DEFAULT_SHORTCUT]
|
|
141
|
-
: typeof config.shortcut === 'string'
|
|
142
|
-
? [config.shortcut]
|
|
143
|
-
: [...config.shortcut];
|
|
144
|
-
for (const combo of combos) {
|
|
145
|
-
disposers.push(tuiShortcuts.register(combo, {
|
|
146
|
-
description: 'Toggle between OpenCode Plan and Build modes',
|
|
147
|
-
handler: async () => {
|
|
148
|
-
const agent = ctx.agents.list()[0];
|
|
149
|
-
if (agent === undefined)
|
|
150
|
-
return;
|
|
151
|
-
try {
|
|
152
|
-
await commandCtx.commands.execute(agent, '/plan-build', [], new AbortController().signal);
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
ctx.logger.warn('dsh-plan-build-mode: TUI shortcut /plan-build failed: %o', error);
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
}, ctx));
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
129
|
});
|
|
162
130
|
return () => {
|
|
163
131
|
for (const dispose of disposers)
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAWxC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAWxC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,WAAW,GACZ,MAAM,cAAc,CAAA;AAGrB,0BAA0B;AAC1B,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAA;AACzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,cAAc,CAAU,CAAA;AACxD,4BAA4B;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC;QACnB,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;QAC1B,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;KAC9B,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClB,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;QAC1B,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;KAC9B,CAAC,CAAC,QAAQ,CAAC,KAAK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ts","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,oCAAoC;AACpC,eAAO,MAAM,IAAI,kCAAkC,CAAA;AACnD,2EAA2E;AAC3E,eAAO,MAAM,MAAM,yBAA0B,CAAA;AAO7C;;;;GAIG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,oCAAoC;AACpC,eAAO,MAAM,IAAI,kCAAkC,CAAA;AACnD,2EAA2E;AAC3E,eAAO,MAAM,MAAM,yBAA0B,CAAA;AAO7C;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,OAAO,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,KAAG,OAAO,CAAC,MAAM,IAAI,CAM9E,CAAA"}
|
package/lib/types.d.ts
CHANGED
|
@@ -29,13 +29,5 @@ export interface PlanBuildModeConfig {
|
|
|
29
29
|
* @default true
|
|
30
30
|
*/
|
|
31
31
|
section?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Keyboard shortcut(s) that toggle between Plan and Build modes in clients
|
|
34
|
-
* exposing a shortcut seam. dsh-tui binds them through `ctx.tuiShortcuts`;
|
|
35
|
-
* the web client binds the same combos through its global keydown listener.
|
|
36
|
-
* Combos use the `ctrl+alt+shift+p` grammar (ctrl or alt required).
|
|
37
|
-
* @default ['ctrl+alt+shift+p']
|
|
38
|
-
*/
|
|
39
|
-
shortcut?: string | readonly string[];
|
|
40
32
|
}
|
|
41
33
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,QAAQ,gCAAgC,CAAC;CAG/C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,QAAQ,gCAAgC,CAAC;CAG/C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB"}
|
package/package.json
CHANGED
|
@@ -1,110 +1,101 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xth26/dsh-plan-build-mode",
|
|
3
|
-
"description": "OpenCode-style Plan / Build hard permission model for DSH",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
7
|
-
},
|
|
8
|
-
"type": "module",
|
|
9
|
-
"main": "lib/index.js",
|
|
10
|
-
"types": "lib/types/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./lib/types/index.d.ts",
|
|
14
|
-
"default": "./lib/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./invariant": {
|
|
17
|
-
"types": "./lib/types/invariant.d.ts",
|
|
18
|
-
"default": "./lib/invariant.js"
|
|
19
|
-
},
|
|
20
|
-
"./
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"@deepseek-ai/
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
52
|
-
"@deepseek-ai/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"@deepseek-ai/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"@deepseek-ai/
|
|
92
|
-
"@deepseek-ai/dsh-
|
|
93
|
-
"@deepseek-ai/dsh-
|
|
94
|
-
"@deepseek-ai/dsh-
|
|
95
|
-
"@deepseek-ai/dsh-
|
|
96
|
-
"@deepseek-ai/
|
|
97
|
-
"@
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"typescript": "^5.7.0",
|
|
103
|
-
"vitest": "^2.1.0"
|
|
104
|
-
},
|
|
105
|
-
"scripts": {
|
|
106
|
-
"build": "tsc -b tsconfig.json && tsc -b tsconfig.client.json && node scripts/build-client-bundle.mjs",
|
|
107
|
-
"test": "vitest run",
|
|
108
|
-
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xth26/dsh-plan-build-mode",
|
|
3
|
+
"description": "OpenCode-style Plan / Build hard permission model for DSH",
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"types": "lib/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./lib/types/index.d.ts",
|
|
14
|
+
"default": "./lib/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./invariant": {
|
|
17
|
+
"types": "./lib/types/invariant.d.ts",
|
|
18
|
+
"default": "./lib/invariant.js"
|
|
19
|
+
},
|
|
20
|
+
"./src/*": "./src/*",
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib",
|
|
25
|
+
"cordis.patch.yml",
|
|
26
|
+
"README.md",
|
|
27
|
+
"README.zh.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"dsh": {
|
|
31
|
+
"bundle": {
|
|
32
|
+
"patch": "./cordis.patch.yml"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -b tsconfig.json",
|
|
37
|
+
"prepublishOnly": "pnpm build",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
44
|
+
"@deepseek-ai/dsh-agent": "^0.1.5-rc.1",
|
|
45
|
+
"@deepseek-ai/dsh-commands": "^0.1.5-rc.1",
|
|
46
|
+
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.1",
|
|
47
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.5-rc.1",
|
|
48
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.5-rc.1",
|
|
49
|
+
"@deepseek-ai/dsh-session": "^0.1.5-rc.1",
|
|
50
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.1",
|
|
51
|
+
"@deepseek-ai/dsh-tools": "^0.1.5-rc.1",
|
|
52
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"@deepseek-ai/cordis": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"@deepseek-ai/dsh-agent": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"@deepseek-ai/dsh-commands": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"@deepseek-ai/dsh-invariants": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"@deepseek-ai/dsh-sandbox": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@deepseek-ai/dsh-sandbox-policy": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@deepseek-ai/dsh-session": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"@deepseek-ai/dsh-system-prompt": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"@deepseek-ai/dsh-tools": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"@deepseek-ai/schemastery": {
|
|
83
|
+
"optional": true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@deepseek-ai/cordis": "4.0.2",
|
|
88
|
+
"@deepseek-ai/dsh-agent": "0.1.5-rc.2",
|
|
89
|
+
"@deepseek-ai/dsh-commands": "0.1.5-rc.2",
|
|
90
|
+
"@deepseek-ai/dsh-invariants": "0.1.5-rc.2",
|
|
91
|
+
"@deepseek-ai/dsh-sandbox": "0.1.5-rc.2",
|
|
92
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.1.5-rc.2",
|
|
93
|
+
"@deepseek-ai/dsh-session": "0.1.5-rc.2",
|
|
94
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.5-rc.2",
|
|
95
|
+
"@deepseek-ai/dsh-tools": "0.1.5-rc.2",
|
|
96
|
+
"@deepseek-ai/schemastery": "^3.18.2",
|
|
97
|
+
"@types/node": "^22.0.0",
|
|
98
|
+
"typescript": "^5.7.0",
|
|
99
|
+
"vitest": "^2.1.0"
|
|
100
|
+
}
|
|
101
|
+
}
|
package/lib/client/index.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser half of `dsh-plan-build-mode`.
|
|
3
|
-
*
|
|
4
|
-
* Adds a global keyboard shortcut that toggles OpenCode Plan / Build mode by
|
|
5
|
-
* executing the host `/plan-build` command against the current session. The
|
|
6
|
-
* bundle is a pure listener: it renders nothing and occupies no Slot seat.
|
|
7
|
-
*
|
|
8
|
-
* The services are consumed through locally declared structural faces rather
|
|
9
|
-
* than cross-plugin imports on purpose — a browser bundle must not compile a
|
|
10
|
-
* require() edge into the loader module table (bundle purity), and these
|
|
11
|
-
* shapes are small and stable. The default combo is kept deliberately complex
|
|
12
|
-
* (three modifiers) so it collides with no terminal or browser built-in.
|
|
13
|
-
*
|
|
14
|
-
* @module dsh-plan-build-mode/client
|
|
15
|
-
*/
|
|
16
|
-
/** Default shortcut; keep in sync with DEFAULT_SHORTCUT in ../helpers.ts. */
|
|
17
|
-
export declare const DEFAULT_SHORTCUT = "ctrl+alt+shift+p";
|
|
18
|
-
/** Client plugin name. */
|
|
19
|
-
export declare const name = "plan-build-mode-client";
|
|
20
|
-
/**
|
|
21
|
-
* Services required at runtime: the commands Remote for `/plan-build` and the
|
|
22
|
-
* session list for the current session id.
|
|
23
|
-
*/
|
|
24
|
-
export declare const inject: readonly ["remote", "remote.commands", "sessions"];
|
|
25
|
-
/** Optional config subset accepted by the client bundle. */
|
|
26
|
-
export interface PlanBuildModeClientConfig {
|
|
27
|
-
/** One or more `ctrl+alt+shift+p` style combos; defaults to DEFAULT_SHORTCUT. */
|
|
28
|
-
readonly shortcut?: string | readonly string[];
|
|
29
|
-
}
|
|
30
|
-
/** Minimal structural faces of the services this plugin consumes. */
|
|
31
|
-
export interface PlanBuildModeClientContext {
|
|
32
|
-
effect(fn: () => (() => void) | void): void;
|
|
33
|
-
sessions: {
|
|
34
|
-
list: {
|
|
35
|
-
getSnapshot(): {
|
|
36
|
-
current: string | undefined;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
remote: {
|
|
41
|
-
commands: {
|
|
42
|
-
execute(sessionId: string, line: string, images: readonly unknown[]): Promise<{
|
|
43
|
-
ok: boolean;
|
|
44
|
-
error?: {
|
|
45
|
-
code: string;
|
|
46
|
-
message: string;
|
|
47
|
-
};
|
|
48
|
-
}>;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/** A parsed `ctrl+alt+shift+p` style combo. */
|
|
53
|
-
export interface ParsedShortcut {
|
|
54
|
-
readonly ctrl: boolean;
|
|
55
|
-
readonly alt: boolean;
|
|
56
|
-
readonly shift: boolean;
|
|
57
|
-
readonly key: string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Parse a `ctrl+alt+shift+p` style combo. Requires at least one of ctrl/alt
|
|
61
|
-
* and exactly one key; returns undefined for malformed or modifier-less
|
|
62
|
-
* combos (mirrors the dsh-tui combo grammar).
|
|
63
|
-
*/
|
|
64
|
-
export declare function parseShortcutCombo(raw: string): ParsedShortcut | undefined;
|
|
65
|
-
/** Structural keydown shape so matching is testable without a DOM. */
|
|
66
|
-
export interface ShortcutKeyEvent {
|
|
67
|
-
readonly ctrlKey: boolean;
|
|
68
|
-
readonly altKey: boolean;
|
|
69
|
-
readonly shiftKey: boolean;
|
|
70
|
-
readonly metaKey: boolean;
|
|
71
|
-
readonly key: string;
|
|
72
|
-
}
|
|
73
|
-
/** Exact modifier + key match against a keydown event. The mac cmd (meta)
|
|
74
|
-
* modifier is never part of a spelled combo, so any meta press is a miss. */
|
|
75
|
-
export declare function shortcutMatches(combo: ParsedShortcut, event: ShortcutKeyEvent): boolean;
|
|
76
|
-
/** Resolve configured combos to parsed form, dropping malformed entries. */
|
|
77
|
-
export declare function resolveCombos(configured: string | readonly string[] | undefined): ParsedShortcut[];
|
|
78
|
-
/**
|
|
79
|
-
* Client plugin body: one global keydown listener that runs `/plan-build`
|
|
80
|
-
* against the current session. Inert without a current session, during IME
|
|
81
|
-
* composition, and on non-matching combos.
|
|
82
|
-
* @param ctx - client root context.
|
|
83
|
-
* @param config - optional config subset (shortcut combos).
|
|
84
|
-
*/
|
|
85
|
-
export declare function apply(ctx: PlanBuildModeClientContext, config?: PlanBuildModeClientConfig): void;
|
|
86
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAElD,0BAA0B;AAC1B,eAAO,MAAM,IAAI,2BAA2B,CAAA;AAE5C;;;GAGG;AACH,eAAO,MAAM,MAAM,oDAA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