@xth26/dsh-plan-build-mode 0.3.0 → 0.3.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/README.md +139 -175
- package/README.zh.md +136 -160
- package/lib/helpers.d.ts +0 -9
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +0 -9
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -34
- package/lib/index.js.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.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;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA+B;IAChE,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CA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26,13 +26,11 @@ export declare const Config: z<Schemastery.ObjectS<{
|
|
|
26
26
|
buildSandbox: z<"read-only" | "workspace-write" | "danger-full-access", "read-only" | "workspace-write" | "danger-full-access">;
|
|
27
27
|
denyWriteTools: z<boolean, boolean>;
|
|
28
28
|
section: z<boolean, boolean>;
|
|
29
|
-
shortcut: z<string | string[], string | string[]>;
|
|
30
29
|
}>, Schemastery.ObjectT<{
|
|
31
30
|
planSandbox: z<"read-only" | "workspace-write" | "danger-full-access", "read-only" | "workspace-write" | "danger-full-access">;
|
|
32
31
|
buildSandbox: z<"read-only" | "workspace-write" | "danger-full-access", "read-only" | "workspace-write" | "danger-full-access">;
|
|
33
32
|
denyWriteTools: z<boolean, boolean>;
|
|
34
33
|
section: z<boolean, boolean>;
|
|
35
|
-
shortcut: z<string | string[], string | string[]>;
|
|
36
34
|
}>>;
|
|
37
35
|
/**
|
|
38
36
|
* 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,8CAA8C;AAC9C,eAAO,MAAM,MAAM,8CAA+C,CAAA;AAClE,4BAA4B;AAC5B,eAAO,MAAM,MAAM;;;;;;;;;;GAajB,CAAA;AAEF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,mBAAwB,GAAG,IAAI,CAoG1E"}
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
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
20
|
/** Service dependencies for the host half. */
|
|
@@ -33,7 +33,6 @@ export const Config = z.object({
|
|
|
33
33
|
]).required(false),
|
|
34
34
|
denyWriteTools: z.boolean().default(true),
|
|
35
35
|
section: z.boolean().default(true),
|
|
36
|
-
shortcut: z.union([z.string(), z.array(z.string())]).required(false),
|
|
37
36
|
});
|
|
38
37
|
/**
|
|
39
38
|
* Plugin entry point.
|
|
@@ -126,38 +125,6 @@ export function apply(ctx, config = {}) {
|
|
|
126
125
|
return { kind: 'success', text: `Switched to ${target} mode.` };
|
|
127
126
|
},
|
|
128
127
|
}));
|
|
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
128
|
});
|
|
162
129
|
return () => {
|
|
163
130
|
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,8CAA8C;AAC9C,M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O;4BACL,IAAI,EAAE,OAAO;4BACb,IAAI,EAAE,8DAA8D;yBACrE,CAAA;oBACH,CAAC;oBAED,MAAM,YAAY,GAAG,MAAM,KAAK,MAAM,CAAA;oBACtC,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;wBAC5B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,MAAM,QAAQ,EAAE,CAAA;oBAChE,CAAC;oBAED,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;oBAC1D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,MAAM,QAAQ,EAAE,CAAA;gBACjE,CAAC;aACF,CAAC,CAAC,CAAA;QACL,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE;YACV,KAAK,MAAM,OAAO,IAAI,SAAS;gBAAE,OAAO,EAAE,CAAA;QAC5C,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
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.3.
|
|
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.3.1",
|
|
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.1",
|
|
44
|
+
"@deepseek-ai/dsh-agent": "^0.1.0-rc.8",
|
|
45
|
+
"@deepseek-ai/dsh-commands": "^0.1.0-rc.8",
|
|
46
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
|
|
47
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.0-rc.8",
|
|
48
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.0-rc.8",
|
|
49
|
+
"@deepseek-ai/dsh-session": "^0.1.0-rc.8",
|
|
50
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.8",
|
|
51
|
+
"@deepseek-ai/dsh-tools": "^0.1.0-rc.8",
|
|
52
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
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": "link:../deepseek-harness/vendor/cordis",
|
|
88
|
+
"@deepseek-ai/dsh-agent": "link:../deepseek-harness/packages/core/agent",
|
|
89
|
+
"@deepseek-ai/dsh-commands": "link:../deepseek-harness/packages/interaction/commands",
|
|
90
|
+
"@deepseek-ai/dsh-invariants": "link:../deepseek-harness/packages/runtime-diagnostics/invariants",
|
|
91
|
+
"@deepseek-ai/dsh-sandbox": "link:../deepseek-harness/packages/sandbox/sandbox",
|
|
92
|
+
"@deepseek-ai/dsh-sandbox-policy": "link:../deepseek-harness/packages/sandbox/sandbox-policy",
|
|
93
|
+
"@deepseek-ai/dsh-session": "link:../deepseek-harness/packages/core/session",
|
|
94
|
+
"@deepseek-ai/dsh-system-prompt": "link:../deepseek-harness/packages/core/system-prompt",
|
|
95
|
+
"@deepseek-ai/dsh-tools": "link:../deepseek-harness/packages/core/tools",
|
|
96
|
+
"@deepseek-ai/schemastery": "link:../deepseek-harness/vendor/schemastery",
|
|
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;AA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zB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED;8EAC8E;AAC9E,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAMvF;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,cAAc,EAAE,CASlG;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,0BAA0B,EAAE,MAAM,GAAE,yBAA8B,GAAG,IAAI,CAwBnG"}
|
package/lib/client/index.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Browser half of `dsh-plan-build-mode`.
|
|
4
|
-
*
|
|
5
|
-
* Adds a global keyboard shortcut that toggles OpenCode Plan / Build mode by
|
|
6
|
-
* executing the host `/plan-build` command against the current session. The
|
|
7
|
-
* bundle is a pure listener: it renders nothing and occupies no Slot seat.
|
|
8
|
-
*
|
|
9
|
-
* The services are consumed through locally declared structural faces rather
|
|
10
|
-
* than cross-plugin imports on purpose — a browser bundle must not compile a
|
|
11
|
-
* require() edge into the loader module table (bundle purity), and these
|
|
12
|
-
* shapes are small and stable. The default combo is kept deliberately complex
|
|
13
|
-
* (three modifiers) so it collides with no terminal or browser built-in.
|
|
14
|
-
*
|
|
15
|
-
* @module dsh-plan-build-mode/client
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.inject = exports.name = exports.DEFAULT_SHORTCUT = void 0;
|
|
19
|
-
exports.parseShortcutCombo = parseShortcutCombo;
|
|
20
|
-
exports.shortcutMatches = shortcutMatches;
|
|
21
|
-
exports.resolveCombos = resolveCombos;
|
|
22
|
-
exports.apply = apply;
|
|
23
|
-
/** Default shortcut; keep in sync with DEFAULT_SHORTCUT in ../helpers.ts. */
|
|
24
|
-
exports.DEFAULT_SHORTCUT = 'ctrl+alt+shift+p';
|
|
25
|
-
/** Client plugin name. */
|
|
26
|
-
exports.name = 'plan-build-mode-client';
|
|
27
|
-
/**
|
|
28
|
-
* Services required at runtime: the commands Remote for `/plan-build` and the
|
|
29
|
-
* session list for the current session id.
|
|
30
|
-
*/
|
|
31
|
-
exports.inject = ['remote', 'remote.commands', 'sessions'];
|
|
32
|
-
/**
|
|
33
|
-
* Parse a `ctrl+alt+shift+p` style combo. Requires at least one of ctrl/alt
|
|
34
|
-
* and exactly one key; returns undefined for malformed or modifier-less
|
|
35
|
-
* combos (mirrors the dsh-tui combo grammar).
|
|
36
|
-
*/
|
|
37
|
-
function parseShortcutCombo(raw) {
|
|
38
|
-
const parts = String(raw ?? '')
|
|
39
|
-
.toLowerCase()
|
|
40
|
-
.split('+')
|
|
41
|
-
.map(part => part.trim())
|
|
42
|
-
.filter(part => part !== '');
|
|
43
|
-
if (parts.length < 2)
|
|
44
|
-
return undefined;
|
|
45
|
-
let ctrl = false;
|
|
46
|
-
let alt = false;
|
|
47
|
-
let shift = false;
|
|
48
|
-
let key;
|
|
49
|
-
for (const part of parts) {
|
|
50
|
-
if (part === 'ctrl' || part === 'control') {
|
|
51
|
-
ctrl = true;
|
|
52
|
-
}
|
|
53
|
-
else if (part === 'alt' || part === 'meta' || part === 'option') {
|
|
54
|
-
alt = true;
|
|
55
|
-
}
|
|
56
|
-
else if (part === 'shift') {
|
|
57
|
-
shift = true;
|
|
58
|
-
}
|
|
59
|
-
else if (part === 'space') {
|
|
60
|
-
if (key !== undefined)
|
|
61
|
-
return undefined;
|
|
62
|
-
key = ' ';
|
|
63
|
-
}
|
|
64
|
-
else if ([...part].length === 1) {
|
|
65
|
-
if (key !== undefined)
|
|
66
|
-
return undefined;
|
|
67
|
-
key = part;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (key === undefined)
|
|
74
|
-
return undefined;
|
|
75
|
-
if (!ctrl && !alt)
|
|
76
|
-
return undefined;
|
|
77
|
-
return { ctrl, alt, shift, key };
|
|
78
|
-
}
|
|
79
|
-
/** Exact modifier + key match against a keydown event. The mac cmd (meta)
|
|
80
|
-
* modifier is never part of a spelled combo, so any meta press is a miss. */
|
|
81
|
-
function shortcutMatches(combo, event) {
|
|
82
|
-
if (event.metaKey)
|
|
83
|
-
return false;
|
|
84
|
-
if (event.ctrlKey !== combo.ctrl)
|
|
85
|
-
return false;
|
|
86
|
-
if (event.altKey !== combo.alt)
|
|
87
|
-
return false;
|
|
88
|
-
if (event.shiftKey !== combo.shift)
|
|
89
|
-
return false;
|
|
90
|
-
return event.key.toLowerCase() === combo.key;
|
|
91
|
-
}
|
|
92
|
-
/** Resolve configured combos to parsed form, dropping malformed entries. */
|
|
93
|
-
function resolveCombos(configured) {
|
|
94
|
-
const raw = configured === undefined
|
|
95
|
-
? [exports.DEFAULT_SHORTCUT]
|
|
96
|
-
: typeof configured === 'string'
|
|
97
|
-
? [configured]
|
|
98
|
-
: [...configured];
|
|
99
|
-
return raw
|
|
100
|
-
.map(parseShortcutCombo)
|
|
101
|
-
.filter((combo) => combo !== undefined);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Client plugin body: one global keydown listener that runs `/plan-build`
|
|
105
|
-
* against the current session. Inert without a current session, during IME
|
|
106
|
-
* composition, and on non-matching combos.
|
|
107
|
-
* @param ctx - client root context.
|
|
108
|
-
* @param config - optional config subset (shortcut combos).
|
|
109
|
-
*/
|
|
110
|
-
function apply(ctx, config = {}) {
|
|
111
|
-
const combos = resolveCombos(config.shortcut);
|
|
112
|
-
if (combos.length === 0)
|
|
113
|
-
return;
|
|
114
|
-
ctx.effect(() => {
|
|
115
|
-
const onKeyDown = (event) => {
|
|
116
|
-
if (event.isComposing)
|
|
117
|
-
return;
|
|
118
|
-
for (const combo of combos) {
|
|
119
|
-
if (!shortcutMatches(combo, event))
|
|
120
|
-
continue;
|
|
121
|
-
const sessionId = ctx.sessions.list.getSnapshot().current;
|
|
122
|
-
if (sessionId === undefined)
|
|
123
|
-
return;
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
void ctx.remote.commands.execute(sessionId, '/plan-build', []).then((result) => {
|
|
126
|
-
if (!result.ok && result.error !== undefined) {
|
|
127
|
-
console.warn(`[plan-build-mode] shortcut failed (${result.error.code}): ${result.error.message}`);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
window.addEventListener('keydown', onKeyDown);
|
|
134
|
-
return () => {
|
|
135
|
-
window.removeEventListener('keydown', onKeyDown);
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
//# sourceMappingURL=index.js.map
|
package/lib/client/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAmDH,gDA+BC;AAaD,0CAMC;AAGD,sCASC;AASD,sBAwBC;AAhJD,6EAA6E;AAChE,QAAA,gBAAgB,GAAG,kBAAkB,CAAA;AAElD,0BAA0B;AACb,QAAA,IAAI,GAAG,wBAAwB,CAAA;AAE5C;;;GAGG;AACU,QAAA,MAAM,GAAG,CAAC,QAAQ,EAAE,iBAAiB,EAAE,UAAU,CAAU,CAAA;AAkCxE;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;SAC5B,WAAW,EAAE;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IA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