@straussenl/opencode-ask-mode 1.0.8 → 1.0.9
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/index.ts +7 -15
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode-ai/plugin"
|
|
2
2
|
|
|
3
3
|
const askPlugin: Plugin = async (_ctx) => {
|
|
4
|
-
let currentAgent: string | undefined
|
|
5
|
-
|
|
6
4
|
return {
|
|
7
5
|
config: (cfg: Record<string, unknown>) => {
|
|
8
6
|
const agents = (cfg.agent ?? {}) as Record<string, unknown>
|
|
@@ -12,8 +10,11 @@ const askPlugin: Plugin = async (_ctx) => {
|
|
|
12
10
|
description: "Read-only assistant — ask questions about your codebase. No file edits, no shell commands.",
|
|
13
11
|
mode: "primary",
|
|
14
12
|
color: "#22c55e",
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
permission: {
|
|
14
|
+
edit: "deny",
|
|
15
|
+
bash: "deny",
|
|
16
|
+
task: { "*": "deny", "explore": "allow" },
|
|
17
|
+
},
|
|
17
18
|
prompt: [
|
|
18
19
|
"You are Ask Mode — a purely read-only assistant.",
|
|
19
20
|
"",
|
|
@@ -23,11 +24,12 @@ const askPlugin: Plugin = async (_ctx) => {
|
|
|
23
24
|
"- Explain how things work",
|
|
24
25
|
"- Look up documentation and references",
|
|
25
26
|
"- Help understand errors and debug output",
|
|
27
|
+
"- Use the explore sub-agent for codebase searches",
|
|
26
28
|
"",
|
|
27
29
|
"## What you CANNOT do",
|
|
28
30
|
"- Edit, create, or delete any files",
|
|
29
31
|
"- Run shell commands (no bash, no terminal)",
|
|
30
|
-
"- Dispatch sub-agents (
|
|
32
|
+
"- Dispatch sub-agents that can modify files (only explore is allowed)",
|
|
31
33
|
"- Create craft plans or task lists",
|
|
32
34
|
"- Make any changes to the project",
|
|
33
35
|
"",
|
|
@@ -38,16 +40,6 @@ const askPlugin: Plugin = async (_ctx) => {
|
|
|
38
40
|
].join("\n"),
|
|
39
41
|
}
|
|
40
42
|
},
|
|
41
|
-
|
|
42
|
-
"chat.params": async (input: { agent: string }) => {
|
|
43
|
-
currentAgent = input.agent
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
"tool.execute.before": async (input: { tool: string }, output: { args: any }) => {
|
|
47
|
-
if (input.tool === "task" && currentAgent === "ask") {
|
|
48
|
-
throw new Error("Task tool is disabled in Ask mode. Switch to Build mode to dispatch sub-agents.")
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
45
|
|
package/package.json
CHANGED