@draht/coding-agent 2026.3.2-9 → 2026.3.3
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/CHANGELOG.md +18 -0
- package/agents/architect.md +45 -0
- package/agents/debugger.md +57 -0
- package/agents/git-committer.md +46 -0
- package/agents/implementer.md +25 -0
- package/agents/reviewer.md +52 -0
- package/agents/security-auditor.md +61 -0
- package/agents/verifier.md +44 -0
- package/bin/draht-tools.cjs +20 -20
- package/dist/agents/architect.md +45 -0
- package/dist/agents/debugger.md +57 -0
- package/dist/agents/git-committer.md +46 -0
- package/dist/agents/implementer.md +25 -0
- package/dist/agents/reviewer.md +52 -0
- package/dist/agents/security-auditor.md +61 -0
- package/dist/agents/verifier.md +44 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +10 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/extensions/gsd-commands.ts +69 -4
- package/dist/extensions/subagent.ts +212 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/prompts/commands/discuss-phase.md +3 -3
- package/dist/prompts/commands/execute-phase.md +9 -9
- package/dist/prompts/commands/map-codebase.md +2 -2
- package/dist/prompts/commands/new-project.md +9 -9
- package/dist/prompts/commands/pause-work.md +2 -2
- package/dist/prompts/commands/plan-phase.md +5 -5
- package/dist/prompts/commands/progress.md +1 -1
- package/dist/prompts/commands/quick.md +4 -4
- package/dist/prompts/commands/resume-work.md +1 -1
- package/dist/prompts/commands/verify-work.md +4 -4
- package/extensions/gsd-commands.ts +69 -4
- package/extensions/subagent.ts +212 -9
- package/package.json +7 -6
- package/prompts/commands/discuss-phase.md +3 -3
- package/prompts/commands/execute-phase.md +9 -9
- package/prompts/commands/map-codebase.md +2 -2
- package/prompts/commands/new-project.md +9 -9
- package/prompts/commands/pause-work.md +2 -2
- package/prompts/commands/plan-phase.md +5 -5
- package/prompts/commands/progress.md +1 -1
- package/prompts/commands/quick.md +4 -4
- package/prompts/commands/resume-work.md +1 -1
- package/prompts/commands/verify-work.md +4 -4
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* /review <scope> — ad-hoc code review + security audit
|
|
14
14
|
* /fix <issue> — targeted fix plan for a failing task
|
|
15
15
|
* /quick <task> — one-shot implement + commit (skip full GSD)
|
|
16
|
-
* /
|
|
16
|
+
* /continue — pick up interrupted work from CONTINUE-HERE.md
|
|
17
17
|
* /status — show .planning/STATE.md overview
|
|
18
|
+
* /next-milestone — plan next milestone after current one is complete
|
|
18
19
|
* /new-project <name> [path] — create project dir, git init, scaffold .draht/
|
|
19
20
|
* /init-project — scaffold .draht/ in existing project
|
|
20
21
|
*/
|
|
@@ -183,9 +184,9 @@ After both complete, merge into a single prioritized findings report.`,
|
|
|
183
184
|
},
|
|
184
185
|
});
|
|
185
186
|
|
|
186
|
-
// ── /
|
|
187
|
-
pi.registerCommand("
|
|
188
|
-
description: "
|
|
187
|
+
// ── /continue ────────────────────────────────────────────────────────────
|
|
188
|
+
pi.registerCommand("continue", {
|
|
189
|
+
description: "Continue interrupted work — reads CONTINUE-HERE.md and picks up where we left off",
|
|
189
190
|
handler: async (_args, ctx) => {
|
|
190
191
|
if (isBusy(ctx, ctx.ui)) return;
|
|
191
192
|
|
|
@@ -241,6 +242,70 @@ After both complete, merge into a single prioritized findings report.`,
|
|
|
241
242
|
},
|
|
242
243
|
});
|
|
243
244
|
|
|
245
|
+
// ── /next-milestone ──────────────────────────────────────────────────────
|
|
246
|
+
pi.registerCommand("next-milestone", {
|
|
247
|
+
description: "Plan the next milestone after the current one is complete — review progress, update requirements, create new phases",
|
|
248
|
+
handler: async (_args, ctx) => {
|
|
249
|
+
if (isBusy(ctx, ctx.ui)) return;
|
|
250
|
+
|
|
251
|
+
const planningDir = path.join(ctx.cwd, ".planning");
|
|
252
|
+
const roadmapFile = path.join(planningDir, "ROADMAP.md");
|
|
253
|
+
const stateFile = path.join(planningDir, "STATE.md");
|
|
254
|
+
const requirementsFile = path.join(planningDir, "REQUIREMENTS.md");
|
|
255
|
+
|
|
256
|
+
if (!fs.existsSync(roadmapFile)) {
|
|
257
|
+
ctx.ui.notify("No .planning/ROADMAP.md found. Run /new-project first.", "warning");
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
let context = `\nROADMAP.md:\n${fs.readFileSync(roadmapFile, "utf-8")}`;
|
|
262
|
+
if (fs.existsSync(stateFile)) {
|
|
263
|
+
context += `\nSTATE.md:\n${fs.readFileSync(stateFile, "utf-8")}`;
|
|
264
|
+
}
|
|
265
|
+
if (fs.existsSync(requirementsFile)) {
|
|
266
|
+
context += `\nREQUIREMENTS.md:\n${fs.readFileSync(requirementsFile, "utf-8")}`;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Collect UAT and summary files for completed phases
|
|
270
|
+
const phasesDir = path.join(planningDir, "phases");
|
|
271
|
+
if (fs.existsSync(phasesDir)) {
|
|
272
|
+
for (const dir of fs.readdirSync(phasesDir)) {
|
|
273
|
+
const phaseDir = path.join(phasesDir, dir);
|
|
274
|
+
if (!fs.statSync(phaseDir).isDirectory()) continue;
|
|
275
|
+
for (const file of fs.readdirSync(phaseDir)) {
|
|
276
|
+
if (file.endsWith("-UAT.md") || file.endsWith("-SUMMARY.md")) {
|
|
277
|
+
context += `\n${dir}/${file}:\n${fs.readFileSync(path.join(phaseDir, file), "utf-8")}`;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
pi.sendUserMessage(
|
|
284
|
+
`Use the subagent tool to delegate to the architect agent with this task:
|
|
285
|
+
|
|
286
|
+
"We have completed a milestone. Your job is to plan the NEXT milestone.
|
|
287
|
+
|
|
288
|
+
1. Read the current ROADMAP.md and identify the completed milestone and its phases
|
|
289
|
+
2. Review all UAT reports and summaries to understand what was built
|
|
290
|
+
3. Review REQUIREMENTS.md — identify which v1 requirements are now satisfied and which remain
|
|
291
|
+
4. Assess if any v2 requirements should be promoted to the next milestone based on what we learned
|
|
292
|
+
5. Propose the next milestone with new phases:
|
|
293
|
+
- Each phase has a clear goal (outcome, not activity)
|
|
294
|
+
- Phases are ordered by dependency
|
|
295
|
+
- Map phases to remaining/new requirements
|
|
296
|
+
6. Update ROADMAP.md with the new milestone and phases
|
|
297
|
+
7. Update STATE.md to reflect milestone transition
|
|
298
|
+
8. Update REQUIREMENTS.md if requirements changed based on learnings
|
|
299
|
+
|
|
300
|
+
Present the proposed milestone for user approval before writing files.
|
|
301
|
+
|
|
302
|
+
Project context:${context}"
|
|
303
|
+
|
|
304
|
+
Set agentScope to "project".`,
|
|
305
|
+
);
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
|
|
244
309
|
// ── /new-project ─────────────────────────────────────────────────────────
|
|
245
310
|
pi.registerCommand("new-project", {
|
|
246
311
|
description: "Create a new project: mkdir, git init, scaffold .draht/. Usage: /new-project <name> [/base/path]",
|
|
@@ -16,13 +16,18 @@ import * as os from "node:os";
|
|
|
16
16
|
import * as path from "node:path";
|
|
17
17
|
import type { Message } from "@draht/ai";
|
|
18
18
|
import { StringEnum } from "@draht/ai";
|
|
19
|
-
import { type ExtensionAPI, getAgentDir, parseFrontmatter } from "@draht/coding-agent";
|
|
19
|
+
import { type ExtensionAPI, getAgentDir, getPackageDir, isBunBinary, parseFrontmatter } from "@draht/coding-agent";
|
|
20
|
+
import { Text } from "@draht/tui";
|
|
20
21
|
import { Type } from "@sinclair/typebox";
|
|
21
22
|
|
|
22
23
|
const MAX_PARALLEL = 8;
|
|
23
24
|
const MAX_CONCURRENCY = 4;
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
// Build the command to spawn a subagent process.
|
|
27
|
+
// Compiled Bun binary: process.execPath IS the CLI binary, args go directly.
|
|
28
|
+
// Source/dev mode: process.execPath is the runtime (bun/node), process.argv[1] is the CLI script.
|
|
25
29
|
const DRAHT_BIN = process.execPath;
|
|
30
|
+
const DRAHT_ARGS_PREFIX: string[] = isBunBinary ? [] : [process.argv[1]];
|
|
26
31
|
|
|
27
32
|
// ─── Agent discovery ────────────────────────────────────────────────────────
|
|
28
33
|
|
|
@@ -82,13 +87,20 @@ function findProjectAgentsDir(cwd: string): string | null {
|
|
|
82
87
|
type AgentScope = "user" | "project" | "both";
|
|
83
88
|
|
|
84
89
|
function discoverAgents(cwd: string, scope: AgentScope): AgentConfig[] {
|
|
90
|
+
// Shipped agents (bundled with the package) — lowest priority
|
|
91
|
+
const shippedDir = path.join(getPackageDir(), "agents");
|
|
92
|
+
const shippedAgents = loadAgentsFromDir(shippedDir, "user");
|
|
93
|
+
|
|
85
94
|
const userDir = path.join(getAgentDir(), "agents");
|
|
86
95
|
const projectDir = findProjectAgentsDir(cwd);
|
|
87
96
|
const userAgents = scope !== "project" ? loadAgentsFromDir(userDir, "user") : [];
|
|
88
97
|
const projectAgents = scope !== "user" && projectDir ? loadAgentsFromDir(projectDir, "project") : [];
|
|
98
|
+
|
|
99
|
+
// Priority: shipped < user < project
|
|
89
100
|
const map = new Map<string, AgentConfig>();
|
|
101
|
+
for (const a of shippedAgents) map.set(a.name, a);
|
|
90
102
|
for (const a of userAgents) map.set(a.name, a);
|
|
91
|
-
for (const a of projectAgents) map.set(a.name, a);
|
|
103
|
+
for (const a of projectAgents) map.set(a.name, a);
|
|
92
104
|
return Array.from(map.values());
|
|
93
105
|
}
|
|
94
106
|
|
|
@@ -127,12 +139,15 @@ function getFinalText(messages: Message[]): string {
|
|
|
127
139
|
return "";
|
|
128
140
|
}
|
|
129
141
|
|
|
142
|
+
type ProgressFn = (activity: string) => void;
|
|
143
|
+
|
|
130
144
|
async function runAgent(
|
|
131
145
|
cwd: string,
|
|
132
146
|
agent: AgentConfig,
|
|
133
147
|
task: string,
|
|
134
148
|
signal?: AbortSignal,
|
|
135
149
|
step?: number,
|
|
150
|
+
onProgress?: ProgressFn,
|
|
136
151
|
): Promise<RunResult> {
|
|
137
152
|
const args: string[] = ["--mode", "json", "-p", "--no-session"];
|
|
138
153
|
if (agent.model) args.push("--model", agent.model);
|
|
@@ -155,7 +170,7 @@ async function runAgent(
|
|
|
155
170
|
|
|
156
171
|
try {
|
|
157
172
|
const exitCode = await new Promise<number>((resolve) => {
|
|
158
|
-
const proc = spawn(DRAHT_BIN, args, { cwd, shell: false, stdio: ["ignore", "pipe", "pipe"] });
|
|
173
|
+
const proc = spawn(DRAHT_BIN, [...DRAHT_ARGS_PREFIX, ...args], { cwd, shell: false, stdio: ["ignore", "pipe", "pipe"] });
|
|
159
174
|
let buf = "";
|
|
160
175
|
|
|
161
176
|
const processLine = (line: string) => {
|
|
@@ -165,6 +180,23 @@ async function runAgent(
|
|
|
165
180
|
if ((event.type === "message_end" || event.type === "tool_result_end") && event.message) {
|
|
166
181
|
messages.push(event.message as Message);
|
|
167
182
|
}
|
|
183
|
+
// Stream activity updates to the parent
|
|
184
|
+
if (onProgress) {
|
|
185
|
+
if (event.type === "tool_execution_start") {
|
|
186
|
+
const toolArgs = event.args ?? {};
|
|
187
|
+
const detail = toolArgs.command || toolArgs.path || toolArgs.file_path || toolArgs.pattern || "";
|
|
188
|
+
const short = typeof detail === "string" && detail.length > 60 ? `${detail.slice(0, 60)}...` : detail;
|
|
189
|
+
onProgress(short ? `${event.toolName} ${short}` : event.toolName);
|
|
190
|
+
} else if (event.type === "text_delta") {
|
|
191
|
+
// Show first line of streaming text as activity
|
|
192
|
+
const text = event.text?.trim();
|
|
193
|
+
if (text) {
|
|
194
|
+
const firstLine = text.split("\n")[0];
|
|
195
|
+
const short = firstLine.length > 80 ? `${firstLine.slice(0, 80)}...` : firstLine;
|
|
196
|
+
onProgress(short);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
168
200
|
} catch {}
|
|
169
201
|
};
|
|
170
202
|
|
|
@@ -235,6 +267,17 @@ const Params = Type.Object({
|
|
|
235
267
|
),
|
|
236
268
|
});
|
|
237
269
|
|
|
270
|
+
// ─── Rendering helpers ──────────────────────────────────────────────────────
|
|
271
|
+
|
|
272
|
+
function truncateTask(task: string, maxLen = 120): string {
|
|
273
|
+
const oneLine = task.replace(/\n/g, " ").trim();
|
|
274
|
+
return oneLine.length > maxLen ? `${oneLine.slice(0, maxLen)}...` : oneLine;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
interface SubagentDetails {
|
|
278
|
+
status?: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
238
281
|
export default function (pi: ExtensionAPI) {
|
|
239
282
|
pi.registerTool({
|
|
240
283
|
name: "subagent",
|
|
@@ -243,7 +286,72 @@ export default function (pi: ExtensionAPI) {
|
|
|
243
286
|
"Delegate to specialized agents. single: {agent,task} | parallel: {tasks:[]} | chain: {chain:[]} with {previous} placeholder. agentScope: 'both' (default) uses project .draht/agents/ + global.",
|
|
244
287
|
parameters: Params,
|
|
245
288
|
|
|
246
|
-
|
|
289
|
+
renderCall(args, theme) {
|
|
290
|
+
const lines: string[] = [];
|
|
291
|
+
|
|
292
|
+
if (args.chain?.length) {
|
|
293
|
+
const agents = args.chain.map((s: { agent: string }) => s.agent).join(" -> ");
|
|
294
|
+
lines.push(theme.fg("toolTitle", theme.bold(`subagent chain`)) + " " + theme.fg("accent", agents));
|
|
295
|
+
for (let i = 0; i < args.chain.length; i++) {
|
|
296
|
+
const step = args.chain[i];
|
|
297
|
+
const prefix = theme.fg("muted", ` ${i + 1}.`);
|
|
298
|
+
lines.push(`${prefix} ${theme.fg("accent", step.agent)} ${theme.fg("toolOutput", truncateTask(step.task))}`);
|
|
299
|
+
}
|
|
300
|
+
} else if (args.tasks?.length) {
|
|
301
|
+
lines.push(theme.fg("toolTitle", theme.bold(`subagent parallel`)) + theme.fg("muted", ` (${args.tasks.length} tasks)`));
|
|
302
|
+
for (const t of args.tasks) {
|
|
303
|
+
lines.push(` ${theme.fg("accent", t.agent)} ${theme.fg("toolOutput", truncateTask(t.task))}`);
|
|
304
|
+
}
|
|
305
|
+
} else if (args.agent) {
|
|
306
|
+
lines.push(
|
|
307
|
+
theme.fg("toolTitle", theme.bold("subagent")) +
|
|
308
|
+
" " +
|
|
309
|
+
theme.fg("accent", args.agent) +
|
|
310
|
+
(args.task ? " " + theme.fg("toolOutput", truncateTask(args.task)) : ""),
|
|
311
|
+
);
|
|
312
|
+
} else {
|
|
313
|
+
lines.push(theme.fg("toolTitle", theme.bold("subagent")));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return new Text(lines.join("\n"), 0, 0);
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
renderResult(result, options, theme) {
|
|
320
|
+
const status = result.details?.status;
|
|
321
|
+
const output = result.content
|
|
322
|
+
?.filter((c) => c.type === "text")
|
|
323
|
+
.map((c) => ("text" in c ? c.text : ""))
|
|
324
|
+
.join("\n") || "";
|
|
325
|
+
|
|
326
|
+
const lines: string[] = [];
|
|
327
|
+
|
|
328
|
+
if (status) {
|
|
329
|
+
lines.push(theme.fg("muted", status));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (output.trim()) {
|
|
333
|
+
const trimmed = output.trim();
|
|
334
|
+
if (options.expanded || options.isPartial) {
|
|
335
|
+
// When expanded or during execution, show full activity log
|
|
336
|
+
for (const line of trimmed.split("\n")) {
|
|
337
|
+
lines.push(theme.fg("toolOutput", line));
|
|
338
|
+
}
|
|
339
|
+
} else {
|
|
340
|
+
// Collapsed final result — show preview
|
|
341
|
+
const allLines = trimmed.split("\n");
|
|
342
|
+
const previewLines = allLines.slice(0, 8);
|
|
343
|
+
lines.push(theme.fg("toolOutput", previewLines.join("\n")));
|
|
344
|
+
if (allLines.length > 8) {
|
|
345
|
+
lines.push(theme.fg("muted", `... (${allLines.length - 8} more lines)`));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (lines.length === 0) return new Text("", 0, 0);
|
|
351
|
+
return new Text(lines.join("\n"), 0, 0);
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
async execute(_id, params, signal, onUpdate, ctx) {
|
|
247
355
|
const scope: AgentScope = (params.agentScope as AgentScope) ?? "both";
|
|
248
356
|
const agents = discoverAgents(ctx.cwd, scope);
|
|
249
357
|
const available = agents.map((a) => a.name).join(", ") || "none";
|
|
@@ -254,6 +362,22 @@ export default function (pi: ExtensionAPI) {
|
|
|
254
362
|
isError: true,
|
|
255
363
|
});
|
|
256
364
|
|
|
365
|
+
// Stream live activity from the subagent process
|
|
366
|
+
const activityLines: string[] = [];
|
|
367
|
+
const emitProgress = (agentName: string, activity?: string) => {
|
|
368
|
+
const status = activity ? `${agentName}: ${activity}` : `${agentName} working...`;
|
|
369
|
+
onUpdate?.({
|
|
370
|
+
content: [{ type: "text" as const, text: activityLines.join("\n") }],
|
|
371
|
+
details: { status },
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
const makeProgressFn = (agentName: string): ProgressFn => (activity) => {
|
|
375
|
+
// Keep a rolling log of recent activities
|
|
376
|
+
activityLines.push(`${agentName}: ${activity}`);
|
|
377
|
+
if (activityLines.length > 50) activityLines.splice(0, activityLines.length - 50);
|
|
378
|
+
emitProgress(agentName, activity);
|
|
379
|
+
};
|
|
380
|
+
|
|
257
381
|
// ── Chain mode ──
|
|
258
382
|
if (params.chain?.length) {
|
|
259
383
|
let previous = "";
|
|
@@ -262,8 +386,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
262
386
|
const step = params.chain[i];
|
|
263
387
|
const agent = find(step.agent);
|
|
264
388
|
if (!agent) return notFound(step.agent);
|
|
389
|
+
activityLines.length = 0;
|
|
390
|
+
emitProgress(step.agent, `step ${i + 1}/${params.chain.length}`);
|
|
265
391
|
const task = step.task.replace(/\{previous\}/g, previous);
|
|
266
|
-
const result = await runAgent(ctx.cwd, agent, task, signal, i + 1);
|
|
392
|
+
const result = await runAgent(ctx.cwd, agent, task, signal, i + 1, makeProgressFn(step.agent));
|
|
267
393
|
results.push(result);
|
|
268
394
|
if (result.exitCode !== 0) {
|
|
269
395
|
return {
|
|
@@ -283,13 +409,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
283
409
|
}
|
|
284
410
|
for (const t of params.tasks) { if (!find(t.agent)) return notFound(t.agent); }
|
|
285
411
|
|
|
412
|
+
const agentNames = params.tasks.map((t: { agent: string }) => t.agent).join(", ");
|
|
413
|
+
emitProgress(agentNames);
|
|
414
|
+
|
|
286
415
|
const results = await runParallel(params.tasks, MAX_CONCURRENCY, async (t, i) => {
|
|
287
|
-
return runAgent(ctx.cwd, find(t.agent)!, t.task, signal);
|
|
416
|
+
return runAgent(ctx.cwd, find(t.agent)!, t.task, signal, undefined, makeProgressFn(t.agent));
|
|
288
417
|
});
|
|
289
418
|
|
|
290
419
|
const ok = results.filter((r) => r.exitCode === 0).length;
|
|
291
420
|
const summary = results
|
|
292
|
-
.map((r) => `[${r.agent}] ${r.exitCode === 0 ? "
|
|
421
|
+
.map((r) => `[${r.agent}] ${r.exitCode === 0 ? "ok" : "fail"} ${r.output.slice(0, 200)}`)
|
|
293
422
|
.join("\n\n");
|
|
294
423
|
return { content: [{ type: "text" as const, text: `Parallel: ${ok}/${results.length} succeeded\n\n${summary}` }] };
|
|
295
424
|
}
|
|
@@ -298,7 +427,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
298
427
|
if (params.agent && params.task) {
|
|
299
428
|
const agent = find(params.agent);
|
|
300
429
|
if (!agent) return notFound(params.agent);
|
|
301
|
-
|
|
430
|
+
emitProgress(params.agent);
|
|
431
|
+
const result = await runAgent(ctx.cwd, agent, params.task, signal, undefined, makeProgressFn(params.agent));
|
|
302
432
|
const isError = result.exitCode !== 0;
|
|
303
433
|
return {
|
|
304
434
|
content: [{ type: "text" as const, text: result.output || result.stderr || "(no output)" }],
|
|
@@ -309,4 +439,77 @@ export default function (pi: ExtensionAPI) {
|
|
|
309
439
|
return { content: [{ type: "text" as const, text: `Provide exactly one mode. Available agents: ${available}` }], isError: true };
|
|
310
440
|
},
|
|
311
441
|
});
|
|
442
|
+
|
|
443
|
+
// ── Agent selection for user prompts ─────────────────────────────────────
|
|
444
|
+
|
|
445
|
+
let selectedAgent: string | undefined;
|
|
446
|
+
|
|
447
|
+
function updateAgentStatus(ctx: { ui: { setStatus: (key: string, text: string | undefined) => void } }) {
|
|
448
|
+
ctx.ui.setStatus("agent", selectedAgent ? `agent: ${selectedAgent}` : undefined);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// /agent command — select an agent or clear selection
|
|
452
|
+
pi.registerCommand("agent", {
|
|
453
|
+
description: "Select an agent to handle your next prompts, or clear selection. Usage: /agent [name]",
|
|
454
|
+
handler: async (args, ctx) => {
|
|
455
|
+
const agents = discoverAgents(ctx.cwd, "both");
|
|
456
|
+
|
|
457
|
+
if (args.trim()) {
|
|
458
|
+
// Direct selection: /agent architect
|
|
459
|
+
const name = args.trim();
|
|
460
|
+
if (name === "none" || name === "off" || name === "clear") {
|
|
461
|
+
selectedAgent = undefined;
|
|
462
|
+
updateAgentStatus(ctx);
|
|
463
|
+
ctx.ui.notify("Agent cleared — prompts go to default model", "info");
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const agent = agents.find((a) => a.name === name);
|
|
467
|
+
if (!agent) {
|
|
468
|
+
const available = agents.map((a) => a.name).join(", ") || "none";
|
|
469
|
+
ctx.ui.notify(`Unknown agent "${name}". Available: ${available}`, "warning");
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
selectedAgent = name;
|
|
473
|
+
updateAgentStatus(ctx);
|
|
474
|
+
ctx.ui.notify(`Agent set to "${name}" — your prompts will be handled by this agent`, "info");
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// Interactive selection
|
|
479
|
+
if (!ctx.hasUI) {
|
|
480
|
+
ctx.ui.notify("Usage: /agent <name> or /agent none", "warning");
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const options = ["(none — default model)", ...agents.map((a) => `${a.name} — ${a.description}`)];
|
|
485
|
+
const choice = await ctx.ui.select("Select agent for your prompts", options);
|
|
486
|
+
if (choice === undefined) return; // cancelled
|
|
487
|
+
|
|
488
|
+
if (choice === options[0]) {
|
|
489
|
+
selectedAgent = undefined;
|
|
490
|
+
updateAgentStatus(ctx);
|
|
491
|
+
ctx.ui.notify("Agent cleared", "info");
|
|
492
|
+
} else {
|
|
493
|
+
const name = choice.split(" — ")[0];
|
|
494
|
+
selectedAgent = name;
|
|
495
|
+
updateAgentStatus(ctx);
|
|
496
|
+
ctx.ui.notify(`Agent set to "${name}"`, "info");
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
getArgumentCompletions: (partial) => {
|
|
500
|
+
const agents = discoverAgents(process.cwd(), "both");
|
|
501
|
+
const names = ["none", ...agents.map((a) => a.name)];
|
|
502
|
+
return names.filter((n) => n.startsWith(partial));
|
|
503
|
+
},
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// Intercept user input when an agent is selected
|
|
507
|
+
pi.on("input", (event) => {
|
|
508
|
+
if (!selectedAgent) return { action: "continue" as const };
|
|
509
|
+
// Don't intercept slash commands
|
|
510
|
+
if (event.text.startsWith("/") || event.text.startsWith("!")) return { action: "continue" as const };
|
|
511
|
+
|
|
512
|
+
const wrapped = `Use the subagent tool to delegate to the "${selectedAgent}" agent with this task:\n\n"${event.text}"\n\nSet agentScope to "both".`;
|
|
513
|
+
return { action: "transform" as const, text: wrapped, images: event.images };
|
|
514
|
+
});
|
|
312
515
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getAgentDir, VERSION } from "./config.js";
|
|
1
|
+
export { getAgentDir, getPackageDir, isBunBinary, VERSION } from "./config.js";
|
|
2
2
|
export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type AgentSessionEventListener, type ModelCycleResult, type ParsedSkillBlock, type PromptOptions, parseSkillBlock, type SessionStats, } from "./core/agent-session.js";
|
|
3
3
|
export { type ApiKeyCredential, type AuthCredential, AuthStorage, type AuthStorageBackend, FileAuthStorageBackend, InMemoryAuthStorageBackend, type OAuthCredential, } from "./core/auth-storage.js";
|
|
4
4
|
export { type BranchPreparation, type BranchSummaryResult, type CollectEntriesResult, type CompactionResult, type CutPointResult, calculateContextTokens, collectEntriesForBranchSummary, compact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, type FileOperations, findCutPoint, findTurnStartIndex, type GenerateBranchSummaryOptions, generateBranchSummary, generateSummary, getLastAssistantUsage, prepareBranchEntries, serializeConversation, shouldCompact, } from "./core/compaction/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,WAAW,EACX,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EACd,KAAK,cAAc,EACnB,YAAY,EACZ,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,qBAA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Z,UAAU,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,cAAc,EACd,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,6BAA6B,EAC7B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,SAAS,EACT,eAAe,EACf,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppAction,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandLocation,\n\tSlashCommandSource,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n\twrapToolsWithExtensions,\n\twrapToolWithExtensions,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcodingTools,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tappKey,\n\tappKeyHint,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\teditorKey,\n\tFooterComponent,\n\tkeyHint,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,WAAW,EACX,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EACd,KAAK,cAAc,EACnB,YAAY,EACZ,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB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AY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,SAAS,EACT,eAAe,EACf,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,UAAU,EACV,UAAU,EACV,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getPackageDir, isBunBinary, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppAction,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandLocation,\n\tSlashCommandSource,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n\twrapToolsWithExtensions,\n\twrapToolWithExtensions,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcodingTools,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tappKey,\n\tappKeyHint,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\teditorKey,\n\tFooterComponent,\n\tkeyHint,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Core session management
|
|
2
2
|
// Config paths
|
|
3
|
-
export { getAgentDir, VERSION } from "./config.js";
|
|
3
|
+
export { getAgentDir, getPackageDir, isBunBinary, VERSION } from "./config.js";
|
|
4
4
|
export { AgentSession, parseSkillBlock, } from "./core/agent-session.js";
|
|
5
5
|
// Auth and model registry
|
|
6
6
|
export { AuthStorage, FileAuthStorageBackend, InMemoryAuthStorageBackend, } from "./core/auth-storage.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAGN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,aAAa;AACb,OAAO,EAMN,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CAAC;AA2E7F,OAAO,EACN,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EA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B,OAAO,EACN,cAAc,EACd,yBAAyB,EACzB,MAAM,EACN,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,6BAA6B,EAC7B,iCAAiC,EACjC,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,SAAS,EACT,eAAe,EACf,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEtB,UAAU,EACV,UAAU,EACV,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppAction,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandLocation,\n\tSlashCommandSource,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n\twrapToolsWithExtensions,\n\twrapToolWithExtensions,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcodingTools,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tappKey,\n\tappKeyHint,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\teditorKey,\n\tFooterComponent,\n\tkeyHint,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,0BAA0B;AAC1B,OAAO,EAGN,WAAW,EAEX,sBAAsB,EACtB,0BAA0B,GAE1B,MAAM,wBAAwB,CAAC;AAChC,aAAa;AACb,OAAO,EAMN,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CAAC;AA2E7F,OAAO,EACN,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AASzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE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xB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getPackageDir, isBunBinary, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppAction,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandLocation,\n\tSlashCommandSource,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n\twrapToolsWithExtensions,\n\twrapToolWithExtensions,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcodingTools,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tappKey,\n\tappKeyHint,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\teditorKey,\n\tFooterComponent,\n\tkeyHint,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
|
|
@@ -8,12 +8,12 @@ Capture implementation decisions before planning a phase.
|
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
## Steps
|
|
11
|
-
1. Run `draht phase-info N` to load phase context
|
|
11
|
+
1. Run `draht-tools phase-info N` to load phase context
|
|
12
12
|
2. Identify gray areas based on what's being built
|
|
13
13
|
3. Present 1-2 questions at a time about preferences
|
|
14
14
|
4. If `.planning/DOMAIN.md` exists, load it and validate discovered terms against the glossary. Add any new domain terms found during discussion.
|
|
15
|
-
5. Record decisions with `draht save-context N`
|
|
16
|
-
6. Commit: `draht commit-docs "capture phase N context"`
|
|
15
|
+
5. Record decisions with `draht-tools save-context N`
|
|
16
|
+
6. Commit: `draht-tools commit-docs "capture phase N context"`
|
|
17
17
|
|
|
18
18
|
## Gray Area Categories
|
|
19
19
|
- **Visual features** → Layout, density, interactions, empty states
|
|
@@ -8,36 +8,36 @@ Execute all plans in a phase with atomic commits.
|
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
## Steps
|
|
11
|
-
1. Run `draht discover-plans N` to find and order plans
|
|
11
|
+
1. Run `draht-tools discover-plans N` to find and order plans
|
|
12
12
|
2. For each plan in dependency order:
|
|
13
|
-
a. Load plan: `draht read-plan N P`
|
|
13
|
+
a. Load plan: `draht-tools read-plan N P`
|
|
14
14
|
b. Execute each task in strict TDD cycle:
|
|
15
15
|
|
|
16
16
|
**🔴 RED — Write failing tests first**
|
|
17
17
|
- Write the test cases from `<test>`
|
|
18
18
|
- Run tests — confirm they FAIL (if they pass, the test is wrong)
|
|
19
|
-
- Commit failing tests: `draht commit-task N P T "red: test description"`
|
|
19
|
+
- Commit failing tests: `draht-tools commit-task N P T "red: test description"`
|
|
20
20
|
|
|
21
21
|
**🟢 GREEN — Minimal implementation**
|
|
22
22
|
- Write the minimum code from `<action>` to make tests pass
|
|
23
23
|
- Use domain language from `<context>` and `<domain>` for all names
|
|
24
24
|
- Run tests — confirm they PASS
|
|
25
|
-
- Commit: `draht commit-task N P T "green: task name"`
|
|
25
|
+
- Commit: `draht-tools commit-task N P T "green: task name"`
|
|
26
26
|
|
|
27
27
|
**🔵 REFACTOR — Clean up with safety net**
|
|
28
28
|
- Apply improvements from `<refactor>` (if any)
|
|
29
29
|
- Run tests after each change — must stay green
|
|
30
30
|
- Verify domain language compliance (names match DOMAIN.md)
|
|
31
|
-
- Commit: `draht commit-task N P T "refactor: description"`
|
|
31
|
+
- Commit: `draht-tools commit-task N P T "refactor: description"`
|
|
32
32
|
|
|
33
33
|
**✅ VERIFY**
|
|
34
34
|
- Run the `<verify>` step
|
|
35
35
|
- Confirm `<done>` criteria met
|
|
36
36
|
|
|
37
|
-
c. Write summary: `draht write-summary N P`
|
|
38
|
-
3. Phase verification: `draht verify-phase N`
|
|
39
|
-
4. Update state: `draht update-state`
|
|
40
|
-
5. Final commit: `draht commit-docs "complete phase N execution"`
|
|
37
|
+
c. Write summary: `draht-tools write-summary N P`
|
|
38
|
+
3. Phase verification: `draht-tools verify-phase N`
|
|
39
|
+
4. Update state: `draht-tools update-state`
|
|
40
|
+
5. Final commit: `draht-tools commit-docs "complete phase N execution"`
|
|
41
41
|
|
|
42
42
|
## TDD Rules
|
|
43
43
|
- Never write implementation before a failing test exists
|
|
@@ -8,7 +8,7 @@ Analyze existing codebase before planning.
|
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
## Steps
|
|
11
|
-
1. Run `draht map-codebase [dir]`
|
|
11
|
+
1. Run `draht-tools map-codebase [dir]`
|
|
12
12
|
2. Tool generates: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md
|
|
13
13
|
3. Review output, supplement with your own analysis if needed
|
|
14
14
|
4. Identify implicit bounded contexts from directory structure:
|
|
@@ -29,4 +29,4 @@ Analyze existing codebase before planning.
|
|
|
29
29
|
- Existing coverage configuration and goals (if any)
|
|
30
30
|
- Which layers have tests today (unit, integration, e2e)
|
|
31
31
|
- Gaps and recommendations
|
|
32
|
-
8. Commit: `draht commit-docs "map existing codebase"`
|
|
32
|
+
8. Commit: `draht-tools commit-docs "map existing codebase"`
|