@zanii/blackbox 0.0.0-stage → 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/LICENSE +202 -0
- package/README.md +109 -2
- package/dist/agents/index.d.ts +34 -0
- package/dist/agents/index.js +73 -0
- package/dist/analysis/detectors.d.ts +36 -0
- package/dist/analysis/detectors.js +339 -0
- package/dist/analysis/faults.d.ts +9 -0
- package/dist/analysis/faults.js +210 -0
- package/dist/analysis/index.d.ts +68 -0
- package/dist/analysis/index.js +388 -0
- package/dist/analysis/landing.d.ts +25 -0
- package/dist/analysis/landing.js +225 -0
- package/dist/analysis/memory.d.ts +13 -0
- package/dist/analysis/memory.js +33 -0
- package/dist/analysis/waste.d.ts +29 -0
- package/dist/analysis/waste.js +79 -0
- package/dist/approvals/index.d.ts +11 -0
- package/dist/approvals/index.js +27 -0
- package/dist/approvals/warnings.d.ts +2 -0
- package/dist/approvals/warnings.js +28 -0
- package/dist/attest/index.d.ts +17 -0
- package/dist/attest/index.js +106 -0
- package/dist/authority/index.d.ts +24 -0
- package/dist/authority/index.js +77 -0
- package/dist/billing/index.d.ts +99 -0
- package/dist/billing/index.js +174 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1019 -0
- package/dist/client/index.d.ts +146 -0
- package/dist/client/index.js +210 -0
- package/dist/compliance/index.d.ts +41 -0
- package/dist/compliance/index.js +96 -0
- package/dist/cost/index.d.ts +133 -0
- package/dist/cost/index.js +293 -0
- package/dist/directives/index.d.ts +35 -0
- package/dist/directives/index.js +80 -0
- package/dist/drills/index.d.ts +43 -0
- package/dist/drills/index.js +101 -0
- package/dist/duty/index.d.ts +21 -0
- package/dist/duty/index.js +68 -0
- package/dist/fleet/index.d.ts +141 -0
- package/dist/fleet/index.js +454 -0
- package/dist/hooks/ai-sdk.d.ts +42 -0
- package/dist/hooks/ai-sdk.js +62 -0
- package/dist/hooks/claude-agent-sdk.d.ts +14 -0
- package/dist/hooks/claude-agent-sdk.js +70 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/langchain-agent.d.ts +69 -0
- package/dist/hooks/langchain-agent.js +163 -0
- package/dist/hooks/langchain.d.ts +41 -0
- package/dist/hooks/langchain.js +216 -0
- package/dist/hooks/langgraph-checkpoint.d.ts +12 -0
- package/dist/hooks/langgraph-checkpoint.js +73 -0
- package/dist/hooks/memory.d.ts +17 -0
- package/dist/hooks/memory.js +64 -0
- package/dist/hooks/openai-agents.d.ts +6 -0
- package/dist/hooks/openai-agents.js +40 -0
- package/dist/hooks/protect.d.ts +7 -0
- package/dist/hooks/protect.js +39 -0
- package/dist/hooks/providers.d.ts +16 -0
- package/dist/hooks/providers.js +149 -0
- package/dist/hooks/shared.d.ts +11 -0
- package/dist/hooks/shared.js +39 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +47 -0
- package/dist/investigate/index.d.ts +66 -0
- package/dist/investigate/index.js +119 -0
- package/dist/mcp-server/index.d.ts +85 -0
- package/dist/mcp-server/index.js +216 -0
- package/dist/mcp-wrap/index.d.ts +17 -0
- package/dist/mcp-wrap/index.js +170 -0
- package/dist/money/index.d.ts +114 -0
- package/dist/money/index.js +622 -0
- package/dist/occurrence/index.d.ts +108 -0
- package/dist/occurrence/index.js +168 -0
- package/dist/ocsf/index.d.ts +22 -0
- package/dist/ocsf/index.js +168 -0
- package/dist/otlp/index.d.ts +24 -0
- package/dist/otlp/index.js +143 -0
- package/dist/packs/index.d.ts +40 -0
- package/dist/packs/index.js +217 -0
- package/dist/policy/delta.d.ts +11 -0
- package/dist/policy/delta.js +39 -0
- package/dist/policy/drafts.d.ts +34 -0
- package/dist/policy/drafts.js +129 -0
- package/dist/policy/index.d.ts +47 -0
- package/dist/policy/index.js +154 -0
- package/dist/precog/index.d.ts +96 -0
- package/dist/precog/index.js +167 -0
- package/dist/precog/intervention.d.ts +22 -0
- package/dist/precog/intervention.js +44 -0
- package/dist/precog/normal.d.ts +31 -0
- package/dist/precog/normal.js +89 -0
- package/dist/preflight/index.d.ts +11 -0
- package/dist/preflight/index.js +19 -0
- package/dist/ratings/index.d.ts +21 -0
- package/dist/ratings/index.js +48 -0
- package/dist/reconcile/claude-code.d.ts +19 -0
- package/dist/reconcile/claude-code.js +220 -0
- package/dist/reconcile/codex.d.ts +5 -0
- package/dist/reconcile/codex.js +191 -0
- package/dist/reconcile/index.d.ts +19 -0
- package/dist/reconcile/index.js +50 -0
- package/dist/reconcile/record.d.ts +49 -0
- package/dist/reconcile/record.js +225 -0
- package/dist/reconcile/shared.d.ts +65 -0
- package/dist/reconcile/shared.js +113 -0
- package/dist/replay/index.d.ts +11 -0
- package/dist/replay/index.js +64 -0
- package/dist/replay/repair.d.ts +10 -0
- package/dist/replay/repair.js +62 -0
- package/dist/session/drain.d.ts +13 -0
- package/dist/session/drain.js +35 -0
- package/dist/session/index.d.ts +256 -0
- package/dist/session/index.js +658 -0
- package/dist/undo/index.d.ts +45 -0
- package/dist/undo/index.js +212 -0
- package/dist/verify/anchor.d.ts +54 -0
- package/dist/verify/anchor.js +77 -0
- package/dist/verify/chain.d.ts +27 -0
- package/dist/verify/chain.js +105 -0
- package/dist/verify/envelope.d.ts +28 -0
- package/dist/verify/envelope.js +55 -0
- package/dist/verify/index.d.ts +3 -0
- package/dist/verify/index.js +3 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/weather/index.d.ts +24 -0
- package/dist/weather/index.js +45 -0
- package/dist/workspace-receipt/index.d.ts +15 -0
- package/dist/workspace-receipt/index.js +121 -0
- package/package.json +56 -3
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type LoadedPrices } from "../cost/index.ts";
|
|
2
|
+
import type { Summary } from "../fleet/index.ts";
|
|
3
|
+
/** `{model: micro_usd}` over the priced calls, sorted by model. */
|
|
4
|
+
export declare function modelSpend(lines: readonly string[], prices: LoadedPrices): Record<string, number>;
|
|
5
|
+
export interface Statement {
|
|
6
|
+
lines: Array<{
|
|
7
|
+
model: string;
|
|
8
|
+
micro_usd: number;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
/** Why a statement is invalid, or undefined. */
|
|
12
|
+
export declare function checkStatement(s: unknown): string | undefined;
|
|
13
|
+
export declare function reconcileBilling(ours: Record<string, number>, statement: Statement, tolerancePpm?: number): {
|
|
14
|
+
v: 1;
|
|
15
|
+
tolerance_ppm: number;
|
|
16
|
+
ours_micro_usd: number;
|
|
17
|
+
theirs_micro_usd: number;
|
|
18
|
+
diff_micro_usd: number;
|
|
19
|
+
ok: boolean;
|
|
20
|
+
models: {
|
|
21
|
+
model: string;
|
|
22
|
+
ours: number;
|
|
23
|
+
theirs: number;
|
|
24
|
+
diff: number;
|
|
25
|
+
status: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
export interface Baseline {
|
|
29
|
+
label: string;
|
|
30
|
+
successes: number;
|
|
31
|
+
median_spend_micro_usd: number;
|
|
32
|
+
p90_spend_micro_usd: number;
|
|
33
|
+
median_model_calls: number;
|
|
34
|
+
median_tool_calls: number;
|
|
35
|
+
}
|
|
36
|
+
/** Per label, over successful sessions only (spec/money.md §3). */
|
|
37
|
+
export declare function baselines(summaries: readonly Summary[]): {
|
|
38
|
+
labels: Baseline[];
|
|
39
|
+
};
|
|
40
|
+
/** Will the remaining budget reach the destination? (spec/money.md §4) */
|
|
41
|
+
export declare function fuel(summary: Summary, budgetMicroUsd: number | null, baseline: Baseline | null): {
|
|
42
|
+
spent_micro_usd: number;
|
|
43
|
+
budget_micro_usd: number | null;
|
|
44
|
+
expected_total_micro_usd: number | null;
|
|
45
|
+
p90_total_micro_usd: number | null;
|
|
46
|
+
verdict: string;
|
|
47
|
+
};
|
|
48
|
+
export type AmountUnit = "usd" | "cents" | "micro_usd" | "aed";
|
|
49
|
+
/** spec/money.md §2a-b: an exact decimal amount (string, or a JSON number's text) to integer
|
|
50
|
+
* micro-USD, rounded half up. `unit` is what the amount counts. */
|
|
51
|
+
export declare function decimalToMicroUsd(value: unknown, unit: AmountUnit): number;
|
|
52
|
+
/** spec/money.md §2a: Anthropic's cost report pages (grouped by description) as a statement. */
|
|
53
|
+
export declare function anthropicStatement(pages: readonly unknown[]): Statement;
|
|
54
|
+
/** spec/money.md §2a: OpenAI's organization costs pages (grouped by line_item) as a statement. */
|
|
55
|
+
export declare function openaiStatement(pages: readonly unknown[]): Statement;
|
|
56
|
+
/** spec/money.md §2b: every value at a path (`a.b[].c`, `[]` alone for a list itself). */
|
|
57
|
+
export declare function resolvePath(value: unknown, path: string): unknown[];
|
|
58
|
+
/** spec/money.md §2b: a CSV export with named columns as a statement. */
|
|
59
|
+
export declare function csvStatement(text: string, opts: {
|
|
60
|
+
model_column: string;
|
|
61
|
+
amount_column: string;
|
|
62
|
+
unit: AmountUnit;
|
|
63
|
+
delimiter?: string;
|
|
64
|
+
}): Statement;
|
|
65
|
+
export interface Connector {
|
|
66
|
+
v: 1;
|
|
67
|
+
name: string;
|
|
68
|
+
request: {
|
|
69
|
+
url: string;
|
|
70
|
+
headers?: Record<string, string>;
|
|
71
|
+
method?: "GET" | "POST";
|
|
72
|
+
body?: string;
|
|
73
|
+
content_type?: string;
|
|
74
|
+
};
|
|
75
|
+
results: string;
|
|
76
|
+
model: string;
|
|
77
|
+
amount: string;
|
|
78
|
+
unit: AmountUnit;
|
|
79
|
+
currency?: {
|
|
80
|
+
path: string;
|
|
81
|
+
equals: string;
|
|
82
|
+
};
|
|
83
|
+
/** spec/money.md §2b: how responses are read; json by default. */
|
|
84
|
+
format?: "json" | "xml";
|
|
85
|
+
next?: {
|
|
86
|
+
cursor: string;
|
|
87
|
+
param: string;
|
|
88
|
+
} | {
|
|
89
|
+
page_param: string;
|
|
90
|
+
first_page?: number;
|
|
91
|
+
size_param?: string;
|
|
92
|
+
size?: number;
|
|
93
|
+
} | {
|
|
94
|
+
offset_param: string;
|
|
95
|
+
size: number;
|
|
96
|
+
size_param?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** spec/money.md §2b: why a connector file is invalid, or undefined. */
|
|
100
|
+
export declare function checkConnector(value: unknown): string | undefined;
|
|
101
|
+
/** spec/money.md §2b: pages from a connector's API as a statement. */
|
|
102
|
+
export declare function customStatement(pages: readonly unknown[], connector: Connector): Statement;
|
|
103
|
+
/** spec/money.md §2b: the query parameters for the next request, or null when there are no more. */
|
|
104
|
+
export declare function pageParams(c: Connector, pages: readonly unknown[]): Array<[string, string]> | null;
|
|
105
|
+
/** spec/money.md §2b: XML as `{root: [value]}`. No DTDs, so no external or expanding entities. */
|
|
106
|
+
export declare function parseXml(text: string): Record<string, unknown>;
|
|
107
|
+
/** spec/money.md §2b: the next request a connector makes, or null when there are no more. */
|
|
108
|
+
export declare function requestFor(c: Connector, pages: readonly unknown[], from: string, to: string): {
|
|
109
|
+
method: "GET" | "POST";
|
|
110
|
+
url: string;
|
|
111
|
+
query: Array<[string, string]>;
|
|
112
|
+
body?: string;
|
|
113
|
+
content_type?: string;
|
|
114
|
+
} | null;
|