agent-afk 5.47.0 → 5.48.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/dist/agent/mcp/config-loader.d.ts +1 -1
- package/dist/cli/commands/insights.d.ts +2 -0
- package/dist/cli.mjs +609 -452
- package/dist/index.mjs +58 -58
- package/dist/insights/aggregators/daemon.d.ts +4 -0
- package/dist/insights/aggregators/index.d.ts +7 -0
- package/dist/insights/aggregators/routing.d.ts +3 -0
- package/dist/insights/aggregators/sessions.d.ts +3 -0
- package/dist/insights/aggregators/traces.d.ts +3 -0
- package/dist/insights/constants.d.ts +11 -0
- package/dist/insights/html.d.ts +3 -0
- package/dist/insights/index.d.ts +5 -0
- package/dist/insights/open.d.ts +1 -0
- package/dist/insights/recommendations.d.ts +2 -0
- package/dist/insights/types.d.ts +79 -0
- package/dist/paths.d.ts +1 -0
- package/dist/telegram/handlers/message.d.ts +1 -0
- package/dist/telegram.mjs +191 -191
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InsightsOptions, DaemonAggregates } from '../types.js';
|
|
2
|
+
export declare function zeroDaemonAggregates(): DaemonAggregates;
|
|
3
|
+
export declare function readTailMb(filePath: string): string;
|
|
4
|
+
export declare function aggregateDaemonTelemetry(options: InsightsOptions): DaemonAggregates;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { aggregateSessions } from './sessions.js';
|
|
2
|
+
import { aggregateTraces } from './traces.js';
|
|
3
|
+
import { aggregateDaemonTelemetry } from './daemon.js';
|
|
4
|
+
import { aggregateRoutingDecisions } from './routing.js';
|
|
5
|
+
import type { InsightsOptions, InsightAggregates } from '../types.js';
|
|
6
|
+
export { aggregateSessions, aggregateTraces, aggregateDaemonTelemetry, aggregateRoutingDecisions, };
|
|
7
|
+
export declare function aggregateAll(options: InsightsOptions): Promise<InsightAggregates>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const RECOMMENDATION_THRESHOLDS: {
|
|
2
|
+
readonly toolErrorRateMin: 0.2;
|
|
3
|
+
readonly highErrorToolMinCalls: 5;
|
|
4
|
+
readonly daemonSuccessRateMin: 0.5;
|
|
5
|
+
readonly budgetExceededSessionsMin: 5;
|
|
6
|
+
readonly overflowKillsMin: 1;
|
|
7
|
+
readonly costConcentrationMax: 0.9;
|
|
8
|
+
readonly costConcentrationMinCostUsd: 0.1;
|
|
9
|
+
readonly highDaemonErrorRateMin: 0.3;
|
|
10
|
+
readonly minRunsForDaemonErrorRate: 10;
|
|
11
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InsightAggregates, Recommendation, InsightsOptions } from './types.js';
|
|
2
|
+
export declare function htmlEscape(s: string): string;
|
|
3
|
+
export declare function generateHtml(aggregates: InsightAggregates, recommendations: Recommendation[], _options: InsightsOptions): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { aggregateAll } from './aggregators/index.js';
|
|
2
|
+
export { evaluateRecommendations } from './recommendations.js';
|
|
3
|
+
export { generateHtml, htmlEscape } from './html.js';
|
|
4
|
+
export { openInBrowser } from './open.js';
|
|
5
|
+
export type { InsightAggregates, InsightsOptions, Recommendation, RecommendationSeverity, SessionAggregates, TraceAggregates, DaemonAggregates, RoutingAggregates, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function openInBrowser(filePath: string): void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface InsightsOptions {
|
|
2
|
+
days: number;
|
|
3
|
+
afkHome?: string | undefined;
|
|
4
|
+
}
|
|
5
|
+
export interface SessionAggregates {
|
|
6
|
+
totalSessions: number;
|
|
7
|
+
totalCostUsd: number;
|
|
8
|
+
totalTokens: number;
|
|
9
|
+
byDay: Record<string, {
|
|
10
|
+
costUsd: number;
|
|
11
|
+
sessions: number;
|
|
12
|
+
}>;
|
|
13
|
+
byModel: Record<string, {
|
|
14
|
+
costUsd: number;
|
|
15
|
+
sessions: number;
|
|
16
|
+
}>;
|
|
17
|
+
bySurface: Record<string, {
|
|
18
|
+
costUsd: number;
|
|
19
|
+
sessions: number;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface TraceAggregates {
|
|
23
|
+
totalTracedSessions: number;
|
|
24
|
+
toolCallCounts: Record<string, number>;
|
|
25
|
+
toolErrorCounts: Record<string, number>;
|
|
26
|
+
toolDurationsMs: Record<string, number>;
|
|
27
|
+
subagentForkDepths: Record<number, number>;
|
|
28
|
+
compactionCount: number;
|
|
29
|
+
closureReasons: Record<string, number>;
|
|
30
|
+
totalInputTokens: number;
|
|
31
|
+
totalOutputTokens: number;
|
|
32
|
+
totalCacheReadTokens: number;
|
|
33
|
+
totalCacheCreationTokens: number;
|
|
34
|
+
totalCostUsd: number;
|
|
35
|
+
sessionsWithCost: number;
|
|
36
|
+
}
|
|
37
|
+
export interface DaemonAggregates {
|
|
38
|
+
totalRuns: number;
|
|
39
|
+
successCount: number;
|
|
40
|
+
errorCount: number;
|
|
41
|
+
skipCount: number;
|
|
42
|
+
byTaskId: Record<string, {
|
|
43
|
+
success: number;
|
|
44
|
+
error: number;
|
|
45
|
+
skip: number;
|
|
46
|
+
}>;
|
|
47
|
+
triggerBreakdown: Record<string, number>;
|
|
48
|
+
skipReasons: Record<string, number>;
|
|
49
|
+
recentErrors: Array<{
|
|
50
|
+
taskId: string;
|
|
51
|
+
ts: number;
|
|
52
|
+
message: string;
|
|
53
|
+
}>;
|
|
54
|
+
avgDurationMs: number;
|
|
55
|
+
}
|
|
56
|
+
export interface RoutingAggregates {
|
|
57
|
+
totalRoutingEvents: number;
|
|
58
|
+
skillDispatchModes: Record<string, number>;
|
|
59
|
+
skillFrequency: Record<string, number>;
|
|
60
|
+
composeCallCount: number;
|
|
61
|
+
avgComposeNodes: number;
|
|
62
|
+
avgComposeEdges: number;
|
|
63
|
+
overflowKills: Record<string, number>;
|
|
64
|
+
}
|
|
65
|
+
export interface InsightAggregates {
|
|
66
|
+
generatedAt: number;
|
|
67
|
+
windowDays: number;
|
|
68
|
+
sessions: SessionAggregates;
|
|
69
|
+
traces: TraceAggregates;
|
|
70
|
+
daemon: DaemonAggregates;
|
|
71
|
+
routing: RoutingAggregates;
|
|
72
|
+
}
|
|
73
|
+
export type RecommendationSeverity = 'high' | 'medium' | 'info';
|
|
74
|
+
export interface Recommendation {
|
|
75
|
+
severity: RecommendationSeverity;
|
|
76
|
+
title: string;
|
|
77
|
+
body: string;
|
|
78
|
+
metric: number;
|
|
79
|
+
}
|
package/dist/paths.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare function getAfkHome(): string;
|
|
|
2
2
|
export declare function getSdkHomeDir(): string;
|
|
3
3
|
export declare function getAgentFrameworkDir(): string;
|
|
4
4
|
export declare function getTelemetryPath(): string;
|
|
5
|
+
export declare function getRoutingDecisionsPath(): string;
|
|
5
6
|
export declare function getSdkSchemaViolationsPath(): string;
|
|
6
7
|
export declare function getBriefsDir(): string;
|
|
7
8
|
export declare function getFacetCacheDir(): string;
|
|
@@ -9,6 +9,7 @@ export declare class MessageHandler {
|
|
|
9
9
|
private registeredCommandChats;
|
|
10
10
|
private log;
|
|
11
11
|
private bot;
|
|
12
|
+
private claimedChats;
|
|
12
13
|
pendingElicitations: Map<number, (text: string) => void>;
|
|
13
14
|
ledgerOriginatedPendingChats: Set<number>;
|
|
14
15
|
constructor(bot: Telegraf, sessionManager: SessionManager, registeredCommandChats: Set<number>, log: LogFn);
|