@sagentlab/navarch-runtime 0.1.3 → 0.1.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.
- package/dist/adapters/claude.cjs +24 -0
- package/package.json +1 -1
package/dist/adapters/claude.cjs
CHANGED
|
@@ -4,6 +4,17 @@ exports.claudeCodeAdapter = void 0;
|
|
|
4
4
|
exports.runClaudeCodeAdapter = runClaudeCodeAdapter;
|
|
5
5
|
const node_child_process_1 = require("node:child_process");
|
|
6
6
|
const exit_conditions_cjs_1 = require("../exit-conditions.cjs");
|
|
7
|
+
const NAVARCH_MCP_ALLOWED_TOOLS = [
|
|
8
|
+
"mcp__navarch__task_comment",
|
|
9
|
+
"mcp__navarch__record_decision",
|
|
10
|
+
"mcp__navarch__request_approval",
|
|
11
|
+
"mcp__navarch__register_resource",
|
|
12
|
+
"mcp__navarch__create_task",
|
|
13
|
+
"mcp__navarch__list_triage_tasks",
|
|
14
|
+
"mcp__navarch__groom_triage_task",
|
|
15
|
+
"mcp__navarch__defer_triage_task",
|
|
16
|
+
"mcp__navarch__file_pr_review",
|
|
17
|
+
];
|
|
7
18
|
/**
|
|
8
19
|
* Headless Claude Code adapter (project-plan.md §3.9 / implementation-plan.md
|
|
9
20
|
* WP-07): `claude -p "<context bundle>" --mcp-config platform-mcp.json
|
|
@@ -28,6 +39,14 @@ async function runClaudeCodeAdapter(options) {
|
|
|
28
39
|
const args = ["-p", options.prompt];
|
|
29
40
|
if (options.mcpConfigPath) {
|
|
30
41
|
args.push("--mcp-config", options.mcpConfigPath);
|
|
42
|
+
// Headless Claude cannot pause for an interactive permission prompt. The
|
|
43
|
+
// Navarch server already scopes every call to the authenticated lease and
|
|
44
|
+
// enforces task/project authorization, so pre-approve exactly its known
|
|
45
|
+
// tools instead of bypassing Claude permissions globally.
|
|
46
|
+
if (!options.extraArgs.includes("--allowedTools") &&
|
|
47
|
+
!options.extraArgs.includes("--allowed-tools")) {
|
|
48
|
+
args.push("--allowedTools", NAVARCH_MCP_ALLOWED_TOOLS.join(","));
|
|
49
|
+
}
|
|
31
50
|
}
|
|
32
51
|
// Only append the default when the caller hasn't already asked for a
|
|
33
52
|
// specific --output-format (extraArgs wins so an operator can opt back
|
|
@@ -70,6 +89,11 @@ async function runOnHost(options, args) {
|
|
|
70
89
|
cwd: options.cwd,
|
|
71
90
|
env: { ...process.env, ...options.env },
|
|
72
91
|
});
|
|
92
|
+
// `claude -p` checks stdin for an additional piped prompt. Node opens a
|
|
93
|
+
// pipe by default, so close it immediately when the complete prompt was
|
|
94
|
+
// supplied as an argument. Leaving it open makes Claude wait and emit a
|
|
95
|
+
// "no stdin data received" warning that the runtime treats as failure.
|
|
96
|
+
child.stdin?.end();
|
|
73
97
|
const timer = setTimeout(() => {
|
|
74
98
|
timedOut = true;
|
|
75
99
|
child.kill("SIGKILL");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sagentlab/navarch-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Navarch machine-side session manager: registers a machine, claims tasks from the control-plane dispatcher, runs them via the Claude Code or Codex adapter, and reports results back.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|