ai-devkit 0.15.0 → 0.16.0
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/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +43 -17
- package/dist/commands/agent.js.map +1 -1
- package/dist/lib/Config.d.ts +1 -0
- package/dist/lib/Config.d.ts.map +1 -1
- package/dist/lib/Config.js +14 -2
- package/dist/lib/Config.js.map +1 -1
- package/dist/lib/SkillManager.d.ts.map +1 -1
- package/dist/lib/SkillManager.js +4 -2
- package/dist/lib/SkillManager.js.map +1 -1
- package/dist/lib/TemplateManager.d.ts.map +1 -1
- package/dist/lib/TemplateManager.js +1 -12
- package/dist/lib/TemplateManager.js.map +1 -1
- package/dist/templates/commands/capture-knowledge.md +7 -5
- package/dist/templates/commands/check-implementation.md +7 -4
- package/dist/templates/commands/code-review.md +7 -4
- package/dist/templates/commands/debug.md +7 -4
- package/dist/templates/commands/execute-plan.md +7 -4
- package/dist/templates/commands/new-requirement.md +7 -6
- package/dist/templates/commands/remember.md +6 -4
- package/dist/templates/commands/review-design.md +13 -10
- package/dist/templates/commands/review-requirements.md +11 -8
- package/dist/templates/commands/simplify-implementation.md +6 -3
- package/dist/templates/commands/update-planning.md +6 -3
- package/dist/templates/commands/writing-test.md +8 -5
- package/dist/templates/templates/commands/capture-knowledge.md +7 -5
- package/dist/templates/templates/commands/check-implementation.md +7 -4
- package/dist/templates/templates/commands/code-review.md +7 -4
- package/dist/templates/templates/commands/debug.md +7 -4
- package/dist/templates/templates/commands/execute-plan.md +7 -4
- package/dist/templates/templates/commands/new-requirement.md +7 -6
- package/dist/templates/templates/commands/remember.md +6 -4
- package/dist/templates/templates/commands/review-design.md +13 -10
- package/dist/templates/templates/commands/review-requirements.md +11 -8
- package/dist/templates/templates/commands/simplify-implementation.md +6 -3
- package/dist/templates/templates/commands/update-planning.md +6 -3
- package/dist/templates/templates/commands/writing-test.md +8 -5
- package/dist/util/process.d.ts +1 -1
- package/dist/util/process.d.ts.map +1 -1
- package/package.json +2 -1
- package/templates/commands/capture-knowledge.md +7 -5
- package/templates/commands/check-implementation.md +7 -4
- package/templates/commands/code-review.md +7 -4
- package/templates/commands/debug.md +7 -4
- package/templates/commands/execute-plan.md +7 -4
- package/templates/commands/new-requirement.md +7 -6
- package/templates/commands/remember.md +6 -4
- package/templates/commands/review-design.md +13 -10
- package/templates/commands/review-requirements.md +11 -8
- package/templates/commands/simplify-implementation.md +6 -3
- package/templates/commands/update-planning.md +6 -3
- package/templates/commands/writing-test.md +8 -5
- package/dist/lib/AgentManager.d.ts +0 -104
- package/dist/lib/AgentManager.d.ts.map +0 -1
- package/dist/lib/AgentManager.js +0 -185
- package/dist/lib/AgentManager.js.map +0 -1
- package/dist/lib/TerminalFocusManager.d.ts +0 -22
- package/dist/lib/TerminalFocusManager.d.ts.map +0 -1
- package/dist/lib/TerminalFocusManager.js +0 -195
- package/dist/lib/TerminalFocusManager.js.map +0 -1
- package/dist/lib/adapters/AgentAdapter.d.ts +0 -92
- package/dist/lib/adapters/AgentAdapter.d.ts.map +0 -1
- package/dist/lib/adapters/AgentAdapter.js +0 -29
- package/dist/lib/adapters/AgentAdapter.js.map +0 -1
- package/dist/lib/adapters/ClaudeCodeAdapter.d.ts +0 -66
- package/dist/lib/adapters/ClaudeCodeAdapter.d.ts.map +0 -1
- package/dist/lib/adapters/ClaudeCodeAdapter.js +0 -306
- package/dist/lib/adapters/ClaudeCodeAdapter.js.map +0 -1
- package/dist/templates/env/base.md +0 -101
- package/dist/templates/templates/env/base.md +0 -101
- package/templates/env/base.md +0 -101
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TerminalFocusManager = void 0;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const util_1 = require("util");
|
|
6
|
-
const process_1 = require("../util/process");
|
|
7
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
8
|
-
class TerminalFocusManager {
|
|
9
|
-
/**
|
|
10
|
-
* Find the terminal location (emulator info) for a given process ID
|
|
11
|
-
*/
|
|
12
|
-
async findTerminal(pid) {
|
|
13
|
-
const ttyShort = (0, process_1.getProcessTty)(pid);
|
|
14
|
-
// If no TTY or invalid, we can't find the terminal
|
|
15
|
-
if (!ttyShort || ttyShort === '?') {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
const fullTty = `/dev/${ttyShort}`;
|
|
19
|
-
// 1. Check tmux (most specific if running inside it)
|
|
20
|
-
const tmuxLocation = await this.findTmuxPane(fullTty);
|
|
21
|
-
if (tmuxLocation)
|
|
22
|
-
return tmuxLocation;
|
|
23
|
-
// 2. Check iTerm2
|
|
24
|
-
const itermLocation = await this.findITerm2Session(fullTty);
|
|
25
|
-
if (itermLocation)
|
|
26
|
-
return itermLocation;
|
|
27
|
-
// 3. Check Terminal.app
|
|
28
|
-
const terminalAppLocation = await this.findTerminalAppWindow(fullTty);
|
|
29
|
-
if (terminalAppLocation)
|
|
30
|
-
return terminalAppLocation;
|
|
31
|
-
// 4. Fallback: we know the TTY but not the emulator wrapper
|
|
32
|
-
return {
|
|
33
|
-
type: 'unknown',
|
|
34
|
-
identifier: '',
|
|
35
|
-
tty: fullTty
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Focus the terminal identified by the location
|
|
40
|
-
*/
|
|
41
|
-
async focusTerminal(location) {
|
|
42
|
-
try {
|
|
43
|
-
switch (location.type) {
|
|
44
|
-
case 'tmux':
|
|
45
|
-
return await this.focusTmuxPane(location.identifier);
|
|
46
|
-
case 'iterm2':
|
|
47
|
-
return await this.focusITerm2Session(location.tty);
|
|
48
|
-
case 'terminal-app':
|
|
49
|
-
return await this.focusTerminalAppWindow(location.tty);
|
|
50
|
-
default:
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async findTmuxPane(tty) {
|
|
59
|
-
try {
|
|
60
|
-
// List all panes with their TTYs and identifiers
|
|
61
|
-
// Format: /dev/ttys001|my-session:1.1
|
|
62
|
-
// using | as separator to handle spaces in session names
|
|
63
|
-
const { stdout } = await execAsync("tmux list-panes -a -F '#{pane_tty}|#{session_name}:#{window_index}.#{pane_index}'");
|
|
64
|
-
const lines = stdout.trim().split('\n');
|
|
65
|
-
for (const line of lines) {
|
|
66
|
-
if (!line.trim())
|
|
67
|
-
continue;
|
|
68
|
-
const [paneTty, identifier] = line.split('|');
|
|
69
|
-
if (paneTty === tty && identifier) {
|
|
70
|
-
return {
|
|
71
|
-
type: 'tmux',
|
|
72
|
-
identifier,
|
|
73
|
-
tty
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
// tmux might not be installed or running
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
async findITerm2Session(tty) {
|
|
84
|
-
try {
|
|
85
|
-
// Check if iTerm2 is running first to avoid launching it
|
|
86
|
-
const { stdout: isRunning } = await execAsync('pgrep -x iTerm2 || echo "no"');
|
|
87
|
-
if (isRunning.trim() === "no")
|
|
88
|
-
return null;
|
|
89
|
-
const script = `
|
|
90
|
-
tell application "iTerm"
|
|
91
|
-
repeat with w in windows
|
|
92
|
-
repeat with t in tabs of w
|
|
93
|
-
repeat with s in sessions of t
|
|
94
|
-
if tty of s is "${tty}" then
|
|
95
|
-
return "found"
|
|
96
|
-
end if
|
|
97
|
-
end repeat
|
|
98
|
-
end repeat
|
|
99
|
-
end repeat
|
|
100
|
-
end tell
|
|
101
|
-
`;
|
|
102
|
-
const { stdout } = await execAsync(`osascript -e '${script}'`);
|
|
103
|
-
if (stdout.trim() === "found") {
|
|
104
|
-
return {
|
|
105
|
-
type: 'iterm2',
|
|
106
|
-
identifier: tty,
|
|
107
|
-
tty
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
// iTerm2 not found or script failed
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
async findTerminalAppWindow(tty) {
|
|
117
|
-
try {
|
|
118
|
-
// Check if Terminal is running
|
|
119
|
-
const { stdout: isRunning } = await execAsync('pgrep -x Terminal || echo "no"');
|
|
120
|
-
if (isRunning.trim() === "no")
|
|
121
|
-
return null;
|
|
122
|
-
const script = `
|
|
123
|
-
tell application "Terminal"
|
|
124
|
-
repeat with w in windows
|
|
125
|
-
repeat with t in tabs of w
|
|
126
|
-
if tty of t is "${tty}" then
|
|
127
|
-
return "found"
|
|
128
|
-
end if
|
|
129
|
-
end repeat
|
|
130
|
-
end repeat
|
|
131
|
-
end tell
|
|
132
|
-
`;
|
|
133
|
-
const { stdout } = await execAsync(`osascript -e '${script}'`);
|
|
134
|
-
if (stdout.trim() === "found") {
|
|
135
|
-
return {
|
|
136
|
-
type: 'terminal-app',
|
|
137
|
-
identifier: tty,
|
|
138
|
-
tty
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
// Terminal not found or script failed
|
|
144
|
-
}
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
async focusTmuxPane(identifier) {
|
|
148
|
-
try {
|
|
149
|
-
await execAsync(`tmux switch-client -t ${identifier}`);
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
async focusITerm2Session(tty) {
|
|
157
|
-
const script = `
|
|
158
|
-
tell application "iTerm"
|
|
159
|
-
activate
|
|
160
|
-
repeat with w in windows
|
|
161
|
-
repeat with t in tabs of w
|
|
162
|
-
repeat with s in sessions of t
|
|
163
|
-
if tty of s is "${tty}" then
|
|
164
|
-
select s
|
|
165
|
-
return "true"
|
|
166
|
-
end if
|
|
167
|
-
end repeat
|
|
168
|
-
end repeat
|
|
169
|
-
end repeat
|
|
170
|
-
end tell
|
|
171
|
-
`;
|
|
172
|
-
const { stdout } = await execAsync(`osascript -e '${script}'`);
|
|
173
|
-
return stdout.trim() === "true";
|
|
174
|
-
}
|
|
175
|
-
async focusTerminalAppWindow(tty) {
|
|
176
|
-
const script = `
|
|
177
|
-
tell application "Terminal"
|
|
178
|
-
activate
|
|
179
|
-
repeat with w in windows
|
|
180
|
-
repeat with t in tabs of w
|
|
181
|
-
if tty of t is "${tty}" then
|
|
182
|
-
set index of w to 1
|
|
183
|
-
set selected tab of w to t
|
|
184
|
-
return "true"
|
|
185
|
-
end if
|
|
186
|
-
end repeat
|
|
187
|
-
end repeat
|
|
188
|
-
end tell
|
|
189
|
-
`;
|
|
190
|
-
const { stdout } = await execAsync(`osascript -e '${script}'`);
|
|
191
|
-
return stdout.trim() === "true";
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
exports.TerminalFocusManager = TerminalFocusManager;
|
|
195
|
-
//# sourceMappingURL=TerminalFocusManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TerminalFocusManager.js","sourceRoot":"","sources":["../../src/lib/TerminalFocusManager.ts"],"names":[],"mappings":";;;AAAA,iDAAqC;AACrC,+BAAiC;AACjC,6CAAgD;AAEhD,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAQlC,MAAa,oBAAoB;IAC7B;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,GAAW;QAC1B,MAAM,QAAQ,GAAG,IAAA,uBAAa,EAAC,GAAG,CAAC,CAAC;QAEpC,mDAAmD;QACnD,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QAChB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AAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,iBAAiB,MAAM,GAAG,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC;IACpC,CAAC;CACJ;AAhMD,oDAgMC"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Adapter Interface
|
|
3
|
-
*
|
|
4
|
-
* Defines the contract for detecting and managing different types of AI agents.
|
|
5
|
-
* Each adapter is responsible for detecting agents of a specific type (e.g., Claude Code).
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Type of AI agent
|
|
9
|
-
*/
|
|
10
|
-
export type AgentType = 'Claude Code' | 'Gemini CLI' | 'Codex' | "Other";
|
|
11
|
-
/**
|
|
12
|
-
* Current status of an agent
|
|
13
|
-
*/
|
|
14
|
-
export declare enum AgentStatus {
|
|
15
|
-
RUNNING = "running",
|
|
16
|
-
WAITING = "waiting",
|
|
17
|
-
IDLE = "idle",
|
|
18
|
-
UNKNOWN = "unknown"
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Status display configuration
|
|
22
|
-
*/
|
|
23
|
-
export interface StatusConfig {
|
|
24
|
-
emoji: string;
|
|
25
|
-
label: string;
|
|
26
|
-
color: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Status configuration map
|
|
30
|
-
*/
|
|
31
|
-
export declare const STATUS_CONFIG: Record<AgentStatus, StatusConfig>;
|
|
32
|
-
/**
|
|
33
|
-
* Information about a detected agent
|
|
34
|
-
*/
|
|
35
|
-
export interface AgentInfo {
|
|
36
|
-
/** Project-based name (e.g., "ai-devkit" or "ai-devkit (merry)") */
|
|
37
|
-
name: string;
|
|
38
|
-
/** Type of agent */
|
|
39
|
-
type: AgentType;
|
|
40
|
-
/** Current status */
|
|
41
|
-
status: AgentStatus;
|
|
42
|
-
/** Display format for status (e.g., "🟡 wait", "🟢 run") */
|
|
43
|
-
statusDisplay: string;
|
|
44
|
-
/** Last user prompt from history (truncated ~40 chars) */
|
|
45
|
-
summary: string;
|
|
46
|
-
/** Process ID */
|
|
47
|
-
pid: number;
|
|
48
|
-
/** Working directory/project path */
|
|
49
|
-
projectPath: string;
|
|
50
|
-
/** Session UUID */
|
|
51
|
-
sessionId: string;
|
|
52
|
-
/** Human-readable session name (e.g., "merry-wobbling-starlight"), may be undefined for new sessions */
|
|
53
|
-
slug?: string;
|
|
54
|
-
/** Timestamp of last activity */
|
|
55
|
-
lastActive: Date;
|
|
56
|
-
/** Relative time display (e.g., "2m ago", "just now") */
|
|
57
|
-
lastActiveDisplay: string;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Information about a running process
|
|
61
|
-
*/
|
|
62
|
-
export interface ProcessInfo {
|
|
63
|
-
/** Process ID */
|
|
64
|
-
pid: number;
|
|
65
|
-
/** Process command */
|
|
66
|
-
command: string;
|
|
67
|
-
/** Working directory */
|
|
68
|
-
cwd: string;
|
|
69
|
-
/** Terminal TTY (e.g., "ttys030") */
|
|
70
|
-
tty: string;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Agent Adapter Interface
|
|
74
|
-
*
|
|
75
|
-
* Implementations must provide detection logic for a specific agent type.
|
|
76
|
-
*/
|
|
77
|
-
export interface AgentAdapter {
|
|
78
|
-
/** Type of agent this adapter handles */
|
|
79
|
-
readonly type: AgentType;
|
|
80
|
-
/**
|
|
81
|
-
* Detect running agents of this type
|
|
82
|
-
* @returns List of detected agents
|
|
83
|
-
*/
|
|
84
|
-
detectAgents(): Promise<AgentInfo[]>;
|
|
85
|
-
/**
|
|
86
|
-
* Check if this adapter can handle the given process
|
|
87
|
-
* @param processInfo Process information
|
|
88
|
-
* @returns True if this adapter can handle the process
|
|
89
|
-
*/
|
|
90
|
-
canHandle(processInfo: ProcessInfo): boolean;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=AgentAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
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EAAE,MAAM,CAAC;IAEZ,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB;;;OAGG;IACH,YAAY,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAErC;;;;OAIG;IACH,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC;CAChD"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Agent Adapter Interface
|
|
4
|
-
*
|
|
5
|
-
* Defines the contract for detecting and managing different types of AI agents.
|
|
6
|
-
* Each adapter is responsible for detecting agents of a specific type (e.g., Claude Code).
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.STATUS_CONFIG = exports.AgentStatus = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* Current status of an agent
|
|
12
|
-
*/
|
|
13
|
-
var AgentStatus;
|
|
14
|
-
(function (AgentStatus) {
|
|
15
|
-
AgentStatus["RUNNING"] = "running";
|
|
16
|
-
AgentStatus["WAITING"] = "waiting";
|
|
17
|
-
AgentStatus["IDLE"] = "idle";
|
|
18
|
-
AgentStatus["UNKNOWN"] = "unknown";
|
|
19
|
-
})(AgentStatus || (exports.AgentStatus = AgentStatus = {}));
|
|
20
|
-
/**
|
|
21
|
-
* Status configuration map
|
|
22
|
-
*/
|
|
23
|
-
exports.STATUS_CONFIG = {
|
|
24
|
-
[AgentStatus.RUNNING]: { emoji: '🟢', label: 'running', color: 'green' },
|
|
25
|
-
[AgentStatus.WAITING]: { emoji: '🟡', label: 'waiting', color: 'yellow' },
|
|
26
|
-
[AgentStatus.IDLE]: { emoji: '⚪', label: 'idle', color: 'dim' },
|
|
27
|
-
[AgentStatus.UNKNOWN]: { emoji: '❓', label: 'unknown', color: 'gray' },
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=AgentAdapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AgentAdapter.js","sourceRoot":"","sources":["../../../src/lib/adapters/AgentAdapter.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAOH;;GAEG;AACH,IAAY,WAKX;AALD,WAAY,WAAW;IACnB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,kCAAmB,CAAA;AACvB,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAWD;;GAEG;AACU,QAAA,aAAa,GAAsC;IAC5D,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE;IACxE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE;IACzE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;IAC/D,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;CACzE,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Code Adapter
|
|
3
|
-
*
|
|
4
|
-
* Detects running Claude Code agents by reading session files
|
|
5
|
-
* from ~/.claude/ directory and correlating with running processes.
|
|
6
|
-
*/
|
|
7
|
-
import type { AgentAdapter, AgentInfo, ProcessInfo } from './AgentAdapter';
|
|
8
|
-
/**
|
|
9
|
-
* Claude Code Adapter
|
|
10
|
-
*
|
|
11
|
-
* Detects Claude Code agents by:
|
|
12
|
-
* 1. Finding running claude processes
|
|
13
|
-
* 2. Reading session files from ~/.claude/projects/
|
|
14
|
-
* 3. Matching sessions to processes via CWD
|
|
15
|
-
* 4. Extracting status from session JSONL
|
|
16
|
-
* 5. Extracting summary from history.jsonl
|
|
17
|
-
*/
|
|
18
|
-
export declare class ClaudeCodeAdapter implements AgentAdapter {
|
|
19
|
-
readonly type: "Claude Code";
|
|
20
|
-
/** Threshold in minutes before considering a session idle */
|
|
21
|
-
private static readonly IDLE_THRESHOLD_MINUTES;
|
|
22
|
-
private claudeDir;
|
|
23
|
-
private projectsDir;
|
|
24
|
-
private historyPath;
|
|
25
|
-
constructor();
|
|
26
|
-
/**
|
|
27
|
-
* Check if this adapter can handle a given process
|
|
28
|
-
*/
|
|
29
|
-
canHandle(processInfo: ProcessInfo): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Detect running Claude Code agents
|
|
32
|
-
*/
|
|
33
|
-
detectAgents(): Promise<AgentInfo[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Read all Claude Code sessions
|
|
36
|
-
*/
|
|
37
|
-
private readSessions;
|
|
38
|
-
/**
|
|
39
|
-
* Read a session JSONL file
|
|
40
|
-
* Only reads last 100 lines for performance with large files
|
|
41
|
-
*/
|
|
42
|
-
private readSessionLog;
|
|
43
|
-
/**
|
|
44
|
-
* Read history.jsonl for user prompts
|
|
45
|
-
* Only reads last 100 lines for performance
|
|
46
|
-
*/
|
|
47
|
-
private readHistory;
|
|
48
|
-
/**
|
|
49
|
-
* Determine agent status from session entry
|
|
50
|
-
*/
|
|
51
|
-
private determineStatus;
|
|
52
|
-
/**
|
|
53
|
-
* Generate unique agent name
|
|
54
|
-
* Uses project basename, appends slug if multiple sessions for same project
|
|
55
|
-
*/
|
|
56
|
-
private generateAgentName;
|
|
57
|
-
/**
|
|
58
|
-
* Truncate summary to ~40 characters
|
|
59
|
-
*/
|
|
60
|
-
private truncateSummary;
|
|
61
|
-
/**
|
|
62
|
-
* Get relative time display (e.g., "2m ago", "just now")
|
|
63
|
-
*/
|
|
64
|
-
private getRelativeTime;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=ClaudeCodeAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClaudeCodeAdapter.d.ts","sourceRoot":"","sources":["../../../src/lib/adapters/ClaudeCodeAdapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA8C3E;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IAClD,QAAQ,CAAC,IAAI,EAAG,aAAa,CAAU;IAEvC,6DAA6D;IAC7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAK;IAEnD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;;IAS5B;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO;IAI5C;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IA+E1C;;OAEG;IACH,OAAO,CAAC,YAAY;IAyDpB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAgCtB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,eAAe;IAqCvB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,eAAe;CAc1B"}
|