@agent-finops/core 0.5.5 → 0.5.7
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 +21 -0
- package/README.md +16 -0
- package/dist/agentInventory.d.ts +35 -9
- package/dist/agentInventory.js +309 -11
- package/dist/analyze.js +6 -2
- package/dist/contextHealth.d.ts +101 -0
- package/dist/contextHealth.js +371 -0
- package/dist/deadContext.js +10 -1
- package/dist/discovery.d.ts +14 -1
- package/dist/discovery.js +54 -28
- package/dist/glance.d.ts +161 -0
- package/dist/glance.js +586 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/localAgentLogs.d.ts +42 -2
- package/dist/localAgentLogs.js +460 -7
- package/dist/modelPricing.d.ts +2 -1
- package/dist/modelPricing.js +22 -3
- package/dist/planMath.d.ts +12 -14
- package/dist/planMath.js +18 -18
- package/dist/providerConnectors.d.ts +19 -1
- package/dist/providerConnectors.js +106 -26
- package/dist/scanGuard.d.ts +35 -0
- package/dist/scanGuard.js +196 -8
- package/dist/schema.d.ts +24 -24
- package/dist/sourceRegistry.js +1 -1
- package/dist/toolInvocations.d.ts +42 -1
- package/dist/toolInvocations.js +244 -4
- package/package.json +15 -2
package/dist/glance.d.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { type LocalAgentActivity, type LocalAgentCall, type LocalAgentLogResult, type LocalAgentRateLimitWindow } from "./localAgentLogs.js";
|
|
2
|
+
import type { DetectedPlan } from "./planDetection.js";
|
|
3
|
+
import { type ContextHealthResult } from "./contextHealth.js";
|
|
4
|
+
export type GlanceSession = {
|
|
5
|
+
status: "active" | "recent";
|
|
6
|
+
agent: LocalAgentCall["agent"];
|
|
7
|
+
project?: string;
|
|
8
|
+
model: string;
|
|
9
|
+
startedAt: string;
|
|
10
|
+
lastActivityAt: string;
|
|
11
|
+
durationMinutes: number;
|
|
12
|
+
apiEquivalentUsd: number | null;
|
|
13
|
+
costConfidence: "estimated" | "missing";
|
|
14
|
+
inputTokens: number;
|
|
15
|
+
outputTokens: number;
|
|
16
|
+
};
|
|
17
|
+
export type GlanceLimit = {
|
|
18
|
+
agent: LocalAgentCall["agent"];
|
|
19
|
+
kind: LocalAgentRateLimitWindow["kind"];
|
|
20
|
+
name: string;
|
|
21
|
+
usedPercent: number;
|
|
22
|
+
remainingPercent: number;
|
|
23
|
+
windowMinutes: number;
|
|
24
|
+
observedAt: string;
|
|
25
|
+
resetsAt: string;
|
|
26
|
+
source: "transcript_reported";
|
|
27
|
+
projectedExhaustionAt: string | null;
|
|
28
|
+
projectedToExhaustBeforeReset: boolean;
|
|
29
|
+
projectionConfidence: "estimated";
|
|
30
|
+
};
|
|
31
|
+
export type GlanceAnomaly = {
|
|
32
|
+
kind: "session_spend" | "session_tokens";
|
|
33
|
+
ratioToMedian: number;
|
|
34
|
+
summary: string;
|
|
35
|
+
action: string;
|
|
36
|
+
confidence: "derived";
|
|
37
|
+
};
|
|
38
|
+
export type GlancePlanContext = {
|
|
39
|
+
agent: LocalAgentCall["agent"];
|
|
40
|
+
planId: string | null;
|
|
41
|
+
planLabel: string;
|
|
42
|
+
billing: DetectedPlan["billing"];
|
|
43
|
+
monthlyUsd: number | null;
|
|
44
|
+
priceConfidence: "published_list" | "missing";
|
|
45
|
+
source: "locally_detected" | "user_declared";
|
|
46
|
+
};
|
|
47
|
+
export type GlanceFocus = {
|
|
48
|
+
windowDays: number;
|
|
49
|
+
summary: string;
|
|
50
|
+
kind: LocalAgentActivity["kind"];
|
|
51
|
+
project?: string;
|
|
52
|
+
file?: string;
|
|
53
|
+
agents: Array<LocalAgentCall["agent"]>;
|
|
54
|
+
sessions: number;
|
|
55
|
+
activitySharePercent: number;
|
|
56
|
+
measure: "observed_prompt_and_tool_activity";
|
|
57
|
+
confidence: "high" | "medium" | "low";
|
|
58
|
+
};
|
|
59
|
+
export type GlancePrimaryAction = {
|
|
60
|
+
intent: "start_fresh" | "review_context" | "trim_context" | "protect_runway" | "continue_focus" | "resume_focus" | "inspect_current_work";
|
|
61
|
+
label: string;
|
|
62
|
+
detail: string;
|
|
63
|
+
project?: string;
|
|
64
|
+
focus?: string;
|
|
65
|
+
agentPrompt: string;
|
|
66
|
+
source: "context_health_focus_and_reported_runway";
|
|
67
|
+
confidence: "high" | "medium" | "low";
|
|
68
|
+
execution: "copy_prompt";
|
|
69
|
+
requiresUserConfirmation: true;
|
|
70
|
+
};
|
|
71
|
+
export type GlanceProvenance = {
|
|
72
|
+
session: {
|
|
73
|
+
source: "local_transcript_metadata";
|
|
74
|
+
agents: Array<LocalAgentCall["agent"]>;
|
|
75
|
+
filesParsed: number;
|
|
76
|
+
};
|
|
77
|
+
sessionValue: {
|
|
78
|
+
source: "local_calculation";
|
|
79
|
+
basis: "transcript_tokens_at_public_api_rates";
|
|
80
|
+
confidence: GlanceSession["costConfidence"];
|
|
81
|
+
pricingAsOf: string;
|
|
82
|
+
};
|
|
83
|
+
plan: {
|
|
84
|
+
source: "local_agent_account_metadata" | "user_declared" | "not_available";
|
|
85
|
+
agent?: LocalAgentCall["agent"];
|
|
86
|
+
};
|
|
87
|
+
limits: {
|
|
88
|
+
source: "transcript_reported" | "not_available";
|
|
89
|
+
agents: Array<LocalAgentCall["agent"]>;
|
|
90
|
+
windows: Array<LocalAgentRateLimitWindow["kind"]>;
|
|
91
|
+
projection: "local_pace_estimate";
|
|
92
|
+
};
|
|
93
|
+
focus: {
|
|
94
|
+
source: "local_prompt_and_tool_activity" | "not_available";
|
|
95
|
+
agents: Array<LocalAgentCall["agent"]>;
|
|
96
|
+
rawPromptTextReturned: false;
|
|
97
|
+
};
|
|
98
|
+
anomaly: {
|
|
99
|
+
source: "local_session_history" | "not_available";
|
|
100
|
+
comparison: "same_agent_session_median";
|
|
101
|
+
};
|
|
102
|
+
contextHealth: {
|
|
103
|
+
source: "canonical_context_health_contract";
|
|
104
|
+
hookPayload: "not_executed_or_inferred";
|
|
105
|
+
};
|
|
106
|
+
primaryAction: {
|
|
107
|
+
source: "canonical_context_health_focus_and_reported_runway";
|
|
108
|
+
execution: "copy_prompt";
|
|
109
|
+
automaticExecution: false;
|
|
110
|
+
};
|
|
111
|
+
network: {
|
|
112
|
+
uploaded: false;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type UsageGlanceSnapshot = {
|
|
116
|
+
dataMode: "local_transcripts";
|
|
117
|
+
generatedAt: string;
|
|
118
|
+
coverage: {
|
|
119
|
+
filesParsed: number;
|
|
120
|
+
supportedTranscriptAgents: Array<LocalAgentCall["agent"]>;
|
|
121
|
+
detectedAgents: Array<LocalAgentCall["agent"]>;
|
|
122
|
+
rateLimitMetadata: Array<{
|
|
123
|
+
agent: LocalAgentCall["agent"];
|
|
124
|
+
status: "reported" | "not_reported_by_transcript" | "not_seen";
|
|
125
|
+
windowsReported: Array<LocalAgentRateLimitWindow["kind"]>;
|
|
126
|
+
}>;
|
|
127
|
+
providerConnectionRequired: ["cursor", "github-copilot"];
|
|
128
|
+
};
|
|
129
|
+
provenance: GlanceProvenance;
|
|
130
|
+
currentSession: GlanceSession | null;
|
|
131
|
+
plan: GlancePlanContext | null;
|
|
132
|
+
limits: GlanceLimit[];
|
|
133
|
+
focus: GlanceFocus | null;
|
|
134
|
+
anomaly: GlanceAnomaly | null;
|
|
135
|
+
sessionHealth: ContextHealthResult;
|
|
136
|
+
primaryAction: GlancePrimaryAction;
|
|
137
|
+
caveats: string[];
|
|
138
|
+
};
|
|
139
|
+
export type BuildUsageGlanceOptions = {
|
|
140
|
+
now?: Date;
|
|
141
|
+
activeWithinMinutes?: number;
|
|
142
|
+
focusWindowDays?: number;
|
|
143
|
+
filesParsed?: number;
|
|
144
|
+
detectedAgents?: Array<LocalAgentCall["agent"]>;
|
|
145
|
+
/** Locally detected or explicitly declared subscription/API billing modes. */
|
|
146
|
+
detectedPlans?: DetectedPlan[];
|
|
147
|
+
/** Account-level limit metadata should not be removed by a project filter. */
|
|
148
|
+
limitCalls?: LocalAgentCall[];
|
|
149
|
+
/** Canonical result shared with CLI/MCP. Falls back to session-only health. */
|
|
150
|
+
contextHealth?: ContextHealthResult;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Build the read model used by the native Glance surface.
|
|
154
|
+
*
|
|
155
|
+
* Token counts, projects, models, timestamps, and Codex limit windows come
|
|
156
|
+
* directly from local transcript metadata. Dollar values and exhaustion
|
|
157
|
+
* times are deterministic estimates and are labeled as such.
|
|
158
|
+
*/
|
|
159
|
+
export declare function buildUsageGlance(calls: LocalAgentCall[], options?: BuildUsageGlanceOptions): UsageGlanceSnapshot;
|
|
160
|
+
export declare function buildUsageGlanceFromLogs(logs: LocalAgentLogResult, options?: Omit<BuildUsageGlanceOptions, "filesParsed">): UsageGlanceSnapshot;
|
|
161
|
+
//# sourceMappingURL=glance.d.ts.map
|