opencode-pair-autonomy 1.0.1 → 1.0.3
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/dist/index.js +24 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16895,20 +16895,35 @@ function safeHook(name, hook) {
|
|
|
16895
16895
|
// src/hooks/pre-tool-use.ts
|
|
16896
16896
|
var NODE_COMMAND_RE = /^(npm|pnpm|yarn|bun|npx|bunx|node|tsc|tsx|vite|next|nuxt|vitest|jest|eslint|prettier)\b/;
|
|
16897
16897
|
var NODE_MODULES_BIN_RE = /node_modules\/\.bin\//;
|
|
16898
|
-
var
|
|
16898
|
+
var PLAN_MODE_ALWAYS_BLOCKED = new Set(["edit", "write", "patch"]);
|
|
16899
16899
|
var PLAN_MODE_ALLOWED_AGENTS = new Set([
|
|
16900
16900
|
"ginko",
|
|
16901
16901
|
"kaiki",
|
|
16902
16902
|
"odokawa",
|
|
16903
16903
|
"rajdhani"
|
|
16904
16904
|
]);
|
|
16905
|
-
function
|
|
16906
|
-
if (
|
|
16907
|
-
return
|
|
16908
|
-
|
|
16909
|
-
|
|
16910
|
-
|
|
16911
|
-
|
|
16905
|
+
function resolveTargetAgent(args) {
|
|
16906
|
+
if (typeof args.subagent_type === "string")
|
|
16907
|
+
return args.subagent_type;
|
|
16908
|
+
if (typeof args.agent === "string")
|
|
16909
|
+
return args.agent;
|
|
16910
|
+
if (typeof args.subagent === "string")
|
|
16911
|
+
return args.subagent;
|
|
16912
|
+
if (typeof args.type === "string")
|
|
16913
|
+
return args.type;
|
|
16914
|
+
return;
|
|
16915
|
+
}
|
|
16916
|
+
function isBlockedInPlanMode(tool, args) {
|
|
16917
|
+
if (PLAN_MODE_ALWAYS_BLOCKED.has(tool))
|
|
16918
|
+
return true;
|
|
16919
|
+
const target = resolveTargetAgent(args);
|
|
16920
|
+
if (target) {
|
|
16921
|
+
return !PLAN_MODE_ALLOWED_AGENTS.has(target);
|
|
16922
|
+
}
|
|
16923
|
+
if (tool === "task" || tool.startsWith("task_") || tool === "delegate" || tool.startsWith("delegate")) {
|
|
16924
|
+
return true;
|
|
16925
|
+
}
|
|
16926
|
+
return false;
|
|
16912
16927
|
}
|
|
16913
16928
|
function isNodeCommand(command) {
|
|
16914
16929
|
return NODE_COMMAND_RE.test(command.trim()) || NODE_MODULES_BIN_RE.test(command);
|
|
@@ -16931,7 +16946,7 @@ function createPreToolUseHook(config2, runtime, profile) {
|
|
|
16931
16946
|
runtime.incrementToolCount(sessionID);
|
|
16932
16947
|
}
|
|
16933
16948
|
if (sessionID && agent && PRIMARY_AGENTS.has(agent) && tool && runtime.getPlanMode(sessionID) === "planning") {
|
|
16934
|
-
const blocked =
|
|
16949
|
+
const blocked = isBlockedInPlanMode(tool, args);
|
|
16935
16950
|
if (blocked) {
|
|
16936
16951
|
const count = runtime.incrementPlanModeBlock(sessionID);
|
|
16937
16952
|
const msg = count >= 3 ? "[PlanMode] STILL in planning mode. You have attempted execution tools multiple times. STOP trying. Complete your plan with TodoWrite. The user will /go to start execution." : "[PlanMode] You are in planning mode. Cannot use execution tools. Use Read/Glob/Grep/TodoWrite to continue planning. The user will /go to start execution.";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-pair-autonomy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "OpenCode harness with opinionated agent orchestration. One coordinator, eight specialized workers, automatic verify+review pipeline.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|