@burtson-labs/host-kit 0.3.1
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/LICENSE +201 -0
- package/README.md +55 -0
- package/dist/backgroundTasks.d.ts +113 -0
- package/dist/backgroundTasks.d.ts.map +1 -0
- package/dist/backgroundTasks.js +137 -0
- package/dist/backgroundTasks.js.map +1 -0
- package/dist/checkpoints.d.ts +99 -0
- package/dist/checkpoints.d.ts.map +1 -0
- package/dist/checkpoints.js +227 -0
- package/dist/checkpoints.js.map +1 -0
- package/dist/hooks.d.ts +51 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +152 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/insights.d.ts +398 -0
- package/dist/insights.d.ts.map +1 -0
- package/dist/insights.js +1933 -0
- package/dist/insights.js.map +1 -0
- package/dist/mcp.d.ts +60 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +281 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mcpConnectors.d.ts +108 -0
- package/dist/mcpConnectors.d.ts.map +1 -0
- package/dist/mcpConnectors.js +217 -0
- package/dist/mcpConnectors.js.map +1 -0
- package/dist/mcpToolCache.d.ts +43 -0
- package/dist/mcpToolCache.d.ts.map +1 -0
- package/dist/mcpToolCache.js +150 -0
- package/dist/mcpToolCache.js.map +1 -0
- package/dist/mcpTrust.d.ts +22 -0
- package/dist/mcpTrust.d.ts.map +1 -0
- package/dist/mcpTrust.js +104 -0
- package/dist/mcpTrust.js.map +1 -0
- package/dist/memory.d.ts +38 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +151 -0
- package/dist/memory.js.map +1 -0
- package/dist/memoryIndex.d.ts +38 -0
- package/dist/memoryIndex.d.ts.map +1 -0
- package/dist/memoryIndex.js +142 -0
- package/dist/memoryIndex.js.map +1 -0
- package/dist/mentions.d.ts +33 -0
- package/dist/mentions.d.ts.map +1 -0
- package/dist/mentions.js +126 -0
- package/dist/mentions.js.map +1 -0
- package/dist/ollamaModels.d.ts +36 -0
- package/dist/ollamaModels.d.ts.map +1 -0
- package/dist/ollamaModels.js +83 -0
- package/dist/ollamaModels.js.map +1 -0
- package/dist/permissions.d.ts +72 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +271 -0
- package/dist/permissions.js.map +1 -0
- package/dist/tools/extraTools.d.ts +80 -0
- package/dist/tools/extraTools.d.ts.map +1 -0
- package/dist/tools/extraTools.js +471 -0
- package/dist/tools/extraTools.js.map +1 -0
- package/dist/tools/readMemoryTool.d.ts +3 -0
- package/dist/tools/readMemoryTool.d.ts.map +1 -0
- package/dist/tools/readMemoryTool.js +115 -0
- package/dist/tools/readMemoryTool.js.map +1 -0
- package/dist/tools/taskTool.d.ts +119 -0
- package/dist/tools/taskTool.d.ts.map +1 -0
- package/dist/tools/taskTool.js +466 -0
- package/dist/tools/taskTool.js.map +1 -0
- package/dist/tools/testRunTool.d.ts +59 -0
- package/dist/tools/testRunTool.d.ts.map +1 -0
- package/dist/tools/testRunTool.js +308 -0
- package/dist/tools/testRunTool.js.map +1 -0
- package/dist/turnLog.d.ts +89 -0
- package/dist/turnLog.d.ts.map +1 -0
- package/dist/turnLog.js +469 -0
- package/dist/turnLog.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `bandit insights` — generate a stand-alone HTML report from local
|
|
3
|
+
* session + turn-log data so the user can see how they (and the agent)
|
|
4
|
+
* are actually using bandit. Written as a single self-contained .html
|
|
5
|
+
* file with inline CSS and inline SVG charts — no server, no external
|
|
6
|
+
* resources, opens in any browser, sharable as one file.
|
|
7
|
+
*
|
|
8
|
+
* Data sources (all local, no network):
|
|
9
|
+
* - ~/.bandit/sessions/*.jsonl — every REPL session, role+content
|
|
10
|
+
* - <cwd>/.bandit/turns/*.jsonl — per-turn telemetry for the
|
|
11
|
+
* current workspace (tool calls,
|
|
12
|
+
* results, errors, timestamps)
|
|
13
|
+
* - <cwd>/.bandit/agent-report.json (when present, for plan goals)
|
|
14
|
+
*
|
|
15
|
+
* The pipeline is intentionally tolerant — corrupt JSONL lines are
|
|
16
|
+
* skipped, missing files are no-ops, individual turn-log fields can be
|
|
17
|
+
* absent. The goal is "show what we have," not "fail because one
|
|
18
|
+
* record was malformed."
|
|
19
|
+
*/
|
|
20
|
+
interface SessionFile {
|
|
21
|
+
id: string;
|
|
22
|
+
startedAt: number;
|
|
23
|
+
prompts: number;
|
|
24
|
+
assistantTurns: number;
|
|
25
|
+
approxChars: number;
|
|
26
|
+
toolCallCount: number;
|
|
27
|
+
toolNames: Map<string, number>;
|
|
28
|
+
}
|
|
29
|
+
interface TurnEvent {
|
|
30
|
+
t: string;
|
|
31
|
+
type: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
prompt?: string;
|
|
34
|
+
finalPreview?: string;
|
|
35
|
+
responsePreview?: string;
|
|
36
|
+
outputSnippet?: string;
|
|
37
|
+
reason?: string;
|
|
38
|
+
taskId?: string;
|
|
39
|
+
isError?: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
/** turnLog.ts writes tool-result events with `outputPreview`, not
|
|
42
|
+
* `error`. When isError is true and ev.error is missing, the actual
|
|
43
|
+
* error text lives here. The aggregate fallback reads this so the
|
|
44
|
+
* "Top error patterns" panel matches the error counts in the tools
|
|
45
|
+
* table (was empty even when 100+ errors were tallied — bug shipped
|
|
46
|
+
* pre-1.7.116). */
|
|
47
|
+
outputPreview?: string;
|
|
48
|
+
iteration?: number;
|
|
49
|
+
outputLength?: number;
|
|
50
|
+
/** Tool-execute events carry the params dict — we mine it for file
|
|
51
|
+
* paths (write_file, apply_edit, replace_range, apply_patch), git subcommands, and test-runner
|
|
52
|
+
* invocations to power the "accomplishments" section. Stored as
|
|
53
|
+
* `unknown` because the shape varies per tool. */
|
|
54
|
+
params?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface TurnFile {
|
|
57
|
+
workspace: string;
|
|
58
|
+
filename: string;
|
|
59
|
+
startedAt: number;
|
|
60
|
+
events: TurnEvent[];
|
|
61
|
+
}
|
|
62
|
+
/** AI-generated summary of what the user got done and where Bandit
|
|
63
|
+
* got in the way. Optional — only populated when the slash command
|
|
64
|
+
* passes an `ai` callback (provider available + user consent for
|
|
65
|
+
* cloud). The framing prompt instructs the model to attribute every
|
|
66
|
+
* friction point to Bandit, never the user — the goal is empathetic
|
|
67
|
+
* product feedback, not a postmortem of the human. */
|
|
68
|
+
export interface AiSummary {
|
|
69
|
+
/** Display label for the model that generated the summary, e.g.
|
|
70
|
+
* "qwen3.6:27b-it-q4_K_M" or "bandit-logic". Rendered in the
|
|
71
|
+
* section header so the user knows which model wrote the prose. */
|
|
72
|
+
modelLabel: string;
|
|
73
|
+
/** 2-4 narrative paragraphs reading as a journal entry — "you did X,
|
|
74
|
+
* then you debugged Y, you also picked at Z." Optional so older
|
|
75
|
+
* AiSummary producers (and the deterministic fallback) stay valid. */
|
|
76
|
+
storyline?: string[];
|
|
77
|
+
/** 3 bullets, accomplishment framing. */
|
|
78
|
+
shipped: string[];
|
|
79
|
+
/** 3 bullets, every line owns the miss as Bandit's, not the user's. */
|
|
80
|
+
friction: string[];
|
|
81
|
+
/** 3 bullets, behavioral patterns — HOW the user works (apply_edit
|
|
82
|
+
* vs write_file mix, commit cadence, debugging style, tool diversity).
|
|
83
|
+
* Distinct from `shipped` (what got done) — patterns describe the
|
|
84
|
+
* user's working style, not their accomplishments. */
|
|
85
|
+
patterns: string[];
|
|
86
|
+
}
|
|
87
|
+
/** Sentiment counts mined deterministically from the user's prompt
|
|
88
|
+
* history — keyword-based, fast, runs locally before the AI call.
|
|
89
|
+
* Surfaces honest visibility into emotional cues so the user sees
|
|
90
|
+
* their own frustration / satisfaction signal across sessions. */
|
|
91
|
+
export interface SentimentCounts {
|
|
92
|
+
satisfied: number;
|
|
93
|
+
happy: number;
|
|
94
|
+
excited: number;
|
|
95
|
+
frustrated: number;
|
|
96
|
+
unsatisfied: number;
|
|
97
|
+
/** Up to 3 short, redacted example phrases from frustration moments —
|
|
98
|
+
* surfaced in the report so the user sees concrete context. Profanity
|
|
99
|
+
* itself is NOT surfaced (replaced with [redacted]); the count is. */
|
|
100
|
+
notable: string[];
|
|
101
|
+
}
|
|
102
|
+
/** Payload handed to an AI summarizer for narrative generation.
|
|
103
|
+
*
|
|
104
|
+
* Consent boundary: the caller's slash command surfaces what's about
|
|
105
|
+
* to be sent and asks for explicit allow/deny before the first call.
|
|
106
|
+
* Local Ollama runs auto-consent (bytes never leave the machine);
|
|
107
|
+
* cloud runs prompt once and persist the answer. The payload includes
|
|
108
|
+
* verbatim prompt excerpts (up to 280 chars × 25 prompts) and work-
|
|
109
|
+
* highlight details (full prompts + topFiles + commands) so the LLM
|
|
110
|
+
* has enough material to write a SPECIFIC narrative — not template
|
|
111
|
+
* prose. Without this richness the storyline reads as generic counts.
|
|
112
|
+
*/
|
|
113
|
+
export interface AiSummaryInput {
|
|
114
|
+
totalPrompts: number;
|
|
115
|
+
totalSessions: number;
|
|
116
|
+
filesTouched: number;
|
|
117
|
+
filesWritten: number;
|
|
118
|
+
editsApplied: number;
|
|
119
|
+
gitOperations: number;
|
|
120
|
+
subagentsSpawned: number;
|
|
121
|
+
testsRun: number;
|
|
122
|
+
/** Coverage window in days, derived from sessions[].at — gives the LLM
|
|
123
|
+
* a sense of "the last week" vs "the last 3 months" so the storyline
|
|
124
|
+
* can scale tense and granularity. */
|
|
125
|
+
windowDays: number;
|
|
126
|
+
topTools: {
|
|
127
|
+
name: string;
|
|
128
|
+
calls: number;
|
|
129
|
+
errors: number;
|
|
130
|
+
errorRate: number;
|
|
131
|
+
}[];
|
|
132
|
+
topErrors: {
|
|
133
|
+
tool: string;
|
|
134
|
+
error: string;
|
|
135
|
+
count: number;
|
|
136
|
+
}[];
|
|
137
|
+
recentPromptExcerpts: {
|
|
138
|
+
date: string;
|
|
139
|
+
text: string;
|
|
140
|
+
}[];
|
|
141
|
+
/** Per-highlight detail handed to the LLM so it can name specific
|
|
142
|
+
* accomplishments in prose. Full prompt up to 400 chars, top 4 file
|
|
143
|
+
* paths, top commands. Areas + language counts come along too so
|
|
144
|
+
* the LLM can color the narrative ("you focused on TypeScript on
|
|
145
|
+
* the agent core"). */
|
|
146
|
+
workHighlights: {
|
|
147
|
+
date: string;
|
|
148
|
+
title: string;
|
|
149
|
+
area: string;
|
|
150
|
+
category: string;
|
|
151
|
+
outcome: string;
|
|
152
|
+
prompt: string;
|
|
153
|
+
turns: number;
|
|
154
|
+
filesTouched: number;
|
|
155
|
+
filesInspected: number;
|
|
156
|
+
externalActions: number;
|
|
157
|
+
testsRun: number;
|
|
158
|
+
gitOperations: number;
|
|
159
|
+
subagentsSpawned: number;
|
|
160
|
+
commands: string[];
|
|
161
|
+
topFiles: string[];
|
|
162
|
+
languages: string[];
|
|
163
|
+
}[];
|
|
164
|
+
/** Larger arcs grouped by repo area/domain. Includes top files so
|
|
165
|
+
* the LLM can write "the work concentrated in clients.ts" etc. */
|
|
166
|
+
workThemes: {
|
|
167
|
+
title: string;
|
|
168
|
+
turns: number;
|
|
169
|
+
filesTouched: number;
|
|
170
|
+
testsRun: number;
|
|
171
|
+
externalActions: number;
|
|
172
|
+
subagentsSpawned: number;
|
|
173
|
+
latest: string;
|
|
174
|
+
sampleTitles: string[];
|
|
175
|
+
outcomes: string[];
|
|
176
|
+
topFiles: string[];
|
|
177
|
+
languages: string[];
|
|
178
|
+
}[];
|
|
179
|
+
/** Sentiment counts scanned deterministically from prompt history —
|
|
180
|
+
* passed to the AI so its `patterns` and `friction` bullets can
|
|
181
|
+
* reference the user's emotional signal without the AI having to
|
|
182
|
+
* count words itself (counting is reliable; AI summarization is not). */
|
|
183
|
+
sentiment: SentimentCounts;
|
|
184
|
+
}
|
|
185
|
+
export interface WorkHighlight {
|
|
186
|
+
timestamp: number;
|
|
187
|
+
date: string;
|
|
188
|
+
title: string;
|
|
189
|
+
prompt: string;
|
|
190
|
+
area: string;
|
|
191
|
+
category: string;
|
|
192
|
+
summary: string;
|
|
193
|
+
outcome: string;
|
|
194
|
+
turns: number;
|
|
195
|
+
score: number;
|
|
196
|
+
turnFile: string;
|
|
197
|
+
filesTouched: number;
|
|
198
|
+
filesInspected: number;
|
|
199
|
+
writes: number;
|
|
200
|
+
edits: number;
|
|
201
|
+
externalActions: number;
|
|
202
|
+
testsRun: number;
|
|
203
|
+
gitOperations: number;
|
|
204
|
+
commitsMade: number;
|
|
205
|
+
subagentsSpawned: number;
|
|
206
|
+
errors: number;
|
|
207
|
+
commands: string[];
|
|
208
|
+
topFiles: {
|
|
209
|
+
path: string;
|
|
210
|
+
touches: number;
|
|
211
|
+
}[];
|
|
212
|
+
languages: {
|
|
213
|
+
label: string;
|
|
214
|
+
count: number;
|
|
215
|
+
}[];
|
|
216
|
+
tools: {
|
|
217
|
+
name: string;
|
|
218
|
+
calls: number;
|
|
219
|
+
}[];
|
|
220
|
+
}
|
|
221
|
+
export interface WorkTheme {
|
|
222
|
+
title: string;
|
|
223
|
+
area: string;
|
|
224
|
+
turns: number;
|
|
225
|
+
score: number;
|
|
226
|
+
latestAt: number;
|
|
227
|
+
latestDate: string;
|
|
228
|
+
filesTouched: number;
|
|
229
|
+
filesInspected: number;
|
|
230
|
+
editsAndWrites: number;
|
|
231
|
+
externalActions: number;
|
|
232
|
+
testsRun: number;
|
|
233
|
+
gitOperations: number;
|
|
234
|
+
subagentsSpawned: number;
|
|
235
|
+
topFiles: {
|
|
236
|
+
path: string;
|
|
237
|
+
touches: number;
|
|
238
|
+
}[];
|
|
239
|
+
languages: {
|
|
240
|
+
label: string;
|
|
241
|
+
count: number;
|
|
242
|
+
}[];
|
|
243
|
+
sampleTitles: string[];
|
|
244
|
+
outcomes: string[];
|
|
245
|
+
}
|
|
246
|
+
export type AiSummaryFn = (input: AiSummaryInput) => Promise<AiSummary | null>;
|
|
247
|
+
export interface InsightsData {
|
|
248
|
+
generatedAt: number;
|
|
249
|
+
cwd: string;
|
|
250
|
+
sessions: SessionFile[];
|
|
251
|
+
turnFiles: TurnFile[];
|
|
252
|
+
/** Per-tool aggregates across every turn file. */
|
|
253
|
+
toolStats: Map<string, {
|
|
254
|
+
calls: number;
|
|
255
|
+
errors: number;
|
|
256
|
+
lastError?: string;
|
|
257
|
+
}>;
|
|
258
|
+
/** Top error patterns across every turn file. Key is tool name, value is array of distinct error strings + counts. */
|
|
259
|
+
errorClusters: Map<string, {
|
|
260
|
+
error: string;
|
|
261
|
+
count: number;
|
|
262
|
+
}[]>;
|
|
263
|
+
/** Total prompts across every session. */
|
|
264
|
+
totalPrompts: number;
|
|
265
|
+
/** Approx total tokens across sessions (chars / 4 — same convention the rest of the CLI uses). */
|
|
266
|
+
totalApproxTokens: number;
|
|
267
|
+
/** Headline accomplishment counters mined from turn logs. Used to
|
|
268
|
+
* surface "what got done" in the report instead of just raw tool
|
|
269
|
+
* call counts. */
|
|
270
|
+
accomplishments: {
|
|
271
|
+
/** Distinct files written (write_file) or edited (apply_edit). */
|
|
272
|
+
filesTouched: number;
|
|
273
|
+
/** Number of write_file calls (file creates / full rewrites). */
|
|
274
|
+
filesWritten: number;
|
|
275
|
+
/** Number of apply_edit calls (targeted edits). */
|
|
276
|
+
editsApplied: number;
|
|
277
|
+
/** Distinct git commands run (git_status, git_diff, git_commit, run_command "git ..."). */
|
|
278
|
+
gitOperations: number;
|
|
279
|
+
/** Subset of gitOperations that were `git_commit` specifically. */
|
|
280
|
+
commitsMade: number;
|
|
281
|
+
/** Number of subagent task spawns. */
|
|
282
|
+
subagentsSpawned: number;
|
|
283
|
+
/** Number of test-related run_command invocations (npm test, pytest, vitest, etc). */
|
|
284
|
+
testsRun: number;
|
|
285
|
+
/** Top 8 most-touched file paths, ordered by hit count. Paths
|
|
286
|
+
* under the user's home directory are normalized to ~/... so
|
|
287
|
+
* the report doesn't leak absolute /Users/<name>/... layouts when
|
|
288
|
+
* shared. */
|
|
289
|
+
topFiles: {
|
|
290
|
+
path: string;
|
|
291
|
+
touches: number;
|
|
292
|
+
}[];
|
|
293
|
+
/** Languages touched, bucketed by file extension. Keys are
|
|
294
|
+
* display labels ("TypeScript", "Python"); values are the
|
|
295
|
+
* count of distinct files that ext is associated with. */
|
|
296
|
+
languages: {
|
|
297
|
+
label: string;
|
|
298
|
+
count: number;
|
|
299
|
+
}[];
|
|
300
|
+
};
|
|
301
|
+
/** Human-readable reconstruction of the actual work, mined from
|
|
302
|
+
* prompt + turn telemetry. This is the part that keeps repeated
|
|
303
|
+
* /insights runs from feeling like the same generic dashboard. */
|
|
304
|
+
work: {
|
|
305
|
+
highlights: WorkHighlight[];
|
|
306
|
+
themes: WorkTheme[];
|
|
307
|
+
};
|
|
308
|
+
/** Deterministic narrative built locally from prompts, final
|
|
309
|
+
* responses, changed files, and mutating external-tool actions. This
|
|
310
|
+
* renders when the optional AI summary is disabled or fails so the
|
|
311
|
+
* report still tells a story instead of falling back to counters. */
|
|
312
|
+
localStory: string[];
|
|
313
|
+
/** Activity-based metrics derived from session timestamps. */
|
|
314
|
+
streak: {
|
|
315
|
+
/** Consecutive days ending today (0 if today had no sessions). */
|
|
316
|
+
current: number;
|
|
317
|
+
/** Longest run of consecutive days the user has ever had. */
|
|
318
|
+
longest: number;
|
|
319
|
+
};
|
|
320
|
+
/** The single calendar day with the most prompts. Null if no data. */
|
|
321
|
+
peakDay: {
|
|
322
|
+
date: string;
|
|
323
|
+
prompts: number;
|
|
324
|
+
} | null;
|
|
325
|
+
/** ms-epoch of the very first session — drives the "since first run" line. */
|
|
326
|
+
firstSeenAt: number | null;
|
|
327
|
+
/** Sentiment counts mined from prompt history — deterministic, no
|
|
328
|
+
* AI required. Surfaced directly in the report so the user sees
|
|
329
|
+
* their frustration / satisfaction signal across sessions. */
|
|
330
|
+
sentiment: SentimentCounts;
|
|
331
|
+
/** Optional AI-generated summary. Only set when the slash command
|
|
332
|
+
* hands an AI callback in and the call completes successfully. */
|
|
333
|
+
ai?: AiSummary;
|
|
334
|
+
}
|
|
335
|
+
export declare function computeInsights(cwd: string): InsightsData;
|
|
336
|
+
/** Build the privacy-aware payload handed to an AI summarizer.
|
|
337
|
+
* Caps everything to small amounts of data — no raw turn logs, no
|
|
338
|
+
* full session contents, prompt titles trimmed to first ~120 chars.
|
|
339
|
+
* This is what gets sent to the user's LLM, so it must contain
|
|
340
|
+
* nothing the user wouldn't paste into a chat themselves. */
|
|
341
|
+
declare function buildAiInput(data: InsightsData): AiSummaryInput;
|
|
342
|
+
export { buildAiInput };
|
|
343
|
+
/**
|
|
344
|
+
* Single non-streaming chat function — provided by the host (CLI builds
|
|
345
|
+
* a fresh provider, IDE wraps its own provider settings). Same shape on
|
|
346
|
+
* both sides so the callback below renders identically regardless of
|
|
347
|
+
* which surface called it.
|
|
348
|
+
*/
|
|
349
|
+
export type OneShotChatFn = (prompt: string, opts?: {
|
|
350
|
+
systemPrompt?: string;
|
|
351
|
+
timeoutMs?: number;
|
|
352
|
+
}) => Promise<string | null>;
|
|
353
|
+
/**
|
|
354
|
+
* Build the AI summary callback handed to `writeInsightsReport({ ai })`.
|
|
355
|
+
*
|
|
356
|
+
* Centralised so the CLI's `/insights` and the VS Code extension's
|
|
357
|
+
* `banditStealth.insights` produce byte-identical prompts and parse
|
|
358
|
+
* the response the same way. Without this, every surface that wants AI
|
|
359
|
+
* summaries had to duplicate the system prompt + JSON-extraction logic
|
|
360
|
+
* and the two could drift — the IDE's report ended up skipping AI
|
|
361
|
+
* entirely ( ) while the CLI rendered the full
|
|
362
|
+
* shipped/friction blocks. One helper, one prompt, identical output.
|
|
363
|
+
*/
|
|
364
|
+
export declare function buildInsightsAiCallback(opts: {
|
|
365
|
+
oneShotChat: OneShotChatFn;
|
|
366
|
+
modelLabel: string;
|
|
367
|
+
/** Override the default 30s timeout if the host wants tighter bounds. */
|
|
368
|
+
timeoutMs?: number;
|
|
369
|
+
}): AiSummaryFn;
|
|
370
|
+
/**
|
|
371
|
+
* Render the data as a single self-contained HTML document. Inline
|
|
372
|
+
* CSS, no JavaScript, no external resources — opens in any browser
|
|
373
|
+
* and is share-as-a-single-file friendly. Intentionally simple:
|
|
374
|
+
* tables, bar charts via flex-width divs, no chart library.
|
|
375
|
+
*/
|
|
376
|
+
export declare function renderInsightsHtml(data: InsightsData): string;
|
|
377
|
+
/**
|
|
378
|
+
* CLI entry: write the HTML report and (optionally) open it in the
|
|
379
|
+
* default browser. Returns the absolute output path on success.
|
|
380
|
+
*
|
|
381
|
+
* Default output is `~/.bandit/insights.html` — same root the CLI uses
|
|
382
|
+
* for sessions/config/themes/skills. The bulk of the report's data
|
|
383
|
+
* source is `~/.bandit/sessions/*.jsonl` (global, all repos), so the
|
|
384
|
+
* report belongs at user level, not at any individual workspace's
|
|
385
|
+
* `.bandit/` dir. The `~/.bandit/` directory is created if missing.
|
|
386
|
+
* Pass `--out <path>` to override (resolved against cwd).
|
|
387
|
+
*/
|
|
388
|
+
export declare function writeInsightsReport(opts: {
|
|
389
|
+
cwd: string;
|
|
390
|
+
out?: string;
|
|
391
|
+
/** Optional AI summarizer. When provided, gets called with a
|
|
392
|
+
* privacy-aware aggregate payload and may return a short
|
|
393
|
+
* accomplishments + friction summary that renders at the top of
|
|
394
|
+
* the report. Must return null (or throw) to fall back to the
|
|
395
|
+
* static, non-AI report — failures here never block writing. */
|
|
396
|
+
ai?: AiSummaryFn;
|
|
397
|
+
}): Promise<string>;
|
|
398
|
+
//# sourceMappingURL=insights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../src/insights.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM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