@agent-finops/core 0.8.1 → 0.9.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.
Files changed (44) hide show
  1. package/README.md +5 -3
  2. package/dist/actionPlanner.d.ts +140 -0
  3. package/dist/actionPlanner.js +938 -0
  4. package/dist/actionVerification.d.ts +1240 -0
  5. package/dist/actionVerification.js +1028 -0
  6. package/dist/activitySnapshot.d.ts +142 -50
  7. package/dist/activitySnapshot.js +145 -6
  8. package/dist/activitySnapshotCache.d.ts +8 -1
  9. package/dist/activitySnapshotCache.js +103 -7
  10. package/dist/agentEconomicsReceipt.d.ts +74 -74
  11. package/dist/glance.d.ts +27 -1
  12. package/dist/glance.js +151 -12
  13. package/dist/index.d.ts +11 -2
  14. package/dist/index.js +10 -1
  15. package/dist/localAgentFormats/gemini.js +2 -2
  16. package/dist/localAgentFormats/registry.js +6 -2
  17. package/dist/localAgentFormats/runtimeRegistry.js +5 -2
  18. package/dist/localAgentFormats/types.d.ts +2 -1
  19. package/dist/localAgentLogs.d.ts +362 -3
  20. package/dist/localAgentLogs.js +1964 -165
  21. package/dist/modelPricing.d.ts +1 -1
  22. package/dist/modelPricing.js +1 -1
  23. package/dist/projectEconomics.d.ts +617 -0
  24. package/dist/projectEconomics.js +620 -0
  25. package/dist/projectEconomicsBuilder.d.ts +89 -0
  26. package/dist/projectEconomicsBuilder.js +473 -0
  27. package/dist/projectIndexStore.d.ts +545 -0
  28. package/dist/projectIndexStore.js +606 -0
  29. package/dist/providerConnectors.d.ts +59 -1
  30. package/dist/providerConnectors.js +175 -11
  31. package/dist/qualitativeIndexCache.d.ts +494 -0
  32. package/dist/qualitativeIndexCache.js +930 -0
  33. package/dist/resultCard.d.ts +350 -0
  34. package/dist/resultCard.js +604 -0
  35. package/dist/runtimeCommands.d.ts +21 -0
  36. package/dist/runtimeCommands.js +27 -0
  37. package/dist/scanGuard.d.ts +3 -1
  38. package/dist/scanGuard.js +164 -4
  39. package/dist/schema.d.ts +31 -31
  40. package/dist/sessionVitals.d.ts +145 -0
  41. package/dist/sessionVitals.js +521 -0
  42. package/dist/toolInvocations.d.ts +40 -1
  43. package/dist/toolInvocations.js +101 -20
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -41,9 +41,11 @@ keep provenance and confidence labels truthful: reserve `verified` for
41
41
  official provider-reported financial evidence, keep modeled/local value
42
42
  `estimated` or `missing`, and leave unvalidated adapters `untested`.
43
43
 
44
- This is the open foundation for aibill's financial-accountability mission. It
45
- does not yet implement company-wide ownership, accepted outcomes, approvals,
46
- invoice reconciliation, or ROI.
44
+ This is the open foundation for aibill's financial-accountability mission. The
45
+ unreleased source preview includes contracts for locally confirmed ownership,
46
+ local self-attested approvals, and opt-in accepted GitHub outcomes. Those are
47
+ not company-wide identity, RBAC, approval routing, invoice reconciliation, or
48
+ verified business ROI; the public npm v0.8.1 package predates this preview.
47
49
 
48
50
  Local API-equivalent estimates, subscription context, and official
49
51
  provider-reported cost are separate concepts and must not be added together.
@@ -0,0 +1,140 @@
1
+ import type { ContextHealthResult } from "./contextHealth.js";
2
+ import type { DeadContextResult } from "./deadContext.js";
3
+ import type { SessionVitalsV0 } from "./sessionVitals.js";
4
+ import { type TokenReductionExperimentV0, type WasteFindingV0 } from "./actionVerification.js";
5
+ export type UserDeclaredQualityV0 = "passed" | "failed" | "missing";
6
+ export type ActionPlannerInputV0 = {
7
+ sessionVitals: SessionVitalsV0;
8
+ generatedAt: string;
9
+ contextHealth?: ContextHealthResult;
10
+ deadContext?: DeadContextResult;
11
+ /** Optional user assertion. Absence remains missing rather than inferred. */
12
+ qualityBySessionRef?: Readonly<Record<string, UserDeclaredQualityV0>>;
13
+ };
14
+ export type TokenReductionActionPlanV0 = {
15
+ finding: WasteFindingV0;
16
+ experiment: TokenReductionExperimentV0;
17
+ };
18
+ export type ApplyTokenReductionExperimentV0Input = {
19
+ approvedAt: string;
20
+ appliedAt: string;
21
+ /** Opaque AV references to the exact change, rollback, and canary evidence. */
22
+ changeRef: string;
23
+ rollbackRef: string;
24
+ canaryRef: string;
25
+ canaryStatus: "passed" | "failed";
26
+ };
27
+ export type RollBackTokenReductionExperimentV0Input = {
28
+ rolledBackAt: string;
29
+ rollbackRef: string;
30
+ };
31
+ export type InvalidateTokenReductionExperimentV0Input = {
32
+ invalidatedAt: string;
33
+ reason: "manual";
34
+ };
35
+ export type RefreshTokenReductionExperimentV0Input = {
36
+ sessionVitals: SessionVitalsV0;
37
+ observedAt: string;
38
+ /** Current-session evidence prevents an in-progress session entering the post cohort. */
39
+ contextHealth?: ContextHealthResult;
40
+ qualityBySessionRef?: Readonly<Record<string, UserDeclaredQualityV0>>;
41
+ };
42
+ export type ActionVerificationProjectionV0 = {
43
+ schemaVersion: 0;
44
+ experimentId: string;
45
+ findingId: string;
46
+ candidateKey: string;
47
+ state: "collect_baseline" | "approve_one_change" | "collect_post_change" | "review_measured_result" | "rollback" | "rolled_back" | "cancelled" | "resolve_evidence";
48
+ tone: "neutral" | "attention" | "positive" | "negative";
49
+ headline: string;
50
+ detail: string;
51
+ evidenceLabel: "calculated" | "missing";
52
+ qualityLabel: "held" | "regressed" | "insufficient";
53
+ qualityEvidence: "verified" | "observed" | "user_declared" | "missing";
54
+ baselineSessions: number;
55
+ postChangeSessions: number;
56
+ minimumSessions: number;
57
+ reductionPercent: number | null;
58
+ };
59
+ /**
60
+ * Select the experiment every read-only surface should foreground.
61
+ *
62
+ * Active work outranks newer terminal history so CLI, MCP, and Glance cannot
63
+ * silently hand the user different tests. Creation time and stable lineage ID
64
+ * are deterministic tie-breakers only within the same lifecycle priority.
65
+ */
66
+ export declare function selectPreferredTokenReductionExperimentV0(experiments: readonly TokenReductionExperimentV0[]): TokenReductionExperimentV0 | undefined;
67
+ export type ResolvedWasteFindingTargetV0 = {
68
+ status: "resolved";
69
+ kind: "session";
70
+ ref: string;
71
+ agent: "claude-code" | "codex";
72
+ sessionType: "parent" | "subagent" | "unknown";
73
+ observedFrom: string;
74
+ observedTo: string;
75
+ localOnly: true;
76
+ } | {
77
+ status: "resolved";
78
+ kind: "repeated_read_file";
79
+ ref: string;
80
+ file: string;
81
+ readCount: number;
82
+ localOnly: true;
83
+ } | {
84
+ status: "resolved";
85
+ kind: "configured_item";
86
+ ref: string;
87
+ name: string;
88
+ itemKind: string;
89
+ path?: string;
90
+ localOnly: true;
91
+ } | {
92
+ status: "not_found";
93
+ kind: WasteFindingV0["target"]["kind"];
94
+ ref: string;
95
+ localOnly: true;
96
+ };
97
+ /**
98
+ * Return at most one launch-safe candidate. Signal priority is explicit
99
+ * compaction, explicit repeated reads, a calculated context ratio, then
100
+ * measured configured-not-observed inventory. No prompt, path, or item name is
101
+ * carried into the finding.
102
+ */
103
+ export declare function selectBestWasteFindingV0(input: ActionPlannerInputV0): WasteFindingV0 | null;
104
+ /** Resolve an opaque candidate only from fresh local evidence supplied by the caller. */
105
+ export declare function resolveWasteFindingTargetV0(input: {
106
+ finding: WasteFindingV0;
107
+ sessionVitals?: SessionVitalsV0;
108
+ contextHealth?: ContextHealthResult;
109
+ deadContext?: DeadContextResult;
110
+ }): ResolvedWasteFindingTargetV0;
111
+ /** Build one immutable pre-change cohort. Fewer than three sessions fails closed. */
112
+ export declare function buildTokenReductionBaselineV0(input: {
113
+ finding: WasteFindingV0;
114
+ sessionVitals: SessionVitalsV0;
115
+ createdAt: string;
116
+ contextHealth?: ContextHealthResult;
117
+ qualityBySessionRef?: Readonly<Record<string, UserDeclaredQualityV0>>;
118
+ }): TokenReductionExperimentV0 | null;
119
+ /** Select one finding and prepare its baseline, or return null without guessing. */
120
+ export declare function planTokenReductionActionV0(input: ActionPlannerInputV0): TokenReductionActionPlanV0 | null;
121
+ /** Record explicit approval, an applied reversible change, and the actual canary outcome. */
122
+ export declare function markTokenReductionAppliedV0(experiment: TokenReductionExperimentV0, input: ApplyTokenReductionExperimentV0Input): TokenReductionExperimentV0;
123
+ /** Record execution of the rollback already frozen at the application boundary. */
124
+ export declare function markTokenReductionRolledBackV0(experiment: TokenReductionExperimentV0, input: RollBackTokenReductionExperimentV0Input): TokenReductionExperimentV0;
125
+ /** Cancel an un-applied baseline so its scope can be used by a future test. */
126
+ export declare function invalidateTokenReductionExperimentV0(experiment: TokenReductionExperimentV0, input: InvalidateTokenReductionExperimentV0Input): TokenReductionExperimentV0;
127
+ /**
128
+ * Add matched completed session snapshots after the application boundary, then delegate every
129
+ * median, exclusion, quality guard, and result label to the canonical evaluator.
130
+ */
131
+ export declare function refreshTokenReductionExperimentV0(experiment: TokenReductionExperimentV0, input: RefreshTokenReductionExperimentV0Input): TokenReductionExperimentV0;
132
+ /** One safe cross-surface projection for CLI, MCP, and Glance adapters. */
133
+ export declare function buildActionVerificationProjectionV0(experiment: TokenReductionExperimentV0): ActionVerificationProjectionV0;
134
+ /**
135
+ * Produce the opaque source-semantics identity used by every action cohort.
136
+ * Exported so adapters and contract fixtures cannot reimplement a stale
137
+ * descriptor fingerprint. The host version remains inside the hash.
138
+ */
139
+ export declare function createActionPlanningSourceVersionReferenceV0(agent: "claude-code" | "codex", hostVersion: string | undefined): string | undefined;
140
+ //# sourceMappingURL=actionPlanner.d.ts.map