opencode-pair-autonomy 1.0.3 → 1.0.4
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 +27 -4
- 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_")
|
|
16938
|
+
if (tool === "task" || tool.startsWith("task_"))
|
|
16924
16939
|
return true;
|
|
16925
|
-
}
|
|
16926
16940
|
return false;
|
|
16927
16941
|
}
|
|
16928
16942
|
function isNodeCommand(command) {
|
|
@@ -16946,7 +16960,16 @@ 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
16975
|
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.";
|
|
@@ -17475,7 +17498,7 @@ function createSessionEndHook(runtime) {
|
|
|
17475
17498
|
|
|
17476
17499
|
// src/hooks/session-start.ts
|
|
17477
17500
|
import { existsSync as existsSync6 } from "fs";
|
|
17478
|
-
import { join as
|
|
17501
|
+
import { join as join6 } from "path";
|
|
17479
17502
|
function detectProjectDocs(directory) {
|
|
17480
17503
|
const candidates = [
|
|
17481
17504
|
"AGENTS.md",
|
|
@@ -17483,7 +17506,7 @@ function detectProjectDocs(directory) {
|
|
|
17483
17506
|
"CONTRIBUTING.md",
|
|
17484
17507
|
"ARCHITECTURE.md"
|
|
17485
17508
|
];
|
|
17486
|
-
return candidates.filter((name) => existsSync6(
|
|
17509
|
+
return candidates.filter((name) => existsSync6(join6(directory, name)));
|
|
17487
17510
|
}
|
|
17488
17511
|
function buildResourceInjection(runtime, directory) {
|
|
17489
17512
|
const parts = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-pair-autonomy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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",
|