@xth26/dsh-plan-build-mode 0.4.0 → 0.5.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 +255 -146
- package/README.zh.md +237 -143
- package/cordis.patch.yml +13 -1
- package/lib/helpers.d.ts +21 -5
- package/lib/helpers.d.ts.map +1 -1
- package/lib/helpers.js +38 -6
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +14 -17
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +186 -33
- package/lib/index.js.map +1 -1
- package/lib/invariant.d.ts +4 -4
- package/lib/invariant.d.ts.map +1 -1
- package/lib/invariant.js +31 -8
- package/lib/invariant.js.map +1 -1
- package/lib/permissions.d.ts +164 -0
- package/lib/permissions.d.ts.map +1 -0
- package/lib/permissions.js +351 -0
- package/lib/permissions.js.map +1 -0
- package/lib/types.d.ts +44 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode-style tool permission engine for `dsh-plan-build-mode`.
|
|
3
|
+
*
|
|
4
|
+
* Models OpenCode's `permission` system — allow | ask | deny per tool
|
|
5
|
+
* category, object-syntax rules with last-match-wins, `~`/`$HOME` expansion,
|
|
6
|
+
* and the `external_directory` gate that asks for any path outside the
|
|
7
|
+
* session workspace — as pure, testable functions evaluated by the plugin's
|
|
8
|
+
* `tools/pre-execute` hook.
|
|
9
|
+
*
|
|
10
|
+
* The DSH sandbox stays the hard enforcement floor: a permission grant can
|
|
11
|
+
* never widen what the sandbox permits, and the gate only ever `ask`s for
|
|
12
|
+
* targets the sandbox can actually allow (the single-prompt principle — an
|
|
13
|
+
* external write the sandbox rejects goes straight to the existing
|
|
14
|
+
* sandbox-escalation flow instead of asking here first).
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-plan-build-mode/permissions
|
|
17
|
+
*/
|
|
18
|
+
import { canonicalPath } from '@deepseek-ai/dsh-sandbox';
|
|
19
|
+
import { homedir, tmpdir } from 'node:os';
|
|
20
|
+
import { isAbsolute, relative, resolve } from 'node:path';
|
|
21
|
+
/** Scalar default action per category (the fallback when no value is given). */
|
|
22
|
+
export const DEFAULT_ACTIONS = {
|
|
23
|
+
read: 'allow',
|
|
24
|
+
edit: 'allow',
|
|
25
|
+
glob: 'allow',
|
|
26
|
+
grep: 'allow',
|
|
27
|
+
bash: 'allow',
|
|
28
|
+
pwsh: 'allow',
|
|
29
|
+
webfetch: 'allow',
|
|
30
|
+
websearch: 'allow',
|
|
31
|
+
};
|
|
32
|
+
/** Global default actions, mirroring OpenCode (most allow; `.env*` reads denied). */
|
|
33
|
+
export const DEFAULT_PERMISSION = {
|
|
34
|
+
read: { '*': 'allow', '**/.env': 'deny', '**/.env.*': 'deny', '**/.env.example': 'allow' },
|
|
35
|
+
edit: DEFAULT_ACTIONS.edit,
|
|
36
|
+
glob: DEFAULT_ACTIONS.glob,
|
|
37
|
+
grep: DEFAULT_ACTIONS.grep,
|
|
38
|
+
bash: DEFAULT_ACTIONS.bash,
|
|
39
|
+
pwsh: DEFAULT_ACTIONS.pwsh,
|
|
40
|
+
webfetch: DEFAULT_ACTIONS.webfetch,
|
|
41
|
+
websearch: DEFAULT_ACTIONS.websearch,
|
|
42
|
+
};
|
|
43
|
+
/** Default Plan-mode overrides (write tools denied, commands ask). */
|
|
44
|
+
export const DEFAULT_PLAN_OVERRIDES = {
|
|
45
|
+
edit: 'deny',
|
|
46
|
+
bash: 'ask',
|
|
47
|
+
pwsh: 'ask',
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Default `external_directory` action. Reads of files outside the workspace
|
|
51
|
+
* stay permitted (DSH reads pass through every sandbox mode); only writes are
|
|
52
|
+
* gated. Set to `'ask'` for full OpenCode behavior (external access prompts).
|
|
53
|
+
*/
|
|
54
|
+
export const DEFAULT_EXTERNAL_DEFAULT = 'allow';
|
|
55
|
+
/** Tools gated under the `read` category. */
|
|
56
|
+
const READ_TOOLS = ['read', 'read_image', 'pdf_read', 'docx_read', 'pptx_read', 'xlsx_read'];
|
|
57
|
+
/** Tools gated under the `edit` category (OpenCode: `write` is controlled by `edit`). */
|
|
58
|
+
const WRITE_TOOLS = [
|
|
59
|
+
'write',
|
|
60
|
+
'edit',
|
|
61
|
+
'pdf_create',
|
|
62
|
+
'docx_create',
|
|
63
|
+
'pptx_create',
|
|
64
|
+
'xlsx_write',
|
|
65
|
+
'pptx_edit',
|
|
66
|
+
'xlsx_edit',
|
|
67
|
+
];
|
|
68
|
+
/** Path argument keys per tool name (verified against the DSH tool schemas). */
|
|
69
|
+
const TOOL_PATH_KEYS = {
|
|
70
|
+
read: ['file_path'],
|
|
71
|
+
read_image: ['file_path'],
|
|
72
|
+
pdf_read: ['file_path'],
|
|
73
|
+
docx_read: ['file_path'],
|
|
74
|
+
pptx_read: ['file_path'],
|
|
75
|
+
xlsx_read: ['file_path'],
|
|
76
|
+
write: ['file_path'],
|
|
77
|
+
edit: ['file_path'],
|
|
78
|
+
pptx_edit: ['file_path'],
|
|
79
|
+
xlsx_edit: ['file_path'],
|
|
80
|
+
pdf_create: ['destination_path'],
|
|
81
|
+
docx_create: ['destination_path'],
|
|
82
|
+
pptx_create: ['destination_path'],
|
|
83
|
+
xlsx_write: ['file_path'],
|
|
84
|
+
glob: ['path'],
|
|
85
|
+
grep: ['path'],
|
|
86
|
+
};
|
|
87
|
+
/** Map a tool name to its permission category, or undefined for ungated tools. */
|
|
88
|
+
export function categoryOf(name) {
|
|
89
|
+
if (READ_TOOLS.includes(name))
|
|
90
|
+
return 'read';
|
|
91
|
+
if (WRITE_TOOLS.includes(name))
|
|
92
|
+
return 'edit';
|
|
93
|
+
switch (name) {
|
|
94
|
+
case 'glob':
|
|
95
|
+
return 'glob';
|
|
96
|
+
case 'grep':
|
|
97
|
+
return 'grep';
|
|
98
|
+
case 'bash':
|
|
99
|
+
return 'bash';
|
|
100
|
+
case 'pwsh':
|
|
101
|
+
return 'pwsh';
|
|
102
|
+
case 'web_fetch':
|
|
103
|
+
return 'webfetch';
|
|
104
|
+
case 'web_search':
|
|
105
|
+
return 'websearch';
|
|
106
|
+
default:
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** The static directory prefix of a glob pattern (`src/**\/*.ts` → `src`). */
|
|
111
|
+
function patternBaseDir(pattern) {
|
|
112
|
+
const firstWild = pattern.search(/[*?]/);
|
|
113
|
+
const head = firstWild === -1 ? pattern : pattern.slice(0, firstWild);
|
|
114
|
+
const idx = head.lastIndexOf('/');
|
|
115
|
+
if (idx <= 0)
|
|
116
|
+
return undefined;
|
|
117
|
+
return head.slice(0, idx);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Extract the model-controlled path targets from one tool call's parsed
|
|
121
|
+
* arguments. Unknown or malformed arguments yield no targets: the category
|
|
122
|
+
* gate still applies, and the sandbox remains the floor for writes.
|
|
123
|
+
*/
|
|
124
|
+
export function extractTargets(name, args) {
|
|
125
|
+
if (args === null || typeof args !== 'object' || Array.isArray(args))
|
|
126
|
+
return [];
|
|
127
|
+
const record = args;
|
|
128
|
+
const targets = [];
|
|
129
|
+
const keys = TOOL_PATH_KEYS[name];
|
|
130
|
+
if (keys !== undefined) {
|
|
131
|
+
for (const key of keys) {
|
|
132
|
+
const value = record[key];
|
|
133
|
+
if (typeof value === 'string' && value.trim() !== '')
|
|
134
|
+
targets.push(value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (name === 'glob' || name === 'grep') {
|
|
138
|
+
const pattern = record.pattern;
|
|
139
|
+
if (typeof pattern === 'string' && pattern.trim() !== '') {
|
|
140
|
+
const base = patternBaseDir(pattern);
|
|
141
|
+
if (base !== undefined && base !== '')
|
|
142
|
+
targets.push(base);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return targets;
|
|
146
|
+
}
|
|
147
|
+
/** Extract the raw command text for bash/pwsh tools (used for prefix rules). */
|
|
148
|
+
export function extractCommand(name, args) {
|
|
149
|
+
if (name !== 'bash' && name !== 'pwsh')
|
|
150
|
+
return undefined;
|
|
151
|
+
if (args === null || typeof args !== 'object' || Array.isArray(args))
|
|
152
|
+
return undefined;
|
|
153
|
+
const value = args.command;
|
|
154
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
155
|
+
}
|
|
156
|
+
/** Normalize a path/pattern for cross-platform wildcard matching (forward slashes). */
|
|
157
|
+
export function normalizePath(p) {
|
|
158
|
+
return p.replace(/\\/g, '/');
|
|
159
|
+
}
|
|
160
|
+
/** Expand `~` / `$HOME` at the start of a pattern to the user home directory. */
|
|
161
|
+
export function expandHome(pattern, home) {
|
|
162
|
+
if (pattern === '~')
|
|
163
|
+
return normalizePath(home);
|
|
164
|
+
if (pattern.startsWith('~/') || pattern.startsWith('~\\'))
|
|
165
|
+
return normalizePath(home + pattern.slice(1));
|
|
166
|
+
if (pattern.startsWith('$HOME'))
|
|
167
|
+
return normalizePath(home + pattern.slice('$HOME'.length));
|
|
168
|
+
return normalizePath(pattern);
|
|
169
|
+
}
|
|
170
|
+
/** OpenCode wildcard match: `*` = any run, `?` = one char, everything else literal. */
|
|
171
|
+
export function wildcardMatch(pattern, value) {
|
|
172
|
+
let re = '';
|
|
173
|
+
for (const ch of pattern) {
|
|
174
|
+
if (ch === '*')
|
|
175
|
+
re += '.*';
|
|
176
|
+
else if (ch === '?')
|
|
177
|
+
re += '.';
|
|
178
|
+
else
|
|
179
|
+
re += ch.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
180
|
+
}
|
|
181
|
+
return new RegExp(`^${re}$`).test(value);
|
|
182
|
+
}
|
|
183
|
+
/** Whether one permission pattern matches a value under the match context. */
|
|
184
|
+
export function ruleMatches(pattern, value, ctx = {}) {
|
|
185
|
+
const home = ctx.home ?? homedir();
|
|
186
|
+
const cs = ctx.caseSensitive ?? true;
|
|
187
|
+
const p = expandHome(pattern, home);
|
|
188
|
+
const v = normalizePath(value);
|
|
189
|
+
return wildcardMatch(cs ? p : p.toLowerCase(), cs ? v : v.toLowerCase());
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Evaluate an ordered rule list against any of several subjects, last matching
|
|
193
|
+
* rule wins (OpenCode's evaluation order). Returns undefined when nothing matches.
|
|
194
|
+
*/
|
|
195
|
+
export function matchRules(rules, subjects, ctx = {}) {
|
|
196
|
+
if (rules === undefined || rules.length === 0 || subjects.length === 0)
|
|
197
|
+
return undefined;
|
|
198
|
+
let hit;
|
|
199
|
+
for (const subject of subjects) {
|
|
200
|
+
for (const rule of rules) {
|
|
201
|
+
if (ruleMatches(rule.pattern, subject, ctx))
|
|
202
|
+
hit = rule.action;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return hit;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Normalize a `PermissionValue` into a scalar action plus ordered rules. The
|
|
209
|
+
* object form's `*` key becomes the catch-all default; later matching
|
|
210
|
+
* non-`*` rules override it (last-match-wins).
|
|
211
|
+
*/
|
|
212
|
+
export function resolveCategory(value, fallback) {
|
|
213
|
+
if (value === undefined)
|
|
214
|
+
return { action: fallback };
|
|
215
|
+
if (typeof value === 'string')
|
|
216
|
+
return { action: value };
|
|
217
|
+
const rules = [];
|
|
218
|
+
let action = fallback;
|
|
219
|
+
for (const [pattern, ruleAction] of Object.entries(value)) {
|
|
220
|
+
if (pattern === '*') {
|
|
221
|
+
action = ruleAction;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
rules.push({ pattern, action: ruleAction });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return rules.length > 0 ? { action, rules } : { action };
|
|
228
|
+
}
|
|
229
|
+
/** Canonicalize a path (resolve symlinks of the deepest existing ancestor). */
|
|
230
|
+
export function canonicalize(path) {
|
|
231
|
+
return canonicalPath(path);
|
|
232
|
+
}
|
|
233
|
+
/** Resolve a model-provided path against the session working directory. */
|
|
234
|
+
export function resolveTarget(path, cwd) {
|
|
235
|
+
return isAbsolute(path) ? path : resolve(cwd, path);
|
|
236
|
+
}
|
|
237
|
+
/** Whether `target` is `root` or lies beneath it (lexical, canonical spellings). */
|
|
238
|
+
export function isUnder(target, root, caseSensitive) {
|
|
239
|
+
const t = normalizePath(target);
|
|
240
|
+
const r = normalizePath(root);
|
|
241
|
+
if (t === r)
|
|
242
|
+
return true;
|
|
243
|
+
const prefix = r.endsWith('/') ? r : `${r}/`;
|
|
244
|
+
const a = caseSensitive ? t : t.toLowerCase();
|
|
245
|
+
const b = caseSensitive ? prefix : prefix.toLowerCase();
|
|
246
|
+
return a.startsWith(b);
|
|
247
|
+
}
|
|
248
|
+
/** Host filesystem case sensitivity (Windows paths compare case-insensitively). */
|
|
249
|
+
export function caseSensitiveHost() {
|
|
250
|
+
return process.platform !== 'win32';
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Whether the effective sandbox mode would permit a WRITE to the given
|
|
254
|
+
* canonical target — the single-prompt principle: the gate only asks for
|
|
255
|
+
* writes the sandbox can actually allow.
|
|
256
|
+
*/
|
|
257
|
+
export function sandboxAllowsWrite(mode, target, workspaceRoot, tempRoots = ['/tmp', tmpdir()]) {
|
|
258
|
+
if (mode === 'danger-full-access')
|
|
259
|
+
return true;
|
|
260
|
+
if (mode === 'workspace-write') {
|
|
261
|
+
const cs = caseSensitiveHost();
|
|
262
|
+
return [workspaceRoot, ...tempRoots].some((root) => isUnder(target, canonicalize(root), cs));
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
/** Subjects category rules are matched against: relative and absolute forms. */
|
|
267
|
+
export function matchSubjectsFor(name, targets, workspaceRoot, command) {
|
|
268
|
+
if (name === 'bash' || name === 'pwsh') {
|
|
269
|
+
return command === undefined ? [] : [command];
|
|
270
|
+
}
|
|
271
|
+
const first = targets[0];
|
|
272
|
+
if (first === undefined)
|
|
273
|
+
return [];
|
|
274
|
+
return [normalizePath(relative(workspaceRoot, first)), normalizePath(first)];
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Pure decision procedure. Order: plans-dir carve-out → external-directory
|
|
278
|
+
* gate → category gate. `ask` is only returned when an approval channel can
|
|
279
|
+
* resolve it; writes the sandbox cannot permit never ask (single-prompt
|
|
280
|
+
* principle — they surface as a `external-write-escalation` denial instead).
|
|
281
|
+
*/
|
|
282
|
+
export function gateDecision(input) {
|
|
283
|
+
const { mode, category, targets, workspaceRoot, plansDir } = input;
|
|
284
|
+
const cs = caseSensitiveHost();
|
|
285
|
+
// 1. Plan-mode plans-directory carve-out (OpenCode `.opencode/plans/`).
|
|
286
|
+
if (mode === 'plan' &&
|
|
287
|
+
category === 'edit' &&
|
|
288
|
+
targets.length > 0 &&
|
|
289
|
+
targets.every((t) => isUnder(t, plansDir, cs))) {
|
|
290
|
+
return { kind: 'allow' };
|
|
291
|
+
}
|
|
292
|
+
// 2. External-directory gate.
|
|
293
|
+
const external = targets.filter((t) => !isUnder(t, workspaceRoot, cs));
|
|
294
|
+
if (external.length > 0) {
|
|
295
|
+
const context = { caseSensitive: cs };
|
|
296
|
+
const subject = external[0];
|
|
297
|
+
if (input.allowlist.some((pattern) => ruleMatches(pattern, subject, context)))
|
|
298
|
+
return { kind: 'allow' };
|
|
299
|
+
const action = matchRules(input.externalRules, external, context) ?? input.externalDefault;
|
|
300
|
+
if (action === 'deny')
|
|
301
|
+
return { kind: 'deny', code: 'external-deny', target: subject };
|
|
302
|
+
if (action === 'ask') {
|
|
303
|
+
if (category === 'edit' && !external.every((t) => input.sandboxAllowsWrite(t))) {
|
|
304
|
+
return { kind: 'deny', code: 'external-write-escalation', target: subject };
|
|
305
|
+
}
|
|
306
|
+
return { kind: 'ask' };
|
|
307
|
+
}
|
|
308
|
+
// allow → fall through to the category gate.
|
|
309
|
+
}
|
|
310
|
+
// 3. Category gate.
|
|
311
|
+
if (category === undefined)
|
|
312
|
+
return { kind: 'allow' };
|
|
313
|
+
const categoryContext = { caseSensitive: cs };
|
|
314
|
+
const subject = input.matchSubjects[0];
|
|
315
|
+
const action = matchRules(input.categorySpec.rules, input.matchSubjects, categoryContext) ?? input.categorySpec.action;
|
|
316
|
+
if (action === 'deny')
|
|
317
|
+
return { kind: 'deny', code: 'category-deny', subject };
|
|
318
|
+
if (action === 'ask') {
|
|
319
|
+
if (category === 'edit' && targets.length > 0 && !targets.every((t) => input.sandboxAllowsWrite(t))) {
|
|
320
|
+
return { kind: 'deny', code: 'external-write-escalation', target: targets[0] };
|
|
321
|
+
}
|
|
322
|
+
return { kind: 'ask' };
|
|
323
|
+
}
|
|
324
|
+
return { kind: 'allow' };
|
|
325
|
+
}
|
|
326
|
+
/** Denial wording: Plan-mode write (keeps the historical `forbidden in Plan Mode` phrase). */
|
|
327
|
+
export function planWriteDenyReason(toolName) {
|
|
328
|
+
return `Tool '${toolName}' is forbidden in Plan Mode (write permission denied). Only files under the configured plans directory may be written in Plan Mode; run /plan-build (or /plan-build switch build) to leave Plan Mode before editing elsewhere.`;
|
|
329
|
+
}
|
|
330
|
+
/** Denial wording: an explicit external-directory deny rule matched. */
|
|
331
|
+
export function externalDenyReason(toolName, target) {
|
|
332
|
+
return `external path access denied for '${target}' (${toolName}) under the external-directory permission. Use /permission allow <pattern> to allowlist this path for the current session, or configure externalDirectory.rules.`;
|
|
333
|
+
}
|
|
334
|
+
/** Denial wording: a write the sandbox cannot permit (single-prompt handoff). */
|
|
335
|
+
export function externalWriteEscalationReason(toolName, target) {
|
|
336
|
+
return `writing outside the workspace ('${target}') is not permitted by the current sandbox (${toolName}). Retry this ${toolName} call once with sandbox_permissions + justification to request approval, or configure buildSandbox: danger-full-access for full write control.`;
|
|
337
|
+
}
|
|
338
|
+
/** Denial wording: a category rule denied the call. */
|
|
339
|
+
export function categoryDenyReason(toolName, subject) {
|
|
340
|
+
const what = subject === undefined || subject === '' ? '' : ` for '${subject}'`;
|
|
341
|
+
return `Tool '${toolName}' is denied by the configured permission${what}. Adjust the permission config, or use /permission allow <pattern> to allowlist this path.`;
|
|
342
|
+
}
|
|
343
|
+
/** Denial wording: the approval channel rejected/aborted the ask. */
|
|
344
|
+
export function approvalDenyReason(toolName, outcome) {
|
|
345
|
+
return `Tool '${toolName}' requires approval and the request was ${outcome}.`;
|
|
346
|
+
}
|
|
347
|
+
/** Denial wording: no approval channel is composed to resolve an ask. */
|
|
348
|
+
export function noApprovalChannelReason(toolName) {
|
|
349
|
+
return `Tool '${toolName}' requires approval, but no approval channel is composed.`;
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA6BzD,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAA2C;IACrE,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,OAAO;CACnB,CAAA;AAED,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAA0C;IACvE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE;IAC1F,IAAI,EAAE,eAAe,CAAC,IAAI;IAC1B,IAAI,EAAE,eAAe,CAAC,IAAI;IAC1B,IAAI,EAAE,eAAe,CAAC,IAAI;IAC1B,IAAI,EAAE,eAAe,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, ModePermissionConfig, PermissionValue, ToolCategory } from './permissions.ts';
|
|
6
7
|
declare module '@deepseek-ai/dsh-session/types' {
|
|
8
|
+
interface SessionEventMap {
|
|
9
|
+
/**
|
|
10
|
+
* The session's Plan/Build mode was switched. Owned by this plugin: under
|
|
11
|
+
* the OpenCode-aligned configuration both Plan and Build can share the
|
|
12
|
+
* same sandbox mode (e.g. `workspace-write`), so the `sandbox/mode` event
|
|
13
|
+
* alone can no longer distinguish them — this event is the durable mode
|
|
14
|
+
* carrier. `sandbox/mode` is still appended for sandbox enforcement when
|
|
15
|
+
* the target sandbox actually differs from the current one.
|
|
16
|
+
*/
|
|
17
|
+
'plan-build/mode': {
|
|
18
|
+
mode: 'plan' | 'build';
|
|
19
|
+
};
|
|
20
|
+
}
|
|
7
21
|
}
|
|
8
22
|
/**
|
|
9
23
|
* Deployment configuration for the Plan/Build mode plugin.
|
|
@@ -11,6 +25,9 @@ declare module '@deepseek-ai/dsh-session/types' {
|
|
|
11
25
|
export interface PlanBuildModeConfig {
|
|
12
26
|
/**
|
|
13
27
|
* Sandbox mode enforced while Plan mode is active.
|
|
28
|
+
* Under the OpenCode-aligned config this may equal `buildSandbox`
|
|
29
|
+
* (e.g. both `workspace-write`): read-only is then enforced by the
|
|
30
|
+
* permission gate instead of the sandbox.
|
|
14
31
|
* @default 'read-only'
|
|
15
32
|
*/
|
|
16
33
|
planSandbox?: SandboxMode;
|
|
@@ -20,7 +37,8 @@ export interface PlanBuildModeConfig {
|
|
|
20
37
|
*/
|
|
21
38
|
buildSandbox?: SandboxMode;
|
|
22
39
|
/**
|
|
23
|
-
* Whether
|
|
40
|
+
* Whether Plan mode denies write-category tools (via the permission gate).
|
|
41
|
+
* When false, Plan mode does not restrict writes by policy.
|
|
24
42
|
* @default true
|
|
25
43
|
*/
|
|
26
44
|
denyWriteTools?: boolean;
|
|
@@ -29,5 +47,30 @@ export interface PlanBuildModeConfig {
|
|
|
29
47
|
* @default true
|
|
30
48
|
*/
|
|
31
49
|
section?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Workspace-relative directory writable in Plan mode — the OpenCode
|
|
52
|
+
* `.opencode/plans/` analog. Must stay inside the workspace.
|
|
53
|
+
* @default '.opencode/plans'
|
|
54
|
+
*/
|
|
55
|
+
plansDirectory?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Global tool permission categories (OpenCode `permission`). Scalar
|
|
58
|
+
* `allow | ask | deny`, or object-syntax rules (`{ pattern: action, ... }`,
|
|
59
|
+
* last-match-wins, `*` catch-all, `~`/`$HOME` expansion).
|
|
60
|
+
*/
|
|
61
|
+
permission?: Partial<Record<ToolCategory, PermissionValue>>;
|
|
62
|
+
/**
|
|
63
|
+
* External-directory access gate (OpenCode `external_directory`): paths
|
|
64
|
+
* outside the session workspace are read freely by default
|
|
65
|
+
* (`default: 'allow'`); set `default: 'ask'` to prompt for every external
|
|
66
|
+
* access. Writes outside the workspace remain governed by the sandbox.
|
|
67
|
+
*/
|
|
68
|
+
externalDirectory?: ExternalDirectoryConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Per-mode permission overrides, applied over the global `permission`
|
|
71
|
+
* (OpenCode agent-over-global precedence). `plan` defaults to write-deny +
|
|
72
|
+
* command-ask; `build` defaults to allow.
|
|
73
|
+
*/
|
|
74
|
+
modes?: ModePermissionConfig;
|
|
32
75
|
}
|
|
33
76
|
//# 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;
|
|
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;AAC3D,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACb,MAAM,kBAAkB,CAAA;AAEzB,OAAO,QAAQ,gCAAgC,CAAC;IAC9C,UAAU,eAAe;QACvB;;;;;;;WAOG;QACH,iBAAiB,EAAE;YACjB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;SACvB,CAAA;KACF;CACF;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAA;IAC3D;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,uBAAuB,CAAA;IAC3C;;;;OAIG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B"}
|