@windyroad/architect 0.23.0 → 0.23.1
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.
|
@@ -85,7 +85,7 @@ if messages:
|
|
|
85
85
|
run_side_effect architect-mark-reviewed.sh || true
|
|
86
86
|
run_side_effect architect-slide-marker.sh || true
|
|
87
87
|
;;
|
|
88
|
-
collaborationspawn_agent|collaborationinterrupt_agent|spawn_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__close_agent)
|
|
88
|
+
collaboration.spawn_agent|collaboration.wait_agent|collaboration.interrupt_agent|collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_agent|interrupt_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__wait_agent|multi_agent_v1__close_agent)
|
|
89
89
|
printf '%s' "$INPUT" | node "$SCRIPT_DIR/codex-agent-completion.mjs"
|
|
90
90
|
;;
|
|
91
91
|
Edit|Write)
|
|
@@ -4,15 +4,11 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
|
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { CLOSE_TOOLS, SPAWN_TOOLS, WAIT_TOOLS, response } from "./lib/codex-completion-input.mjs";
|
|
7
8
|
|
|
8
9
|
const hookDir = dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
const role = "wr-architect:agent";
|
|
10
11
|
|
|
11
|
-
function response(input) {
|
|
12
|
-
if (typeof input.tool_response === "object" && input.tool_response) return input.tool_response;
|
|
13
|
-
try { return JSON.parse(input.tool_response); } catch { return {}; }
|
|
14
|
-
}
|
|
15
|
-
|
|
16
12
|
function riskDir(sessionId) {
|
|
17
13
|
return join(process.env.TMPDIR || "/tmp", `claude-risk-${sessionId}`);
|
|
18
14
|
}
|
|
@@ -50,6 +46,14 @@ function complete(input) {
|
|
|
50
46
|
});
|
|
51
47
|
}
|
|
52
48
|
|
|
49
|
+
function wait(input) {
|
|
50
|
+
const statuses = response(input).status;
|
|
51
|
+
if (!statuses || typeof statuses !== "object") return;
|
|
52
|
+
for (const [target, status] of Object.entries(statuses)) {
|
|
53
|
+
complete({ ...input, tool_input: { target }, tool_response: { previous_status: status } });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
let body = "";
|
|
54
58
|
process.stdin.setEncoding("utf8");
|
|
55
59
|
for await (const chunk of process.stdin) body += chunk;
|
|
@@ -57,5 +61,6 @@ let input;
|
|
|
57
61
|
try { input = JSON.parse(body); } catch { process.exit(0); }
|
|
58
62
|
if (!/^[A-Za-z0-9-]+$/.test(input.session_id || "")) process.exit(0);
|
|
59
63
|
|
|
60
|
-
if (
|
|
61
|
-
if (
|
|
64
|
+
if (SPAWN_TOOLS.has(input.tool_name)) remember(input);
|
|
65
|
+
if (CLOSE_TOOLS.has(input.tool_name)) complete(input);
|
|
66
|
+
if (WAIT_TOOLS.has(input.tool_name)) wait(input);
|
package/hooks/hooks.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{ "matcher": "Bash|Edit|Write|ExitPlanMode", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/architect-dispatch.sh pre-tool" }] }
|
|
13
13
|
],
|
|
14
14
|
"PostToolUse": [
|
|
15
|
-
{ "matcher": "Agent|Bash|Edit|Skill|Write|collaborationspawn_agent|collaborationinterrupt_agent|spawn_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__close_agent", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/architect-dispatch.sh post-tool" }] }
|
|
15
|
+
{ "matcher": "Agent|Bash|Edit|Skill|Write|collaboration.spawn_agent|collaboration.wait_agent|collaboration.interrupt_agent|collaborationspawn_agent|collaborationwait_agent|collaborationinterrupt_agent|spawn_agent|wait_agent|interrupt_agent|close_agent|multi_agent_v1__spawn_agent|multi_agent_v1__wait_agent|multi_agent_v1__close_agent", "hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/hooks/architect-dispatch.sh post-tool" }] }
|
|
16
16
|
]
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const SPAWN_TOOLS = new Set([
|
|
2
|
+
"collaboration.spawn_agent",
|
|
3
|
+
"collaborationspawn_agent",
|
|
4
|
+
"spawn_agent",
|
|
5
|
+
"multi_agent_v1__spawn_agent",
|
|
6
|
+
]);
|
|
7
|
+
|
|
8
|
+
export const WAIT_TOOLS = new Set([
|
|
9
|
+
"collaboration.wait_agent",
|
|
10
|
+
"collaborationwait_agent",
|
|
11
|
+
"wait_agent",
|
|
12
|
+
"multi_agent_v1__wait_agent",
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export const CLOSE_TOOLS = new Set([
|
|
16
|
+
"collaboration.interrupt_agent",
|
|
17
|
+
"collaborationinterrupt_agent",
|
|
18
|
+
"interrupt_agent",
|
|
19
|
+
"close_agent",
|
|
20
|
+
"multi_agent_v1__close_agent",
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
export function parsedResponse(value) {
|
|
24
|
+
if (Array.isArray(value)) {
|
|
25
|
+
const text = value
|
|
26
|
+
.filter((item) => item && typeof item === "object" && typeof item.text === "string")
|
|
27
|
+
.map((item) => item.text)
|
|
28
|
+
.join("\n");
|
|
29
|
+
return parsedResponse(text);
|
|
30
|
+
}
|
|
31
|
+
if (typeof value === "object" && value) return value;
|
|
32
|
+
try {
|
|
33
|
+
return parsedResponse(JSON.parse(value));
|
|
34
|
+
} catch {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function response(input) {
|
|
40
|
+
return parsedResponse(input?.tool_response);
|
|
41
|
+
}
|