@zanii/blackbox 0.2.0 → 0.4.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 +26 -1
- package/dist/a2a/index.d.ts +77 -0
- package/dist/a2a/index.js +305 -0
- package/dist/agents/index.d.ts +8 -0
- package/dist/analysis/accuracy.d.ts +24 -0
- package/dist/analysis/accuracy.js +45 -0
- package/dist/analysis/credential.d.ts +101 -0
- package/dist/analysis/credential.js +142 -0
- package/dist/analysis/faults.js +115 -0
- package/dist/analysis/grounding.d.ts +122 -0
- package/dist/analysis/grounding.js +445 -0
- package/dist/analysis/hallucination.d.ts +32 -0
- package/dist/analysis/hallucination.js +357 -0
- package/dist/analysis/index.d.ts +23 -0
- package/dist/analysis/index.js +93 -0
- package/dist/analysis/memory.d.ts +8 -0
- package/dist/analysis/memory.js +35 -8
- package/dist/analysis/reference.d.ts +49 -0
- package/dist/analysis/reference.js +164 -0
- package/dist/analysis/taxonomy.d.ts +18 -0
- package/dist/analysis/taxonomy.js +66 -0
- package/dist/approvals/index.d.ts +23 -0
- package/dist/approvals/index.js +48 -0
- package/dist/archive/index.d.ts +39 -0
- package/dist/archive/index.js +96 -0
- package/dist/archive/parquet.d.ts +2 -0
- package/dist/archive/parquet.js +185 -0
- package/dist/badge/index.d.ts +16 -0
- package/dist/badge/index.js +48 -0
- package/dist/bom/index.d.ts +14 -0
- package/dist/bom/index.js +152 -0
- package/dist/cli.js +114 -10
- package/dist/compliance/art12.d.ts +35 -0
- package/dist/compliance/art12.js +190 -0
- package/dist/compliance/index.d.ts +36 -2
- package/dist/compliance/index.js +78 -11
- package/dist/compliance/zanii.d.ts +29 -0
- package/dist/compliance/zanii.js +84 -0
- package/dist/constitution/index.d.ts +57 -0
- package/dist/constitution/index.js +131 -0
- package/dist/cv/index.d.ts +39 -0
- package/dist/cv/index.js +108 -0
- package/dist/disclosure/index.d.ts +31 -0
- package/dist/disclosure/index.js +113 -0
- package/dist/encryption/index.d.ts +9 -0
- package/dist/encryption/index.js +31 -0
- package/dist/evidence/index.d.ts +60 -0
- package/dist/evidence/index.js +151 -0
- package/dist/federation/index.d.ts +35 -0
- package/dist/federation/index.js +102 -0
- package/dist/finance/index.d.ts +126 -0
- package/dist/finance/index.js +320 -0
- package/dist/fleet/index.js +9 -0
- package/dist/gov/index.d.ts +108 -0
- package/dist/gov/index.js +225 -0
- package/dist/health/index.d.ts +120 -0
- package/dist/health/index.js +233 -0
- package/dist/index.d.ts +34 -5
- package/dist/index.js +34 -5
- package/dist/memory/index.d.ts +36 -0
- package/dist/memory/index.js +85 -0
- package/dist/occurrence/index.d.ts +11 -0
- package/dist/occurrence/index.js +18 -0
- package/dist/ocsf/index.d.ts +1 -1
- package/dist/ocsf/index.js +36 -3
- package/dist/otlp/index.d.ts +8 -1
- package/dist/otlp/index.js +258 -1
- package/dist/packs/index.js +44 -4
- package/dist/policy/delta.js +7 -1
- package/dist/policy/index.d.ts +40 -6
- package/dist/policy/index.js +186 -8
- package/dist/policy/zanii.d.ts +31 -0
- package/dist/policy/zanii.js +87 -0
- package/dist/pq/index.d.ts +23 -0
- package/dist/pq/index.js +104 -0
- package/dist/search/index.d.ts +23 -0
- package/dist/search/index.js +69 -0
- package/dist/session/index.d.ts +107 -1
- package/dist/session/index.js +189 -11
- package/dist/sla/index.d.ts +61 -0
- package/dist/sla/index.js +197 -0
- package/dist/succession/index.d.ts +50 -0
- package/dist/succession/index.js +123 -0
- package/dist/timestamp/index.d.ts +24 -0
- package/dist/timestamp/index.js +274 -0
- package/dist/tokens/index.d.ts +6 -0
- package/dist/tokens/index.js +46 -0
- package/dist/transparency/index.d.ts +188 -0
- package/dist/transparency/index.js +712 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/walls/index.d.ts +31 -0
- package/dist/walls/index.js +119 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,46 +1,75 @@
|
|
|
1
|
+
export { A2A_STREAMING, type AgentCardReport, a2aMethod, a2aRequestMeta, a2aResponseMeta, a2aRestMethod, a2aRestRequestMeta, a2aRestResponseMeta, agentCardDigest, agentCardPayload, gatewayCardKey, rewriteAgentCard, verifyAgentCard, } from "./a2a/index.ts";
|
|
1
2
|
export { causality, memoryXray } from "./agents/index.ts";
|
|
2
3
|
export { type DetectorOptions, detectors, fingerprint } from "./analysis/detectors.ts";
|
|
3
4
|
export { FAULTS, type Fault, faultOf } from "./analysis/faults.ts";
|
|
4
|
-
export { type AnalyzeOptions, analyze, type ClaimVerdict, type CriterionResult, checkFlightPlan, checkpointReplay, dualWitness, eventsOf, type Finding as AnalysisFinding, findingKey, type Landing, landing, OUTCOMES, type Outcome, type OutcomeRollup, rollup, type Severity, type WasteReason, type WasteReport, waste, } from "./analysis/index.ts";
|
|
5
|
-
export { type
|
|
5
|
+
export { type Accuracy, type AnalyzeOptions, type AnswerClaims, analyze, answerClaims, answerCredential, answerRisk, answersOf, answerText, type ClaimEntry, type ClaimVerdict, type CriterionResult, canonicalNumber, checkAgainstPacks, checkFlightPlan, checkpointReplay, detectorAccuracy, dualWitness, Evidence, eventsOf, type Fact, type Finding as AnalysisFinding, factsIn, findingKey, type GroundedClaim, groundingFindings, groundingRequest, HOLD_TRIGGERS, identifiersIn, judgeFindings, judgeRequest, type Label as AccuracyLabel, type Landing, landing, loadReferencePacks, modelGroundingFindings, normaliseValue, OUTCOMES, type Outcome, type OutcomeRollup, packsFor, parseGroundingAnswer, parseJudgeAnswer, type ReferenceFact, type ReferencePack, type ReferenceVerdict, referenceContext, rollup, type Severity, schemaProblem, toolHallucinations, verifyAnswerCredential, type WasteReason, type WasteReport, waste, wilsonLow, } from "./analysis/index.ts";
|
|
6
|
+
export { MITRE_ATLAS, OWASP_ASI, TAXONOMY, type Taxonomy, taxonomyOf, } from "./analysis/taxonomy.ts";
|
|
7
|
+
export { type ApprovalFinding, approvalConfirmation, approvalFindings, argsHash, verifyConfirmation, } from "./approvals/index.ts";
|
|
6
8
|
export { textWarnings } from "./approvals/warnings.ts";
|
|
9
|
+
export { type ArchiveFile, type ArchiveManifest, type ArchiveReport, archiveDigest, archiveEntry, archiveManifest, verifyArchive, } from "./archive/index.ts";
|
|
10
|
+
export { archiveParquet } from "./archive/parquet.ts";
|
|
7
11
|
export { type Attestation, attest, isReadOnly, normalise, parseCommand } from "./attest/index.ts";
|
|
8
12
|
export { type AuthorityFinding, authorityAt, authorityTimeline, automationSurprise, type Mode as AuthorityMode, type Span as AuthoritySpan, } from "./authority/index.ts";
|
|
13
|
+
export { badgeSvg, RECORD_STATES, type RecordState, recordBadge, recordState, } from "./badge/index.ts";
|
|
9
14
|
export { type Invoice, type InvoiceLine, invoice, loadPlans, type Plan, type Plans, renderTaxInvoice, stripeSignatureOk, type TaxInvoice, type TaxInvoiceInput, taxInvoice, } from "./billing/index.ts";
|
|
15
|
+
export { type AgentIdentity, checkAgent, sessionBom } from "./bom/index.ts";
|
|
10
16
|
export { BlackboxApiError, type Client, type ClientOptions, client, type SessionQuery, } from "./client/index.ts";
|
|
11
|
-
export {
|
|
17
|
+
export { ART12_MIN_RETENTION_DAYS, type Art12Check, type Art12Report, art12Check, } from "./compliance/art12.ts";
|
|
18
|
+
export { accuracyFact, complianceFacts, complianceReport, controlsFact, type Facts, type Framework, hallucinationFacts, type Report as ComplianceReport, renderReport, } from "./compliance/index.ts";
|
|
19
|
+
export { renderZaniiCompliance, type ZaniiComplianceReport, zaniiCompliance, } from "./compliance/zanii.ts";
|
|
20
|
+
export { type Constitution, type ConstitutionRule, constitutionHash, createConstitution, evaluateConstitution, governanceOf, verifyConstitution, } from "./constitution/index.ts";
|
|
12
21
|
export { 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";
|
|
22
|
+
export { agentCv, buildCv, cvHash, verifyCv } from "./cv/index.ts";
|
|
13
23
|
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";
|
|
14
24
|
export { type Directive, type DirectiveItem, type DirectiveOptions, directives, fleetDirectives, } from "./directives/index.ts";
|
|
25
|
+
export { argumentLeaves, type Disclosure, type DisclosureEnvelope, discloseFields, disclosureEnvelope, verifyDisclosure, verifyEventDisclosure, } from "./disclosure/index.ts";
|
|
15
26
|
export { checkDrill, drillReport, type Fault as DrillFault } from "./drills/index.ts";
|
|
16
27
|
export { checkDuty, type DutyFinding, type DutyLimits, dutyFindings } from "./duty/index.ts";
|
|
28
|
+
export { openSegments, type SealedSegment } from "./encryption/index.ts";
|
|
29
|
+
export { type EvidencePack, type EvidencePackOptions, evidencePack, renderEvidencePack, } from "./evidence/index.ts";
|
|
30
|
+
export { buildEquivocationProof, compareViews, cosignLedgerSth, verifyEquivocationProof, verifyLedgerCosignature, } from "./federation/index.ts";
|
|
31
|
+
export { buildOwnerAttestation, buildPayment, CURRENCIES, FTA_WALL_ID, financeFindings, formatMoney, ftaPayload, parseMoney, paymentsOf, screenCounterparty, screeningPayload, verifyOwnerAttestation, verifyOwnerBinding, } from "./finance/index.ts";
|
|
17
32
|
export { aggregateFindings, airworthiness, type Collision, collisions, didFromSeed, type FindingGroup, incidentReport, logbook, type Summary, sessionSummary, signatureOf, signatures, signCertificate, verifyCertificate, } from "./fleet/index.ts";
|
|
33
|
+
export { type AppealItem, type AppealPack, appealPack, decisionPayload, GOV_DECISION_KINDS, renderAppealPack, ruleConsistency, signSubjectClaim, subjectTag, verifyDecision, verifyFactors, verifySubjectClaim, } from "./gov/index.ts";
|
|
34
|
+
export { accessPayload, breakGlass, checkEpisodeTag, clinicianConfirmation, type EpisodeItem, episodeSeed, episodesPack, episodeTag, healthFindings, protocolTrail, recommendationHash, recommendationPayload, verifyCommitment, verifyHealthSignature, } from "./health/index.ts";
|
|
18
35
|
export { attachBlackbox, BlackboxAgentHooks, BlackboxCallbackHandler, type BlackboxCallbacks, blackboxAgentHooks, blackboxCallbacks, blackboxMiddleware, type EventSink, llmIds, llmIdsOf, trackMemory, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI, } from "./hooks/index.ts";
|
|
19
36
|
export { type AgentSink, BlackboxStoppedError, blackboxAgentMiddleware, blackboxHitl, type HitlRequest, } from "./hooks/langchain-agent.ts";
|
|
20
37
|
export { blackboxCheckpointer } from "./hooks/langgraph-checkpoint.ts";
|
|
21
38
|
export { MANAGED_END, MANAGED_START, managedBlock, protectedEdit } from "./hooks/protect.ts";
|
|
22
39
|
export { type Investigation, investigation, renderInvestigation, } from "./investigate/index.ts";
|
|
23
40
|
export { type McpWrapOptions, mcpWrap } from "./mcp-wrap/index.ts";
|
|
41
|
+
export { commitContent, memoryChain, memoryEntry, verifyMemoryContent, verifyMemoryEntry, } from "./memory/index.ts";
|
|
24
42
|
export { type AmountUnit, anthropicStatement, type Baseline, baselines, type Connector, checkConnector, checkStatement, csvStatement, customStatement, decimalToMicroUsd, fuel, modelSpend, openaiStatement, pageParams, parseXml, reconcileBilling, requestFor, resolvePath, type Statement, } from "./money/index.ts";
|
|
25
|
-
export { filingPack, type OccurrenceFacts, type OccurrenceFramework, type OccurrenceReport, occurrenceFacts, occurrenceReport, renderOccurrence, } from "./occurrence/index.ts";
|
|
43
|
+
export { deadlinesDue, filingPack, type OccurrenceFacts, type OccurrenceFramework, type OccurrenceReport, occurrenceFacts, occurrenceReport, renderOccurrence, } from "./occurrence/index.ts";
|
|
26
44
|
export { ingestOcsf, type OcsfEvent, type OcsfVersion, ocsfLine, toOcsf } from "./ocsf/index.ts";
|
|
27
45
|
export { toOtlp } from "./otlp/index.ts";
|
|
28
46
|
export { checkIdentifier, checkPack, corePack, type PackEntry, packData, packFrameworks, } from "./packs/index.ts";
|
|
29
47
|
export { type PolicyChange, type PolicyDelta, policyDelta } from "./policy/delta.ts";
|
|
30
48
|
export { type Draft, type DraftGroup, policyDrafts } from "./policy/drafts.ts";
|
|
31
|
-
export { audited, type CompiledPolicy, compilePolicy, type Decision, decide, loadPolicy, type Policy, policyFindings, type Rule, } from "./policy/index.ts";
|
|
49
|
+
export { audited, type CompiledPolicy, compilePolicy, type Decision, decide, ENVIRONMENT, environmentOf, loadPolicy, mcpToolHints, type Policy, policyFindings, type Rule, type ToolHints, toolDefinitionHash, } from "./policy/index.ts";
|
|
50
|
+
export { fromZaniiPolicy, toZaniiPolicy } from "./policy/zanii.ts";
|
|
51
|
+
export { bindPqKey, PQ_ALG, pqAvailable, pqPublicKey, pqSeedOf, pqTransitionPayload, verifyPqBinding, } from "./pq/index.ts";
|
|
32
52
|
export { calibration, FEATURES, features, MIN_EACH, type PrecogModel, precogFindings, precogReport, predict, prefixOf, splitOf, TARGET, train, } from "./precog/index.ts";
|
|
33
53
|
export { type InterventionEvidence, interventionEvidence, interventionGain, } from "./precog/intervention.ts";
|
|
34
54
|
export { activities, buildNormal, type NormalModel, type NormalScore, normalScore, normalThreshold, } from "./precog/normal.ts";
|
|
35
55
|
export { type PreflightFinding, preflightFindings } from "./preflight/index.ts";
|
|
36
56
|
export { type Rating, type TypeUnratedFinding, typeRatings, typeUnrated, } from "./ratings/index.ts";
|
|
37
57
|
export { type Finding, type FindingCode, type Harness, loadLocal, type ReconcileOptions, RecordNotVerified, type Report, reconcile, } from "./reconcile/index.ts";
|
|
58
|
+
/** Canonical JSON (keys sorted, no whitespace, JavaScript number formatting), as hashed. */
|
|
59
|
+
export { canonical } from "./reconcile/shared.ts";
|
|
38
60
|
export { cassette, requestKey, type Take } from "./replay/index.ts";
|
|
39
61
|
export { ORPHAN_TEXT, repairToolCalls } from "./replay/repair.ts";
|
|
62
|
+
export { checkSearch, type SearchMatch, type SearchQuery, searchEvents } from "./search/index.ts";
|
|
40
63
|
export { type DrainResult, drainSpools } from "./session/drain.ts";
|
|
41
64
|
export { BlackboxSession, checkEgress, type EgressCheck, type FlightPlan, type LlmCallIds, type SessionError, type SessionOptions, type SessionState, type SessionStats, session, stableEventId, } from "./session/index.ts";
|
|
65
|
+
export { assembleSla, assessCompliance, buildSlaBody, signSla, slaHash, verifySla, } from "./sla/index.ts";
|
|
66
|
+
export { assembleSuccession, buildSuccessionBody, type Succession, type SuccessionBody, type SuccessionReason, signSuccession, successionHash, verifyLineage, verifySuccession, } from "./succession/index.ts";
|
|
67
|
+
export { type TimestampReport, timestampRequest, verifyTimestamp, } from "./timestamp/index.ts";
|
|
68
|
+
export { resolveToken, resolveTokens, tokenFor } from "./tokens/index.ts";
|
|
69
|
+
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";
|
|
42
70
|
export { type Compensation, checkCompensations, runUndo, type UndoFinding, type UndoStatus, type UndoStep, undoFindings, undoPlan, } from "./undo/index.ts";
|
|
43
71
|
export * from "./verify/index.ts";
|
|
44
72
|
export { VERSION } from "./version.ts";
|
|
73
|
+
export { checkOutput, WALLS, type Wall, wallFindings, wallManifestHash, } from "./walls/index.ts";
|
|
45
74
|
export { type Conditions, type Sample, weather } from "./weather/index.ts";
|
|
46
75
|
export { postReceipt, receiptFor, type Tree, workspaceTree } from "./workspace-receipt/index.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,48 +1,77 @@
|
|
|
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
|
+
export { A2A_STREAMING, a2aMethod, a2aRequestMeta, a2aResponseMeta, a2aRestMethod, a2aRestRequestMeta, a2aRestResponseMeta, agentCardDigest, agentCardPayload, gatewayCardKey, rewriteAgentCard, verifyAgentCard, } from "./a2a/index.js";
|
|
3
4
|
export { causality, memoryXray } from "./agents/index.js";
|
|
4
5
|
export { detectors, fingerprint } from "./analysis/detectors.js";
|
|
5
6
|
export { FAULTS, faultOf } from "./analysis/faults.js";
|
|
6
|
-
export { analyze, checkFlightPlan, checkpointReplay, dualWitness, eventsOf, findingKey, landing, OUTCOMES, rollup, waste, } from "./analysis/index.js";
|
|
7
|
-
export {
|
|
7
|
+
export { analyze, answerClaims, answerCredential, answerRisk, answersOf, answerText, canonicalNumber, checkAgainstPacks, checkFlightPlan, checkpointReplay, detectorAccuracy, dualWitness, Evidence, eventsOf, factsIn, findingKey, groundingFindings, groundingRequest, HOLD_TRIGGERS, identifiersIn, judgeFindings, judgeRequest, landing, loadReferencePacks, modelGroundingFindings, normaliseValue, OUTCOMES, packsFor, parseGroundingAnswer, parseJudgeAnswer, referenceContext, rollup, schemaProblem, toolHallucinations, verifyAnswerCredential, waste, wilsonLow, } from "./analysis/index.js";
|
|
8
|
+
export { MITRE_ATLAS, OWASP_ASI, TAXONOMY, taxonomyOf, } from "./analysis/taxonomy.js";
|
|
9
|
+
export { approvalConfirmation, approvalFindings, argsHash, verifyConfirmation, } from "./approvals/index.js";
|
|
8
10
|
export { textWarnings } from "./approvals/warnings.js";
|
|
11
|
+
export { archiveDigest, archiveEntry, archiveManifest, verifyArchive, } from "./archive/index.js";
|
|
12
|
+
export { archiveParquet } from "./archive/parquet.js";
|
|
9
13
|
export { attest, isReadOnly, normalise, parseCommand } from "./attest/index.js";
|
|
10
14
|
export { authorityAt, authorityTimeline, automationSurprise, } from "./authority/index.js";
|
|
15
|
+
export { badgeSvg, RECORD_STATES, recordBadge, recordState, } from "./badge/index.js";
|
|
11
16
|
export { invoice, loadPlans, renderTaxInvoice, stripeSignatureOk, taxInvoice, } from "./billing/index.js";
|
|
17
|
+
export { checkAgent, sessionBom } from "./bom/index.js";
|
|
12
18
|
export { BlackboxApiError, client, } from "./client/index.js";
|
|
13
|
-
export {
|
|
19
|
+
export { ART12_MIN_RETENTION_DAYS, art12Check, } from "./compliance/art12.js";
|
|
20
|
+
export { accuracyFact, complianceFacts, complianceReport, controlsFact, hallucinationFacts, renderReport, } from "./compliance/index.js";
|
|
21
|
+
export { renderZaniiCompliance, zaniiCompliance, } from "./compliance/zanii.js";
|
|
22
|
+
export { constitutionHash, createConstitution, evaluateConstitution, governanceOf, verifyConstitution, } from "./constitution/index.js";
|
|
14
23
|
export { callMicroUsd, effectivePrice, formatAed, loadPrices, priceCall, priceFor, promptTokens, requestsOf, sessionCost, toAedFils, tokensOf, } from "./cost/index.js";
|
|
24
|
+
export { agentCv, buildCv, cvHash, verifyCv } from "./cv/index.js";
|
|
15
25
|
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";
|
|
16
26
|
export { directives, fleetDirectives, } from "./directives/index.js";
|
|
27
|
+
export { argumentLeaves, discloseFields, disclosureEnvelope, verifyDisclosure, verifyEventDisclosure, } from "./disclosure/index.js";
|
|
17
28
|
export { checkDrill, drillReport } from "./drills/index.js";
|
|
18
29
|
export { checkDuty, dutyFindings } from "./duty/index.js";
|
|
30
|
+
export { openSegments } from "./encryption/index.js";
|
|
31
|
+
export { evidencePack, renderEvidencePack, } from "./evidence/index.js";
|
|
32
|
+
export { buildEquivocationProof, compareViews, cosignLedgerSth, verifyEquivocationProof, verifyLedgerCosignature, } from "./federation/index.js";
|
|
33
|
+
export { buildOwnerAttestation, buildPayment, CURRENCIES, FTA_WALL_ID, financeFindings, formatMoney, ftaPayload, parseMoney, paymentsOf, screenCounterparty, screeningPayload, verifyOwnerAttestation, verifyOwnerBinding, } from "./finance/index.js";
|
|
19
34
|
export { aggregateFindings, airworthiness, collisions, didFromSeed, incidentReport, logbook, sessionSummary, signatureOf, signatures, signCertificate, verifyCertificate, } from "./fleet/index.js";
|
|
35
|
+
export { appealPack, decisionPayload, GOV_DECISION_KINDS, renderAppealPack, ruleConsistency, signSubjectClaim, subjectTag, verifyDecision, verifyFactors, verifySubjectClaim, } from "./gov/index.js";
|
|
36
|
+
export { accessPayload, breakGlass, checkEpisodeTag, clinicianConfirmation, episodeSeed, episodesPack, episodeTag, healthFindings, protocolTrail, recommendationHash, recommendationPayload, verifyCommitment, verifyHealthSignature, } from "./health/index.js";
|
|
20
37
|
export { attachBlackbox, BlackboxAgentHooks, BlackboxCallbackHandler, blackboxAgentHooks, blackboxCallbacks, blackboxMiddleware, llmIds, llmIdsOf, trackMemory, wrapAnthropic, wrapBedrock, wrapGemini, wrapOpenAI, } from "./hooks/index.js";
|
|
21
38
|
export { BlackboxStoppedError, blackboxAgentMiddleware, blackboxHitl, } from "./hooks/langchain-agent.js";
|
|
22
39
|
export { blackboxCheckpointer } from "./hooks/langgraph-checkpoint.js";
|
|
23
40
|
export { MANAGED_END, MANAGED_START, managedBlock, protectedEdit } from "./hooks/protect.js";
|
|
24
41
|
export { investigation, renderInvestigation, } from "./investigate/index.js";
|
|
25
42
|
export { mcpWrap } from "./mcp-wrap/index.js";
|
|
43
|
+
export { commitContent, memoryChain, memoryEntry, verifyMemoryContent, verifyMemoryEntry, } from "./memory/index.js";
|
|
26
44
|
export { anthropicStatement, baselines, checkConnector, checkStatement, csvStatement, customStatement, decimalToMicroUsd, fuel, modelSpend, openaiStatement, pageParams, parseXml, reconcileBilling, requestFor, resolvePath, } from "./money/index.js";
|
|
27
|
-
export { filingPack, occurrenceFacts, occurrenceReport, renderOccurrence, } from "./occurrence/index.js";
|
|
45
|
+
export { deadlinesDue, filingPack, occurrenceFacts, occurrenceReport, renderOccurrence, } from "./occurrence/index.js";
|
|
28
46
|
export { ingestOcsf, ocsfLine, toOcsf } from "./ocsf/index.js";
|
|
29
47
|
export { toOtlp } from "./otlp/index.js";
|
|
30
48
|
export { checkIdentifier, checkPack, corePack, packData, packFrameworks, } from "./packs/index.js";
|
|
31
49
|
export { policyDelta } from "./policy/delta.js";
|
|
32
50
|
export { policyDrafts } from "./policy/drafts.js";
|
|
33
|
-
export { audited, compilePolicy, decide, loadPolicy, policyFindings, } from "./policy/index.js";
|
|
51
|
+
export { audited, compilePolicy, decide, ENVIRONMENT, environmentOf, loadPolicy, mcpToolHints, policyFindings, toolDefinitionHash, } from "./policy/index.js";
|
|
52
|
+
export { fromZaniiPolicy, toZaniiPolicy } from "./policy/zanii.js";
|
|
53
|
+
export { bindPqKey, PQ_ALG, pqAvailable, pqPublicKey, pqSeedOf, pqTransitionPayload, verifyPqBinding, } from "./pq/index.js";
|
|
34
54
|
export { calibration, FEATURES, features, MIN_EACH, precogFindings, precogReport, predict, prefixOf, splitOf, TARGET, train, } from "./precog/index.js";
|
|
35
55
|
export { interventionEvidence, interventionGain, } from "./precog/intervention.js";
|
|
36
56
|
export { activities, buildNormal, normalScore, normalThreshold, } from "./precog/normal.js";
|
|
37
57
|
export { preflightFindings } from "./preflight/index.js";
|
|
38
58
|
export { typeRatings, typeUnrated, } from "./ratings/index.js";
|
|
39
59
|
export { loadLocal, RecordNotVerified, reconcile, } from "./reconcile/index.js";
|
|
60
|
+
/** Canonical JSON (keys sorted, no whitespace, JavaScript number formatting), as hashed. */
|
|
61
|
+
export { canonical } from "./reconcile/shared.js";
|
|
40
62
|
export { cassette, requestKey } from "./replay/index.js";
|
|
41
63
|
export { ORPHAN_TEXT, repairToolCalls } from "./replay/repair.js";
|
|
64
|
+
export { checkSearch, searchEvents } from "./search/index.js";
|
|
42
65
|
export { drainSpools } from "./session/drain.js";
|
|
43
66
|
export { BlackboxSession, checkEgress, session, stableEventId, } from "./session/index.js";
|
|
67
|
+
export { assembleSla, assessCompliance, buildSlaBody, signSla, slaHash, verifySla, } from "./sla/index.js";
|
|
68
|
+
export { assembleSuccession, buildSuccessionBody, signSuccession, successionHash, verifyLineage, verifySuccession, } from "./succession/index.js";
|
|
69
|
+
export { timestampRequest, verifyTimestamp, } from "./timestamp/index.js";
|
|
70
|
+
export { resolveToken, resolveTokens, tokenFor } from "./tokens/index.js";
|
|
71
|
+
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";
|
|
44
72
|
export { checkCompensations, runUndo, undoFindings, undoPlan, } from "./undo/index.js";
|
|
45
73
|
export * from "./verify/index.js";
|
|
46
74
|
export { VERSION } from "./version.js";
|
|
75
|
+
export { checkOutput, WALLS, wallFindings, wallManifestHash, } from "./walls/index.js";
|
|
47
76
|
export { weather } from "./weather/index.js";
|
|
48
77
|
export { postReceipt, receiptFor, workspaceTree } from "./workspace-receipt/index.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type Obj = Record<string, unknown>;
|
|
2
|
+
/** Zanii's salted commitment to memory content. */
|
|
3
|
+
export declare function commitContent(content: string, salt?: string): {
|
|
4
|
+
commitment: string;
|
|
5
|
+
salt: string;
|
|
6
|
+
};
|
|
7
|
+
/** The entry was about `content`, given the salt kept at write time. */
|
|
8
|
+
export declare const verifyMemoryContent: (content: string, salt: string, commitment: string) => boolean;
|
|
9
|
+
/** Zanii's memory.write payload, after `prev` (the previous entry; null starts a chain). Keep the salt. */
|
|
10
|
+
export declare function memoryEntry(input: {
|
|
11
|
+
content: string;
|
|
12
|
+
ts: string;
|
|
13
|
+
kind?: string;
|
|
14
|
+
prev?: Obj | null;
|
|
15
|
+
salt?: string;
|
|
16
|
+
agent?: string;
|
|
17
|
+
tags?: string[];
|
|
18
|
+
}): {
|
|
19
|
+
payload: Obj;
|
|
20
|
+
salt: string;
|
|
21
|
+
};
|
|
22
|
+
/** Zanii's check of one entry: well formed, and its entry_hash matches. */
|
|
23
|
+
export declare function verifyMemoryEntry(payload: unknown): {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
reasons: string[];
|
|
26
|
+
};
|
|
27
|
+
/** Walks entries in order: each checks, links to the one before and counts up by one. The first may continue a chain from elsewhere. */
|
|
28
|
+
export declare function memoryChain(entries: readonly unknown[]): {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
length: number;
|
|
31
|
+
broken: {
|
|
32
|
+
index: number;
|
|
33
|
+
reason: string;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Provable agent memory (spec/agents.md §4): Zanii's memory.write entries, a salted commitment to
|
|
2
|
+
// what the agent remembered, hash-chained so an edit afterwards shows (@zanii/memory). Pure;
|
|
3
|
+
// mirrors sdks/python/src/zanii_blackbox/memory.py; pinned by spec/vectors/memory.json.
|
|
4
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
5
|
+
import { jcsHash } from "@zanii/core";
|
|
6
|
+
/** Zanii's salted commitment to memory content. */
|
|
7
|
+
export function commitContent(content, salt) {
|
|
8
|
+
const s = salt ?? randomBytes(16).toString("hex");
|
|
9
|
+
const h = createHash("sha256")
|
|
10
|
+
.update(Buffer.from(s, "hex"))
|
|
11
|
+
.update(content, "utf8")
|
|
12
|
+
.digest("hex");
|
|
13
|
+
return { commitment: `sha256:${h}`, salt: s };
|
|
14
|
+
}
|
|
15
|
+
/** The entry was about `content`, given the salt kept at write time. */
|
|
16
|
+
export const verifyMemoryContent = (content, salt, commitment) => commitContent(content, salt).commitment === commitment;
|
|
17
|
+
const validTs = (ts) => typeof ts === "string" && !Number.isNaN(Date.parse(ts));
|
|
18
|
+
const entryHash = (commitment, kind, ts, prev, seq) => jcsHash({ v: 1, content_commitment: commitment, kind, ts, prev, seq });
|
|
19
|
+
/** Zanii's memory.write payload, after `prev` (the previous entry; null starts a chain). Keep the salt. */
|
|
20
|
+
export function memoryEntry(input) {
|
|
21
|
+
if (!validTs(input.ts))
|
|
22
|
+
throw new Error("ts must be an ISO timestamp");
|
|
23
|
+
const p = input.prev ?? null;
|
|
24
|
+
if (p && (typeof p.entry_hash !== "string" || !Number.isSafeInteger(p.seq)))
|
|
25
|
+
throw new Error("previous entry has no entry_hash or seq");
|
|
26
|
+
const kind = input.kind ?? "fact";
|
|
27
|
+
const c = commitContent(input.content, input.salt);
|
|
28
|
+
const seq = p ? p.seq + 1 : 0;
|
|
29
|
+
const prev = p ? p.entry_hash : null;
|
|
30
|
+
return {
|
|
31
|
+
payload: {
|
|
32
|
+
_zr_kind: "memory",
|
|
33
|
+
v: 1,
|
|
34
|
+
kind,
|
|
35
|
+
content_commitment: c.commitment,
|
|
36
|
+
prev,
|
|
37
|
+
seq,
|
|
38
|
+
entry_hash: entryHash(c.commitment, kind, input.ts, prev, seq),
|
|
39
|
+
agent: input.agent ?? null,
|
|
40
|
+
tags: input.tags ?? null,
|
|
41
|
+
ts: input.ts,
|
|
42
|
+
},
|
|
43
|
+
salt: c.salt,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Zanii's check of one entry: well formed, and its entry_hash matches. */
|
|
47
|
+
export function verifyMemoryEntry(payload) {
|
|
48
|
+
const p = (payload ?? {});
|
|
49
|
+
const reasons = [];
|
|
50
|
+
if (p._zr_kind !== "memory" || p.v !== 1)
|
|
51
|
+
reasons.push("not a memory receipt (v1)");
|
|
52
|
+
const cc = p.content_commitment;
|
|
53
|
+
if (typeof cc !== "string" || !cc.startsWith("sha256:"))
|
|
54
|
+
reasons.push("missing/invalid content commitment");
|
|
55
|
+
if (!validTs(p.ts))
|
|
56
|
+
reasons.push("missing/invalid ts");
|
|
57
|
+
if (!Number.isSafeInteger(p.seq) || p.seq < 0)
|
|
58
|
+
reasons.push("missing/invalid seq");
|
|
59
|
+
if (p.prev !== null && p.prev !== undefined && typeof p.prev !== "string")
|
|
60
|
+
reasons.push("prev must be a hash string or null");
|
|
61
|
+
if (reasons.length === 0 &&
|
|
62
|
+
entryHash(cc, p.kind || "fact", p.ts, p.prev ?? null, p.seq) !== p.entry_hash)
|
|
63
|
+
reasons.push("entry_hash does not match its contents (tampered)");
|
|
64
|
+
return { ok: reasons.length === 0, reasons };
|
|
65
|
+
}
|
|
66
|
+
/** Walks entries in order: each checks, links to the one before and counts up by one. The first may continue a chain from elsewhere. */
|
|
67
|
+
export function memoryChain(entries) {
|
|
68
|
+
const broken = [];
|
|
69
|
+
let prevHash = null;
|
|
70
|
+
let prevSeq = null;
|
|
71
|
+
entries.forEach((e, i) => {
|
|
72
|
+
const p = (e ?? {});
|
|
73
|
+
const single = verifyMemoryEntry(p);
|
|
74
|
+
if (!single.ok)
|
|
75
|
+
broken.push({ index: i, reason: single.reasons.join("; ") });
|
|
76
|
+
else if (i > 0 && (p.prev ?? null) !== prevHash)
|
|
77
|
+
broken.push({ index: i, reason: "broken link (prev is not the previous entry_hash)" });
|
|
78
|
+
if (single.ok && prevSeq !== null && p.seq !== prevSeq + 1)
|
|
79
|
+
broken.push({ index: i, reason: "seq is not previous + 1" });
|
|
80
|
+
// a bad entry is reported once: the next one is checked against what it claims
|
|
81
|
+
prevHash = p.entry_hash;
|
|
82
|
+
prevSeq = Number.isSafeInteger(p.seq) ? p.seq : null;
|
|
83
|
+
});
|
|
84
|
+
return { ok: broken.length === 0, length: entries.length, broken };
|
|
85
|
+
}
|
|
@@ -5,6 +5,8 @@ export interface OccurrenceFramework {
|
|
|
5
5
|
title: string;
|
|
6
6
|
authority: string;
|
|
7
7
|
deadlines: string[];
|
|
8
|
+
/** spec/packs.md §1: each deadline's hours after awareness, or null. */
|
|
9
|
+
clock_hours?: Array<number | null>;
|
|
8
10
|
sections: Array<{
|
|
9
11
|
id: string;
|
|
10
12
|
title: string;
|
|
@@ -68,6 +70,15 @@ export declare function occurrenceReport(id: string, framework: OccurrenceFramew
|
|
|
68
70
|
}[];
|
|
69
71
|
};
|
|
70
72
|
export type OccurrenceReport = ReturnType<typeof occurrenceReport>;
|
|
73
|
+
/**
|
|
74
|
+
* spec/occurrence.md §1a: each deadline's due time, counted from when the entity became aware
|
|
75
|
+
* (`awareAt`, ISO-8601 with a zone). A deadline without a clock (it runs from another event, like a
|
|
76
|
+
* corrective measure) is `null`. Whether and when the entity became aware is the entity's call.
|
|
77
|
+
*/
|
|
78
|
+
export declare function deadlinesDue(framework: OccurrenceFramework, awareAt: string, lang?: "en" | "ar"): Array<{
|
|
79
|
+
deadline: string;
|
|
80
|
+
due_at: string | null;
|
|
81
|
+
}>;
|
|
71
82
|
export declare function renderOccurrence(r: OccurrenceReport, notes: string): string;
|
|
72
83
|
/** spec/occurrence.md "Filing": what a person needs to file the report in an authority's portal. */
|
|
73
84
|
export declare function filingPack(r: OccurrenceReport, notes: string, pack: {
|
package/dist/occurrence/index.js
CHANGED
|
@@ -114,6 +114,24 @@ export function occurrenceReport(id, framework, facts, lang = "en") {
|
|
|
114
114
|
})),
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* spec/occurrence.md §1a: each deadline's due time, counted from when the entity became aware
|
|
119
|
+
* (`awareAt`, ISO-8601 with a zone). A deadline without a clock (it runs from another event, like a
|
|
120
|
+
* corrective measure) is `null`. Whether and when the entity became aware is the entity's call.
|
|
121
|
+
*/
|
|
122
|
+
export function deadlinesDue(framework, awareAt, lang = "en") {
|
|
123
|
+
const at = Date.parse(awareAt);
|
|
124
|
+
if (!/[zZ]|[+-]\d{2}:\d{2}$/.test(awareAt) || Number.isNaN(at))
|
|
125
|
+
throw new Error("aware_at must be an ISO-8601 time with a zone");
|
|
126
|
+
const texts = lang === "ar" && framework.ar ? framework.ar.deadlines : framework.deadlines;
|
|
127
|
+
return texts.map((deadline, i) => {
|
|
128
|
+
const h = framework.clock_hours?.[i];
|
|
129
|
+
return {
|
|
130
|
+
deadline,
|
|
131
|
+
due_at: typeof h === "number" ? new Date(at + h * 3_600_000).toISOString() : null,
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
}
|
|
117
135
|
const LABELS = {
|
|
118
136
|
en: ["Session", "Record verifies", "yes", "NO", "Report to", "Generated", "Deadlines"],
|
|
119
137
|
ar: ["الجلسة", "السجل موثّق", "نعم", "لا", "جهة الإبلاغ", "تاريخ الإنشاء", "المواعيد النهائية"],
|
package/dist/ocsf/index.d.ts
CHANGED
package/dist/ocsf/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// OCSF export (spec/ocsf.md, idea S1): a session's record as OCSF 1.8.0 events for a SIEM (Splunk,
|
|
2
2
|
// AWS Security Lake, CrowdStrike, Elastic), with a lossy downgrade to 1.1 / 1.3 and a one-line text
|
|
3
3
|
// form. Mirrors ocsf.py.
|
|
4
|
+
import { taxonomyOf } from "../analysis/taxonomy.js";
|
|
4
5
|
const SEVERITY = {
|
|
5
6
|
advisory: [2, "Low"],
|
|
6
7
|
caution: [3, "Medium"],
|
|
@@ -45,11 +46,16 @@ const FINDING = [2004, "Detection Finding", 2, "Findings"];
|
|
|
45
46
|
* gets what the gateway saw. */
|
|
46
47
|
export function toOcsf(lines, options = {}) {
|
|
47
48
|
const pv = options.productVersion ?? "unknown";
|
|
49
|
+
let label;
|
|
50
|
+
let session = "";
|
|
48
51
|
const requests = new Map();
|
|
49
52
|
const out = [];
|
|
50
53
|
for (const line of lines) {
|
|
51
54
|
const e = JSON.parse(line);
|
|
52
55
|
const m = e.meta;
|
|
56
|
+
session = e.session_id;
|
|
57
|
+
if (e.kind === "session.open" && typeof m.label === "string")
|
|
58
|
+
label = m.label;
|
|
53
59
|
if (e.kind === "llm.request") {
|
|
54
60
|
requests.set(e.seq, {
|
|
55
61
|
...(typeof m.provider === "string" ? { provider: m.provider } : {}),
|
|
@@ -114,9 +120,36 @@ export function toOcsf(lines, options = {}) {
|
|
|
114
120
|
out.push(ev);
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
const version = options.version ?? "1.9";
|
|
124
|
+
if (version === "1.9")
|
|
125
|
+
return out.map((ev) => upgrade(ev, label, session));
|
|
126
|
+
return version === "1.8" ? out : out.map((ev) => downgrade(ev, version));
|
|
127
|
+
}
|
|
128
|
+
/** OCSF 1.9 (spec/ocsf.md §2): the agent (`ai_agent`) on model and tool events, and each finding's
|
|
129
|
+
* MITRE ATLAS techniques (`attacks`) and OWASP ASI ids (`metadata.tags`). */
|
|
130
|
+
function upgrade(ev, label, session) {
|
|
131
|
+
const metadata = {
|
|
132
|
+
...ev.metadata,
|
|
133
|
+
version: "1.9.0",
|
|
134
|
+
};
|
|
135
|
+
const out = { ...ev, metadata };
|
|
136
|
+
const ai = ev.ai_model !== undefined ||
|
|
137
|
+
ev.api?.operation === "tools/call";
|
|
138
|
+
if (ai) {
|
|
139
|
+
out.ai_agent = { name: label ?? "agent", instance_uid: session };
|
|
140
|
+
metadata.profiles = ["ai_operation"];
|
|
141
|
+
}
|
|
142
|
+
if (ev.class_uid === 2004) {
|
|
143
|
+
const t = taxonomyOf(String(ev.finding_info.title));
|
|
144
|
+
if (t.atlas.length)
|
|
145
|
+
out.attacks = t.atlas.map((a) => ({
|
|
146
|
+
technique: { uid: a.id, name: a.name },
|
|
147
|
+
version: "ATLAS v2026.09",
|
|
148
|
+
}));
|
|
149
|
+
if (t.owasp.length)
|
|
150
|
+
metadata.tags = t.owasp.map((o) => ({ name: "owasp_asi", value: o.id }));
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
120
153
|
}
|
|
121
154
|
/** Idea S1: for a SIEM on an older OCSF: drops what came later (`ai_model`), the `ai_operation`
|
|
122
155
|
* profile, and says so in `unmapped.downgraded_from`. */
|
package/dist/otlp/index.d.ts
CHANGED
|
@@ -7,7 +7,14 @@ type Attr = {
|
|
|
7
7
|
key: string;
|
|
8
8
|
value: Value;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* spec/otlp.md: a session as OTLP/JSON. `semconv: 2` (the default) follows the GenAI semantic
|
|
12
|
+
* conventions as of v1.42 (`gen_ai.provider.name`, `invoke_agent`, MCP `tools/call`); `semconv: 1`
|
|
13
|
+
* is the first version's output, pinned by spec/vectors/otlp.json.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toOtlp(lines: readonly string[], options?: {
|
|
16
|
+
semconv?: 1 | 2;
|
|
17
|
+
}): {
|
|
11
18
|
resourceSpans: {
|
|
12
19
|
resource: {
|
|
13
20
|
attributes: Attr[];
|