opencode-pair-autonomy 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16895,20 +16895,30 @@ 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 PLAN_MODE_BLOCKED_TOOLS = new Set(["task", "edit", "write", "patch"]);
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 isBlockedTaskInPlanMode(tool, args) {
16906
- if (tool !== "task" && !tool.startsWith("task_"))
16907
- return false;
16908
- const target = typeof args.subagent_type === "string" ? args.subagent_type : typeof args.agent === "string" ? args.agent : undefined;
16909
- if (target && PLAN_MODE_ALLOWED_AGENTS.has(target))
16905
+ function isWorkerSpawnTool(tool) {
16906
+ return tool === "task" || tool.startsWith("task_") || tool === "delegate" || tool.startsWith("delegate");
16907
+ }
16908
+ function resolveTargetAgent(args) {
16909
+ if (typeof args.subagent_type === "string")
16910
+ return args.subagent_type;
16911
+ if (typeof args.agent === "string")
16912
+ return args.agent;
16913
+ return;
16914
+ }
16915
+ function isBlockedInPlanMode(tool, args) {
16916
+ if (PLAN_MODE_ALWAYS_BLOCKED.has(tool))
16917
+ return true;
16918
+ if (!isWorkerSpawnTool(tool))
16910
16919
  return false;
16911
- return true;
16920
+ const target = resolveTargetAgent(args);
16921
+ return !(target && PLAN_MODE_ALLOWED_AGENTS.has(target));
16912
16922
  }
16913
16923
  function isNodeCommand(command) {
16914
16924
  return NODE_COMMAND_RE.test(command.trim()) || NODE_MODULES_BIN_RE.test(command);
@@ -16931,7 +16941,7 @@ function createPreToolUseHook(config2, runtime, profile) {
16931
16941
  runtime.incrementToolCount(sessionID);
16932
16942
  }
16933
16943
  if (sessionID && agent && PRIMARY_AGENTS.has(agent) && tool && runtime.getPlanMode(sessionID) === "planning") {
16934
- const blocked = PLAN_MODE_BLOCKED_TOOLS.has(tool) || isBlockedTaskInPlanMode(tool, args);
16944
+ const blocked = isBlockedInPlanMode(tool, args);
16935
16945
  if (blocked) {
16936
16946
  const count = runtime.incrementPlanModeBlock(sessionID);
16937
16947
  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.1",
3
+ "version": "1.0.2",
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",