@zanii/blackbox 0.22.0 → 0.23.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/README.md +1 -0
- package/dist/analysis/accepted.d.ts +26 -0
- package/dist/analysis/accepted.js +61 -0
- package/dist/analysis/detectors.js +12 -9
- package/dist/analysis/faults.js +71 -0
- package/dist/analysis/grounding.js +5 -9
- package/dist/analysis/guard.d.ts +72 -0
- package/dist/analysis/guard.js +240 -0
- package/dist/analysis/hallucination.js +2 -2
- package/dist/analysis/index.d.ts +21 -1
- package/dist/analysis/index.js +101 -19
- package/dist/analysis/injection.d.ts +2 -1
- package/dist/analysis/injection.js +16 -16
- package/dist/analysis/landing.js +60 -14
- package/dist/analysis/plan-checks.d.ts +55 -0
- package/dist/analysis/plan-checks.js +748 -0
- package/dist/analysis/taxonomy.js +1 -0
- package/dist/analysis/waste.js +2 -3
- package/dist/approvals/index.d.ts +12 -3
- package/dist/approvals/index.js +36 -10
- package/dist/authority/index.js +3 -3
- package/dist/aviation/index.d.ts +422 -0
- package/dist/aviation/index.js +1014 -0
- package/dist/aviation/qrh.d.ts +4 -0
- package/dist/aviation/qrh.js +171 -0
- package/dist/budgets/index.d.ts +63 -0
- package/dist/budgets/index.js +161 -0
- package/dist/cli.js +172 -24
- package/dist/compliance/index.d.ts +2 -0
- package/dist/compliance/index.js +26 -2
- package/dist/cost/batch.d.ts +26 -0
- package/dist/cost/batch.js +173 -0
- package/dist/cost/index.d.ts +21 -0
- package/dist/cost/index.js +115 -30
- package/dist/cv/index.js +1 -1
- package/dist/duty/index.js +2 -1
- package/dist/evals/index.d.ts +233 -0
- package/dist/evals/index.js +488 -0
- package/dist/federation/index.d.ts +9 -0
- package/dist/federation/index.js +8 -1
- package/dist/finance/index.js +3 -4
- package/dist/fleet/index.d.ts +25 -0
- package/dist/fleet/index.js +57 -17
- package/dist/fleet/insights.js +4 -1
- package/dist/health/index.js +2 -2
- package/dist/hooks/ai-sdk.d.ts +17 -19
- package/dist/hooks/ai-sdk.js +13 -7
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/mastra.d.ts +26 -0
- package/dist/hooks/mastra.js +63 -0
- package/dist/index.d.ts +22 -9
- package/dist/index.js +23 -9
- package/dist/mcp-requests/index.d.ts +26 -0
- package/dist/mcp-requests/index.js +154 -0
- package/dist/mcp-server/index.d.ts +12 -0
- package/dist/mcp-server/index.js +84 -2
- package/dist/mcp-wrap/index.js +8 -4
- package/dist/otlp/index.d.ts +155 -0
- package/dist/otlp/index.js +468 -0
- package/dist/otlp/protobuf.d.ts +7 -0
- package/dist/otlp/protobuf.js +314 -0
- package/dist/packs/index.d.ts +2 -0
- package/dist/packs/index.js +5 -1
- package/dist/pdf/arabic.d.ts +45 -0
- package/dist/pdf/arabic.js +373 -0
- package/dist/pdf/index.d.ts +77 -0
- package/dist/pdf/index.js +673 -0
- package/dist/policy/index.d.ts +0 -4
- package/dist/policy/index.js +13 -5
- package/dist/realtime/index.d.ts +33 -0
- package/dist/realtime/index.js +204 -0
- package/dist/reconcile/record.d.ts +12 -0
- package/dist/reconcile/record.js +114 -65
- package/dist/session/index.d.ts +43 -0
- package/dist/session/index.js +83 -0
- package/dist/undo/index.js +3 -3
- package/dist/verify/anchor.d.ts +5 -1
- package/dist/verify/anchor.js +13 -4
- package/dist/verify/envelope.d.ts +1 -1
- package/dist/verify/envelope.js +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/walls/index.js +2 -2
- package/dist/warehouse/index.d.ts +62 -0
- package/dist/warehouse/index.js +142 -0
- package/package.json +6 -3
package/dist/fleet/index.js
CHANGED
|
@@ -10,6 +10,37 @@ import { authorityTimeline } from "../authority/index.js";
|
|
|
10
10
|
import { formatAed, sessionCost, toAedFils } from "../cost/index.js";
|
|
11
11
|
import { callsOf } from "../reconcile/record.js";
|
|
12
12
|
import { canonical } from "../reconcile/shared.js";
|
|
13
|
+
const PROMPT_NAME = /^[A-Za-z0-9._-]{1,128}$/;
|
|
14
|
+
/** spec/evals.md §4-§5: the first prompt version a run declared, and its experiment's arm. */
|
|
15
|
+
function promptOf(evs) {
|
|
16
|
+
const named = (name, version) => typeof name === "string" &&
|
|
17
|
+
PROMPT_NAME.test(name) &&
|
|
18
|
+
typeof version === "number" &&
|
|
19
|
+
Number.isSafeInteger(version) &&
|
|
20
|
+
version >= 1;
|
|
21
|
+
for (const e of evs) {
|
|
22
|
+
const m = e.meta;
|
|
23
|
+
if (e.kind === "control" &&
|
|
24
|
+
m.action === "experiment" &&
|
|
25
|
+
typeof m.experiment === "string" &&
|
|
26
|
+
typeof m.arm === "string" &&
|
|
27
|
+
named(m.prompt, m.version))
|
|
28
|
+
return {
|
|
29
|
+
prompt_version: {
|
|
30
|
+
name: m.prompt,
|
|
31
|
+
version: m.version,
|
|
32
|
+
via: "experiment",
|
|
33
|
+
},
|
|
34
|
+
experiment: { id: m.experiment, arm: m.arm },
|
|
35
|
+
};
|
|
36
|
+
const d = e.data ?? {};
|
|
37
|
+
if (e.kind === "sdk.event" && m.type === "prompt_version" && named(d.name, d.version))
|
|
38
|
+
return {
|
|
39
|
+
prompt_version: { name: d.name, version: d.version, via: "sdk" },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
13
44
|
/** An approval id: what a lesson may point at, and nothing else (spec/fleet.md §9). */
|
|
14
45
|
export const APPROVAL_ID = /^apr_[0-9a-f]{18}$/;
|
|
15
46
|
/** spec/fleet.md §9: a Zanii Evolve certificate's digest (`sha256:` + 64 hex, or the 64 hex its
|
|
@@ -173,6 +204,7 @@ export function sessionSummary(lines, bodies, prices) {
|
|
|
173
204
|
...(humanSteps ? { human_steps: humanSteps } : {}),
|
|
174
205
|
...(selfChanges.length ? { self_changes: selfChanges } : {}),
|
|
175
206
|
...(decided ? { approvals } : {}),
|
|
207
|
+
...promptOf(evs),
|
|
176
208
|
};
|
|
177
209
|
}
|
|
178
210
|
const T = {
|
|
@@ -350,6 +382,24 @@ function resourceOf(tool, args) {
|
|
|
350
382
|
}
|
|
351
383
|
return undefined;
|
|
352
384
|
}
|
|
385
|
+
/** A session's changes (spec/fleet.md §4): each changing tool call and its resource, by seq. */
|
|
386
|
+
export function resourceChanges(lines, bodies) {
|
|
387
|
+
const touches = [];
|
|
388
|
+
for (const t of toolCallsOf(callsOf(lines, bodies))) {
|
|
389
|
+
const res = resourceOf(t.tool, t.args);
|
|
390
|
+
if (res !== undefined)
|
|
391
|
+
touches.push({ seq: t.seq, tool: t.tool, resource: res });
|
|
392
|
+
}
|
|
393
|
+
for (const line of lines) {
|
|
394
|
+
const e = JSON.parse(line);
|
|
395
|
+
if (e.kind !== "tool.call" || e.meta.method !== "tools/call" || typeof e.meta.tool !== "string")
|
|
396
|
+
continue;
|
|
397
|
+
const res = resourceOf(e.meta.tool, mcpArgs(bodies(e.body_hash)));
|
|
398
|
+
if (res !== undefined)
|
|
399
|
+
touches.push({ seq: e.seq, tool: e.meta.tool, resource: res });
|
|
400
|
+
}
|
|
401
|
+
return touches.sort((a, b) => a.seq - b.seq);
|
|
402
|
+
}
|
|
353
403
|
/** Changes to the same resource from two or more sessions (A7), by resource; each session's first change. */
|
|
354
404
|
export function collisions(records) {
|
|
355
405
|
const by = new Map();
|
|
@@ -363,23 +413,7 @@ export function collisions(records) {
|
|
|
363
413
|
if (r.lines.length === 0)
|
|
364
414
|
continue;
|
|
365
415
|
const sid = JSON.parse(r.lines[0]).session_id;
|
|
366
|
-
const
|
|
367
|
-
for (const t of toolCallsOf(callsOf(r.lines, r.bodies))) {
|
|
368
|
-
const res = resourceOf(t.tool, t.args);
|
|
369
|
-
if (res !== undefined)
|
|
370
|
-
touches.push({ seq: t.seq, tool: t.tool, resource: res });
|
|
371
|
-
}
|
|
372
|
-
for (const line of r.lines) {
|
|
373
|
-
const e = JSON.parse(line);
|
|
374
|
-
if (e.kind !== "tool.call" ||
|
|
375
|
-
e.meta.method !== "tools/call" ||
|
|
376
|
-
typeof e.meta.tool !== "string")
|
|
377
|
-
continue;
|
|
378
|
-
const res = resourceOf(e.meta.tool, mcpArgs(r.bodies(e.body_hash)));
|
|
379
|
-
if (res !== undefined)
|
|
380
|
-
touches.push({ seq: e.seq, tool: e.meta.tool, resource: res });
|
|
381
|
-
}
|
|
382
|
-
for (const t of touches.sort((a, b) => a.seq - b.seq))
|
|
416
|
+
for (const t of resourceChanges(r.lines, r.bodies))
|
|
383
417
|
touch(t.resource, sid, t.tool, t.seq);
|
|
384
418
|
}
|
|
385
419
|
return [...by.keys()]
|
|
@@ -498,6 +532,12 @@ export function signCertificate(cert, did, seed) {
|
|
|
498
532
|
const sig = signBytes(null, unsigned(cert), key).toString("hex");
|
|
499
533
|
return { ...cert, signed: { by: did, sig: `ed25519:${sig}` } };
|
|
500
534
|
}
|
|
535
|
+
/** spec/anchoring.md §15: `signCertificate` with a key held outside the process (`sign` returns
|
|
536
|
+
* the raw 64-byte Ed25519 signature). Same bytes as `signCertificate` with the same key. */
|
|
537
|
+
export async function signCertificateWith(cert, did, sign) {
|
|
538
|
+
const sig = Buffer.from(await sign(unsigned(cert))).toString("hex");
|
|
539
|
+
return { ...cert, signed: { by: did, sig: `ed25519:${sig}` } };
|
|
540
|
+
}
|
|
501
541
|
/** Checks a signed certificate offline, from the signer's did:key alone. */
|
|
502
542
|
export function verifyCertificate(cert, expectedDid) {
|
|
503
543
|
const s = cert.signed;
|
package/dist/fleet/insights.js
CHANGED
|
@@ -181,9 +181,12 @@ function value(v) {
|
|
|
181
181
|
const isMoment = (e) => {
|
|
182
182
|
const meta = e.meta;
|
|
183
183
|
const status = meta?.status;
|
|
184
|
-
// an allowed policy check (one per local tool call) is routine, not a moment
|
|
184
|
+
// an allowed policy check (one per local tool call) is routine, not a moment; so is an
|
|
185
|
+
// allowed guard decision (spec/guard.md §8)
|
|
185
186
|
if (e.kind === "control" && meta?.action === "policy_check" && meta.decision === "allow")
|
|
186
187
|
return false;
|
|
188
|
+
if (e.kind === "control" && meta?.action === "guard" && meta.verdict === "allow")
|
|
189
|
+
return false;
|
|
187
190
|
return (e.kind === "finding" ||
|
|
188
191
|
e.kind === "control" ||
|
|
189
192
|
e.kind === "outcome" ||
|
package/dist/health/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { createHash, randomBytes } from "node:crypto";
|
|
6
6
|
import { createConfirmation, jcsHash } from "@zanii/core";
|
|
7
7
|
import { verifyConfirmation } from "../approvals/index.js";
|
|
8
|
+
import { envelopesOf } from "../reconcile/record.js";
|
|
8
9
|
import { canonical } from "../reconcile/shared.js";
|
|
9
10
|
const TAG = /^sha256:[0-9a-f]{64}$/;
|
|
10
11
|
const HEX64 = /^[0-9a-f]{64}$/;
|
|
@@ -180,8 +181,7 @@ export function healthFindings(lines, bodies, closing = false) {
|
|
|
180
181
|
const recommendations = [];
|
|
181
182
|
const confirmed = new Set();
|
|
182
183
|
let closed = closing;
|
|
183
|
-
for (const
|
|
184
|
-
const e = JSON.parse(l);
|
|
184
|
+
for (const e of envelopesOf(lines)) {
|
|
185
185
|
if (e.kind === "session.close")
|
|
186
186
|
closed = true;
|
|
187
187
|
if (e.kind !== "sdk.event" || !String(e.meta.type).startsWith("health."))
|
package/dist/hooks/ai-sdk.d.ts
CHANGED
|
@@ -12,31 +12,29 @@ type Part = {
|
|
|
12
12
|
input?: unknown;
|
|
13
13
|
};
|
|
14
14
|
/** For `wrapLanguageModel({ model, middleware })`: every generate and stream is observed; what the
|
|
15
|
-
* model returns reaches the app unchanged.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
modelId?: string;
|
|
23
|
-
};
|
|
24
|
-
}>;
|
|
25
|
-
model?: ModelInfo;
|
|
26
|
-
}): Promise<{
|
|
15
|
+
* model returns reaches the app unchanged. `toolCalls: false` leaves the tool calls the model asks
|
|
16
|
+
* for to a hook that sees them run (Mastra's exporter, G21). */
|
|
17
|
+
export declare function blackboxMiddleware(sink: EventSink, options?: {
|
|
18
|
+
toolCalls?: boolean;
|
|
19
|
+
}): {
|
|
20
|
+
specificationVersion: "v3";
|
|
21
|
+
wrapGenerate<R extends {
|
|
27
22
|
content?: Part[];
|
|
28
23
|
response?: {
|
|
29
24
|
id?: string;
|
|
30
25
|
modelId?: string;
|
|
31
26
|
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
doStream: () => Promise<{
|
|
35
|
-
stream: ReadableStream<Part>;
|
|
36
|
-
}>;
|
|
27
|
+
}>({ doGenerate, model }: {
|
|
28
|
+
doGenerate: () => PromiseLike<R>;
|
|
37
29
|
model?: ModelInfo;
|
|
38
|
-
}): Promise<
|
|
30
|
+
}): Promise<R>;
|
|
31
|
+
wrapStream<S extends {
|
|
39
32
|
stream: ReadableStream<Part>;
|
|
40
|
-
}
|
|
33
|
+
}, P extends Part>({ doStream, model, }: {
|
|
34
|
+
doStream: () => PromiseLike<S & {
|
|
35
|
+
stream: ReadableStream<P>;
|
|
36
|
+
}>;
|
|
37
|
+
model?: ModelInfo;
|
|
38
|
+
}): Promise<S>;
|
|
41
39
|
};
|
|
42
40
|
export {};
|
package/dist/hooks/ai-sdk.js
CHANGED
|
@@ -29,15 +29,20 @@ function reportTool(sink, p) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
/** For `wrapLanguageModel({ model, middleware })`: every generate and stream is observed; what the
|
|
32
|
-
* model returns reaches the app unchanged.
|
|
33
|
-
|
|
32
|
+
* model returns reaches the app unchanged. `toolCalls: false` leaves the tool calls the model asks
|
|
33
|
+
* for to a hook that sees them run (Mastra's exporter, G21). */
|
|
34
|
+
export function blackboxMiddleware(sink, options = {}) {
|
|
35
|
+
const tools = options.toolCalls ?? true;
|
|
34
36
|
return {
|
|
35
|
-
|
|
37
|
+
// AI SDK 6 types its middleware by the model spec it wraps; AI SDK 5 ignores the field (G21)
|
|
38
|
+
specificationVersion: "v3",
|
|
39
|
+
async wrapGenerate({ doGenerate, model }) {
|
|
36
40
|
const result = await doGenerate();
|
|
37
41
|
neverThrow(() => {
|
|
38
42
|
reportCall(sink, model, result.response?.id, result.response?.modelId);
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
if (tools)
|
|
44
|
+
for (const p of result.content ?? [])
|
|
45
|
+
reportTool(sink, p);
|
|
41
46
|
});
|
|
42
47
|
return result;
|
|
43
48
|
},
|
|
@@ -51,12 +56,13 @@ export function blackboxMiddleware(sink) {
|
|
|
51
56
|
reported = true;
|
|
52
57
|
reportCall(sink, model, chunk.id, chunk.modelId);
|
|
53
58
|
}
|
|
54
|
-
|
|
59
|
+
if (tools)
|
|
60
|
+
reportTool(sink, chunk);
|
|
55
61
|
});
|
|
56
62
|
controller.enqueue(chunk);
|
|
57
63
|
},
|
|
58
64
|
}));
|
|
59
|
-
return { stream: observed
|
|
65
|
+
return { ...rest, stream: observed };
|
|
60
66
|
},
|
|
61
67
|
};
|
|
62
68
|
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { blackboxMiddleware } from "./ai-sdk.ts";
|
|
2
2
|
export { BlackboxAgentHooks, blackboxAgentHooks } from "./claude-agent-sdk.ts";
|
|
3
3
|
export { BlackboxCallbackHandler, type BlackboxCallbacks, blackboxCallbacks } from "./langchain.ts";
|
|
4
|
+
export { blackboxMastraExporter } from "./mastra.ts";
|
|
4
5
|
export { type MemorySink, type TrackMemoryOptions, trackMemory } from "./memory.ts";
|
|
5
6
|
export { attachBlackbox } from "./openai-agents.ts";
|
|
6
7
|
export { llmIdsOf, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI } from "./providers.ts";
|
package/dist/hooks/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export { blackboxMiddleware } from "./ai-sdk.js";
|
|
5
5
|
export { BlackboxAgentHooks, blackboxAgentHooks } from "./claude-agent-sdk.js";
|
|
6
6
|
export { BlackboxCallbackHandler, blackboxCallbacks } from "./langchain.js";
|
|
7
|
+
export { blackboxMastraExporter } from "./mastra.js";
|
|
7
8
|
export { trackMemory } from "./memory.js";
|
|
8
9
|
export { attachBlackbox } from "./openai-agents.js";
|
|
9
10
|
export { llmIdsOf, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI } from "./providers.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type EventSink } from "./shared.ts";
|
|
2
|
+
interface Span {
|
|
3
|
+
type?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
entityName?: string;
|
|
6
|
+
entityId?: string;
|
|
7
|
+
input?: unknown;
|
|
8
|
+
attributes?: object;
|
|
9
|
+
errorInfo?: {
|
|
10
|
+
message?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
};
|
|
13
|
+
isEvent?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface TracingEvent {
|
|
16
|
+
type?: string;
|
|
17
|
+
exportedSpan?: Span;
|
|
18
|
+
}
|
|
19
|
+
/** For `exporters: [...]` in a Mastra observability config. Records only; never throws. */
|
|
20
|
+
export declare function blackboxMastraExporter(sink: EventSink): {
|
|
21
|
+
name: string;
|
|
22
|
+
exportTracingEvent(event: TracingEvent): Promise<void>;
|
|
23
|
+
flush(): Promise<void>;
|
|
24
|
+
shutdown(): Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Mastra (G21, spec/sdk.md §5): an observability exporter that turns Mastra's tracing spans into
|
|
2
|
+
// session events: agent runs, tool calls and their results, model-call failures. Typed structurally
|
|
3
|
+
// on Mastra's `ObservabilityExporter`: no dependency on `@mastra/core`.
|
|
4
|
+
//
|
|
5
|
+
// import { Observability } from "@mastra/observability";
|
|
6
|
+
// new Mastra({ agents, observability: new Observability({ configs: { blackbox: {
|
|
7
|
+
// serviceName: "payments", exporters: [blackboxMastraExporter(session)] } } }) });
|
|
8
|
+
//
|
|
9
|
+
// Mastra's spans carry the provider's response id of a generation's last model call only, so the
|
|
10
|
+
// model-call ids come from the AI SDK middleware on the agent's model (ai-sdk.ts), with its own
|
|
11
|
+
// tool-call reports off (this exporter records the tool calls as they run):
|
|
12
|
+
// model: wrapLanguageModel({ model, middleware: blackboxMiddleware(session, { toolCalls: false }) })
|
|
13
|
+
import { neverThrow } from "./shared.js";
|
|
14
|
+
const MAX_ERROR = 500;
|
|
15
|
+
const str = (v) => (typeof v === "string" && v ? v : undefined);
|
|
16
|
+
/** For `exporters: [...]` in a Mastra observability config. Records only; never throws. */
|
|
17
|
+
export function blackboxMastraExporter(sink) {
|
|
18
|
+
const record = ({ type, exportedSpan: span }) => {
|
|
19
|
+
if (!span)
|
|
20
|
+
return;
|
|
21
|
+
const a = (span.attributes ?? {});
|
|
22
|
+
const name = (span.entityName ?? span.entityId ?? span.name ?? "").slice(0, 256);
|
|
23
|
+
const callId = str(a.toolCallId);
|
|
24
|
+
const ids = callId ? { call_id: callId } : {};
|
|
25
|
+
const tool = span.type === "tool_call" || span.type === "mcp_tool_call";
|
|
26
|
+
if (type === "span_started") {
|
|
27
|
+
if (span.type === "agent_run")
|
|
28
|
+
sink.event("step", name || "agent", {});
|
|
29
|
+
else if (tool)
|
|
30
|
+
sink.event("tool.call", name || "tool", {
|
|
31
|
+
...ids,
|
|
32
|
+
...(span.input === undefined ? {} : { args: span.input }),
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (type !== "span_ended")
|
|
37
|
+
return;
|
|
38
|
+
if (tool) {
|
|
39
|
+
const failed = span.errorInfo !== undefined || a.success === false;
|
|
40
|
+
sink.event("tool.result", name || "tool", {
|
|
41
|
+
ok: !failed,
|
|
42
|
+
...ids,
|
|
43
|
+
...(span.errorInfo
|
|
44
|
+
? { error: String(span.errorInfo.message ?? "").slice(0, MAX_ERROR) }
|
|
45
|
+
: {}),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else if (span.type === "model_generation" && span.errorInfo) {
|
|
49
|
+
sink.event("llm.error", undefined, {
|
|
50
|
+
error: String(span.errorInfo.message ?? "").slice(0, MAX_ERROR),
|
|
51
|
+
type: span.errorInfo.name ?? "Error",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
name: "zanii-blackbox",
|
|
57
|
+
async exportTracingEvent(event) {
|
|
58
|
+
neverThrow(() => record(event));
|
|
59
|
+
},
|
|
60
|
+
async flush() { },
|
|
61
|
+
async shutdown() { },
|
|
62
|
+
};
|
|
63
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
|
+
export { publicKeyFromDid } from "@zanii/core";
|
|
1
2
|
export { A2A_STREAMING, type AgentCardReport, a2aMethod, a2aRequestMeta, a2aResponseMeta, a2aRestMethod, a2aRestRequestMeta, a2aRestResponseMeta, agentCardDigest, agentCardPayload, gatewayCardKey, rewriteAgentCard, verifyAgentCard, } from "./a2a/index.ts";
|
|
2
3
|
export { type Action, actionsFromCalls, actionsOf, actionsPage, type Reasoning, } from "./actions/index.ts";
|
|
3
4
|
export { ACCREDITATION_TYPE, type AccreditationRefusal, checkAccreditation, checkRegister, docHash, REGISTER_TYPE, SERVICE_ID, type ServiceRow, serviceTier, } from "./admission/index.ts";
|
|
4
5
|
export { causality, memoryXray } from "./agents/index.ts";
|
|
6
|
+
export { type AcceptedEntry, acceptedHash, acceptedMatch, checkAcceptedFindings, } from "./analysis/accepted.ts";
|
|
5
7
|
export { type DetectorOptions, detectors, fingerprint } from "./analysis/detectors.ts";
|
|
6
8
|
export { FAULTS, type Fault, faultOf } from "./analysis/faults.ts";
|
|
7
|
-
export { type
|
|
9
|
+
export { type GuardCall, type GuardConfig, type GuardFinding, type GuardMode, type GuardState, type GuardToolResult, type GuardVerdict, guardCheck, guardMode, guardObserve, guardPin, guardState, guardToolResults, loadGuardConfig, } from "./analysis/guard.ts";
|
|
10
|
+
export { type Accuracy, type AnalyzeOptions, Analyzer, type AnswerClaims, analyze, answerClaims, answerCredential, answerRisk, answersOf, answerText, type ClaimEntry, type ClaimVerdict, type CriterionResult, canonicalNumber, checkAgainstPacks, checkFlightPlan, checkpointReplay, detectorAccuracy, dualWitness, Evidence, elicitationSecret, eventsOf, type Fact, type Finding as AnalysisFinding, factsIn, findingKey, type GroundedClaim, groundingFindings, groundingRequest, growth, HOLD_TRIGGERS, identifiersIn, isoWeek, judgeFindings, judgeRequest, type Label as AccuracyLabel, type Landing, landing, lessons, loadReferencePacks, modelGroundingFindings, normaliseValue, OUTCOMES, type Outcome, type OutcomeRollup, packsFor, parseGroundingAnswer, parseJudgeAnswer, promptChanged, type ReferenceFact, type ReferencePack, type ReferenceVerdict, referenceContext, rollup, type Severity, schemaProblem, secretSent, selfChanges, successRange, systemPromptHash, toolDrifted, toolHallucinations, toolsHash, userDownvotes, verifyAnswerCredential, type WasteReason, type WasteReport, waste, wilsonLow, } from "./analysis/index.ts";
|
|
8
11
|
export { injectionFindings, injectionRule } from "./analysis/injection.ts";
|
|
12
|
+
export { checkPredicate, checkSchema, compilePattern, milliOf, patternMatches, schemaError, } from "./analysis/plan-checks.ts";
|
|
9
13
|
export { MITRE_ATLAS, OWASP_ASI, TAXONOMY, type Taxonomy, taxonomyOf, } from "./analysis/taxonomy.ts";
|
|
10
|
-
export { type ApprovalFinding, approvalConfirmation, approvalFindings, argsHash, verifyConfirmation, } from "./approvals/index.ts";
|
|
14
|
+
export { type ApprovalFinding, approvalConfirmation, approvalConfirmationWith, approvalFindings, argsHash, verifyConfirmation, } from "./approvals/index.ts";
|
|
11
15
|
export { textWarnings } from "./approvals/warnings.ts";
|
|
12
16
|
export { type ArchiveFile, type ArchiveManifest, type ArchiveReport, archiveDigest, archiveEntry, archiveManifest, verifyArchive, } from "./archive/index.ts";
|
|
13
17
|
export { archiveParquet } from "./archive/parquet.ts";
|
|
14
18
|
export { type Attestation, attest, isReadOnly, normalise, parseCommand } from "./attest/index.ts";
|
|
15
19
|
export { type AuthorityFinding, authorityAt, authorityTimeline, automationSurprise, type Mode as AuthorityMode, type Span as AuthoritySpan, } from "./authority/index.ts";
|
|
20
|
+
export { type ActiveClearance, type ApproverStat, agentReportFindings, approverFatigueFindings, approverStats, type Check, type CheckStatus, type ClearanceAnswer, type ClearanceDecision, type ClearanceMode, type Currency, checkChecks, checkEnvelope, checkFindings, checkHazardRegister, checkNotam, checkOperatorCertificate, checkOpspecs, checkSafetyReport, checkStatus, clearance, clearanceFindings, commitPointSeq, configurationId, type EnvelopeChange, type EnvelopeLimits, envelopeFindings, globMatch, type Hazard, type HazardRegister, hazardStatus, isLevel, LEVELS, type Level, type LoadSheet, type Locator, loadSheet, locator, locatorFindings, type Notam, notamFindings, notamsInForce, type OperatorFacts, type OpSpecs, operatorCertificate, opspecsCheck, type Procedure, pastCommitPoint, procedureFor, protectReasoning, QRH, type ReasoningRequest, ratingCurrency, ratingLapsed, reasoningStatus, SAFETY_CATEGORIES, safetyReportSummary, samePerson, shapeRequest, type TypeCertificate, typeCertificate, unapprovedModifications, } from "./aviation/index.ts";
|
|
16
21
|
export { badgeSvg, RECORD_STATES, type RecordState, recordBadge, recordState, } from "./badge/index.ts";
|
|
17
22
|
export { type Invoice, type InvoiceLine, invoice, loadPlans, type Plan, type Plans, renderTaxCreditNote, renderTaxInvoice, stripeSignatureOk, type TaxCreditNote, type TaxCreditNoteInput, type TaxInvoice, type TaxInvoiceInput, taxCreditNote, taxInvoice, } from "./billing/index.ts";
|
|
18
23
|
export { type AgentIdentity, checkAgent, sessionBom } from "./bom/index.ts";
|
|
24
|
+
export { type AgentBudget, type AgentBudgets, agentBudgetFindings, budgetFor, mad, median, type Period as BudgetPeriod, parseAgentBudgets, peerFindings, periodOf, type UsageRow, } from "./budgets/index.ts";
|
|
19
25
|
export { BlackboxApiError, type Client, type ClientOptions, client, type SessionQuery, } from "./client/index.ts";
|
|
20
26
|
export { ART12_MIN_RETENTION_DAYS, type Art12Check, type Art12Report, art12Check, } from "./compliance/art12.ts";
|
|
21
27
|
export { accuracyFact, complianceFacts, complianceReport, controlsFact, type Facts, type Framework, hallucinationFacts, type Report as ComplianceReport, renderReport, } from "./compliance/index.ts";
|
|
22
28
|
export { renderZaniiCompliance, type ZaniiComplianceReport, zaniiCompliance, } from "./compliance/zanii.ts";
|
|
23
29
|
export { type Constitution, type ConstitutionRule, constitutionHash, createConstitution, evaluateConstitution, governanceOf, verifyConstitution, } from "./constitution/index.ts";
|
|
24
|
-
export { type
|
|
30
|
+
export { type BatchEntry, type BatchItem, type BatchReport, batchReport, } from "./cost/batch.ts";
|
|
31
|
+
export { batchModels, type CallCost, type CostReport, callMicroUsd, effectivePrice, formatAed, type LoadedPrices, loadPrices, type ModelPrice, type PriceTable, priceCall, priceFor, promptTokens, requestsOf, sessionCost, type Tokens, toAedFils, tokensOf, } from "./cost/index.ts";
|
|
25
32
|
export { agentCv, buildCv, cvHash, verifyCv } from "./cv/index.ts";
|
|
26
33
|
export { type AuditRow, CORE_EVIDENCE, CORE_IDENTIFIERS, type Connector as AuditConnector, canaryIdentifier, checkAuditConnector, type DataFinding, type DataRules, dataClasses, dataFindings, dataFingerprint, dataMeta, dataScan, dataTopology, hasEvidence, type Identifier, type Lineage, lineage, luhn, normalizeValue, parseAuditLog, parseCsv, reconcileSystem, type SystemReport, type Topology, toolWitness, unevidenced, verifyToolWitness, witnessOf, } from "./data/index.ts";
|
|
27
34
|
export { type Directive, type DirectiveItem, type DirectiveOptions, directives, fleetDirectives, } from "./directives/index.ts";
|
|
@@ -29,26 +36,30 @@ export { argumentLeaves, type Disclosure, type DisclosureEnvelope, discloseField
|
|
|
29
36
|
export { checkDrill, drillReport, type Fault as DrillFault } from "./drills/index.ts";
|
|
30
37
|
export { checkDuty, type DutyFinding, type DutyLimits, dutyFindings } from "./duty/index.ts";
|
|
31
38
|
export { openSegments, type SealedSegment } from "./encryption/index.ts";
|
|
39
|
+
export { type Arm, armStats, assignArm, type CaseScore, casesFromScenarios, casesFromSessions, checkDataset, checkExperiment, checkScorer, compareRuns, datasetHash, type EvalCase, experimentResults, type Observation, parseCasesJsonl, promptResults, promptSha256, type RunSummary, runSummary, SCORERS, type Scorer, scoreCase, toMilli, } from "./evals/index.ts";
|
|
32
40
|
export { type EvidencePack, type EvidencePackOptions, evidencePack, renderEvidencePack, } from "./evidence/index.ts";
|
|
33
|
-
export { buildEquivocationProof, compareViews, cosignLedgerSth, verifyEquivocationProof, verifyLedgerCosignature, } from "./federation/index.ts";
|
|
41
|
+
export { buildEquivocationProof, compareViews, cosignLedgerSth, cosignLedgerSthWith, verifyEquivocationProof, verifyLedgerCosignature, } from "./federation/index.ts";
|
|
34
42
|
export { buildOwnerAttestation, buildPayment, CURRENCIES, FTA_WALL_ID, financeFindings, formatMoney, ftaPayload, parseMoney, paymentsOf, screenCounterparty, screeningPayload, verifyOwnerAttestation, verifyOwnerBinding, } from "./finance/index.ts";
|
|
35
|
-
export { APPROVAL_ID, aggregateFindings, airworthiness, type Collision, certificateOf, collisions, didFromSeed, type FindingGroup, incidentReport, logbook, type Summary, sessionSummary, signatureOf, signatures, signCertificate, taughtBy, verifyCertificate, } from "./fleet/index.ts";
|
|
43
|
+
export { APPROVAL_ID, aggregateFindings, airworthiness, type Collision, certificateOf, collisions, didFromSeed, type FindingGroup, incidentReport, logbook, type Summary, sessionSummary, signatureOf, signatures, signCertificate, signCertificateWith, taughtBy, verifyCertificate, } from "./fleet/index.ts";
|
|
36
44
|
export { copilotContext, copilotPrompt, type Insights, insights, parseCopilotAnswer, } from "./fleet/insights.ts";
|
|
37
45
|
export { type AppealItem, type AppealPack, appealPack, decisionPayload, GOV_DECISION_KINDS, renderAppealPack, ruleConsistency, signSubjectClaim, subjectTag, verifyDecision, verifyFactors, verifySubjectClaim, } from "./gov/index.ts";
|
|
38
46
|
export { accessPayload, breakGlass, checkEpisodeTag, clinicianConfirmation, type EpisodeItem, episodeSeed, episodesPack, episodeTag, healthFindings, protocolTrail, recommendationHash, recommendationPayload, verifyCommitment, verifyHealthSignature, } from "./health/index.ts";
|
|
39
|
-
export { attachBlackbox, BlackboxAgentHooks, BlackboxCallbackHandler, type BlackboxCallbacks, blackboxAgentHooks, blackboxCallbacks, blackboxMiddleware, type EventSink, llmIds, llmIdsOf, trackMemory, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI, } from "./hooks/index.ts";
|
|
47
|
+
export { attachBlackbox, BlackboxAgentHooks, BlackboxCallbackHandler, type BlackboxCallbacks, blackboxAgentHooks, blackboxCallbacks, blackboxMastraExporter, blackboxMiddleware, type EventSink, llmIds, llmIdsOf, trackMemory, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI, } from "./hooks/index.ts";
|
|
40
48
|
export { type AgentSink, BlackboxStoppedError, blackboxAgentMiddleware, blackboxHitl, type HitlRequest, } from "./hooks/langchain-agent.ts";
|
|
41
49
|
export { blackboxCheckpointer } from "./hooks/langgraph-checkpoint.ts";
|
|
42
50
|
export { MANAGED_END, MANAGED_START, managedBlock, protectedEdit } from "./hooks/protect.ts";
|
|
43
51
|
export { type Investigation, investigation, renderInvestigation, } from "./investigate/index.ts";
|
|
52
|
+
export { isRpcResponse, rpcIdOf, SERVER_REQUESTS, type ServerRequestKind, secretFields, serverReplyMeta, serverRequestMeta, } from "./mcp-requests/index.ts";
|
|
44
53
|
export { type McpWrapOptions, mcpWrap } from "./mcp-wrap/index.ts";
|
|
45
54
|
export { commitContent, memoryChain, memoryEntry, verifyMemoryContent, verifyMemoryEntry, } from "./memory/index.ts";
|
|
46
55
|
export { type AmountUnit, anthropicStatement, type Baseline, baselines, type Connector, checkConnector, checkStatement, csvStatement, customStatement, decimalToMicroUsd, fuel, fxRate, fxUnit, modelSpend, openaiStatement, pageParams, parseXml, reconcileBilling, requestFor, resolvePath, type Statement, } from "./money/index.ts";
|
|
47
56
|
export { deadlinesDue, filingPack, type OccurrenceFacts, type OccurrenceFramework, type OccurrenceReport, occurrenceFacts, occurrenceReport, renderOccurrence, } from "./occurrence/index.ts";
|
|
48
57
|
export { ingestOcsf, type OcsfEvent, type OcsfVersion, ocsfLine, toOcsf } from "./ocsf/index.ts";
|
|
49
|
-
export { fromOtlp, type OtlpEvent, toOtlp } from "./otlp/index.ts";
|
|
50
|
-
export { otlpFromProtobuf } from "./otlp/protobuf.ts";
|
|
58
|
+
export { fromOtlp, fromOtlpLogs, fromOtlpMetrics, type GatewayCall, gatewayTrace, microOf, type OtlpEvent, toOtlp, toOtlpLogs, toOtlpMetrics, } from "./otlp/index.ts";
|
|
59
|
+
export { otlpDecode, otlpEncode, otlpFromProtobuf, type Signal as OtlpSignal, } from "./otlp/protobuf.ts";
|
|
51
60
|
export { checkIdentifier, checkPack, corePack, type PackEntry, packData, packFrameworks, } from "./packs/index.ts";
|
|
61
|
+
export { shapeArabic, type UnicodeTables, visualLine, } from "./pdf/arabic.ts";
|
|
62
|
+
export { type ArabicAssets, type ArabicMetrics, type FontMetrics, type PdfAssets, type PdfAttachment, type PdfInput, type PdfVerification, pdfCertificate, reportPdf, verifyPdf, } from "./pdf/index.ts";
|
|
52
63
|
export { type PolicyChange, type PolicyDelta, policyDelta } from "./policy/delta.ts";
|
|
53
64
|
export { type Draft, type DraftGroup, policyDrafts } from "./policy/drafts.ts";
|
|
54
65
|
export { audited, type CompiledPolicy, compilePolicy, type Decision, decide, ENVIRONMENT, environmentOf, loadPolicy, mcpToolHints, type Policy, policyFindings, type Rule, type ToolHints, toolDefinitionHash, } from "./policy/index.ts";
|
|
@@ -59,6 +70,7 @@ export { type InterventionEvidence, interventionEvidence, interventionGain, } fr
|
|
|
59
70
|
export { activities, buildNormal, type NormalModel, type NormalScore, normalScore, normalThreshold, } from "./precog/normal.ts";
|
|
60
71
|
export { type PreflightFinding, preflightFindings } from "./preflight/index.ts";
|
|
61
72
|
export { type Rating, type TypeUnratedFinding, typeRatings, typeUnrated, } from "./ratings/index.ts";
|
|
73
|
+
export { type RealtimeFormat, type RealtimeFrame, realtimeFrame, realtimeModelFromPath, } from "./realtime/index.ts";
|
|
62
74
|
export { type Finding, type FindingCode, type Harness, loadLocal, type ReconcileOptions, RecordNotVerified, type Report, reconcile, } from "./reconcile/index.ts";
|
|
63
75
|
/** Canonical JSON (keys sorted, no whitespace, JavaScript number formatting), as hashed. */
|
|
64
76
|
export { canonical } from "./reconcile/shared.ts";
|
|
@@ -72,10 +84,11 @@ export { assembleSla, assessCompliance, buildSlaBody, signSla, slaHash, verifySl
|
|
|
72
84
|
export { assembleSuccession, buildSuccessionBody, type Succession, type SuccessionBody, type SuccessionReason, signSuccession, successionHash, verifyLineage, verifySuccession, } from "./succession/index.ts";
|
|
73
85
|
export { type TimestampReport, timestampRequest, verifyTimestamp, } from "./timestamp/index.ts";
|
|
74
86
|
export { resolveToken, resolveTokens, tokenFor } from "./tokens/index.ts";
|
|
75
|
-
export { addCheckpointBody, type Cbor, cborDecode, cborEncode, checkpointText, consistencyProof, cosign, cosignMldsa, ed25519PublicKey, inclusionProof, keyRotationNote, leafHash, logKid, makeReceipt, merkleRoot, mldsaAvailable, mldsaPublicKey, noteVkey, parseAddCheckpoint, parseCheckpoint, parseVkey, RECEIPT_SUB, SESSION_CONTENT_TYPE, sessionStatement, signNote, signStatement, splitNote, statementEntry, subtreeMessage, transparentStatement, verifyConsistency, verifyCoseSign1, verifyCosignature, verifyInclusion, verifyKeyRotation, verifyNote, verifyReceipt, verifyTransparency, } from "./transparency/index.ts";
|
|
87
|
+
export { addCheckpointBody, type Cbor, cborDecode, cborEncode, checkpointText, consistencyProof, cosign, cosignMldsa, ed25519PublicKey, ed25519Sign, ed25519Verify, inclusionProof, keyRotationNote, leafHash, logKid, makeReceipt, merkleRoot, mldsaAvailable, mldsaPublicKey, noteVkey, parseAddCheckpoint, parseCheckpoint, parseVkey, RECEIPT_SUB, SESSION_CONTENT_TYPE, sessionStatement, signNote, signStatement, splitNote, statementEntry, subtreeMessage, transparentStatement, verifyConsistency, verifyCoseSign1, verifyCosignature, verifyInclusion, verifyKeyRotation, verifyNote, verifyReceipt, verifyTransparency, } from "./transparency/index.ts";
|
|
76
88
|
export { type Compensation, checkCompensations, runUndo, type UndoFinding, type UndoStatus, type UndoStep, undoFindings, undoPlan, } from "./undo/index.ts";
|
|
77
89
|
export * from "./verify/index.ts";
|
|
78
90
|
export { VERSION } from "./version.ts";
|
|
79
91
|
export { checkOutput, WALLS, type Wall, wallFindings, wallManifestHash, } from "./walls/index.ts";
|
|
92
|
+
export { WAREHOUSE_TABLES, type WarehouseCost, type WarehouseDestination, type WarehouseRequest, type WarehouseRow, type WarehouseSession, type WarehouseTable, warehouseBatches, warehouseRequest, warehouseRequestId, warehouseRows, } from "./warehouse/index.ts";
|
|
80
93
|
export { type Conditions, type Sample, weather } from "./weather/index.ts";
|
|
81
94
|
export { postReceipt, receiptFor, type Tree, workspaceTree } from "./workspace-receipt/index.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
// Public API of @zanii/blackbox. Everything customers can import is re-exported here.
|
|
2
2
|
// Keep this file in step with sdks/python/src/zanii_blackbox/__init__.py (the SDKs mirror each other).
|
|
3
|
+
// spec/anchoring.md §15: the servers check an outside signer against the identity's did:key
|
|
4
|
+
export { publicKeyFromDid } from "@zanii/core";
|
|
3
5
|
export { A2A_STREAMING, a2aMethod, a2aRequestMeta, a2aResponseMeta, a2aRestMethod, a2aRestRequestMeta, a2aRestResponseMeta, agentCardDigest, agentCardPayload, gatewayCardKey, rewriteAgentCard, verifyAgentCard, } from "./a2a/index.js";
|
|
4
6
|
export { actionsFromCalls, actionsOf, actionsPage, } from "./actions/index.js";
|
|
5
7
|
export { ACCREDITATION_TYPE, checkAccreditation, checkRegister, docHash, REGISTER_TYPE, SERVICE_ID, serviceTier, } from "./admission/index.js";
|
|
6
8
|
export { causality, memoryXray } from "./agents/index.js";
|
|
9
|
+
export { acceptedHash, acceptedMatch, checkAcceptedFindings, } from "./analysis/accepted.js";
|
|
7
10
|
export { detectors, fingerprint } from "./analysis/detectors.js";
|
|
8
11
|
export { FAULTS, faultOf } from "./analysis/faults.js";
|
|
9
|
-
export {
|
|
12
|
+
export { guardCheck, guardMode, guardObserve, guardPin, guardState, guardToolResults, loadGuardConfig, } from "./analysis/guard.js";
|
|
13
|
+
export { Analyzer, analyze, answerClaims, answerCredential, answerRisk, answersOf, answerText, canonicalNumber, checkAgainstPacks, checkFlightPlan, checkpointReplay, detectorAccuracy, dualWitness, Evidence, elicitationSecret, eventsOf, factsIn, findingKey, groundingFindings, groundingRequest, growth, HOLD_TRIGGERS, identifiersIn, isoWeek, judgeFindings, judgeRequest, landing, lessons, loadReferencePacks, modelGroundingFindings, normaliseValue, OUTCOMES, packsFor, parseGroundingAnswer, parseJudgeAnswer, promptChanged, referenceContext, rollup, schemaProblem, secretSent, selfChanges, successRange, systemPromptHash, toolDrifted, toolHallucinations, toolsHash, userDownvotes, verifyAnswerCredential, waste, wilsonLow, } from "./analysis/index.js";
|
|
10
14
|
export { injectionFindings, injectionRule } from "./analysis/injection.js";
|
|
15
|
+
export { checkPredicate, checkSchema, compilePattern, milliOf, patternMatches, schemaError, } from "./analysis/plan-checks.js";
|
|
11
16
|
export { MITRE_ATLAS, OWASP_ASI, TAXONOMY, taxonomyOf, } from "./analysis/taxonomy.js";
|
|
12
|
-
export { approvalConfirmation, approvalFindings, argsHash, verifyConfirmation, } from "./approvals/index.js";
|
|
17
|
+
export { approvalConfirmation, approvalConfirmationWith, approvalFindings, argsHash, verifyConfirmation, } from "./approvals/index.js";
|
|
13
18
|
export { textWarnings } from "./approvals/warnings.js";
|
|
14
19
|
export { archiveDigest, archiveEntry, archiveManifest, verifyArchive, } from "./archive/index.js";
|
|
15
20
|
export { archiveParquet } from "./archive/parquet.js";
|
|
16
21
|
export { attest, isReadOnly, normalise, parseCommand } from "./attest/index.js";
|
|
17
22
|
export { authorityAt, authorityTimeline, automationSurprise, } from "./authority/index.js";
|
|
23
|
+
export { agentReportFindings, approverFatigueFindings, approverStats, checkChecks, checkEnvelope, checkFindings, checkHazardRegister, checkNotam, checkOperatorCertificate, checkOpspecs, checkSafetyReport, checkStatus, clearance, clearanceFindings, commitPointSeq, configurationId, envelopeFindings, globMatch, hazardStatus, isLevel, LEVELS, loadSheet, locator, locatorFindings, notamFindings, notamsInForce, operatorCertificate, opspecsCheck, pastCommitPoint, procedureFor, protectReasoning, QRH, ratingCurrency, ratingLapsed, reasoningStatus, SAFETY_CATEGORIES, safetyReportSummary, samePerson, shapeRequest, typeCertificate, unapprovedModifications, } from "./aviation/index.js";
|
|
18
24
|
export { badgeSvg, RECORD_STATES, recordBadge, recordState, } from "./badge/index.js";
|
|
19
25
|
export { invoice, loadPlans, renderTaxCreditNote, renderTaxInvoice, stripeSignatureOk, taxCreditNote, taxInvoice, } from "./billing/index.js";
|
|
20
26
|
export { checkAgent, sessionBom } from "./bom/index.js";
|
|
27
|
+
export { agentBudgetFindings, budgetFor, mad, median, parseAgentBudgets, peerFindings, periodOf, } from "./budgets/index.js";
|
|
21
28
|
export { BlackboxApiError, client, } from "./client/index.js";
|
|
22
29
|
export { ART12_MIN_RETENTION_DAYS, art12Check, } from "./compliance/art12.js";
|
|
23
30
|
export { accuracyFact, complianceFacts, complianceReport, controlsFact, hallucinationFacts, renderReport, } from "./compliance/index.js";
|
|
24
31
|
export { renderZaniiCompliance, zaniiCompliance, } from "./compliance/zanii.js";
|
|
25
32
|
export { constitutionHash, createConstitution, evaluateConstitution, governanceOf, verifyConstitution, } from "./constitution/index.js";
|
|
26
|
-
export {
|
|
33
|
+
export { batchReport, } from "./cost/batch.js";
|
|
34
|
+
export { batchModels, callMicroUsd, effectivePrice, formatAed, loadPrices, priceCall, priceFor, promptTokens, requestsOf, sessionCost, toAedFils, tokensOf, } from "./cost/index.js";
|
|
27
35
|
export { agentCv, buildCv, cvHash, verifyCv } from "./cv/index.js";
|
|
28
36
|
export { CORE_EVIDENCE, CORE_IDENTIFIERS, canaryIdentifier, checkAuditConnector, dataClasses, dataFindings, dataFingerprint, dataMeta, dataScan, dataTopology, hasEvidence, lineage, luhn, normalizeValue, parseAuditLog, parseCsv, reconcileSystem, toolWitness, unevidenced, verifyToolWitness, witnessOf, } from "./data/index.js";
|
|
29
37
|
export { directives, fleetDirectives, } from "./directives/index.js";
|
|
@@ -31,26 +39,30 @@ export { argumentLeaves, discloseFields, disclosureEnvelope, verifyDisclosure, v
|
|
|
31
39
|
export { checkDrill, drillReport } from "./drills/index.js";
|
|
32
40
|
export { checkDuty, dutyFindings } from "./duty/index.js";
|
|
33
41
|
export { openSegments } from "./encryption/index.js";
|
|
42
|
+
export { armStats, assignArm, casesFromScenarios, casesFromSessions, checkDataset, checkExperiment, checkScorer, compareRuns, datasetHash, experimentResults, parseCasesJsonl, promptResults, promptSha256, runSummary, SCORERS, scoreCase, toMilli, } from "./evals/index.js";
|
|
34
43
|
export { evidencePack, renderEvidencePack, } from "./evidence/index.js";
|
|
35
|
-
export { buildEquivocationProof, compareViews, cosignLedgerSth, verifyEquivocationProof, verifyLedgerCosignature, } from "./federation/index.js";
|
|
44
|
+
export { buildEquivocationProof, compareViews, cosignLedgerSth, cosignLedgerSthWith, verifyEquivocationProof, verifyLedgerCosignature, } from "./federation/index.js";
|
|
36
45
|
export { buildOwnerAttestation, buildPayment, CURRENCIES, FTA_WALL_ID, financeFindings, formatMoney, ftaPayload, parseMoney, paymentsOf, screenCounterparty, screeningPayload, verifyOwnerAttestation, verifyOwnerBinding, } from "./finance/index.js";
|
|
37
|
-
export { APPROVAL_ID, aggregateFindings, airworthiness, certificateOf, collisions, didFromSeed, incidentReport, logbook, sessionSummary, signatureOf, signatures, signCertificate, taughtBy, verifyCertificate, } from "./fleet/index.js";
|
|
46
|
+
export { APPROVAL_ID, aggregateFindings, airworthiness, certificateOf, collisions, didFromSeed, incidentReport, logbook, sessionSummary, signatureOf, signatures, signCertificate, signCertificateWith, taughtBy, verifyCertificate, } from "./fleet/index.js";
|
|
38
47
|
export { copilotContext, copilotPrompt, insights, parseCopilotAnswer, } from "./fleet/insights.js";
|
|
39
48
|
export { appealPack, decisionPayload, GOV_DECISION_KINDS, renderAppealPack, ruleConsistency, signSubjectClaim, subjectTag, verifyDecision, verifyFactors, verifySubjectClaim, } from "./gov/index.js";
|
|
40
49
|
export { accessPayload, breakGlass, checkEpisodeTag, clinicianConfirmation, episodeSeed, episodesPack, episodeTag, healthFindings, protocolTrail, recommendationHash, recommendationPayload, verifyCommitment, verifyHealthSignature, } from "./health/index.js";
|
|
41
|
-
export { attachBlackbox, BlackboxAgentHooks, BlackboxCallbackHandler, blackboxAgentHooks, blackboxCallbacks, blackboxMiddleware, llmIds, llmIdsOf, trackMemory, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI, } from "./hooks/index.js";
|
|
50
|
+
export { attachBlackbox, BlackboxAgentHooks, BlackboxCallbackHandler, blackboxAgentHooks, blackboxCallbacks, blackboxMastraExporter, blackboxMiddleware, llmIds, llmIdsOf, trackMemory, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI, } from "./hooks/index.js";
|
|
42
51
|
export { BlackboxStoppedError, blackboxAgentMiddleware, blackboxHitl, } from "./hooks/langchain-agent.js";
|
|
43
52
|
export { blackboxCheckpointer } from "./hooks/langgraph-checkpoint.js";
|
|
44
53
|
export { MANAGED_END, MANAGED_START, managedBlock, protectedEdit } from "./hooks/protect.js";
|
|
45
54
|
export { investigation, renderInvestigation, } from "./investigate/index.js";
|
|
55
|
+
export { isRpcResponse, rpcIdOf, SERVER_REQUESTS, secretFields, serverReplyMeta, serverRequestMeta, } from "./mcp-requests/index.js";
|
|
46
56
|
export { mcpWrap } from "./mcp-wrap/index.js";
|
|
47
57
|
export { commitContent, memoryChain, memoryEntry, verifyMemoryContent, verifyMemoryEntry, } from "./memory/index.js";
|
|
48
58
|
export { anthropicStatement, baselines, checkConnector, checkStatement, csvStatement, customStatement, decimalToMicroUsd, fuel, fxRate, fxUnit, modelSpend, openaiStatement, pageParams, parseXml, reconcileBilling, requestFor, resolvePath, } from "./money/index.js";
|
|
49
59
|
export { deadlinesDue, filingPack, occurrenceFacts, occurrenceReport, renderOccurrence, } from "./occurrence/index.js";
|
|
50
60
|
export { ingestOcsf, ocsfLine, toOcsf } from "./ocsf/index.js";
|
|
51
|
-
export { fromOtlp, toOtlp } from "./otlp/index.js";
|
|
52
|
-
export { otlpFromProtobuf } from "./otlp/protobuf.js";
|
|
61
|
+
export { fromOtlp, fromOtlpLogs, fromOtlpMetrics, gatewayTrace, microOf, toOtlp, toOtlpLogs, toOtlpMetrics, } from "./otlp/index.js";
|
|
62
|
+
export { otlpDecode, otlpEncode, otlpFromProtobuf, } from "./otlp/protobuf.js";
|
|
53
63
|
export { checkIdentifier, checkPack, corePack, packData, packFrameworks, } from "./packs/index.js";
|
|
64
|
+
export { shapeArabic, visualLine, } from "./pdf/arabic.js";
|
|
65
|
+
export { pdfCertificate, reportPdf, verifyPdf, } from "./pdf/index.js";
|
|
54
66
|
export { policyDelta } from "./policy/delta.js";
|
|
55
67
|
export { policyDrafts } from "./policy/drafts.js";
|
|
56
68
|
export { audited, compilePolicy, decide, ENVIRONMENT, environmentOf, loadPolicy, mcpToolHints, policyFindings, toolDefinitionHash, } from "./policy/index.js";
|
|
@@ -61,6 +73,7 @@ export { interventionEvidence, interventionGain, } from "./precog/intervention.j
|
|
|
61
73
|
export { activities, buildNormal, normalScore, normalThreshold, } from "./precog/normal.js";
|
|
62
74
|
export { preflightFindings } from "./preflight/index.js";
|
|
63
75
|
export { typeRatings, typeUnrated, } from "./ratings/index.js";
|
|
76
|
+
export { realtimeFrame, realtimeModelFromPath, } from "./realtime/index.js";
|
|
64
77
|
export { loadLocal, RecordNotVerified, reconcile, } from "./reconcile/index.js";
|
|
65
78
|
/** Canonical JSON (keys sorted, no whitespace, JavaScript number formatting), as hashed. */
|
|
66
79
|
export { canonical } from "./reconcile/shared.js";
|
|
@@ -74,10 +87,11 @@ export { assembleSla, assessCompliance, buildSlaBody, signSla, slaHash, verifySl
|
|
|
74
87
|
export { assembleSuccession, buildSuccessionBody, signSuccession, successionHash, verifyLineage, verifySuccession, } from "./succession/index.js";
|
|
75
88
|
export { timestampRequest, verifyTimestamp, } from "./timestamp/index.js";
|
|
76
89
|
export { resolveToken, resolveTokens, tokenFor } from "./tokens/index.js";
|
|
77
|
-
export { addCheckpointBody, cborDecode, cborEncode, checkpointText, consistencyProof, cosign, cosignMldsa, ed25519PublicKey, inclusionProof, keyRotationNote, leafHash, logKid, makeReceipt, merkleRoot, mldsaAvailable, mldsaPublicKey, noteVkey, parseAddCheckpoint, parseCheckpoint, parseVkey, RECEIPT_SUB, SESSION_CONTENT_TYPE, sessionStatement, signNote, signStatement, splitNote, statementEntry, subtreeMessage, transparentStatement, verifyConsistency, verifyCoseSign1, verifyCosignature, verifyInclusion, verifyKeyRotation, verifyNote, verifyReceipt, verifyTransparency, } from "./transparency/index.js";
|
|
90
|
+
export { addCheckpointBody, cborDecode, cborEncode, checkpointText, consistencyProof, cosign, cosignMldsa, ed25519PublicKey, ed25519Sign, ed25519Verify, inclusionProof, keyRotationNote, leafHash, logKid, makeReceipt, merkleRoot, mldsaAvailable, mldsaPublicKey, noteVkey, parseAddCheckpoint, parseCheckpoint, parseVkey, RECEIPT_SUB, SESSION_CONTENT_TYPE, sessionStatement, signNote, signStatement, splitNote, statementEntry, subtreeMessage, transparentStatement, verifyConsistency, verifyCoseSign1, verifyCosignature, verifyInclusion, verifyKeyRotation, verifyNote, verifyReceipt, verifyTransparency, } from "./transparency/index.js";
|
|
78
91
|
export { checkCompensations, runUndo, undoFindings, undoPlan, } from "./undo/index.js";
|
|
79
92
|
export * from "./verify/index.js";
|
|
80
93
|
export { VERSION } from "./version.js";
|
|
81
94
|
export { checkOutput, WALLS, wallFindings, wallManifestHash, } from "./walls/index.js";
|
|
95
|
+
export { WAREHOUSE_TABLES, warehouseBatches, warehouseRequest, warehouseRequestId, warehouseRows, } from "./warehouse/index.js";
|
|
82
96
|
export { weather } from "./weather/index.js";
|
|
83
97
|
export { postReceipt, receiptFor, workspaceTree } from "./workspace-receipt/index.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Json } from "../verify/envelope.ts";
|
|
2
|
+
type Meta = {
|
|
3
|
+
[key: string]: Json;
|
|
4
|
+
};
|
|
5
|
+
/** The server's request methods and the event kind each is recorded as. */
|
|
6
|
+
export declare const SERVER_REQUESTS: Readonly<Record<string, ServerRequestKind>>;
|
|
7
|
+
export type ServerRequestKind = "tool.sampling" | "tool.elicitation" | "tool.roots";
|
|
8
|
+
/** A JSON-RPC id as recorded: a string of at most 256 characters, or a safe integer. */
|
|
9
|
+
export declare function rpcIdOf(id: unknown): string | number | undefined;
|
|
10
|
+
/** The field names that ask for a credential: the name, lowercased with everything but letters
|
|
11
|
+
* and digits removed, contains one of the credential words, or is `pin`. In the order given. */
|
|
12
|
+
export declare function secretFields(names: readonly string[]): string[];
|
|
13
|
+
/**
|
|
14
|
+
* A server → client message that is one of the server's requests: its kind and `meta`, or null
|
|
15
|
+
* for anything else (a notification, a response, another method, a batch, a request without a
|
|
16
|
+
* usable id).
|
|
17
|
+
*/
|
|
18
|
+
export declare function serverRequestMeta(message: unknown): {
|
|
19
|
+
kind: ServerRequestKind;
|
|
20
|
+
meta: Meta;
|
|
21
|
+
} | null;
|
|
22
|
+
/** The client's reply to a server request of `method`: its `meta` (spec/mcp.md §6). */
|
|
23
|
+
export declare function serverReplyMeta(method: string, message: unknown): Meta;
|
|
24
|
+
/** Whether a client → server message is a reply (a JSON-RPC response) rather than a request. */
|
|
25
|
+
export declare function isRpcResponse(message: unknown): boolean;
|
|
26
|
+
export {};
|