@straussenl/opencode-ask-mode 1.0.7 → 1.0.8
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 +13 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode-ai/plugin"
|
|
2
2
|
|
|
3
3
|
const askPlugin: Plugin = async (_ctx) => {
|
|
4
|
+
let currentAgent: string | undefined
|
|
5
|
+
|
|
4
6
|
return {
|
|
5
7
|
config: (cfg: Record<string, unknown>) => {
|
|
6
8
|
const agents = (cfg.agent ?? {}) as Record<string, unknown>
|
|
@@ -10,6 +12,7 @@ const askPlugin: Plugin = async (_ctx) => {
|
|
|
10
12
|
description: "Read-only assistant — ask questions about your codebase. No file edits, no shell commands.",
|
|
11
13
|
mode: "primary",
|
|
12
14
|
color: "#22c55e",
|
|
15
|
+
tools: { task: false },
|
|
13
16
|
permission: { edit: "deny", bash: "deny", task: "deny" },
|
|
14
17
|
prompt: [
|
|
15
18
|
"You are Ask Mode — a purely read-only assistant.",
|
|
@@ -35,6 +38,16 @@ const askPlugin: Plugin = async (_ctx) => {
|
|
|
35
38
|
].join("\n"),
|
|
36
39
|
}
|
|
37
40
|
},
|
|
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
|
+
},
|
|
38
51
|
}
|
|
39
52
|
}
|
|
40
53
|
|
package/package.json
CHANGED