@tenova/swt3-ai 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +100 -8
  2. package/dist/adapters/cerebras.d.ts +25 -0
  3. package/dist/adapters/cerebras.d.ts.map +1 -0
  4. package/dist/adapters/cerebras.js +79 -0
  5. package/dist/adapters/cerebras.js.map +1 -0
  6. package/dist/clearing.d.ts +15 -3
  7. package/dist/clearing.d.ts.map +1 -1
  8. package/dist/clearing.js +42 -10
  9. package/dist/clearing.js.map +1 -1
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +54 -2
  12. package/dist/config.js.map +1 -1
  13. package/dist/demo.d.ts.map +1 -1
  14. package/dist/demo.js +6 -2
  15. package/dist/demo.js.map +1 -1
  16. package/dist/doctor.d.ts.map +1 -1
  17. package/dist/doctor.js +20 -0
  18. package/dist/doctor.js.map +1 -1
  19. package/dist/exporters/evidence.d.ts +59 -0
  20. package/dist/exporters/evidence.d.ts.map +1 -0
  21. package/dist/exporters/evidence.js +148 -0
  22. package/dist/exporters/evidence.js.map +1 -0
  23. package/dist/index.d.ts +10 -5
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +6 -4
  26. package/dist/index.js.map +1 -1
  27. package/dist/merkle.d.ts +15 -0
  28. package/dist/merkle.d.ts.map +1 -1
  29. package/dist/merkle.js +24 -0
  30. package/dist/merkle.js.map +1 -1
  31. package/dist/schema.d.ts.map +1 -1
  32. package/dist/schema.js +60 -4
  33. package/dist/schema.js.map +1 -1
  34. package/dist/sentinel-client.d.ts +90 -0
  35. package/dist/sentinel-client.d.ts.map +1 -0
  36. package/dist/sentinel-client.js +179 -0
  37. package/dist/sentinel-client.js.map +1 -0
  38. package/dist/signing.d.ts +31 -6
  39. package/dist/signing.d.ts.map +1 -1
  40. package/dist/signing.js +105 -12
  41. package/dist/signing.js.map +1 -1
  42. package/dist/types.d.ts +25 -0
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/types.js +15 -0
  45. package/dist/types.js.map +1 -1
  46. package/dist/wal.d.ts +1 -1
  47. package/dist/wal.js +1 -1
  48. package/dist/witness.d.ts +117 -0
  49. package/dist/witness.d.ts.map +1 -1
  50. package/dist/witness.js +334 -9
  51. package/dist/witness.js.map +1 -1
  52. package/package.json +3 -2
  53. package/templates/autonomous-systems.yaml +70 -0
  54. package/templates/content-platform.yaml +68 -0
  55. package/templates/defense-govcon.yaml +77 -0
  56. package/templates/fintech-model-risk.yaml +69 -0
  57. package/templates/github-action.yml +44 -0
  58. package/templates/healthcare-clinical.yaml +67 -0
  59. package/templates/insurance-underwriting.yaml +68 -0
  60. package/templates/microsoft-foundry.yaml +61 -0
  61. package/templates/telecom-compliance.yaml +72 -0
@@ -0,0 +1,44 @@
1
+ # SWT3 AI Witness -- Config Validation for CI/CD
2
+ # Ensures your governance config (swt3.yaml) is valid before deploy.
3
+ #
4
+ # Setup:
5
+ # 1. Run: npx swt3 init --profile <profile> --tenant <your-tenant>
6
+ # 2. Commit swt3.yaml to your repo
7
+ # 3. Copy this file to .github/workflows/swt3-ci.yml
8
+ # 4. (Optional) Add SWT3_API_KEY to repository secrets for cloud mode
9
+ #
10
+ # This validates config structure, not runtime behavior.
11
+ # Runtime witnessing happens in your application code via the SDK.
12
+
13
+ name: SWT3 Config Validation
14
+
15
+ on:
16
+ push:
17
+ branches: [main]
18
+ paths: [swt3.yaml, .swt3.yaml]
19
+ pull_request:
20
+ branches: [main]
21
+ paths: [swt3.yaml, .swt3.yaml]
22
+
23
+ jobs:
24
+ swt3-validate:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+
29
+ - uses: actions/setup-node@v4
30
+ with:
31
+ node-version: "20"
32
+
33
+ - name: Install SWT3 SDK
34
+ run: npm install @tenova/swt3-ai
35
+
36
+ - name: Validate governance config
37
+ env:
38
+ SWT3_API_KEY: ${{ secrets.SWT3_API_KEY }}
39
+ run: |
40
+ if [ ! -f swt3.yaml ] && [ ! -f .swt3.yaml ]; then
41
+ echo "No swt3.yaml found. Run: npx swt3 init"
42
+ exit 1
43
+ fi
44
+ npx swt3 doctor --ci
@@ -0,0 +1,67 @@
1
+ # SWT3 Profile: Healthcare Clinical AI (HIPAA + FDA AI/ML + EU MDR)
2
+ # AI governance for clinical decision support, diagnostic AI, patient
3
+ # risk scoring, and treatment recommendation systems.
4
+ #
5
+ # Covers HIPAA Privacy/Security Rules, FDA AI/ML SaMD guidance,
6
+ # EU Medical Device Regulation (MDR), GDPR Art. 22/35, and
7
+ # NIST AI RMF GOVERN/MAP/MEASURE/MANAGE.
8
+ #
9
+ # Clinical AI processes protected health information (PHI) and makes
10
+ # decisions with direct patient safety implications. Maximum clearing
11
+ # level and strict human oversight are non-negotiable.
12
+ #
13
+ # Usage:
14
+ # profile: healthcare-clinical
15
+ # api_key_env: SWT3_API_KEY
16
+ # tenant_id: YOUR_TENANT
17
+ # agent_id: diagnostic-radiology-v2
18
+
19
+ clearing_level: 3 # Classified (PHI and clinical data)
20
+
21
+ policy:
22
+ require_agent_id: true
23
+ require_signing: true
24
+ min_clearing_level: 3
25
+ require_jurisdiction: true # HIPAA / MDR jurisdiction tracking
26
+ required_procedures:
27
+ # Inference provenance
28
+ - AI-INF.1 # Prompt/response hash capture
29
+ # Fairness (diagnostic equity across demographics)
30
+ - AI-FAIR.1 # Bias disparity measurement
31
+ - AI-FAIR.3 # Bias audit witnessing
32
+ # Explainability (clinical decision transparency)
33
+ - AI-EXPL.1 # Explanation generation (feature attribution)
34
+ - AI-EXPL.2 # Confidence scoring (diagnostic certainty)
35
+ # Automated decisions (clinical recommendations)
36
+ - AI-AUTO.1 # Automated decision notification
37
+ # Human oversight (clinician review -- mandatory)
38
+ - AI-HITL.1 # Human review completion
39
+ - AI-HITL.2 # Human override event tracking
40
+ # Patient rights
41
+ - AI-CONSENT.1 # Patient consent (HIPAA authorization)
42
+ - AI-DPIA.1 # Data protection impact assessment
43
+ - AI-TRANS.1 # Transparency disclosure to patients
44
+ # Continuous monitoring
45
+ - AI-PERF.1 # Diagnostic accuracy metrics
46
+ - AI-SAFE.1 # Clinical safe state (failover to human)
47
+ - AI-AUDIT.1 # Audit log integrity (HIPAA requirement)
48
+ - AI-DRIFT.1 # Model drift (population shift detection)
49
+
50
+ trust_mesh:
51
+ mode: strict
52
+ min_trust_level: 3
53
+ require_signature: true
54
+ freshness_window: 1800 # 30 minutes (clinical shift-aligned)
55
+
56
+ density_policy:
57
+ min_anchors_per_1000_tokens: 4
58
+ max_chain_gap_seconds: 60 # Tight gap for clinical decisions
59
+ require_signing_key: true
60
+
61
+ mcp_policy:
62
+ witnessed_tools: ["*"]
63
+ auto_witness: true
64
+ block_on_failure: true # Never allow unwitnessed clinical decisions
65
+ max_velocity: "15/60s"
66
+ max_chain_depth: 5
67
+ fail_secure: true
@@ -0,0 +1,68 @@
1
+ # SWT3 Profile: Insurance Underwriting AI (NAIC + State Regs + GDPR)
2
+ # AI governance for actuarial modeling, claims processing, pricing
3
+ # algorithms, risk classification, and underwriting decisions.
4
+ #
5
+ # Covers NAIC Model AI Governance Guidelines, state insurance
6
+ # commissioner regulations, FCRA (adverse action), GDPR Art. 22
7
+ # (automated profiling), and emerging state AI disclosure laws.
8
+ #
9
+ # Insurance AI makes decisions that directly affect coverage access
10
+ # and pricing for protected classes. Bias monitoring, adverse action
11
+ # explainability, and ongoing model validation are regulatory
12
+ # requirements in most US states and EU member states.
13
+ #
14
+ # Usage:
15
+ # profile: insurance-underwriting
16
+ # api_key_env: SWT3_API_KEY
17
+ # tenant_id: YOUR_TENANT
18
+ # agent_id: underwriting-model-v5
19
+
20
+ clearing_level: 2 # Sensitive (policyholder PII)
21
+
22
+ policy:
23
+ require_agent_id: true
24
+ require_signing: true
25
+ min_clearing_level: 2
26
+ require_jurisdiction: true # State-by-state regulation
27
+ required_procedures:
28
+ # Inference provenance
29
+ - AI-INF.1 # Prompt/response hash capture
30
+ # Model lifecycle
31
+ - AI-MDL.1 # Model validation (actuarial standards)
32
+ # Fairness (protected classes in underwriting)
33
+ - AI-FAIR.1 # Bias disparity measurement
34
+ - AI-FAIR.3 # Bias audit witnessing
35
+ # Explainability (adverse action notices)
36
+ - AI-EXPL.1 # Explanation generation (denial reasons)
37
+ - AI-EXPL.2 # Confidence scoring
38
+ # Automated decisions (underwriting, pricing, claims)
39
+ - AI-AUTO.1 # Automated decision notification
40
+ # Human oversight
41
+ - AI-HITL.1 # Human review of denials and edge cases
42
+ # Data governance
43
+ - AI-CONSENT.1 # Policyholder consent
44
+ - AI-DPIA.1 # Data protection impact assessment
45
+ - AI-TRANS.1 # Transparency disclosure
46
+ # Continuous monitoring
47
+ - AI-DRIFT.1 # Model drift (loss ratio shift detection)
48
+ - AI-PERF.1 # Actuarial accuracy metrics
49
+ - AI-AUDIT.1 # Audit log integrity
50
+
51
+ trust_mesh:
52
+ mode: strict
53
+ min_trust_level: 3
54
+ require_signature: true
55
+ freshness_window: 3600 # 1 hour
56
+
57
+ density_policy:
58
+ min_anchors_per_1000_tokens: 3
59
+ max_chain_gap_seconds: 180
60
+ require_signing_key: true
61
+
62
+ mcp_policy:
63
+ witnessed_tools: ["*"]
64
+ auto_witness: true
65
+ block_on_failure: true
66
+ max_velocity: "15/60s"
67
+ max_chain_depth: 6
68
+ fail_secure: true
@@ -0,0 +1,61 @@
1
+ # SWT3 Profile: Microsoft Foundry (Agent Governance)
2
+ #
3
+ # Independent cryptographic witness layer for Microsoft Foundry Agent Service.
4
+ # Complements the Microsoft Agent Governance Toolkit (AGT) by providing
5
+ # out-of-band, tamper-evident evidence that auditors can verify without
6
+ # any Microsoft infrastructure.
7
+ #
8
+ # Covers OWASP Agentic Top 10 via independent attestation.
9
+ # Compatible with EU AI Act, NIST AI RMF, CMMC, SOC 2.
10
+ #
11
+ # Usage:
12
+ # profile: microsoft-foundry
13
+ # api_key_env: SWT3_API_KEY
14
+ # tenant_id: YOUR_TENANT
15
+ # agent_id: your-foundry-agent
16
+ # signing_key_env: SWT3_SIGNING_KEY
17
+
18
+ clearing_level: 2
19
+
20
+ policy:
21
+ require_signing: true
22
+ require_agent_id: true
23
+ min_clearing_level: 2
24
+ required_procedures:
25
+ - AI-INF.1 # Inference provenance (prompt/response hashing)
26
+ - AI-GRD.1 # Guardrail presence attestation
27
+ - AI-TOOL.1 # Tool call witnessing (Foundry Toolbox)
28
+ - AI-CHAIN.1 # Chain monitoring (multi-agent Foundry sessions)
29
+ - AI-ID.1 # Agent identity (complements AGT SPIFFE/DID)
30
+ - AI-ACC.1 # Access control witnessing (Foundry RBAC)
31
+ - AI-AUDIT.1 # Independent audit trail (Merkle-rooted)
32
+
33
+ trust_mesh:
34
+ mode: strict
35
+ min_trust_level: 2
36
+ require_signature: true
37
+ freshness_window: 1800
38
+
39
+ mcp_policy:
40
+ witnessed_tools: ["*"]
41
+ exempt_tools: []
42
+ require_trust_level: 2
43
+ auto_witness: true
44
+ block_on_failure: true
45
+ max_velocity: "20/60s"
46
+ max_chain_depth: 12
47
+ max_tokens_per_session: 200000
48
+ fail_secure: true
49
+
50
+ density_policy:
51
+ min_anchors_per_1000_tokens: 1
52
+ max_chain_gap_seconds: 300
53
+ require_signing_key: true
54
+ min_trust_level: 2
55
+
56
+ hardware:
57
+ require_attestation: false
58
+
59
+ merkle:
60
+ enabled: true
61
+ accumulator_interval: 60
@@ -0,0 +1,72 @@
1
+ # SWT3 Profile: Telecom Compliance (FCC + EU AI Act + NIST AI RMF)
2
+ # Comprehensive AI governance for telecommunications providers operating
3
+ # fraud detection, network optimization, customer scoring, call routing,
4
+ # and predictive maintenance models.
5
+ #
6
+ # Covers FCC AI transparency requirements, EU AI Act Art. 9-15 (high-risk),
7
+ # GDPR Art. 22 (automated decisions), and NIST AI RMF GOVERN/MAP/MEASURE/MANAGE.
8
+ #
9
+ # Telecom AI models process regulated customer data across jurisdictions,
10
+ # requiring strict clearing levels, fairness monitoring, and human oversight
11
+ # for decisions with legal or financial effects.
12
+ #
13
+ # Usage:
14
+ # profile: telecom-compliance
15
+ # api_key_env: SWT3_API_KEY
16
+ # tenant_id: YOUR_TENANT
17
+ # agent_id: fraud-scoring-v3
18
+
19
+ clearing_level: 2 # Sensitive (telecom customer data is regulated)
20
+
21
+ policy:
22
+ require_agent_id: true
23
+ require_signing: true
24
+ min_clearing_level: 2
25
+ require_jurisdiction: true # Multi-country operations require jurisdiction tracking
26
+ required_procedures:
27
+ # Inference provenance (all models)
28
+ - AI-INF.1 # Prompt/response hash capture
29
+ - AI-INF.2 # Latency monitoring (SLA compliance)
30
+ # Model lifecycle
31
+ - AI-MDL.1 # Model weight integrity verification
32
+ - AI-MDL.3 # Model drift scoring
33
+ # Fairness (fraud scoring, credit, customer classification)
34
+ - AI-FAIR.1 # Bias disparity measurement
35
+ - AI-FAIR.3 # Bias audit witnessing
36
+ # Explainability (regulatory requirement for customer-facing decisions)
37
+ - AI-EXPL.1 # Explanation generation
38
+ - AI-EXPL.2 # Confidence scoring
39
+ # Human oversight (flagged transactions, escalations)
40
+ - AI-HITL.1 # Human review completion
41
+ - AI-HITL.2 # Human override event tracking
42
+ # Automated decisions (fraud flags, service denial, credit scoring)
43
+ - AI-AUTO.1 # Automated decision notification (GDPR Art. 22)
44
+ - AI-CONSENT.1 # Data subject consent (GDPR)
45
+ - AI-TRANS.1 # Transparency disclosure (FCC + Art. 13)
46
+ # Continuous monitoring
47
+ - AI-DRIFT.1 # Model drift detection
48
+ - AI-PERF.1 # Performance metrics (accuracy, precision, recall)
49
+ - AI-ROBUST.1 # Robustness testing (adversarial inputs)
50
+ - AI-AUDIT.1 # Audit log integrity
51
+ # Safety and environment
52
+ - AI-SAFE.1 # Safe state transition (network AI failover)
53
+ - AI-ENV.1 # Runtime environment attestation
54
+
55
+ trust_mesh:
56
+ mode: strict # Inter-system handoffs in telecom require strict trust
57
+ min_trust_level: 3
58
+ require_signature: true
59
+ freshness_window: 3600 # 1 hour (shift-aligned)
60
+
61
+ density_policy:
62
+ min_anchors_per_1000_tokens: 3
63
+ max_chain_gap_seconds: 120 # Tight gap for real-time fraud detection
64
+ require_signing_key: true
65
+
66
+ mcp_policy:
67
+ witnessed_tools: ["*"]
68
+ auto_witness: true
69
+ block_on_failure: true # Fail closed for regulated decisions
70
+ max_velocity: "20/60s" # Higher throughput for batch fraud scoring
71
+ max_chain_depth: 8
72
+ fail_secure: true