opencode-pair-autonomy 1.0.3 → 1.0.5

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 +29 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16849,6 +16849,11 @@ function createPreCompactHook(runtime) {
16849
16849
  };
16850
16850
  }
16851
16851
 
16852
+ // src/hooks/pre-tool-use.ts
16853
+ import { appendFileSync as appendFileSync2 } from "fs";
16854
+ import { homedir as homedir4 } from "os";
16855
+ import { join as join5 } from "path";
16856
+
16852
16857
  // src/hooks/sdk.ts
16853
16858
  class BlockingHookError extends Error {
16854
16859
  constructor(message) {
@@ -16893,6 +16898,14 @@ function safeHook(name, hook) {
16893
16898
  }
16894
16899
 
16895
16900
  // src/hooks/pre-tool-use.ts
16901
+ var PLAN_MODE_DEBUG_LOG = join5(homedir4(), ".config", "opencode", "plan-mode-debug.log");
16902
+ function debugPlanMode(data) {
16903
+ try {
16904
+ const line = `${new Date().toISOString()} ${JSON.stringify(data)}
16905
+ `;
16906
+ appendFileSync2(PLAN_MODE_DEBUG_LOG, line, "utf8");
16907
+ } catch {}
16908
+ }
16896
16909
  var NODE_COMMAND_RE = /^(npm|pnpm|yarn|bun|npx|bunx|node|tsc|tsx|vite|next|nuxt|vitest|jest|eslint|prettier)\b/;
16897
16910
  var NODE_MODULES_BIN_RE = /node_modules\/\.bin\//;
16898
16911
  var PLAN_MODE_ALWAYS_BLOCKED = new Set(["edit", "write", "patch"]);
@@ -16916,13 +16929,14 @@ function resolveTargetAgent(args) {
16916
16929
  function isBlockedInPlanMode(tool, args) {
16917
16930
  if (PLAN_MODE_ALWAYS_BLOCKED.has(tool))
16918
16931
  return true;
16932
+ if (tool === "delegate" || tool.startsWith("delegation"))
16933
+ return false;
16919
16934
  const target = resolveTargetAgent(args);
16920
16935
  if (target) {
16921
16936
  return !PLAN_MODE_ALLOWED_AGENTS.has(target);
16922
16937
  }
16923
- if (tool === "task" || tool.startsWith("task_") || tool === "delegate" || tool.startsWith("delegate")) {
16938
+ if (tool === "task" || tool.startsWith("task_"))
16924
16939
  return true;
16925
- }
16926
16940
  return false;
16927
16941
  }
16928
16942
  function isNodeCommand(command) {
@@ -16946,10 +16960,20 @@ function createPreToolUseHook(config2, runtime, profile) {
16946
16960
  runtime.incrementToolCount(sessionID);
16947
16961
  }
16948
16962
  if (sessionID && agent && PRIMARY_AGENTS.has(agent) && tool && runtime.getPlanMode(sessionID) === "planning") {
16963
+ const target = resolveTargetAgent(args);
16949
16964
  const blocked = isBlockedInPlanMode(tool, args);
16965
+ debugPlanMode({
16966
+ tool,
16967
+ args: Object.keys(args),
16968
+ argsSnapshot: JSON.parse(JSON.stringify(args, (_, v) => typeof v === "string" && v.length > 80 ? `${v.slice(0, 80)}...` : v)),
16969
+ target,
16970
+ blocked,
16971
+ rawInput: typeof input === "object" && input ? Object.keys(input) : "not-object"
16972
+ });
16950
16973
  if (blocked) {
16951
16974
  const count = runtime.incrementPlanModeBlock(sessionID);
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.";
16975
+ const isTaskBlocked = tool === "task" || tool.startsWith("task_");
16976
+ const msg = isTaskBlocked ? `[PlanMode] task tool is blocked in planning mode. For read-only workers (rajdhani, ginko, kaiki, odokawa), use delegate instead of task. The user will /go to start execution.` : 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.";
16953
16977
  throw new BlockingHookError(msg);
16954
16978
  }
16955
16979
  }
@@ -17475,7 +17499,7 @@ function createSessionEndHook(runtime) {
17475
17499
 
17476
17500
  // src/hooks/session-start.ts
17477
17501
  import { existsSync as existsSync6 } from "fs";
17478
- import { join as join5 } from "path";
17502
+ import { join as join6 } from "path";
17479
17503
  function detectProjectDocs(directory) {
17480
17504
  const candidates = [
17481
17505
  "AGENTS.md",
@@ -17483,7 +17507,7 @@ function detectProjectDocs(directory) {
17483
17507
  "CONTRIBUTING.md",
17484
17508
  "ARCHITECTURE.md"
17485
17509
  ];
17486
- return candidates.filter((name) => existsSync6(join5(directory, name)));
17510
+ return candidates.filter((name) => existsSync6(join6(directory, name)));
17487
17511
  }
17488
17512
  function buildResourceInjection(runtime, directory) {
17489
17513
  const parts = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-pair-autonomy",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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",