@hanhnd/agent-kit 1.0.22 → 1.0.24
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/README.md +68 -33
- package/dist/kit-server.js +46 -27
- package/dist/tools/agent.d.ts +1 -1
- package/dist/tools/agent.js +48 -32
- package/dist/utils/utils.js +2 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
# Agent-Kit
|
|
2
2
|
|
|
3
|
-
**Super Engineer** — a team of specialized AI agents for software development. Brainstorm ideas, plan implementations, write code, and review PRs using a structured multi-agent workflow
|
|
3
|
+
**Super Engineer** — a team of specialized AI agents for software development. Brainstorm ideas, plan implementations, write code, and review PRs using a structured multi-agent workflow.
|
|
4
4
|
|
|
5
5
|
## What It Does
|
|
6
6
|
|
|
7
7
|
### Commands
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
| `/
|
|
14
|
-
| `/
|
|
15
|
-
| `/
|
|
16
|
-
| `/
|
|
17
|
-
| `/
|
|
18
|
-
| `/
|
|
19
|
-
| `/
|
|
20
|
-
| `/
|
|
21
|
-
| `/
|
|
22
|
-
| `/
|
|
23
|
-
| `/
|
|
24
|
-
| `/
|
|
25
|
-
| `/
|
|
26
|
-
| `/
|
|
27
|
-
| `/
|
|
9
|
+
Agent Kit ships these workflows as skills. In Claude Code, invoke them as slash commands such as `/plan ...`. In Codex or Gemini, ask the agent to use Agent Kit or the named skill, for example: `Use Agent Kit plan for this change`.
|
|
10
|
+
|
|
11
|
+
| Skill / Command | Description |
|
|
12
|
+
| -------------------------------- | ------------------------------------------------------------------ |
|
|
13
|
+
| `/brainstorm [idea]` | Turn a raw idea into an engineer-ready design brief |
|
|
14
|
+
| `/scenario [artifact]` | Stress-test requirements, plans, tickets, or reviews for risks |
|
|
15
|
+
| `/clarify <file or task>` | Resolve requirement gaps using codebase evidence |
|
|
16
|
+
| `/plan [file or idea]` | Create a detailed implementation blueprint |
|
|
17
|
+
| `/investigate [issue]` | Trace bugs, errors, or unexpected behavior to root cause |
|
|
18
|
+
| `/code [plan or report]` | Implement from a WBS plan or investigation report |
|
|
19
|
+
| `/test [intent]` | Add or update focused tests after implementation intent exists |
|
|
20
|
+
| `/code-review [diff or target]` | Review diffs, PRs, or commits with evidence-backed findings |
|
|
21
|
+
| `/review [base]` | Review local staged and unstaged changes |
|
|
22
|
+
| `/review-pr [PR URL]` | Fetch PR/Jira context, check out the branch, and run code review |
|
|
23
|
+
| `/code-simplify [target]` | Improve readability without changing behavior or public shape |
|
|
24
|
+
| `/code-refactor [target]` | Analyze structural refactors and produce a refactor proposal |
|
|
25
|
+
| `/validate [artifact]` | Validate artifacts directly or by appending `with /validate` |
|
|
26
|
+
| `/research [topic]` | Produce source-backed technical research |
|
|
27
|
+
| `/debate [subject]` | Run adversarial validation of an analysis, review, or plan |
|
|
28
|
+
| `/ticket [ID]` | Fetch a Jira ticket and route it into the planning pipeline |
|
|
29
|
+
| `/init` | Extract project DNA for downstream coding and planning workflows |
|
|
30
|
+
| `/orchestrate [file or idea]` | Decompose cross-service work into scoped handoff briefs |
|
|
31
|
+
| `/delegate <agent> <task>` | Delegate to Gemini, Claude, or Codex CLI with optional handoff |
|
|
32
|
+
| `/wiki [compile\|query\|lint]` | Maintain and query the persistent project knowledge wiki |
|
|
28
33
|
|
|
29
34
|
---
|
|
30
35
|
|
|
@@ -46,9 +51,9 @@ You don't need to run the wiki manually. Five hooks keep it fed automatically:
|
|
|
46
51
|
|
|
47
52
|
| Command | Description |
|
|
48
53
|
| -------------------------------- | --------------------------------------------------------------------- |
|
|
49
|
-
| `/
|
|
50
|
-
| `/
|
|
51
|
-
| `/
|
|
54
|
+
| `/wiki` or `/wiki compile` | Ingest raw inbox + conversation exports → build/update wiki pages |
|
|
55
|
+
| `/wiki query {question}` | Search the wiki and synthesize a cited answer |
|
|
56
|
+
| `/wiki lint` | Health-check: broken links, orphan pages, contradictions, stale inbox |
|
|
52
57
|
|
|
53
58
|
### Directory Structure
|
|
54
59
|
|
|
@@ -58,7 +63,7 @@ You don't need to run the wiki manually. Five hooks keep it fed automatically:
|
|
|
58
63
|
│ ├── inbox.md # Auto-appended by PostToolUse hook (handoff logs)
|
|
59
64
|
│ └── conv_*.md # Exported by PreCompact hook (conversation transcripts)
|
|
60
65
|
├── compiled/
|
|
61
|
-
│ └── *.md # Structured wiki pages built by /
|
|
66
|
+
│ └── *.md # Structured wiki pages built by /wiki compile
|
|
62
67
|
└── archive/
|
|
63
68
|
└── *.md # Old raw files moved here after compilation
|
|
64
69
|
```
|
|
@@ -69,12 +74,27 @@ You don't need to run the wiki manually. Five hooks keep it fed automatically:
|
|
|
69
74
|
|
|
70
75
|
### Option 1: Install via GitHub (Recommended)
|
|
71
76
|
|
|
77
|
+
Claude Code:
|
|
78
|
+
|
|
72
79
|
```bash
|
|
73
80
|
claude plugin marketplace add https://github.com/hanh-nd/agent-kit
|
|
74
81
|
claude plugin install agent-kit
|
|
75
82
|
```
|
|
76
83
|
|
|
77
|
-
|
|
84
|
+
Codex:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
codex plugin marketplace add https://github.com/hanh-nd/agent-kit.git
|
|
88
|
+
codex
|
|
89
|
+
/plugins # then choose agent-kit
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For Codex hooks, add this to `~/.codex/config.toml`:
|
|
93
|
+
|
|
94
|
+
```toml
|
|
95
|
+
[features]
|
|
96
|
+
hooks = true
|
|
97
|
+
```
|
|
78
98
|
|
|
79
99
|
**Add credentials** to `~/.claude/credentials` (like `~/.aws/credentials`):
|
|
80
100
|
|
|
@@ -114,14 +134,29 @@ npm run build
|
|
|
114
134
|
|
|
115
135
|
**2. Register the plugin**
|
|
116
136
|
|
|
137
|
+
Claude Code:
|
|
138
|
+
|
|
117
139
|
```bash
|
|
118
140
|
claude plugin marketplace add /absolute/path/to/agent-kit
|
|
119
141
|
claude plugin install agent-kit
|
|
120
142
|
```
|
|
121
143
|
|
|
122
|
-
|
|
144
|
+
Codex:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
codex plugin marketplace add /absolute/path/to/agent-kit
|
|
148
|
+
codex
|
|
149
|
+
/plugins # then choose agent-kit
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
For Codex hooks, add this to `~/.codex/config.toml`:
|
|
153
|
+
|
|
154
|
+
```toml
|
|
155
|
+
[features]
|
|
156
|
+
hooks = true
|
|
157
|
+
```
|
|
123
158
|
|
|
124
|
-
**3. Add credentials** to `~/.claude/credentials
|
|
159
|
+
**3. Add credentials** to `~/.claude/credentials` for MCP integrations:
|
|
125
160
|
|
|
126
161
|
```bash
|
|
127
162
|
touch ~/.claude/credentials && chmod 600 ~/.claude/credentials
|
|
@@ -140,14 +175,14 @@ BITBUCKET_DEFAULT_WORKSPACE = your-default-workspace-slug
|
|
|
140
175
|
**4. Verify**
|
|
141
176
|
|
|
142
177
|
```
|
|
143
|
-
/
|
|
178
|
+
/brainstorm test idea
|
|
144
179
|
```
|
|
145
180
|
|
|
146
181
|
---
|
|
147
182
|
|
|
148
183
|
### Option 3: Install as Gemini Extension (Optional)
|
|
149
184
|
|
|
150
|
-
If you want to reuse the commands with [Gemini CLI](https://geminicli.com) (for `/
|
|
185
|
+
If you want to reuse the commands with [Gemini CLI](https://geminicli.com) (for `/delegate` to Gemini), install it using:
|
|
151
186
|
|
|
152
187
|
```bash
|
|
153
188
|
git clone https://github.com/hanh-nd/agent-kit.git
|
|
@@ -167,14 +202,14 @@ npm run build
|
|
|
167
202
|
npm run dev
|
|
168
203
|
```
|
|
169
204
|
|
|
170
|
-
The MCP server source is in `src/`. Agent personas are in `agents/`.
|
|
205
|
+
The MCP server source is in `src/`. Agent personas are in `agents/`. Canonical skill modules are in `skills/`; `npm run build:skills` generates provider-safe copies into `.claude/skills/`, `.codex/skills/`, and `.gemini/skills/`.
|
|
171
206
|
|
|
172
207
|
---
|
|
173
208
|
|
|
174
209
|
## Requirements
|
|
175
210
|
|
|
176
211
|
- Node.js 18+
|
|
177
|
-
- Claude Code
|
|
212
|
+
- Claude Code, Codex, or Gemini CLI
|
|
178
213
|
|
|
179
214
|
---
|
|
180
215
|
|
|
@@ -184,7 +219,7 @@ Credentials are stored in `~/.claude/credentials` (INI format). Keys can also be
|
|
|
184
219
|
|
|
185
220
|
### Jira (via Atlassian REST API)
|
|
186
221
|
|
|
187
|
-
Used by `/
|
|
222
|
+
Used by `/ticket` and `/review-pr`.
|
|
188
223
|
|
|
189
224
|
| Key | Description |
|
|
190
225
|
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -194,7 +229,7 @@ Used by `/ak:ticket` and `/ak:review-pr`.
|
|
|
194
229
|
|
|
195
230
|
### Bitbucket Cloud (via Bitbucket REST API)
|
|
196
231
|
|
|
197
|
-
Used by `/
|
|
232
|
+
Used by `/review-pr`.
|
|
198
233
|
|
|
199
234
|
| Key | Description |
|
|
200
235
|
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
package/dist/kit-server.js
CHANGED
|
@@ -20995,7 +20995,7 @@ import * as path from "path";
|
|
|
20995
20995
|
|
|
20996
20996
|
// src/utils/utils.ts
|
|
20997
20997
|
function getWorkspaceRoot() {
|
|
20998
|
-
return process.env.WORKSPACE_DIR || process.env.CLAUDE_WORKSPACE || process.env.GEMINI_WORKSPACE || process.env.INIT_CWD || process.env.PWD || process.cwd();
|
|
20998
|
+
return process.env.WORKSPACE_DIR || process.env.CODEX_WORKSPACE || process.env.CODEX_PROJECT_DIR || process.env.CLAUDE_WORKSPACE || process.env.GEMINI_WORKSPACE || process.env.INIT_CWD || process.env.PWD || process.cwd();
|
|
20999
20999
|
}
|
|
21000
21000
|
function mcpText(text) {
|
|
21001
21001
|
return { content: [{ type: "text", text }] };
|
|
@@ -21154,6 +21154,30 @@ function sanitizeOutput(text) {
|
|
|
21154
21154
|
// src/tools/agent.ts
|
|
21155
21155
|
var AGENT_TIMEOUT = parseInt(process.env.KIT_AGENT_TIMEOUT || "300000", 10);
|
|
21156
21156
|
var jobRegistry = /* @__PURE__ */ new Map();
|
|
21157
|
+
var INSTALL_HINTS = {
|
|
21158
|
+
gemini: "Install Gemini CLI: https://github.com/google-gemini/gemini-cli",
|
|
21159
|
+
claude: "Install Claude CLI: npm install -g @anthropic-ai/claude-code",
|
|
21160
|
+
codex: "Install Codex CLI: npm install -g @openai/codex"
|
|
21161
|
+
};
|
|
21162
|
+
function agentArgs(agent, prompt, workspaceRoot) {
|
|
21163
|
+
switch (agent) {
|
|
21164
|
+
case "gemini":
|
|
21165
|
+
return ["-y", "-p", prompt];
|
|
21166
|
+
case "claude":
|
|
21167
|
+
return ["--dangerously-skip-permissions", "-p", prompt];
|
|
21168
|
+
case "codex":
|
|
21169
|
+
return [
|
|
21170
|
+
"exec",
|
|
21171
|
+
"--ask-for-approval",
|
|
21172
|
+
"never",
|
|
21173
|
+
"--sandbox",
|
|
21174
|
+
"workspace-write",
|
|
21175
|
+
"--cd",
|
|
21176
|
+
workspaceRoot,
|
|
21177
|
+
prompt
|
|
21178
|
+
];
|
|
21179
|
+
}
|
|
21180
|
+
}
|
|
21157
21181
|
function taskSlug(task) {
|
|
21158
21182
|
return task.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).slice(0, 6).join("-").slice(0, 48);
|
|
21159
21183
|
}
|
|
@@ -21176,9 +21200,9 @@ ${"\u2500".repeat(60)}
|
|
|
21176
21200
|
function registerAgentTools(server2) {
|
|
21177
21201
|
server2.tool(
|
|
21178
21202
|
"kit_trigger_agent",
|
|
21179
|
-
"!Important: Trigger only when user explicitly asks to delegate a task to an external agent CLI (gemini or
|
|
21203
|
+
"!Important: Trigger only when user explicitly asks to delegate a task to an external agent CLI (gemini, claude, or codex). The task can be a direct message or a path to a handoff file (.agent-kit/handoffs/plans/plan-xyz.md).",
|
|
21180
21204
|
{
|
|
21181
|
-
agent: external_exports.enum(["gemini", "claude"]).describe('The agent CLI to invoke: "gemini" or "
|
|
21205
|
+
agent: external_exports.enum(["gemini", "claude", "codex"]).describe('The agent CLI to invoke: "gemini", "claude", or "codex"'),
|
|
21182
21206
|
task: external_exports.string().describe(
|
|
21183
21207
|
'Task message or path to a handoff file (e.g., ".agent-kit/handoffs/plans/plan-xyz.md")'
|
|
21184
21208
|
)
|
|
@@ -21199,30 +21223,26 @@ function registerAgentTools(server2) {
|
|
|
21199
21223
|
return mcpText(`Error reading task file: ${err}`);
|
|
21200
21224
|
}
|
|
21201
21225
|
}
|
|
21202
|
-
let usedAgent = agent;
|
|
21203
|
-
let fallbackReason;
|
|
21204
21226
|
if (!commandExists(agent)) {
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
return mcpJson({
|
|
21212
|
-
agent,
|
|
21213
|
-
status: "error",
|
|
21214
|
-
output: "",
|
|
21215
|
-
error: `Neither ${agent} nor the fallback agent CLI is installed. ${installHint}`
|
|
21216
|
-
});
|
|
21217
|
-
}
|
|
21227
|
+
return mcpJson({
|
|
21228
|
+
agent,
|
|
21229
|
+
status: "error",
|
|
21230
|
+
output: "",
|
|
21231
|
+
error: `${agent} CLI is not installed. ${INSTALL_HINTS[agent]}`
|
|
21232
|
+
});
|
|
21218
21233
|
}
|
|
21219
|
-
const
|
|
21220
|
-
const { logPath: lp, logStream } = initAgentLog(workspaceRoot, taskSlug(task),
|
|
21234
|
+
const args = agentArgs(agent, prompt, workspaceRoot);
|
|
21235
|
+
const { logPath: lp, logStream } = initAgentLog(workspaceRoot, taskSlug(task), agent);
|
|
21221
21236
|
logPath = lp;
|
|
21222
21237
|
const jobId = randomUUID();
|
|
21223
|
-
const child = spawn(
|
|
21238
|
+
const child = spawn(agent, args, {
|
|
21224
21239
|
cwd: workspaceRoot,
|
|
21225
|
-
env: {
|
|
21240
|
+
env: {
|
|
21241
|
+
...process.env,
|
|
21242
|
+
CODEX_PROJECT_DIR: workspaceRoot,
|
|
21243
|
+
CODEX_WORKSPACE: workspaceRoot,
|
|
21244
|
+
GEMINI_WORKSPACE: workspaceRoot
|
|
21245
|
+
},
|
|
21226
21246
|
detached: process.platform !== "win32"
|
|
21227
21247
|
});
|
|
21228
21248
|
const killTree = (sig) => {
|
|
@@ -21237,7 +21257,7 @@ function registerAgentTools(server2) {
|
|
|
21237
21257
|
}
|
|
21238
21258
|
};
|
|
21239
21259
|
job = {
|
|
21240
|
-
agent
|
|
21260
|
+
agent,
|
|
21241
21261
|
process: child,
|
|
21242
21262
|
startedAt: /* @__PURE__ */ new Date(),
|
|
21243
21263
|
chunks: [],
|
|
@@ -21270,11 +21290,10 @@ function registerAgentTools(server2) {
|
|
|
21270
21290
|
child.on("error", reject);
|
|
21271
21291
|
});
|
|
21272
21292
|
return mcpJson({
|
|
21273
|
-
agent
|
|
21274
|
-
status:
|
|
21293
|
+
agent,
|
|
21294
|
+
status: "success",
|
|
21275
21295
|
log: logPath,
|
|
21276
|
-
output: sanitizeOutput(job.chunks.join(""))
|
|
21277
|
-
...fallbackReason && { fallback_reason: fallbackReason }
|
|
21296
|
+
output: sanitizeOutput(job.chunks.join(""))
|
|
21278
21297
|
});
|
|
21279
21298
|
} catch (error2) {
|
|
21280
21299
|
if (extra.signal.aborted) {
|
package/dist/tools/agent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agent Delegation Tools - Invoke external agent CLIs (Gemini, Claude)
|
|
2
|
+
* Agent Delegation Tools - Invoke external agent CLIs (Gemini, Claude, Codex)
|
|
3
3
|
* Supports handoff file injection and automatic fallback
|
|
4
4
|
*/
|
|
5
5
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
package/dist/tools/agent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agent Delegation Tools - Invoke external agent CLIs (Gemini, Claude)
|
|
2
|
+
* Agent Delegation Tools - Invoke external agent CLIs (Gemini, Claude, Codex)
|
|
3
3
|
* Supports handoff file injection and automatic fallback
|
|
4
4
|
*/
|
|
5
5
|
import { spawn } from 'child_process';
|
|
@@ -12,6 +12,30 @@ import { commandExists, sanitizeOutput, validatePath } from './security.js';
|
|
|
12
12
|
// Configurable timeout via environment variable (default: 5 minutes)
|
|
13
13
|
const AGENT_TIMEOUT = parseInt(process.env.KIT_AGENT_TIMEOUT || '300000', 10);
|
|
14
14
|
const jobRegistry = new Map();
|
|
15
|
+
const INSTALL_HINTS = {
|
|
16
|
+
gemini: 'Install Gemini CLI: https://github.com/google-gemini/gemini-cli',
|
|
17
|
+
claude: 'Install Claude CLI: npm install -g @anthropic-ai/claude-code',
|
|
18
|
+
codex: 'Install Codex CLI: npm install -g @openai/codex',
|
|
19
|
+
};
|
|
20
|
+
function agentArgs(agent, prompt, workspaceRoot) {
|
|
21
|
+
switch (agent) {
|
|
22
|
+
case 'gemini':
|
|
23
|
+
return ['-y', '-p', prompt];
|
|
24
|
+
case 'claude':
|
|
25
|
+
return ['--dangerously-skip-permissions', '-p', prompt];
|
|
26
|
+
case 'codex':
|
|
27
|
+
return [
|
|
28
|
+
'exec',
|
|
29
|
+
'--ask-for-approval',
|
|
30
|
+
'never',
|
|
31
|
+
'--sandbox',
|
|
32
|
+
'workspace-write',
|
|
33
|
+
'--cd',
|
|
34
|
+
workspaceRoot,
|
|
35
|
+
prompt,
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
15
39
|
function taskSlug(task) {
|
|
16
40
|
return task
|
|
17
41
|
.toLowerCase()
|
|
@@ -34,8 +58,10 @@ function initAgentLog(workspaceRoot, slug, agent) {
|
|
|
34
58
|
return { logPath: path.relative(workspaceRoot, logFile), logStream };
|
|
35
59
|
}
|
|
36
60
|
export function registerAgentTools(server) {
|
|
37
|
-
server.tool('kit_trigger_agent', '!Important: Trigger only when user explicitly asks to delegate a task to an external agent CLI (gemini or
|
|
38
|
-
agent: z
|
|
61
|
+
server.tool('kit_trigger_agent', '!Important: Trigger only when user explicitly asks to delegate a task to an external agent CLI (gemini, claude, or codex). The task can be a direct message or a path to a handoff file (.agent-kit/handoffs/plans/plan-xyz.md).', {
|
|
62
|
+
agent: z
|
|
63
|
+
.enum(['gemini', 'claude', 'codex'])
|
|
64
|
+
.describe('The agent CLI to invoke: "gemini", "claude", or "codex"'),
|
|
39
65
|
task: z
|
|
40
66
|
.string()
|
|
41
67
|
.describe('Task message or path to a handoff file (e.g., ".agent-kit/handoffs/plans/plan-xyz.md")'),
|
|
@@ -57,40 +83,31 @@ export function registerAgentTools(server) {
|
|
|
57
83
|
return mcpText(`Error reading task file: ${err}`);
|
|
58
84
|
}
|
|
59
85
|
}
|
|
60
|
-
// Resolve agent with fallback
|
|
61
|
-
let usedAgent = agent;
|
|
62
|
-
let fallbackReason;
|
|
63
86
|
if (!commandExists(agent)) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const installHint = agent === 'gemini'
|
|
71
|
-
? 'Install Gemini CLI: https://github.com/google-gemini/gemini-cli'
|
|
72
|
-
: 'Install Claude CLI: npm install -g @anthropic-ai/claude-code';
|
|
73
|
-
return mcpJson({
|
|
74
|
-
agent,
|
|
75
|
-
status: 'error',
|
|
76
|
-
output: '',
|
|
77
|
-
error: `Neither ${agent} nor the fallback agent CLI is installed. ${installHint}`,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
87
|
+
return mcpJson({
|
|
88
|
+
agent,
|
|
89
|
+
status: 'error',
|
|
90
|
+
output: '',
|
|
91
|
+
error: `${agent} CLI is not installed. ${INSTALL_HINTS[agent]}`,
|
|
92
|
+
});
|
|
80
93
|
}
|
|
81
94
|
// Gemini: -y (--yolo) for auto-accept, -p for headless prompt
|
|
82
95
|
// Claude: --dangerously-skip-permissions for auto-accept, -p/--print for headless
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const { logPath: lp, logStream } = initAgentLog(workspaceRoot, taskSlug(task), usedAgent);
|
|
96
|
+
// Codex: exec for headless prompt, never ask for approval, workspace-write sandbox
|
|
97
|
+
const args = agentArgs(agent, prompt, workspaceRoot);
|
|
98
|
+
const { logPath: lp, logStream } = initAgentLog(workspaceRoot, taskSlug(task), agent);
|
|
87
99
|
logPath = lp;
|
|
88
100
|
const jobId = randomUUID();
|
|
89
101
|
// detached=true on Unix creates a new process group so we can kill the
|
|
90
102
|
// entire tree (CLI + its sub-agents) with process.kill(-pid, signal).
|
|
91
|
-
const child = spawn(
|
|
103
|
+
const child = spawn(agent, args, {
|
|
92
104
|
cwd: workspaceRoot,
|
|
93
|
-
env: {
|
|
105
|
+
env: {
|
|
106
|
+
...process.env,
|
|
107
|
+
CODEX_PROJECT_DIR: workspaceRoot,
|
|
108
|
+
CODEX_WORKSPACE: workspaceRoot,
|
|
109
|
+
GEMINI_WORKSPACE: workspaceRoot,
|
|
110
|
+
},
|
|
94
111
|
detached: process.platform !== 'win32',
|
|
95
112
|
});
|
|
96
113
|
const killTree = (sig) => {
|
|
@@ -107,7 +124,7 @@ export function registerAgentTools(server) {
|
|
|
107
124
|
}
|
|
108
125
|
};
|
|
109
126
|
job = {
|
|
110
|
-
agent
|
|
127
|
+
agent,
|
|
111
128
|
process: child,
|
|
112
129
|
startedAt: new Date(),
|
|
113
130
|
chunks: [],
|
|
@@ -142,11 +159,10 @@ export function registerAgentTools(server) {
|
|
|
142
159
|
child.on('error', reject);
|
|
143
160
|
});
|
|
144
161
|
return mcpJson({
|
|
145
|
-
agent
|
|
146
|
-
status:
|
|
162
|
+
agent,
|
|
163
|
+
status: 'success',
|
|
147
164
|
log: logPath,
|
|
148
165
|
output: sanitizeOutput(job.chunks.join('')),
|
|
149
|
-
...(fallbackReason && { fallback_reason: fallbackReason }),
|
|
150
166
|
});
|
|
151
167
|
}
|
|
152
168
|
catch (error) {
|
package/dist/utils/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanhnd/agent-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Super Engineer - Team of AI Agents for software development (Claude Code Plugin)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/kit-server.js",
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
"url": "git+https://github.com/hanh-nd/agent-kit.git"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
+
"build:skills": "node scripts/build-skills.js",
|
|
21
22
|
"prepublishOnly": "npm run build",
|
|
22
|
-
"build": "tsc && npm run bundle",
|
|
23
|
+
"build": "npm run build:skills && tsc && npm run bundle",
|
|
23
24
|
"bundle": "esbuild src/kit-server.ts --bundle --platform=node --format=esm --outfile=dist/kit-server.js --external:node:* --banner:js=\"import { createRequire } from 'module'; const require = createRequire(import.meta.url);\"",
|
|
24
25
|
"dev": "tsc --watch",
|
|
25
26
|
"test": "node --test tests/*.test.js"
|