heyiam 0.1.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/app/dist/assets/index-BGQkmy7q.css +1 -0
- package/app/dist/assets/index-CbLHxerW.js +14 -0
- package/app/dist/favicon.svg +1 -0
- package/app/dist/icons.svg +24 -0
- package/app/dist/index.html +20 -0
- package/dist/analyzer.d.ts +96 -0
- package/dist/analyzer.js +249 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/auth.d.ts +34 -0
- package/dist/auth.js +99 -0
- package/dist/auth.js.map +1 -0
- package/dist/bridge.d.ts +32 -0
- package/dist/bridge.js +211 -0
- package/dist/bridge.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +129 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/anthropic-provider.d.ts +11 -0
- package/dist/llm/anthropic-provider.js +16 -0
- package/dist/llm/anthropic-provider.js.map +1 -0
- package/dist/llm/index.d.ts +16 -0
- package/dist/llm/index.js +25 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/project-enhance.d.ts +71 -0
- package/dist/llm/project-enhance.js +236 -0
- package/dist/llm/project-enhance.js.map +1 -0
- package/dist/llm/proxy-provider.d.ts +16 -0
- package/dist/llm/proxy-provider.js +60 -0
- package/dist/llm/proxy-provider.js.map +1 -0
- package/dist/llm/triage.d.ts +66 -0
- package/dist/llm/triage.js +283 -0
- package/dist/llm/triage.js.map +1 -0
- package/dist/llm/types.d.ts +19 -0
- package/dist/llm/types.js +2 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/machine-key.d.ts +10 -0
- package/dist/machine-key.js +51 -0
- package/dist/machine-key.js.map +1 -0
- package/dist/parsers/claude.d.ts +18 -0
- package/dist/parsers/claude.js +265 -0
- package/dist/parsers/claude.js.map +1 -0
- package/dist/parsers/index.d.ts +28 -0
- package/dist/parsers/index.js +124 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/types.d.ts +81 -0
- package/dist/parsers/types.js +2 -0
- package/dist/parsers/types.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +857 -0
- package/dist/server.js.map +1 -0
- package/dist/settings.d.ts +92 -0
- package/dist/settings.js +160 -0
- package/dist/settings.js.map +1 -0
- package/dist/summarize.d.ts +72 -0
- package/dist/summarize.js +312 -0
- package/dist/summarize.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import readline from 'node:readline';
|
|
3
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
4
|
+
import { getAnthropicApiKey } from '../settings.js';
|
|
5
|
+
// ── Signal extraction (Layer 2) ──────────────────────────────────
|
|
6
|
+
const CORRECTION_WORDS = /\b(no|wrong|not that|actually|stop|undo|revert|don't|incorrect)\b/i;
|
|
7
|
+
const ARCH_KEYWORDS = /\b(design|approach|trade-?off|instead|because|architecture|strategy|decision|chose|alternative)\b/i;
|
|
8
|
+
const ERROR_WORDS = /\b(error|failed|failure|exception|crash|bug|broken|fix)\b/i;
|
|
9
|
+
/**
|
|
10
|
+
* Extract cheap signals from a session's raw JSONL file.
|
|
11
|
+
* Scans user messages for patterns without full parsing.
|
|
12
|
+
*/
|
|
13
|
+
export async function extractSignals(sessionPath) {
|
|
14
|
+
const signals = {
|
|
15
|
+
correctionCount: 0,
|
|
16
|
+
avgUserExplanationLength: 0,
|
|
17
|
+
errorRetryCount: 0,
|
|
18
|
+
userToAiRatio: 0,
|
|
19
|
+
toolDiversity: 0,
|
|
20
|
+
multiDirScope: 0,
|
|
21
|
+
architecturalKeywords: 0,
|
|
22
|
+
};
|
|
23
|
+
let userTurnCount = 0;
|
|
24
|
+
let totalTurns = 0;
|
|
25
|
+
let totalUserWords = 0;
|
|
26
|
+
const tools = new Set();
|
|
27
|
+
const topDirs = new Set();
|
|
28
|
+
const stream = fs.createReadStream(sessionPath, { encoding: 'utf-8' });
|
|
29
|
+
const rl = readline.createInterface({ input: stream, crlfDelay: Infinity });
|
|
30
|
+
for await (const line of rl) {
|
|
31
|
+
if (!line.trim())
|
|
32
|
+
continue;
|
|
33
|
+
try {
|
|
34
|
+
const entry = JSON.parse(line);
|
|
35
|
+
totalTurns++;
|
|
36
|
+
if (entry.type === 'user' && entry.message?.role === 'human') {
|
|
37
|
+
userTurnCount++;
|
|
38
|
+
const text = extractText(entry.message?.content);
|
|
39
|
+
const words = text.split(/\s+/).filter(Boolean);
|
|
40
|
+
totalUserWords += words.length;
|
|
41
|
+
if (CORRECTION_WORDS.test(text))
|
|
42
|
+
signals.correctionCount++;
|
|
43
|
+
// Count all architectural keyword matches
|
|
44
|
+
const archMatches = text.match(new RegExp(ARCH_KEYWORDS.source, 'gi'));
|
|
45
|
+
if (archMatches)
|
|
46
|
+
signals.architecturalKeywords += archMatches.length;
|
|
47
|
+
}
|
|
48
|
+
if (entry.type === 'tool_result' || entry.type === 'tool_use') {
|
|
49
|
+
const text = extractText(entry.message?.content);
|
|
50
|
+
if (ERROR_WORDS.test(text))
|
|
51
|
+
signals.errorRetryCount++;
|
|
52
|
+
}
|
|
53
|
+
// Track tool diversity
|
|
54
|
+
if (entry.message?.content && Array.isArray(entry.message.content)) {
|
|
55
|
+
for (const block of entry.message.content) {
|
|
56
|
+
if (block.type === 'tool_use' && block.name) {
|
|
57
|
+
tools.add(block.name);
|
|
58
|
+
}
|
|
59
|
+
// Track file paths for directory scope
|
|
60
|
+
if (block.type === 'tool_use' && block.input?.file_path) {
|
|
61
|
+
const topDir = String(block.input.file_path).split('/').filter(Boolean)[0];
|
|
62
|
+
if (topDir)
|
|
63
|
+
topDirs.add(topDir);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// Skip malformed lines
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
signals.avgUserExplanationLength = userTurnCount > 0 ? totalUserWords / userTurnCount : 0;
|
|
73
|
+
signals.userToAiRatio = totalTurns > 0 ? userTurnCount / totalTurns : 0;
|
|
74
|
+
signals.toolDiversity = tools.size;
|
|
75
|
+
signals.multiDirScope = topDirs.size;
|
|
76
|
+
return signals;
|
|
77
|
+
}
|
|
78
|
+
function extractText(content) {
|
|
79
|
+
if (typeof content === 'string')
|
|
80
|
+
return content;
|
|
81
|
+
if (Array.isArray(content)) {
|
|
82
|
+
return content
|
|
83
|
+
.filter((b) => b.type === 'text' && typeof b.text === 'string')
|
|
84
|
+
.map((b) => b.text)
|
|
85
|
+
.join(' ');
|
|
86
|
+
}
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
// ── Hard floor (Layer 1) ─────────────────────────────────────────
|
|
90
|
+
const MIN_DURATION = 5; // minutes
|
|
91
|
+
const MIN_TURNS = 3;
|
|
92
|
+
const MIN_FILES = 1; // at least 1 file changed
|
|
93
|
+
const MAX_SELECTED = 10; // cap featured sessions for a focused portfolio
|
|
94
|
+
function passesHardFloor(s) {
|
|
95
|
+
return s.duration >= MIN_DURATION && s.turns >= MIN_TURNS && s.files >= MIN_FILES;
|
|
96
|
+
}
|
|
97
|
+
// ── Scoring fallback (no LLM) ────────────────────────────────────
|
|
98
|
+
function scoreSession(s, signals) {
|
|
99
|
+
return (signals.correctionCount * 3 +
|
|
100
|
+
Math.min(signals.avgUserExplanationLength / 10, 5) * 2 +
|
|
101
|
+
signals.toolDiversity * 2 +
|
|
102
|
+
signals.multiDirScope +
|
|
103
|
+
signals.architecturalKeywords * 2 +
|
|
104
|
+
Math.min(s.duration / 10, 5) + // bonus for longer sessions
|
|
105
|
+
Math.min(s.loc / 100, 5) // bonus for more LOC
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
// ── LLM triage (Layer 3) ─────────────────────────────────────────
|
|
109
|
+
const TRIAGE_PROMPT = `You are selecting which coding sessions are worth showcasing in a developer portfolio.
|
|
110
|
+
|
|
111
|
+
Given a list of sessions with their metadata and behavioral signals, decide which ones tell an interesting story about the developer's skills and decision-making.
|
|
112
|
+
|
|
113
|
+
Select sessions that show:
|
|
114
|
+
- Interesting technical decisions (high correction count = dev pushed back on AI)
|
|
115
|
+
- Complex problem solving (high tool diversity, multi-directory scope)
|
|
116
|
+
- Architectural thinking (architectural keywords in conversations)
|
|
117
|
+
- Substantial work (meaningful LOC and duration)
|
|
118
|
+
|
|
119
|
+
Skip sessions that are:
|
|
120
|
+
- Too small or mechanical (config changes, dependency updates)
|
|
121
|
+
- Repetitive of already-selected sessions
|
|
122
|
+
- Pure boilerplate generation
|
|
123
|
+
|
|
124
|
+
Select at most 10 sessions. A focused portfolio is better than an exhaustive one. Pick the strongest 6-10.
|
|
125
|
+
|
|
126
|
+
Return JSON with this exact structure:
|
|
127
|
+
{
|
|
128
|
+
"selected": [{ "sessionId": "...", "reason": "Brief explanation of why this is interesting" }],
|
|
129
|
+
"skipped": [{ "sessionId": "...", "reason": "Brief explanation of why skipped" }]
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
Every session in the input must appear in either selected or skipped.`;
|
|
133
|
+
async function llmTriage(sessions) {
|
|
134
|
+
const apiKey = getAnthropicApiKey();
|
|
135
|
+
if (!apiKey)
|
|
136
|
+
return null;
|
|
137
|
+
const client = new Anthropic({ apiKey });
|
|
138
|
+
const input = sessions.map((s) => ({
|
|
139
|
+
sessionId: s.sessionId,
|
|
140
|
+
title: s.title,
|
|
141
|
+
duration: s.duration,
|
|
142
|
+
loc: s.loc,
|
|
143
|
+
turns: s.turns,
|
|
144
|
+
files: s.files,
|
|
145
|
+
skills: s.skills,
|
|
146
|
+
signals: s.signals,
|
|
147
|
+
}));
|
|
148
|
+
try {
|
|
149
|
+
const response = await client.messages.create({
|
|
150
|
+
model: 'claude-haiku-4-5-20251001',
|
|
151
|
+
max_tokens: 2048,
|
|
152
|
+
system: TRIAGE_PROMPT,
|
|
153
|
+
messages: [{
|
|
154
|
+
role: 'user',
|
|
155
|
+
content: JSON.stringify(input),
|
|
156
|
+
}],
|
|
157
|
+
});
|
|
158
|
+
const text = response.content
|
|
159
|
+
.filter((b) => b.type === 'text')
|
|
160
|
+
.map((b) => b.text)
|
|
161
|
+
.join('');
|
|
162
|
+
// Extract JSON from response (may be wrapped in markdown code block)
|
|
163
|
+
const jsonMatch = text.match(/\{[\s\S]*\}/);
|
|
164
|
+
if (!jsonMatch)
|
|
165
|
+
return null;
|
|
166
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
167
|
+
// Validate structure
|
|
168
|
+
if (!Array.isArray(parsed.selected) || !Array.isArray(parsed.skipped))
|
|
169
|
+
return null;
|
|
170
|
+
return parsed;
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
console.error('[triage] LLM triage failed, falling back to scoring:', err.message);
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// ── Main triage function ─────────────────────────────────────────
|
|
178
|
+
export async function triageSessions(sessions, useLLM = true, onProgress) {
|
|
179
|
+
onProgress?.({ type: 'scanning', total: sessions.length });
|
|
180
|
+
// Layer 1: Hard floor
|
|
181
|
+
const passed = [];
|
|
182
|
+
const hardSkipped = [];
|
|
183
|
+
for (const s of sessions) {
|
|
184
|
+
if (passesHardFloor(s)) {
|
|
185
|
+
passed.push(s);
|
|
186
|
+
onProgress?.({ type: 'hard_floor', sessionId: s.sessionId, title: s.title, passed: true });
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
const reasons = [];
|
|
190
|
+
if (s.duration < MIN_DURATION)
|
|
191
|
+
reasons.push('Too short');
|
|
192
|
+
if (s.turns < MIN_TURNS)
|
|
193
|
+
reasons.push('Too few turns');
|
|
194
|
+
if (s.files < MIN_FILES)
|
|
195
|
+
reasons.push('No files changed');
|
|
196
|
+
const reason = reasons.join(', ');
|
|
197
|
+
hardSkipped.push({ sessionId: s.sessionId, reason });
|
|
198
|
+
onProgress?.({ type: 'hard_floor', sessionId: s.sessionId, title: s.title, passed: false, reason });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Small project optimization: if fewer than 5 sessions pass hard floor, auto-select all
|
|
202
|
+
const AUTO_SELECT_THRESHOLD = 5;
|
|
203
|
+
if (passed.length < AUTO_SELECT_THRESHOLD) {
|
|
204
|
+
const result = {
|
|
205
|
+
selected: passed.map((s) => ({ sessionId: s.sessionId, reason: 'Auto-selected (small project)' })),
|
|
206
|
+
skipped: hardSkipped,
|
|
207
|
+
triageMethod: 'auto-select',
|
|
208
|
+
autoSelected: true,
|
|
209
|
+
};
|
|
210
|
+
onProgress?.({ type: 'done', selected: result.selected.length, skipped: result.skipped.length });
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
// Layer 2: Signal extraction (sequential for progress reporting)
|
|
214
|
+
const sessionsWithSignals = [];
|
|
215
|
+
for (const s of passed) {
|
|
216
|
+
onProgress?.({ type: 'extracting_signals', sessionId: s.sessionId, title: s.title });
|
|
217
|
+
const signals = await extractSignals(s.path);
|
|
218
|
+
onProgress?.({ type: 'signals_done', sessionId: s.sessionId, signals });
|
|
219
|
+
sessionsWithSignals.push({ ...s, signals });
|
|
220
|
+
}
|
|
221
|
+
// Layer 3: LLM ranking or fallback scoring
|
|
222
|
+
if (useLLM) {
|
|
223
|
+
onProgress?.({ type: 'llm_ranking', sessionCount: sessionsWithSignals.length });
|
|
224
|
+
const llmResult = await llmTriage(sessionsWithSignals);
|
|
225
|
+
if (llmResult) {
|
|
226
|
+
// Enforce cap even if LLM returns too many
|
|
227
|
+
const capped = llmResult.selected.slice(0, MAX_SELECTED);
|
|
228
|
+
const overflow = llmResult.selected.slice(MAX_SELECTED).map((s) => ({
|
|
229
|
+
...s,
|
|
230
|
+
reason: 'Over selection cap',
|
|
231
|
+
}));
|
|
232
|
+
const result = {
|
|
233
|
+
selected: capped,
|
|
234
|
+
skipped: [...overflow, ...llmResult.skipped, ...hardSkipped],
|
|
235
|
+
triageMethod: 'llm',
|
|
236
|
+
};
|
|
237
|
+
onProgress?.({ type: 'done', selected: result.selected.length, skipped: result.skipped.length });
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
240
|
+
// LLM failed, fall through to scoring
|
|
241
|
+
onProgress?.({ type: 'scoring_fallback', sessionCount: sessionsWithSignals.length });
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
onProgress?.({ type: 'scoring_fallback', sessionCount: sessionsWithSignals.length });
|
|
245
|
+
}
|
|
246
|
+
// Fallback: score-based selection
|
|
247
|
+
const scored = sessionsWithSignals.map((s) => ({
|
|
248
|
+
...s,
|
|
249
|
+
score: scoreSession(s, s.signals),
|
|
250
|
+
}));
|
|
251
|
+
scored.sort((a, b) => b.score - a.score);
|
|
252
|
+
// Select top sessions (at least 1, at most MAX_SELECTED)
|
|
253
|
+
const selectCount = Math.max(1, Math.min(Math.ceil(scored.length * 0.6), MAX_SELECTED));
|
|
254
|
+
const selected = scored.slice(0, selectCount).map((s) => ({
|
|
255
|
+
sessionId: s.sessionId,
|
|
256
|
+
reason: buildScoreReason(s.signals),
|
|
257
|
+
}));
|
|
258
|
+
const skipped = [
|
|
259
|
+
...scored.slice(selectCount).map((s) => ({
|
|
260
|
+
sessionId: s.sessionId,
|
|
261
|
+
reason: 'Lower signal score',
|
|
262
|
+
})),
|
|
263
|
+
...hardSkipped,
|
|
264
|
+
];
|
|
265
|
+
const result = { selected, skipped, triageMethod: 'scoring' };
|
|
266
|
+
onProgress?.({ type: 'done', selected: result.selected.length, skipped: result.skipped.length });
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
function buildScoreReason(signals) {
|
|
270
|
+
const parts = [];
|
|
271
|
+
if (signals.correctionCount > 0)
|
|
272
|
+
parts.push(`${signals.correctionCount} corrections`);
|
|
273
|
+
if (signals.architecturalKeywords > 2)
|
|
274
|
+
parts.push('architectural decisions');
|
|
275
|
+
if (signals.toolDiversity > 5)
|
|
276
|
+
parts.push('diverse tooling');
|
|
277
|
+
if (signals.multiDirScope > 2)
|
|
278
|
+
parts.push('multi-directory scope');
|
|
279
|
+
if (signals.avgUserExplanationLength > 20)
|
|
280
|
+
parts.push('detailed explanations');
|
|
281
|
+
return parts.length > 0 ? parts.join(', ') : 'Substantive session';
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=triage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triage.js","sourceRoot":"","sources":["../../src/llm/triage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,oEAAoE;AAEpE,MAAM,gBAAgB,GAAG,oEAAoE,CAAC;AAC9F,MAAM,aAAa,GAAG,oGAAoG,CAAC;AAC3H,MAAM,WAAW,GAAG,4DAA4D,CAAC;AAYjF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,WAAmB;IACtD,MAAM,OAAO,GAAmB;QAC9B,eAAe,EAAE,CAAC;QAClB,wBAAwB,EAAE,CAAC;QAC3B,eAAe,EAAE,CAAC;QAClB,aAAa,EAAE,CAAC;QAChB,aAAa,EAAE,CAAC;QAChB,aAAa,EAAE,CAAC;QAChB,qBAAqB,EAAE,CAAC;KACzB,CAAC;IAEF,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACvE,MAAM,EAAE,GAAG,QAAQ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,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Session } from '../analyzer.js';
|
|
2
|
+
import type { EnhancementResult } from '../summarize.js';
|
|
3
|
+
export interface LLMProvider {
|
|
4
|
+
name: 'local' | 'proxy';
|
|
5
|
+
enhance(session: Session): Promise<EnhancementResult>;
|
|
6
|
+
}
|
|
7
|
+
export interface ProxyEnhanceResponse {
|
|
8
|
+
result: EnhancementResult;
|
|
9
|
+
usage: {
|
|
10
|
+
remaining: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface ProxyErrorResponse {
|
|
14
|
+
error: {
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
resets_at?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface MachineKeyPair {
|
|
2
|
+
publicKey: string;
|
|
3
|
+
privateKey: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function generateKeyPair(): MachineKeyPair;
|
|
7
|
+
export declare function loadOrCreateKeyPair(configDir?: string): MachineKeyPair;
|
|
8
|
+
export declare function signPayload(payload: string, privateKeyBase64: string): string;
|
|
9
|
+
export declare function verifySignature(payload: string, signatureBase64: string, publicKeyBase64: string): boolean;
|
|
10
|
+
export declare function getFingerprint(publicKeyBase64: string): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { generateKeyPairSync, sign, verify, createHash } from 'node:crypto';
|
|
2
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
const CONFIG_DIR = join(homedir(), '.config', 'heyiam');
|
|
6
|
+
const KEY_FILE = 'machine-key.json';
|
|
7
|
+
export function generateKeyPair() {
|
|
8
|
+
const { publicKey, privateKey } = generateKeyPairSync('ed25519', {
|
|
9
|
+
publicKeyEncoding: { type: 'spki', format: 'der' },
|
|
10
|
+
privateKeyEncoding: { type: 'pkcs8', format: 'der' },
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
publicKey: publicKey.toString('base64'),
|
|
14
|
+
privateKey: privateKey.toString('base64'),
|
|
15
|
+
createdAt: new Date().toISOString(),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function loadOrCreateKeyPair(configDir = CONFIG_DIR) {
|
|
19
|
+
const keyPath = join(configDir, KEY_FILE);
|
|
20
|
+
if (existsSync(keyPath)) {
|
|
21
|
+
const raw = readFileSync(keyPath, 'utf-8');
|
|
22
|
+
return JSON.parse(raw);
|
|
23
|
+
}
|
|
24
|
+
const keyPair = generateKeyPair();
|
|
25
|
+
mkdirSync(configDir, { recursive: true });
|
|
26
|
+
writeFileSync(keyPath, JSON.stringify(keyPair, null, 2), { mode: 0o600 });
|
|
27
|
+
return keyPair;
|
|
28
|
+
}
|
|
29
|
+
export function signPayload(payload, privateKeyBase64) {
|
|
30
|
+
const privateKeyDer = Buffer.from(privateKeyBase64, 'base64');
|
|
31
|
+
const keyObject = createPrivateKeyFromDer(privateKeyDer);
|
|
32
|
+
const signature = sign(null, Buffer.from(payload, 'utf-8'), keyObject);
|
|
33
|
+
return signature.toString('base64');
|
|
34
|
+
}
|
|
35
|
+
export function verifySignature(payload, signatureBase64, publicKeyBase64) {
|
|
36
|
+
const publicKeyDer = Buffer.from(publicKeyBase64, 'base64');
|
|
37
|
+
const keyObject = createPublicKeyFromDer(publicKeyDer);
|
|
38
|
+
return verify(null, Buffer.from(payload, 'utf-8'), keyObject, Buffer.from(signatureBase64, 'base64'));
|
|
39
|
+
}
|
|
40
|
+
export function getFingerprint(publicKeyBase64) {
|
|
41
|
+
const hash = createHash('sha256').update(Buffer.from(publicKeyBase64, 'base64')).digest('hex');
|
|
42
|
+
// Format as colon-separated pairs for display
|
|
43
|
+
return hash.match(/.{2}/g).join(':');
|
|
44
|
+
}
|
|
45
|
+
function createPrivateKeyFromDer(der) {
|
|
46
|
+
return { key: der, format: 'der', type: 'pkcs8' };
|
|
47
|
+
}
|
|
48
|
+
function createPublicKeyFromDer(der) {
|
|
49
|
+
return { key: der, format: 'der', type: 'spki' };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=machine-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machine-key.js","sourceRoot":"","sources":["../src/machine-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAQlC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACxD,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAEpC,MAAM,UAAU,eAAe;IAC7B,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,mBAAmB,CAAC,SAAS,EAAE;QAC/D,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;QAClD,kBAAkB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;KACrD,CAAC,CAAC;IAEH,OAAO;QACL,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACvC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACzC,SAAS,EAAE,IAAI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MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,eAAuB;IACpD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/F,8CAA8C;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,uBAAuB,CAAC,GAAW;IAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAc,EAAE,IAAI,EAAE,OAAgB,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW;IACzC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAc,EAAE,IAAI,EAAE,MAAe,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SessionParser, type RawEntry, type LocStats } from "./types.js";
|
|
2
|
+
export declare function computeLocStats(entries: RawEntry[]): LocStats;
|
|
3
|
+
/**
|
|
4
|
+
* Map subagent_type values from Agent tool calls to display roles.
|
|
5
|
+
* Teamrc agent names like "trc-frontend-dev" get the prefix stripped.
|
|
6
|
+
* Built-in types like "Explore" or "Plan" are lowercased.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mapAgentRole(subagentType: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Extract agent roles from parent's Agent tool calls.
|
|
11
|
+
* Returns a map of tool_use id → agentRole for matching with child sessions.
|
|
12
|
+
*/
|
|
13
|
+
export declare function extractAgentRoles(entries: RawEntry[]): Map<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Extract the agentId from a child session's first entry (fallback role detection).
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractAgentIdFromEntries(entries: RawEntry[]): string | undefined;
|
|
18
|
+
export declare const claudeParser: SessionParser;
|