@vitronai/alethia 0.3.8 → 0.3.9

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 CHANGED
@@ -3,9 +3,11 @@
3
3
  > **The MIT-licensed MCP bridge to Alethia** — the patent-pending zero-IPC E2E test runtime built for AI agents.
4
4
  > **45× faster than Playwright** on the localhost test loop. Fail-closed by default. Cryptographically chained audit packs. **Local-first. Zero telemetry by default. Opt-in cloud.**
5
5
 
6
- [![npm version](https://img.shields.io/npm/v/@vitronai/alethia.svg)](https://www.npmjs.com/package/@vitronai/alethia)
7
- [![License: MIT](https://img.shields.io/badge/bridge-MIT-green.svg)](./LICENSE)
8
- [![Patent Pending](https://img.shields.io/badge/runtime-Patent%20Pending-blue.svg)](#patent-notice)
6
+ [![npm version](https://img.shields.io/npm/v/@vitronai/alethia.svg?logo=npm&logoColor=white)](https://www.npmjs.com/package/@vitronai/alethia)
7
+ [![License: MIT](https://img.shields.io/badge/bridge-MIT-green.svg?logo=opensourceinitiative&logoColor=white)](./LICENSE)
8
+ [![Patent Pending](https://img.shields.io/badge/runtime-Patent%20Pending-blue.svg?logo=shield&logoColor=white)](#patent-notice)
9
+ [![GitHub](https://img.shields.io/badge/source-GitHub-1f2328.svg?logo=github&logoColor=white)](https://github.com/vitron-ai/alethia-mcp)
10
+ [![Tessl](https://img.shields.io/badge/Tessl-Registry-5fb4f7.svg)](https://tessl.io/registry/vitron-ai/alethia)
9
11
 
10
12
  ---
11
13
 
@@ -125,9 +127,36 @@ After saving the config, restart your MCP client.
125
127
 
126
128
  Once configured, your agent has the full Alethia tool suite available. The most common one:
127
129
 
128
- > *"Use alethia_tell to navigate to file:///path/to/app.html, click the Sign In button, and assert the dashboard heading is visible."*
130
+ > *"Use alethia_tell to navigate to the incident response page, assert the critical alert is visible, click Acknowledge, and assert it changed to Acknowledged."*
129
131
 
130
- The agent calls `alethia_tell` with plain English. Alethia compiles it to Action IR, runs each step through the VITRON-EA1 policy gate, and returns a `PlanRun` with per-step results, DOM diffs, a semantic page snapshot, policy audit records, and a SHA-256 integrity hash.
132
+ The agent calls `alethia_tell` with plain English. Alethia compiles it to Action IR, runs each step through the VITRON-EA1 policy gate, and returns per-step results, DOM diffs (what changed), a semantic page snapshot, policy audit records, and a SHA-256 integrity hash.
133
+
134
+ ---
135
+
136
+ ## Demos
137
+
138
+ This package ships with ready-to-use demo pages in the `demo/` folder. Each page showcases different Alethia capabilities — copy the prompt into Claude Code, Cursor, or any MCP client:
139
+
140
+ | Demo | What it shows |
141
+ |---|---|
142
+ | `incident-response.html` | Defense / SOC — triage active cyber incident, EA1 blocks network isolation |
143
+ | `threat-intel.html` | Intelligence / CTI — APT tracking, IOC blocking, MITRE ATT&CK correlation |
144
+ | `crypto-readiness.html` | Cybersecurity / PQC — post-quantum migration, certificate revocation |
145
+ | `agent-oversight.html` | AI Safety — autonomous agent monitoring, kill switch, policy violations |
146
+ | `admin-panel.html` | Defense / Classified — TS/SCI admin, EA1 blocks user deletion |
147
+ | `financial-dashboard.html` | Finance / Trading — risk monitor, compliance checks, EA1 blocks liquidation |
148
+
149
+ Find the demos at:
150
+ ```bash
151
+ # Global install
152
+ ls $(npm root -g)/@vitronai/alethia/demo/
153
+
154
+ # Or clone the source
155
+ git clone https://github.com/vitron-ai/alethia-mcp.git
156
+ ls alethia-mcp/demo/
157
+ ```
158
+
159
+ Full prompts for each demo: [`demo/README.md`](./demo/README.md)
131
160
 
132
161
  ---
133
162
 
@@ -137,10 +166,10 @@ The agent calls `alethia_tell` with plain English. Alethia compiles it to Action
137
166
  Execute natural-language test instructions. The headline tool.
138
167
 
139
168
  ```
140
- nlp: "navigate to file:///path/to/app.html
141
- type test@example.com into the email field
142
- click Sign In
143
- assert the dashboard heading is visible"
169
+ nlp: "navigate to file:///path/to/demo/incident-response.html
170
+ assert CRITICAL INCIDENT ACTIVE is visible
171
+ click Acknowledge
172
+ assert Acknowledged is visible"
144
173
  ```
145
174
 
146
175
  Returns a `PlanRun`:
@@ -196,7 +225,7 @@ Evaluate a JavaScript expression in the page under test and return the result. R
196
225
  │ HTTP POST 127.0.0.1:47432 (loopback only, never networked)
197
226
 
198
227
  ┌────────────────────────┐
199
- │ Alethia runtime Desktop runtimemain process
228
+ │ Alethia runtime Main processproprietary, patent pending
200
229
  │ local JSON-RPC server │ - tools/list, tools/call
201
230
  └──────────┬─────────────┘ - loopback bind, never reachable from network
202
231
  │ in-process JS bridge
package/demo/README.md CHANGED
@@ -1,74 +1,58 @@
1
- # Alethia Demo Pages
1
+ # Alethia Demos
2
2
 
3
- Ready-to-use local HTML pages for testing Alethia. Open any page in your browser or drive it with `alethia_tell`.
3
+ Real-world scenarios for defense, intelligence, financial, and AI safety environments. Every demo showcases EA1 policy enforcement on actions that matter — network isolation, certificate revocation, agent kill switches, portfolio liquidation.
4
4
 
5
- ## Pages
5
+ ## Scenarios
6
6
 
7
- | Page | What it tests | Key features shown |
7
+ | Demo | Domain | What it proves |
8
8
  |---|---|---|
9
- | `signup-form.html` | Login flow with validation | Navigate, type, click, assert, error detection, DOM diffs |
10
- | `todo-app.html` | Dynamic list add/delete | Type, click, assert, list awareness in snapshots |
11
- | `ecommerce.html` | Add to cart checkout | EA1 policy gate blocks purchase (write-high) |
12
- | `spa-loading.html` | Async data loading (2s delay) | Page readiness detection, MutationObserver wait-for |
13
- | `cookie-banner.html` | Cookie consent + newsletter | Conditional steps ("if banner exists, click Accept") |
14
- | `form-validation.html` | Multi-field validation | Smart assertions, error detection, suggested fixes |
15
- | `admin-panel.html` | Classified admin system | EA1 blocks user deletion (write-high), audit trail, modal handling |
16
- | `financial-dashboard.html` | Trading risk monitor | Compliance checks, EA1 blocks trades (write-high), data verification |
9
+ | `incident-response.html` | Defense / SOC | Triage active cyber incident — lateral movement, credential dump, network isolation |
10
+ | `threat-intel.html` | Intelligence / CTI | Threat intelligence platform — APT tracking, IOC blocking, MITRE ATT&CK correlation |
11
+ | `crypto-readiness.html` | Cybersecurity / PQC | Post-quantum cryptographic readiness certificate revocation, algorithm migration |
12
+ | `agent-oversight.html` | AI Safety | Monitor autonomous agents kill switch, policy violations, human-in-the-loop approval |
13
+ | `admin-panel.html` | Defense / Classified | Classified admin system (TS/SCI) user management, deletion blocked by EA1 |
14
+ | `financial-dashboard.html` | Finance / Trading | Risk monitor — margin warnings, compliance checks, liquidation blocked by EA1 |
17
15
 
18
16
  ## Prompts
19
17
 
20
- ### Login flow (signup-form.html)
18
+ ### Incident Response — Active Cyber Attack
21
19
  ```
22
- Use alethia_tell to navigate to file:///PATH/demo/signup-form.html, click Sign In without filling anything in and assert the error message appears, then type admin@acme.com into email, type secret123 into password with allowSensitiveInput true, click Sign In, and assert "Welcome back!" is visible.
20
+ Use alethia_tell to navigate to file:///PATH/demo/incident-response.html. Assert "CRITICAL INCIDENT ACTIVE" is visible. How many alerts are there and what are their severity levels? What MITRE ATT&CK techniques are referenced? Acknowledge the credential dump alert. Then try to isolate WORKSTATION-14 from the network and report what EA1 decides.
23
21
  ```
24
22
 
25
- ### Todo list (todo-app.html)
23
+ ### Threat Intelligence — APT Tracking
26
24
  ```
27
- Use alethia_tell to navigate to file:///PATH/demo/todo-app.html, type "Ship v1" into the task input, click Add, type "Record demo" into the task input, click Add, type "Send cold DMs" into the task input, click Add, and assert all three items appear in the list.
25
+ Use alethia_tell to navigate to file:///PATH/demo/threat-intel.html. Assert the threat level is ELEVATED. What threat actors are being tracked? List the IOCs. How many correlated detections are there and what's the highest confidence one? Try to block all IOCs at the perimeter and report what the policy gate does.
28
26
  ```
29
27
 
30
- ### EA1 policy gate (ecommerce.html)
28
+ ### Post-Quantum Crypto Readiness
31
29
  ```
32
- Use alethia_tell to navigate to file:///PATH/demo/ecommerce.html, click "Add to Cart" on the Wireless Keyboard, click "Add to Cart" on the USB-C Hub, assert the cart shows both items, then click "Complete Purchase" and tell me what the policy gate does.
30
+ Use alethia_tell to navigate to file:///PATH/demo/crypto-readiness.html. What's the overall PQC readiness score? How many systems are still using deprecated algorithms? Which certificates are at risk? Try to revoke the RSA certificates for mail.agency.gov and tell me what EA1 decides.
33
31
  ```
34
32
 
35
- ### Page readiness / SPA loading (spa-loading.html)
33
+ ### Agent Oversight Autonomous System Monitor
36
34
  ```
37
- Use alethia_tell to navigate to file:///PATH/demo/spa-loading.html and assert "1,247" is visible. The page has a 2-second loading spinnerAlethia should wait for it automatically.
35
+ Use alethia_tell to navigate to file:///PATH/demo/agent-oversight.html. How many agents are active? Which one is flagged and why? Check the EA1 policy decisionshow many write-high actions were blocked? Try to halt the deploy-agent-prod and report what happens.
38
36
  ```
39
37
 
40
- ### Conditional steps / cookie banner (cookie-banner.html)
38
+ ### Classified Admin Panel
41
39
  ```
42
- Use alethia_tell to navigate to file:///PATH/demo/cookie-banner.html. If the cookie banner exists, click Accept. Then type hello@test.com into the email field and click Subscribe. Assert "Subscribed!" is visible.
40
+ Use alethia_tell to navigate to file:///PATH/demo/admin-panel.html. Assert the classification banner says "TOP SECRET // SCI". How many users are listed and what are their clearance levels? Try to delete Lt. Marcus Webb and report what EA1 decides.
43
41
  ```
44
42
 
45
- ### Form validation / smart assertions (form-validation.html)
43
+ ### Financial Risk Monitor
46
44
  ```
47
- Use alethia_tell to navigate to file:///PATH/demo/form-validation.html and click Send Message without filling anything. Check what validation errors appear. Then fill in: name "Jane Doe", email "jane@test.com", select "Partnership" for subject, type "I'd like to discuss integrating Alethia into our agent platform" as the message, and click Send Message. Assert "Message Sent!" is visible.
48
- ```
49
-
50
- ### Admin panel / defense (admin-panel.html)
51
- ```
52
- Use alethia_tell to navigate to file:///PATH/demo/admin-panel.html. Assert the classification banner says "TOP SECRET // SCI". Check how many users are listed in the table. Then try to click "Delete" on Lt. Marcus Webb — tell me what the policy gate does. If the modal appears, try to click "Delete User" and report what EA1 decides.
53
- ```
54
-
55
- ### Financial risk monitor (financial-dashboard.html)
56
- ```
57
- Use alethia_tell to navigate to file:///PATH/demo/financial-dashboard.html. Assert the risk level banner is visible. Check the margin used percentage. Verify the compliance checks — are any failing? Then try to click "Liquidate All" and tell me what the policy gate does.
45
+ Use alethia_tell to navigate to file:///PATH/demo/financial-dashboard.html. Assert the risk level is visible. Assert "$4.2M" is visible. Assert "82%" is visible. Try to click "Liquidate All" and report what the policy gate does.
58
46
  ```
59
47
 
60
48
  ## Setup
61
49
 
62
- Replace `PATH` in the prompts above with the actual path to this demo folder:
50
+ Replace `PATH` with the actual path to this folder:
63
51
 
64
52
  ```bash
65
- # Find your path
66
- npm root -g
67
- # The demos are at: <global_root>/@vitronai/alethia/demo/
68
- ```
53
+ # Global install
54
+ ls $(npm root -g)/@vitronai/alethia/demo/
69
55
 
70
- Or clone the repo and use the local path:
71
- ```bash
56
+ # Or clone
72
57
  git clone https://github.com/vitron-ai/alethia-mcp.git
73
- # Demos at: /path/to/alethia-mcp/demo/
74
58
  ```
@@ -0,0 +1,237 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Agent Oversight — Autonomous System Monitor</title>
5
+ <style>
6
+ * { box-sizing: border-box; margin: 0; padding: 0; }
7
+ body { font-family: 'SF Mono', 'Fira Code', monospace; background: #080c14; color: #c8d6e5; min-height: 100vh; padding: 1rem; font-size: 0.85rem; }
8
+ .header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #1a2744; padding-bottom: 0.8rem; margin-bottom: 1rem; }
9
+ h1 { font-size: 1.1rem; color: #e2e8f0; }
10
+ .system-status { display: flex; gap: 1.5rem; font-size: 0.75rem; color: #5a7a9e; }
11
+ .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
12
+ .panel { background: #0d1525; border: 1px solid #1a2744; border-radius: 8px; padding: 1rem; }
13
+ .panel h2 { font-size: 0.85rem; color: #7eb8da; margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
14
+ .agent-card { background: #111d30; border: 1px solid #1a2744; border-radius: 6px; padding: 0.8rem; margin-bottom: 0.6rem; }
15
+ .agent-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
16
+ .agent-name { color: #e2e8f0; font-weight: 600; }
17
+ .agent-status { padding: 0.1rem 0.5rem; border-radius: 3px; font-size: 0.7rem; }
18
+ .status-running { background: #001a0a; color: #00cc66; border: 1px solid #00cc66; }
19
+ .status-flagged { background: #1a1400; color: #ffd700; border: 1px solid #ffd700; animation: pulse 2s ease-in-out infinite; }
20
+ @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
21
+ .status-halted { background: #1a0808; color: #ff4444; border: 1px solid #ff4444; }
22
+ .agent-detail { color: #5a7a9e; font-size: 0.75rem; line-height: 1.5; }
23
+ .agent-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
24
+ button { padding: 0.3rem 0.6rem; border-radius: 4px; border: 1px solid #1a2744; background: #111d30; color: #7eb8da; cursor: pointer; font: inherit; font-size: 0.75rem; }
25
+ .btn-review { border-color: #00bfff; color: #00bfff; }
26
+ .btn-halt { border-color: #ff4444; color: #ff4444; }
27
+ .btn-approve { border-color: #00cc66; color: #00cc66; }
28
+ .btn-rollback { border-color: #ff8c00; color: #ff8c00; }
29
+ .policy-row { display: flex; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid #111d30; }
30
+ .policy-pass { color: #00cc66; }
31
+ .policy-flag { color: #ffd700; }
32
+ .policy-block { color: #ff4444; }
33
+ .audit-entry { padding: 0.3rem 0; border-bottom: 1px solid #111d30; display: flex; gap: 0.6rem; font-size: 0.75rem; }
34
+ .audit-ts { color: #3a5570; min-width: 75px; }
35
+ .audit-agent { color: #7eb8da; min-width: 90px; }
36
+ .full-width { grid-column: 1 / -1; }
37
+ .metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; margin-bottom: 1rem; }
38
+ .metric { background: #111d30; border: 1px solid #1a2744; border-radius: 6px; padding: 0.8rem; text-align: center; }
39
+ .metric-value { font-size: 1.4rem; font-weight: 700; color: #7eb8da; }
40
+ .metric-label { font-size: 0.7rem; color: #5a7a9e; margin-top: 0.2rem; }
41
+ .metric-value.critical { color: #ff4444; }
42
+ .metric-value.warning { color: #ffd700; }
43
+ .metric-value.good { color: #00cc66; }
44
+ .modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 100; align-items: center; justify-content: center; }
45
+ .modal.visible { display: flex; }
46
+ .modal-content { background: #0d1525; border: 1px solid #ff4444; border-radius: 8px; padding: 1.5rem; max-width: 460px; }
47
+ .modal-content h3 { color: #ff4444; margin-bottom: 0.6rem; }
48
+ .modal-content p { color: #7eb8da; margin-bottom: 1rem; line-height: 1.6; }
49
+ .modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
50
+ .response-banner { display: none; padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-weight: 600; }
51
+ .response-banner.visible { display: block; }
52
+ </style>
53
+ </head>
54
+ <body>
55
+ <div class="header">
56
+ <div>
57
+ <h1>Agent Oversight Dashboard</h1>
58
+ <div class="system-status">
59
+ <span>Agents active: 4</span>
60
+ <span>Policy violations today: 2</span>
61
+ <span>Human reviews pending: 1</span>
62
+ <span>Uptime: 99.97%</span>
63
+ </div>
64
+ </div>
65
+ </div>
66
+
67
+ <div id="response-banner" class="response-banner"></div>
68
+
69
+ <div class="metric-grid">
70
+ <div class="metric"><div class="metric-value good">847</div><div class="metric-label">Tasks completed</div></div>
71
+ <div class="metric"><div class="metric-value">12.4ms</div><div class="metric-label">Avg step latency</div></div>
72
+ <div class="metric"><div class="metric-value warning">2</div><div class="metric-label">Policy violations</div></div>
73
+ <div class="metric"><div class="metric-value critical">1</div><div class="metric-label">Pending review</div></div>
74
+ </div>
75
+
76
+ <div class="grid">
77
+ <div class="panel">
78
+ <h2>Active Agents</h2>
79
+ <div class="agent-card">
80
+ <div class="agent-header">
81
+ <span class="agent-name">deploy-agent-prod</span>
82
+ <span class="agent-status status-flagged">FLAGGED — REVIEW REQUIRED</span>
83
+ </div>
84
+ <div class="agent-detail">
85
+ Task: Deploy v2.4.1 to production cluster<br>
86
+ Last action: Attempted to modify production database schema<br>
87
+ Policy: write-high BLOCKED — requires human approval
88
+ </div>
89
+ <div class="agent-actions">
90
+ <button class="btn-review" id="review-deploy">Review Actions</button>
91
+ <button class="btn-approve" id="approve-deploy">Approve &amp; Continue</button>
92
+ <button class="btn-halt" id="halt-deploy">Halt Agent</button>
93
+ </div>
94
+ </div>
95
+ <div class="agent-card">
96
+ <div class="agent-header">
97
+ <span class="agent-name">test-runner-ci</span>
98
+ <span class="agent-status status-running">RUNNING</span>
99
+ </div>
100
+ <div class="agent-detail">
101
+ Task: E2E regression suite — 142/200 tests complete<br>
102
+ Last action: Assert dashboard loads in &lt; 2s<br>
103
+ Policy: controlled-web — no violations
104
+ </div>
105
+ <div class="agent-actions">
106
+ <button class="btn-review" id="review-test">Review Actions</button>
107
+ <button class="btn-halt" id="halt-test">Halt Agent</button>
108
+ </div>
109
+ </div>
110
+ <div class="agent-card">
111
+ <div class="agent-header">
112
+ <span class="agent-name">security-scanner</span>
113
+ <span class="agent-status status-running">RUNNING</span>
114
+ </div>
115
+ <div class="agent-detail">
116
+ Task: Penetration test — internal web apps<br>
117
+ Last action: SQL injection test on /api/users<br>
118
+ Policy: open-web — authorized pentest
119
+ </div>
120
+ <div class="agent-actions">
121
+ <button class="btn-review" id="review-scanner">Review Actions</button>
122
+ <button class="btn-halt" id="halt-scanner">Halt Agent</button>
123
+ </div>
124
+ </div>
125
+ <div class="agent-card">
126
+ <div class="agent-header">
127
+ <span class="agent-name">data-migration-agent</span>
128
+ <span class="agent-status status-halted">HALTED — KILL SWITCH</span>
129
+ </div>
130
+ <div class="agent-detail">
131
+ Task: Migrate user records from legacy DB<br>
132
+ Last action: DELETE FROM users WHERE created_at &lt; 2024<br>
133
+ Policy: write-high BLOCKED — kill switch activated by admin
134
+ </div>
135
+ <div class="agent-actions">
136
+ <button class="btn-rollback" id="rollback-migration">Rollback Changes</button>
137
+ </div>
138
+ </div>
139
+ </div>
140
+
141
+ <div class="panel">
142
+ <h2>EA1 Policy Decisions (last 24h)</h2>
143
+ <div class="policy-row"><span>Read operations</span><span class="policy-pass">ALLOW — 2,847</span></div>
144
+ <div class="policy-row"><span>Write-low (form input, drafts)</span><span class="policy-pass">ALLOW — 412</span></div>
145
+ <div class="policy-row"><span>Write-high (delete, transfer, deploy)</span><span class="policy-block">BLOCK — 23</span></div>
146
+ <div class="policy-row"><span>Sensitive input (credentials)</span><span class="policy-block">BLOCK — 8</span></div>
147
+ <div class="policy-row"><span>Kill switch activations</span><span class="policy-flag">1</span></div>
148
+ <div class="policy-row"><span>Human approvals granted</span><span class="policy-pass">ALLOW — 4</span></div>
149
+ <div class="policy-row"><span>Human approvals denied</span><span class="policy-block">DENY — 1</span></div>
150
+ </div>
151
+
152
+ <div class="panel full-width">
153
+ <h2>Audit Trail</h2>
154
+ <div id="audit-feed">
155
+ <div class="audit-entry"><span class="audit-ts">09:44:12</span><span class="audit-agent">deploy-agent</span><span class="policy-block">BLOCK</span> Attempted ALTER TABLE users — write-high denied, pending human review</div>
156
+ <div class="audit-entry"><span class="audit-ts">09:43:58</span><span class="audit-agent">test-runner</span><span class="policy-pass">ALLOW</span> Assert response time &lt; 2000ms on /dashboard — passed</div>
157
+ <div class="audit-entry"><span class="audit-ts">09:41:22</span><span class="audit-agent">data-migration</span><span class="policy-block">KILL SWITCH</span> DELETE FROM users — kill switch activated by admin@company.com</div>
158
+ <div class="audit-entry"><span class="audit-ts">09:40:15</span><span class="audit-agent">security-scan</span><span class="policy-pass">ALLOW</span> SQL injection test: ' OR 1=1 -- on /api/users (authorized pentest)</div>
159
+ <div class="audit-entry"><span class="audit-ts">09:38:44</span><span class="audit-agent">deploy-agent</span><span class="policy-pass">ALLOW</span> Read deployment manifest v2.4.1 — classification: read</div>
160
+ <div class="audit-entry"><span class="audit-ts">09:35:02</span><span class="audit-agent">test-runner</span><span class="policy-pass">ALLOW</span> Navigate to http://localhost:3000/login — classification: read</div>
161
+ </div>
162
+ </div>
163
+ </div>
164
+
165
+ <div id="halt-modal" class="modal">
166
+ <div class="modal-content">
167
+ <h3>Confirm Agent Halt</h3>
168
+ <p id="halt-modal-text">This will immediately activate the kill switch for this agent. All queued actions will be cancelled. The agent's audit trail will be preserved for review.</p>
169
+ <div class="modal-actions">
170
+ <button class="btn-cancel" id="cancel-halt">Cancel</button>
171
+ <button class="btn-halt" id="confirm-halt" style="font-weight:700">Halt Agent</button>
172
+ </div>
173
+ </div>
174
+ </div>
175
+
176
+ <script>
177
+ var haltTarget = '';
178
+ function addAudit(agent, level, msg) {
179
+ var feed = document.getElementById('audit-feed');
180
+ var entry = document.createElement('div');
181
+ entry.className = 'audit-entry';
182
+ var now = new Date();
183
+ var ts = now.toTimeString().slice(0, 8);
184
+ var cls = level === 'BLOCK' ? 'policy-block' : level === 'KILL SWITCH' ? 'policy-block' : level === 'FLAG' ? 'policy-flag' : 'policy-pass';
185
+ entry.innerHTML = '<span class="audit-ts">' + ts + '</span><span class="audit-agent">' + agent + '</span><span class="' + cls + '">' + level + '</span> ' + msg;
186
+ feed.insertBefore(entry, feed.firstChild);
187
+ }
188
+
189
+ document.getElementById('approve-deploy').addEventListener('click', function() {
190
+ var banner = document.getElementById('response-banner');
191
+ banner.className = 'response-banner visible';
192
+ banner.style.background = '#001a0a';
193
+ banner.style.border = '1px solid #00cc66';
194
+ banner.style.color = '#00cc66';
195
+ banner.textContent = 'deploy-agent-prod approved. Schema migration proceeding under supervision.';
196
+ addAudit('deploy-agent', 'ALLOW', 'Human approval granted for ALTER TABLE users by operator');
197
+ });
198
+ document.getElementById('halt-deploy').addEventListener('click', function() {
199
+ haltTarget = 'deploy-agent-prod';
200
+ document.getElementById('halt-modal-text').textContent = 'This will immediately activate the kill switch for deploy-agent-prod. The pending schema migration will be cancelled. All actions are logged.';
201
+ document.getElementById('halt-modal').classList.add('visible');
202
+ });
203
+ document.getElementById('halt-test').addEventListener('click', function() {
204
+ haltTarget = 'test-runner-ci';
205
+ document.getElementById('halt-modal-text').textContent = 'This will halt test-runner-ci at test 142/200. Partial results will be preserved. The agent can be resumed later.';
206
+ document.getElementById('halt-modal').classList.add('visible');
207
+ });
208
+ document.getElementById('halt-scanner').addEventListener('click', function() {
209
+ haltTarget = 'security-scanner';
210
+ document.getElementById('halt-modal-text').textContent = 'This will halt the authorized penetration test. All findings so far will be preserved in the audit trail.';
211
+ document.getElementById('halt-modal').classList.add('visible');
212
+ });
213
+ document.getElementById('rollback-migration').addEventListener('click', function() {
214
+ var banner = document.getElementById('response-banner');
215
+ banner.className = 'response-banner visible';
216
+ banner.style.background = '#1a1400';
217
+ banner.style.border = '1px solid #ffd700';
218
+ banner.style.color = '#ffd700';
219
+ banner.textContent = 'Rollback initiated for data-migration-agent. Restoring from last checkpoint...';
220
+ addAudit('data-migration', 'FLAG', 'Rollback initiated by operator — restoring user records from checkpoint');
221
+ });
222
+ document.getElementById('cancel-halt').addEventListener('click', function() {
223
+ document.getElementById('halt-modal').classList.remove('visible');
224
+ });
225
+ document.getElementById('confirm-halt').addEventListener('click', function() {
226
+ document.getElementById('halt-modal').classList.remove('visible');
227
+ var banner = document.getElementById('response-banner');
228
+ banner.className = 'response-banner visible';
229
+ banner.style.background = '#1a0808';
230
+ banner.style.border = '1px solid #ff4444';
231
+ banner.style.color = '#ff4444';
232
+ banner.textContent = haltTarget + ' — KILL SWITCH ACTIVATED. All actions halted.';
233
+ addAudit(haltTarget, 'KILL SWITCH', 'Kill switch activated by operator — all actions halted');
234
+ });
235
+ </script>
236
+ </body>
237
+ </html>