@xth26/dsh-plan-build-mode 0.3.1 → 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/lib/index.js CHANGED
@@ -1,38 +1,56 @@
1
1
  /**
2
2
  * Host half of `dsh-plan-build-mode`.
3
3
  *
4
- * Implements an OpenCode-style Plan / Build mode that is independent from
5
- * DSH's built-in `/plan` soft-guidance mode:
4
+ * Implements an OpenCode-style Plan / Build mode with a tool permission gate:
6
5
  *
7
6
  * - `/plan-build` -> Toggle between Plan and Build modes
8
7
  * - `/plan-build status` -> Show the current mode
9
- * - `/plan-build switch plan` -> Plan mode + read-only sandbox
10
- * - `/plan-build switch build` -> Build mode + workspace-write sandbox
11
- * - Blocks `write`/`edit` tool calls while in Plan mode
8
+ * - `/plan-build switch plan` -> Plan mode (read-only by policy)
9
+ * - `/plan-build switch build` -> Build mode (writable)
10
+ * - `/permission status|allow|deny` -> Inspect / adjust the permission gate
11
+ * - Denies write-category tools while in Plan mode (OpenCode `edit` permission)
12
+ * - Permits reads outside the workspace (DSH reads pass through every mode);
13
+ * external writes stay gated by the sandbox unless `external_directory` is
14
+ * configured to `ask`
12
15
  * - Injects a `plan-build:policy` system prompt section
13
16
  *
17
+ * Mode state lives in the plugin-owned `plan-build/mode` session event; the
18
+ * `sandbox/mode` event is still written for sandbox enforcement whenever the
19
+ * target sandbox actually differs.
20
+ *
14
21
  * @module dsh-plan-build-mode
15
22
  */
16
23
  import z from '@deepseek-ai/schemastery';
17
- import { DEFAULT_BUILD_SANDBOX, DEFAULT_PLAN_SANDBOX, isPlanModeActive, planModeDenial, setPlanBuildMode, WRITE_TOOLS, } from "./helpers.js";
24
+ import { currentPlanBuildMode, currentSandboxMode, DEFAULT_BUILD_SANDBOX, DEFAULT_PLAN_SANDBOX, isPlanModeActive, setPlanBuildMode, } from "./helpers.js";
25
+ import { approvalDenyReason, canonicalize, categoryDenyReason, categoryOf, DEFAULT_ACTIONS, DEFAULT_EXTERNAL_DEFAULT, DEFAULT_PERMISSION, DEFAULT_PLAN_OVERRIDES, extractCommand, extractTargets, externalDenyReason, externalWriteEscalationReason, gateDecision, matchSubjectsFor, noApprovalChannelReason, planWriteDenyReason, resolveCategory, resolveTarget, sandboxAllowsWrite, } from "./permissions.js";
18
26
  /** Cordis plugin name. */
19
27
  export const name = 'dsh-plan-build-mode';
20
- /** Service dependencies for the host half. */
21
- export const inject = ['agents', 'tools', 'systemPrompt'];
28
+ /**
29
+ * Service dependencies for the host half. `commands` is injected optionally at
30
+ * runtime via ctx.inject(['commands'], ...) so headless assemblies stay
31
+ * unaffected; `approval` is read optionally via ctx.get('approval').
32
+ */
33
+ export const inject = ['tools', 'systemPrompt'];
34
+ const PERMISSION_ACTIONS = z.union([z.const('allow'), z.const('ask'), z.const('deny')]);
35
+ const PERMISSION_VALUE = z.union([PERMISSION_ACTIONS, z.dict(PERMISSION_ACTIONS)]);
36
+ const CATEGORY_MAP = z.dict(PERMISSION_VALUE);
37
+ const SANDBOX = z.union([z.const('read-only'), z.const('workspace-write'), z.const('danger-full-access')]);
22
38
  /** Configuration schema. */
23
39
  export const Config = z.object({
24
- planSandbox: z.union([
25
- z.const('read-only'),
26
- z.const('workspace-write'),
27
- z.const('danger-full-access'),
28
- ]).required(false),
29
- buildSandbox: z.union([
30
- z.const('read-only'),
31
- z.const('workspace-write'),
32
- z.const('danger-full-access'),
33
- ]).required(false),
40
+ planSandbox: SANDBOX.required(false),
41
+ buildSandbox: SANDBOX.required(false),
34
42
  denyWriteTools: z.boolean().default(true),
35
43
  section: z.boolean().default(true),
44
+ plansDirectory: z.string().default('.opencode/plans'),
45
+ permission: CATEGORY_MAP.required(false),
46
+ externalDirectory: z.object({
47
+ default: PERMISSION_ACTIONS.required(false),
48
+ rules: z.array(z.object({ pattern: z.string(), action: PERMISSION_ACTIONS })).required(false),
49
+ }).required(false),
50
+ modes: z.object({
51
+ plan: CATEGORY_MAP.required(false),
52
+ build: CATEGORY_MAP.required(false),
53
+ }).required(false),
36
54
  });
37
55
  /**
38
56
  * Plugin entry point.
@@ -42,18 +60,22 @@ export const Config = z.object({
42
60
  export function apply(ctx, config = {}) {
43
61
  const planSandbox = config.planSandbox ?? DEFAULT_PLAN_SANDBOX;
44
62
  const buildSandbox = config.buildSandbox ?? DEFAULT_BUILD_SANDBOX;
45
- if (planSandbox === buildSandbox) {
46
- throw new Error(`planSandbox and buildSandbox must be different, but both are '${planSandbox}'.`);
47
- }
48
63
  const denyWriteTools = config.denyWriteTools !== false;
49
64
  const enableSection = config.section !== false;
65
+ const plansDirectory = config.plansDirectory ?? '.opencode/plans';
66
+ // Session-scoped external-path allowlist (OpenCode "always", in-memory).
67
+ const allowlist = new Map();
68
+ const executionConfig = {
69
+ planSandbox,
70
+ buildSandbox,
71
+ denyWriteTools,
72
+ plansDirectory,
73
+ permission: config.permission,
74
+ externalDirectory: config.externalDirectory,
75
+ modes: config.modes,
76
+ };
50
77
  ctx.effect(() => {
51
78
  const disposers = [];
52
- // Align existing sessions on load (resumed sessions may already have
53
- // sandbox/mode events).
54
- for (const _agent of ctx.agents.list()) {
55
- // No-op on load: state is already in the log; we only react to commands.
56
- }
57
79
  // Inject a system prompt section describing the current mode.
58
80
  if (enableSection) {
59
81
  disposers.push(ctx.systemPrompt.section({
@@ -63,23 +85,48 @@ export function apply(ctx, config = {}) {
63
85
  const agent = context.agent;
64
86
  if (agent === undefined)
65
87
  return '';
66
- return isPlanModeActive(agent.session.events, planSandbox)
67
- ? '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.'
68
- : '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.';
88
+ return isPlanModeActive(agent.session, planSandbox)
89
+ ? 'You are in OpenCode Plan Mode. You are READ-ONLY: you may not modify files except under the configured plans directory. You may read files anywhere (including outside the workspace), 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. In Plan Mode you may write plan files only under the configured plans directory.'
90
+ : '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. Reading files outside the session workspace is allowed; writing outside the workspace requires sandbox escalation (retry with sandbox_permissions + justification).';
69
91
  },
70
92
  }));
71
93
  }
72
- // Block mutating tool calls while in Plan mode.
94
+ // The tool permission gate (OpenCode `permission` + `external_directory`).
73
95
  disposers.push(ctx.on('tools/pre-execute', async (exec, next) => {
74
- if (!denyWriteTools)
75
- return next();
76
- const reason = planModeDenial(exec, planSandbox, WRITE_TOOLS);
77
- if (reason !== undefined)
78
- return { kind: 'deny', reason };
96
+ const decision = await evaluateExecution(exec, executionConfig, allowlist, ctx);
97
+ if (decision.kind === 'deny')
98
+ return { kind: 'deny', reason: decision.reason };
79
99
  return next();
80
100
  }));
81
- // User-facing slash command to check or switch Plan/Build mode.
82
- // Activates only when a command registry is composed (headless assemblies stay unaffected).
101
+ // Pin a deterministic mode event on new sessions (and legacy-loaded ones)
102
+ // so mode state does not depend on sandbox inference forever.
103
+ const pinMode = (session) => {
104
+ if (currentPlanBuildMode(session, planSandbox) !== undefined)
105
+ return;
106
+ const sandbox = currentSandboxMode(session);
107
+ let inferred;
108
+ if (sandbox === undefined) {
109
+ inferred = 'build';
110
+ }
111
+ else if (planSandbox !== buildSandbox) {
112
+ inferred = sandbox === planSandbox ? 'plan' : 'build';
113
+ }
114
+ else {
115
+ inferred = sandbox === 'read-only' ? 'plan' : 'build';
116
+ }
117
+ session.append('plan-build/mode', { mode: inferred });
118
+ };
119
+ disposers.push(ctx.on('session/created', pinMode));
120
+ const sessions = ctx.sessions;
121
+ if (sessions !== undefined) {
122
+ for (const session of sessions.list())
123
+ pinMode(session);
124
+ }
125
+ // Drop session-scoped allowlist entries when their session is disposed.
126
+ disposers.push(ctx.on('session/disposed', (session) => {
127
+ allowlist.delete(session.id);
128
+ }));
129
+ // User-facing slash commands: mode toggle + permission gate control.
83
130
  ctx.inject(['commands'], (commandCtx) => {
84
131
  disposers.push(commandCtx.commands.register({
85
132
  name: 'plan-build',
@@ -87,7 +134,7 @@ export function apply(ctx, config = {}) {
87
134
  input: { hint: '[status | switch [plan|build]]' },
88
135
  handler: ({ agent, rawInput }) => {
89
136
  const arg = rawInput.trim().toLowerCase();
90
- const active = isPlanModeActive(agent.session.events, planSandbox);
137
+ const active = isPlanModeActive(agent.session, planSandbox);
91
138
  if (arg === '' || arg === 'switch') {
92
139
  const next = active ? 'build' : 'plan';
93
140
  setPlanBuildMode(agent, next, planSandbox, buildSandbox);
@@ -100,7 +147,7 @@ export function apply(ctx, config = {}) {
100
147
  return {
101
148
  kind: 'success',
102
149
  text: active
103
- ? 'Plan mode is active (read-only). Run /plan-build to enter Build mode, or /plan-build switch build.'
150
+ ? 'Plan mode is active (read-only by policy). Run /plan-build to enter Build mode, or /plan-build switch build.'
104
151
  : 'Build mode is active. Run /plan-build to enter Plan mode, or /plan-build switch plan.',
105
152
  };
106
153
  }
@@ -125,6 +172,43 @@ export function apply(ctx, config = {}) {
125
172
  return { kind: 'success', text: `Switched to ${target} mode.` };
126
173
  },
127
174
  }));
175
+ disposers.push(commandCtx.commands.register({
176
+ name: 'permission',
177
+ description: 'Inspect or adjust the OpenCode-style permission gate (external-path allowlist)',
178
+ input: { hint: '[status | allow <pattern> | deny <pattern>]' },
179
+ handler: ({ agent, rawInput }) => {
180
+ const arg = rawInput.trim();
181
+ const sessionId = agent.session.id;
182
+ const entries = allowlist.get(sessionId) ?? [];
183
+ if (arg === '' || arg === 'status') {
184
+ const rules = (config.externalDirectory?.rules ?? []).map((r) => `${r.pattern}=${r.action}`).join(', ');
185
+ return {
186
+ kind: 'success',
187
+ text: [
188
+ 'Permission gate status:',
189
+ `- external_directory default: ${config.externalDirectory?.default ?? DEFAULT_EXTERNAL_DEFAULT}`,
190
+ `- external_directory rules: ${rules || '(none)'}`,
191
+ `- session allowlist: ${entries.join(', ') || '(empty)'}`,
192
+ ].join('\n'),
193
+ };
194
+ }
195
+ const parts = arg.split(/\s+/);
196
+ const verb = parts[0] ?? '';
197
+ const pattern = parts.slice(1).join(' ');
198
+ if (verb === 'allow' && pattern !== '') {
199
+ if (!entries.includes(pattern)) {
200
+ entries.push(pattern);
201
+ allowlist.set(sessionId, entries);
202
+ }
203
+ return { kind: 'success', text: `Allowed external path pattern for this session: ${pattern}` };
204
+ }
205
+ if (verb === 'deny' && pattern !== '') {
206
+ allowlist.set(sessionId, entries.filter((p) => p !== pattern));
207
+ return { kind: 'success', text: `Removed external path pattern from this session's allowlist: ${pattern}` };
208
+ }
209
+ return { kind: 'error', text: 'Usage: /permission status, /permission allow <pattern>, or /permission deny <pattern>.' };
210
+ },
211
+ }));
128
212
  });
129
213
  return () => {
130
214
  for (const dispose of disposers)
@@ -132,4 +216,74 @@ export function apply(ctx, config = {}) {
132
216
  };
133
217
  });
134
218
  }
219
+ /** The plugin's view of the effective category policy for a mode. */
220
+ function categorySpecFor(config, mode, category) {
221
+ const globalValue = config.permission?.[category] ?? DEFAULT_PERMISSION[category];
222
+ const modeValue = mode === 'plan'
223
+ ? (config.modes?.plan?.[category] ?? (category === 'edit' && !config.denyWriteTools ? 'allow' : DEFAULT_PLAN_OVERRIDES[category]))
224
+ : config.modes?.build?.[category];
225
+ return resolveCategory(modeValue ?? globalValue, DEFAULT_ACTIONS[category]);
226
+ }
227
+ /** Evaluate one tool call through the permission gate; pure decision + approval. */
228
+ async function evaluateExecution(exec, config, allowlist, ctx) {
229
+ if (exec.agent === undefined)
230
+ return { kind: 'allow' };
231
+ const session = exec.agent.session;
232
+ const mode = currentPlanBuildMode(session, config.planSandbox) ?? 'build';
233
+ const workspaceRoot = canonicalize(session.header.cwd ?? process.cwd());
234
+ const plansDir = canonicalize(resolveTarget(config.plansDirectory, workspaceRoot));
235
+ const category = categoryOf(exec.name);
236
+ const targets = extractTargets(exec.name, exec.arguments).map((t) => canonicalize(resolveTarget(t, workspaceRoot)));
237
+ const command = extractCommand(exec.name, exec.arguments);
238
+ const matchSubjects = matchSubjectsFor(exec.name, targets, workspaceRoot, command);
239
+ const effectiveSandbox = currentSandboxMode(session);
240
+ const decision = gateDecision({
241
+ mode,
242
+ category,
243
+ targets,
244
+ matchSubjects,
245
+ workspaceRoot,
246
+ plansDir,
247
+ allowlist: allowlist.get(session.id) ?? [],
248
+ externalDefault: config.externalDirectory?.default ?? DEFAULT_EXTERNAL_DEFAULT,
249
+ externalRules: config.externalDirectory?.rules,
250
+ categorySpec: category === undefined ? { action: 'allow' } : categorySpecFor(config, mode, category),
251
+ sandboxAllowsWrite: (target) => sandboxAllowsWrite(effectiveSandbox, target, workspaceRoot),
252
+ });
253
+ if (decision.kind === 'allow')
254
+ return { kind: 'allow' };
255
+ if (decision.kind === 'deny')
256
+ return { kind: 'deny', reason: denialReason(exec.name, mode, category, decision) };
257
+ // ask → approval channel (fail closed on any resolution problem).
258
+ const approval = ctx.get?.('approval');
259
+ if (approval === undefined)
260
+ return { kind: 'deny', reason: noApprovalChannelReason(exec.name) };
261
+ let outcome;
262
+ try {
263
+ outcome = await approval.request({
264
+ agent: exec.agent,
265
+ toolName: exec.name,
266
+ callId: exec.callId,
267
+ reason: `permission gate: ${exec.name} requires approval under the configured permission`,
268
+ signal: exec.signal,
269
+ });
270
+ }
271
+ catch {
272
+ return { kind: 'deny', reason: `Tool '${exec.name}' requires approval, but the approval request failed closed.` };
273
+ }
274
+ if (outcome !== 'allowed-once')
275
+ return { kind: 'deny', reason: approvalDenyReason(exec.name, outcome) };
276
+ return { kind: 'allow' };
277
+ }
278
+ /** Map a gate decision onto a model-facing reason string. */
279
+ function denialReason(toolName, mode, category, decision) {
280
+ if (decision.code === 'plan-write' || (mode === 'plan' && category === 'edit' && decision.code === 'category-deny')) {
281
+ return planWriteDenyReason(toolName);
282
+ }
283
+ if (decision.code === 'external-deny')
284
+ return externalDenyReason(toolName, decision.target ?? '');
285
+ if (decision.code === 'external-write-escalation')
286
+ return externalWriteEscalationReason(toolName, decision.target ?? '');
287
+ return categoryDenyReason(toolName, decision.subject);
288
+ }
135
289
  //# sourceMappingURL=index.js.map
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,cAAc,EACd,gBAAgB,EAChB,WAAW,GACZ,MAAM,cAAc,CAAA;AAGrB,0BAA0B;AAC1B,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAA;AACzC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAU,CAAA;AAClE,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,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D,CAAC"}
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Package-owned invariant companion for `dsh-plan-build-mode`.
3
3
  *
4
- * This plugin stores its state entirely in the existing `sandbox/mode` event
5
- * (owned by `@deepseek-ai/dsh-sandbox-policy`), so there is no custom event
6
- * type to validate. The companion is kept as a no-op installer so downstream
7
- * deployments can still mount `dsh-plan-build-mode/invariant` if desired.
4
+ * The plugin stores its Plan/Build mode in its own `plan-build/mode` session
5
+ * event, so the companion validates that event's payload before it reaches
6
+ * the durable log. The `sandbox/mode` event it also writes is validated by
7
+ * `@deepseek-ai/dsh-sandbox-policy`.
8
8
  *
9
9
  * @module dsh-plan-build-mode/invariant
10
10
  */
@@ -1 +1 @@
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,QAAS,OAAO,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,KAAG,OAAO,CAAC,MAAM,IAAI,CAM9E,CAAA"}
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;AA8B7C;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,OAAO,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,KAAG,OAAO,CAAC,MAAM,IAAI,CAM9E,CAAA"}
package/lib/invariant.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Package-owned invariant companion for `dsh-plan-build-mode`.
3
3
  *
4
- * This plugin stores its state entirely in the existing `sandbox/mode` event
5
- * (owned by `@deepseek-ai/dsh-sandbox-policy`), so there is no custom event
6
- * type to validate. The companion is kept as a no-op installer so downstream
7
- * deployments can still mount `dsh-plan-build-mode/invariant` if desired.
4
+ * The plugin stores its Plan/Build mode in its own `plan-build/mode` session
5
+ * event, so the companion validates that event's payload before it reaches
6
+ * the durable log. The `sandbox/mode` event it also writes is validated by
7
+ * `@deepseek-ai/dsh-sandbox-policy`.
8
8
  *
9
9
  * @module dsh-plan-build-mode/invariant
10
10
  */
@@ -12,10 +12,33 @@
12
12
  export const name = 'dsh-plan-build-mode-invariant';
13
13
  /** Service required before the companion can reserve package ownership. */
14
14
  export const inject = ['invariants'];
15
- /** No-op installer: state lives in sandbox/mode, validated by dsh-sandbox-policy. */
16
- const install = Object.assign(() => {
17
- // Intentionally empty: this plugin does not introduce new session event types.
18
- }, { inject: [] });
15
+ /** Validate one `plan-build/mode` event before it reaches the durable log. */
16
+ function validateEvent(event, fail) {
17
+ if (event.type !== 'plan-build/mode')
18
+ return;
19
+ const mode = event.data?.mode;
20
+ if (mode !== 'plan' && mode !== 'build') {
21
+ fail(`plan-build/mode carries invalid mode ${JSON.stringify(mode)}; expected 'plan' or 'build'`);
22
+ }
23
+ }
24
+ /** Validate loaded and newly appended plan-build/mode state. */
25
+ const install = Object.assign((ctx, fail) => {
26
+ const seed = (session) => {
27
+ for (const event of session.snapshotEvents())
28
+ validateEvent(event, fail);
29
+ };
30
+ for (const session of ctx.sessions.list())
31
+ seed(session);
32
+ ctx.on('session/created', (session) => {
33
+ seed(session);
34
+ }, { global: true });
35
+ ctx.on('internal/dispatch', (_mode, eventName, args) => {
36
+ if (eventName !== 'session/event')
37
+ return;
38
+ const event = args[1];
39
+ validateEvent(event, fail);
40
+ }, { global: true });
41
+ }, { inject: ['sessions'] });
19
42
  /**
20
43
  * Register the plan-build-mode invariant companion.
21
44
  * @param ctx - Cordis context carrying the invariant service.
@@ -1 +1 @@
1
- {"version":3,"file":"invariant.js","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,oCAAoC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,+BAA+B,CAAA;AACnD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,YAAY,CAAU,CAAA;AAE7C,qFAAqF;AACrF,MAAM,OAAO,GAAuB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;IACrD,+EAA+E;AACjF,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAA;AAElB;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAsC,EAAuB,EAAE,CACnF,OAAO,CAAC,OAAO,CACZ,GAAG,CAAC,UAAoF,CAAC,QAAQ,CAChG,qBAAqB,EACrB,OAAO,CACR,CACF,CAAA"}
1
+ {"version":3,"file":"invariant.js","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,oCAAoC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,+BAA+B,CAAA;AACnD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,YAAY,CAAU,CAAA;AAE7C,8EAA8E;AAC9E,SAAS,aAAa,CAAC,KAAsC,EAAE,IAAgC;IAC7F,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;QAAE,OAAM;IAC5C,MAAM,IAAI,GAAI,KAAK,CAAC,IAA8C,EAAE,IAAI,CAAA;IACxE,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACxC,IAAI,CAAC,wCAAwC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAA;IAClG,CAAC;AACH,CAAC;AAED,gEAAgE;AAChE,MAAM,OAAO,GAAuB,MAAM,CAAC,MAAM,CAC/C,CAAC,GAA2G,EAAE,IAAgC,EAAE,EAAE;IAChJ,MAAM,IAAI,GAAG,CAAC,OAAyE,EAAE,EAAE;QACzF,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,cAAc,EAAE;YAAE,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC1E,CAAC,CAAA;IACD,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACxD,GAAG,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,OAAyE,EAAE,EAAE;QACtG,IAAI,CAAC,OAAO,CAAC,CAAA;IACf,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IACpB,GAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAa,EAAE,SAAiB,EAAE,IAAW,EAAE,EAAE;QAC5E,IAAI,SAAS,KAAK,eAAe;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAoC,CAAA;QACxD,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC5B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;AACtB,CAAC,EACD,EAAE,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,CACzB,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAsC,EAAuB,EAAE,CACnF,OAAO,CAAC,OAAO,CACZ,GAAG,CAAC,UAAoF,CAAC,QAAQ,CAChG,qBAAqB,EACrB,OAAO,CACR,CACF,CAAA"}
@@ -0,0 +1,164 @@
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 type { SandboxMode } from '@deepseek-ai/dsh-sandbox';
19
+ /** One of OpenCode's permission verdicts. */
20
+ export type PermissionAction = 'allow' | 'ask' | 'deny';
21
+ /** Tool categories the permission engine gates (mirrors OpenCode's permission keys). */
22
+ export type ToolCategory = 'read' | 'edit' | 'glob' | 'grep' | 'bash' | 'pwsh' | 'webfetch' | 'websearch';
23
+ /** A wildcard permission rule: pattern → action. */
24
+ export interface PermissionRule {
25
+ pattern: string;
26
+ action: PermissionAction;
27
+ }
28
+ /** Scalar value, or object-syntax rules (`{ pattern: action, ... }`, last-match-wins). */
29
+ export type PermissionValue = PermissionAction | Record<string, PermissionAction>;
30
+ /** The `external_directory` gate config: default action + explicit rules. */
31
+ export interface ExternalDirectoryConfig {
32
+ default?: PermissionAction;
33
+ rules?: PermissionRule[];
34
+ }
35
+ /** Per-mode permission overrides, applied over the global `permission`. */
36
+ export interface ModePermissionConfig {
37
+ plan?: Partial<Record<ToolCategory, PermissionValue>>;
38
+ build?: Partial<Record<ToolCategory, PermissionValue>>;
39
+ }
40
+ /** Scalar default action per category (the fallback when no value is given). */
41
+ export declare const DEFAULT_ACTIONS: Record<ToolCategory, PermissionAction>;
42
+ /** Global default actions, mirroring OpenCode (most allow; `.env*` reads denied). */
43
+ export declare const DEFAULT_PERMISSION: Record<ToolCategory, PermissionValue>;
44
+ /** Default Plan-mode overrides (write tools denied, commands ask). */
45
+ export declare const DEFAULT_PLAN_OVERRIDES: Partial<Record<ToolCategory, PermissionValue>>;
46
+ /**
47
+ * Default `external_directory` action. Reads of files outside the workspace
48
+ * stay permitted (DSH reads pass through every sandbox mode); only writes are
49
+ * gated. Set to `'ask'` for full OpenCode behavior (external access prompts).
50
+ */
51
+ export declare const DEFAULT_EXTERNAL_DEFAULT: PermissionAction;
52
+ /** Map a tool name to its permission category, or undefined for ungated tools. */
53
+ export declare function categoryOf(name: string): ToolCategory | undefined;
54
+ /**
55
+ * Extract the model-controlled path targets from one tool call's parsed
56
+ * arguments. Unknown or malformed arguments yield no targets: the category
57
+ * gate still applies, and the sandbox remains the floor for writes.
58
+ */
59
+ export declare function extractTargets(name: string, args: unknown): string[];
60
+ /** Extract the raw command text for bash/pwsh tools (used for prefix rules). */
61
+ export declare function extractCommand(name: string, args: unknown): string | undefined;
62
+ /** Normalize a path/pattern for cross-platform wildcard matching (forward slashes). */
63
+ export declare function normalizePath(p: string): string;
64
+ /** Expand `~` / `$HOME` at the start of a pattern to the user home directory. */
65
+ export declare function expandHome(pattern: string, home: string): string;
66
+ /** OpenCode wildcard match: `*` = any run, `?` = one char, everything else literal. */
67
+ export declare function wildcardMatch(pattern: string, value: string): boolean;
68
+ /** Matching options for rule evaluation. */
69
+ export interface RuleMatchContext {
70
+ /** User home for `~` expansion (defaults to `os.homedir()`). */
71
+ home?: string;
72
+ /** Whether comparisons ignore case — Windows paths. */
73
+ caseSensitive?: boolean;
74
+ }
75
+ /** Whether one permission pattern matches a value under the match context. */
76
+ export declare function ruleMatches(pattern: string, value: string, ctx?: RuleMatchContext): boolean;
77
+ /**
78
+ * Evaluate an ordered rule list against any of several subjects, last matching
79
+ * rule wins (OpenCode's evaluation order). Returns undefined when nothing matches.
80
+ */
81
+ export declare function matchRules(rules: readonly PermissionRule[] | undefined, subjects: readonly string[], ctx?: RuleMatchContext): PermissionAction | undefined;
82
+ /** A category's resolved policy: a scalar action plus optional object-form rules. */
83
+ export interface ResolvedCategory {
84
+ action: PermissionAction;
85
+ rules?: readonly PermissionRule[];
86
+ }
87
+ /**
88
+ * Normalize a `PermissionValue` into a scalar action plus ordered rules. The
89
+ * object form's `*` key becomes the catch-all default; later matching
90
+ * non-`*` rules override it (last-match-wins).
91
+ */
92
+ export declare function resolveCategory(value: PermissionValue | undefined, fallback: PermissionAction): ResolvedCategory;
93
+ /** Canonicalize a path (resolve symlinks of the deepest existing ancestor). */
94
+ export declare function canonicalize(path: string): string;
95
+ /** Resolve a model-provided path against the session working directory. */
96
+ export declare function resolveTarget(path: string, cwd: string): string;
97
+ /** Whether `target` is `root` or lies beneath it (lexical, canonical spellings). */
98
+ export declare function isUnder(target: string, root: string, caseSensitive: boolean): boolean;
99
+ /** Host filesystem case sensitivity (Windows paths compare case-insensitively). */
100
+ export declare function caseSensitiveHost(): boolean;
101
+ /**
102
+ * Whether the effective sandbox mode would permit a WRITE to the given
103
+ * canonical target — the single-prompt principle: the gate only asks for
104
+ * writes the sandbox can actually allow.
105
+ */
106
+ export declare function sandboxAllowsWrite(mode: SandboxMode | undefined, target: string, workspaceRoot: string, tempRoots?: readonly string[]): boolean;
107
+ /** Subjects category rules are matched against: relative and absolute forms. */
108
+ export declare function matchSubjectsFor(name: string, targets: readonly string[], workspaceRoot: string, command: string | undefined): string[];
109
+ /** The resolved verdict of {@link gateDecision}. */
110
+ export type Decision = {
111
+ kind: 'allow';
112
+ } | {
113
+ kind: 'ask';
114
+ } | {
115
+ kind: 'deny';
116
+ code: 'plan-write' | 'external-deny' | 'external-write-escalation' | 'category-deny';
117
+ /** The offending external target, when the denial is external. */
118
+ target?: string | undefined;
119
+ /** The matched subject, when the denial comes from a category rule. */
120
+ subject?: string | undefined;
121
+ };
122
+ /** Pure inputs for the gate's decision procedure. */
123
+ export interface GateInput {
124
+ mode: 'plan' | 'build';
125
+ category: ToolCategory | undefined;
126
+ /** Canonical absolute targets (resolved + canonicalized). */
127
+ targets: readonly string[];
128
+ /** Subjects matched against category rules. */
129
+ matchSubjects: readonly string[];
130
+ /** Canonical workspace root. */
131
+ workspaceRoot: string;
132
+ /** Canonical plans directory (`workspaceRoot`/`plansDirectory`). */
133
+ plansDir: string;
134
+ /** Session-scoped allowlist patterns (OpenCode "always"). */
135
+ allowlist: readonly string[];
136
+ /** `external_directory` default action. */
137
+ externalDefault: PermissionAction;
138
+ /** `external_directory` explicit rules (last-match-wins). */
139
+ externalRules: readonly PermissionRule[] | undefined;
140
+ /** The category's resolved policy. */
141
+ categorySpec: ResolvedCategory;
142
+ /** Per-target sandbox write allowance. */
143
+ sandboxAllowsWrite: (target: string) => boolean;
144
+ }
145
+ /**
146
+ * Pure decision procedure. Order: plans-dir carve-out → external-directory
147
+ * gate → category gate. `ask` is only returned when an approval channel can
148
+ * resolve it; writes the sandbox cannot permit never ask (single-prompt
149
+ * principle — they surface as a `external-write-escalation` denial instead).
150
+ */
151
+ export declare function gateDecision(input: GateInput): Decision;
152
+ /** Denial wording: Plan-mode write (keeps the historical `forbidden in Plan Mode` phrase). */
153
+ export declare function planWriteDenyReason(toolName: string): string;
154
+ /** Denial wording: an explicit external-directory deny rule matched. */
155
+ export declare function externalDenyReason(toolName: string, target: string): string;
156
+ /** Denial wording: a write the sandbox cannot permit (single-prompt handoff). */
157
+ export declare function externalWriteEscalationReason(toolName: string, target: string): string;
158
+ /** Denial wording: a category rule denied the call. */
159
+ export declare function categoryDenyReason(toolName: string, subject: string | undefined): string;
160
+ /** Denial wording: the approval channel rejected/aborted the ask. */
161
+ export declare function approvalDenyReason(toolName: string, outcome: string): string;
162
+ /** Denial wording: no approval channel is composed to resolve an ask. */
163
+ export declare function noApprovalChannelReason(toolName: string): string;
164
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAI3D,6CAA6C;AAC7C,MAAM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