@spekra.in/agent-os 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Booker/README.md +41 -0
- package/Booker/package.json +11 -0
- package/Booker/src/agent.js +15 -0
- package/Booker/src/calendar-adapter.js +75 -0
- package/Booker/src/index.js +4 -0
- package/Booker/src/intake-parser.js +96 -0
- package/Booker/src/validation.js +34 -0
- package/Booker/test/booker.test.js +35 -0
- package/CashHound/README.md +181 -0
- package/CashHound/package.json +21 -0
- package/CashHound/src/agent.js +621 -0
- package/CashHound/src/bank-reconciler.js +66 -0
- package/CashHound/src/dunning.js +380 -0
- package/CashHound/src/index.js +32 -0
- package/CashHound/src/invoice.js +371 -0
- package/CashHound/src/mobile.js +35 -0
- package/CashHound/src/npv-optimizer.js +259 -0
- package/CashHound/test/advanced.test.js +44 -0
- package/CashHound/test/cashhound.test.js +530 -0
- package/CashHound/test/mobile.test.js +25 -0
- package/CashHound/test/security.test.js +35 -0
- package/Clerk/README.md +30 -0
- package/Clerk/package.json +11 -0
- package/Clerk/src/agent.js +18 -0
- package/Clerk/src/index.js +2 -0
- package/Clerk/src/reconciliation.js +52 -0
- package/Clerk/test/clerk.test.js +39 -0
- package/LocalRoar/README.md +37 -0
- package/LocalRoar/package.json +13 -0
- package/LocalRoar/src/agent.js +70 -0
- package/LocalRoar/src/booking-router.js +74 -0
- package/LocalRoar/src/feedback-interceptor.js +47 -0
- package/LocalRoar/src/index.js +7 -0
- package/LocalRoar/src/lead-engine.js +52 -0
- package/LocalRoar/src/mobile.js +23 -0
- package/LocalRoar/src/review-booster.js +24 -0
- package/LocalRoar/src/route-density.js +46 -0
- package/LocalRoar/test/advanced.test.js +41 -0
- package/LocalRoar/test/localroar.test.js +59 -0
- package/LocalRoar/test/mobile.test.js +12 -0
- package/OmniLife/README.md +39 -0
- package/OmniLife/package.json +13 -0
- package/OmniLife/src/agent.js +47 -0
- package/OmniLife/src/bill-negotiator.js +43 -0
- package/OmniLife/src/browser-cancel.js +28 -0
- package/OmniLife/src/conflict-engine.js +49 -0
- package/OmniLife/src/index.js +6 -0
- package/OmniLife/src/mobile.js +18 -0
- package/OmniLife/src/subscription-manager.js +66 -0
- package/OmniLife/test/advanced.test.js +29 -0
- package/OmniLife/test/mobile.test.js +12 -0
- package/OmniLife/test/omnilife.test.js +71 -0
- package/PulseMD/README.md +42 -0
- package/PulseMD/package.json +13 -0
- package/PulseMD/src/agent.js +67 -0
- package/PulseMD/src/ambient-scribe.js +46 -0
- package/PulseMD/src/auth.js +63 -0
- package/PulseMD/src/charting.js +54 -0
- package/PulseMD/src/index.js +7 -0
- package/PulseMD/src/mobile.js +18 -0
- package/PulseMD/src/prior-auth.js +39 -0
- package/PulseMD/src/safety-guard.js +88 -0
- package/PulseMD/test/advanced.test.js +50 -0
- package/PulseMD/test/mobile.test.js +12 -0
- package/PulseMD/test/pulsemd.test.js +71 -0
- package/README.md +208 -2
- package/ResolveX/README.md +274 -0
- package/ResolveX/package.json +20 -0
- package/ResolveX/src/agent.js +679 -0
- package/ResolveX/src/carrier-listener.js +405 -0
- package/ResolveX/src/diagnosis.js +315 -0
- package/ResolveX/src/index.js +36 -0
- package/ResolveX/src/mobile.js +31 -0
- package/ResolveX/src/policy.js +325 -0
- package/ResolveX/src/vision.js +384 -0
- package/ResolveX/test/advanced.test.js +445 -0
- package/ResolveX/test/mobile.test.js +15 -0
- package/ResolveX/test/resolvex.test.js +428 -0
- package/SentinelMesh/README.md +51 -0
- package/SentinelMesh/package.json +13 -0
- package/SentinelMesh/src/governor.js +61 -0
- package/SentinelMesh/src/index.js +4 -0
- package/SentinelMesh/src/mobile.js +19 -0
- package/SentinelMesh/src/policy.js +63 -0
- package/SentinelMesh/src/sandbox.js +152 -0
- package/SentinelMesh/test/mobile.test.js +12 -0
- package/SentinelMesh/test/sentinel.test.js +135 -0
- package/Sidekick/README.md +43 -0
- package/Sidekick/package.json +11 -0
- package/Sidekick/src/agent.js +15 -0
- package/Sidekick/src/evidence.js +45 -0
- package/Sidekick/src/index.js +3 -0
- package/Sidekick/src/validation.js +15 -0
- package/Sidekick/test/sidekick.test.js +33 -0
- package/agent-os-mobile/README.md +26 -0
- package/agent-os-mobile/src/api.js +97 -0
- package/agent-os-mobile/src/biometric.js +41 -0
- package/agent-os-mobile/src/components/ApprovalStack.js +207 -0
- package/agent-os-mobile/src/components/OutcomeCard.js +98 -0
- package/agent-os-mobile/src/memory-graph.js +114 -0
- package/agent-os-mobile/src/screens/CashHoundMobileScreen.js +111 -0
- package/agent-os-mobile/src/screens/LocalRoarMobileScreen.js +183 -0
- package/agent-os-mobile/src/screens/OmniLifeMobileScreen.js +111 -0
- package/agent-os-mobile/src/screens/PulseMDMobileScreen.js +55 -0
- package/agent-os-mobile/src/screens/ResolveXMobileScreen.js +96 -0
- package/agent-os-mobile/src/screens/SentinelMeshMobileScreen.js +199 -0
- package/agent-os-mobile/src/self-healer.js +104 -0
- package/agent-os-mobile/src/speculative-verifier.js +69 -0
- package/agent-os-mobile/src/spekra-bridge.js +216 -0
- package/agent-os-mobile/src/swarm.js +72 -0
- package/agent-os-mobile/src/voice.js +51 -0
- package/bin/agentos.js +338 -0
- package/package.json +52 -4
- package/src/index.js +95 -0
- package/src/llm-gateway.js +226 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StyleSheet, View, Text, TouchableOpacity, Alert } from 'react-native';
|
|
3
|
+
import { OutcomeCard } from '../components/OutcomeCard.js';
|
|
4
|
+
import { ApprovalStack } from '../components/ApprovalStack.js';
|
|
5
|
+
|
|
6
|
+
export function OmniLifeMobileScreen() {
|
|
7
|
+
const [approvals, setApprovals] = useState([
|
|
8
|
+
{
|
|
9
|
+
id: 'sub-gym-cancel',
|
|
10
|
+
agentName: 'OmniLife',
|
|
11
|
+
title: 'Dormant Subscription Cancellation: Fitness Gym',
|
|
12
|
+
description: 'Unused for 120 days. Early termination penalty of $50.00 applies, but net projected yearly savings is $670.00.',
|
|
13
|
+
amountFormatted: '$670/yr net savings',
|
|
14
|
+
timestamp: '25m ago'
|
|
15
|
+
}
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const handleApprove = (id) => {
|
|
19
|
+
setApprovals(approvals.filter(a => a.id !== id));
|
|
20
|
+
Alert.alert('Subscription Cancelled', 'Cancellation notice transmitted with biometric confirmation.');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleReject = (id) => {
|
|
24
|
+
setApprovals(approvals.filter(a => a.id !== id));
|
|
25
|
+
Alert.alert('Kept Active', 'Subscription retained.');
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View style={styles.container}>
|
|
30
|
+
<OutcomeCard
|
|
31
|
+
title="Personal Life Operating System"
|
|
32
|
+
subtitle="OmniLife Autonomous Guardian"
|
|
33
|
+
metric="$740.00 Saved / Yr"
|
|
34
|
+
highlightColor="#EC4899"
|
|
35
|
+
details={[
|
|
36
|
+
{ label: 'Passport Travel Validity', value: 'Expiring in 78 days (ALERT)' },
|
|
37
|
+
{ label: 'Calendar Collisions Resolved', value: '2 rescheduled' },
|
|
38
|
+
{ label: 'Household Bills Audited', value: '6 checked (0 surprises)' }
|
|
39
|
+
]}
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
{/* Travel Passport Warning Card */}
|
|
43
|
+
<View style={styles.warningCard}>
|
|
44
|
+
<View style={styles.warningHeader}>
|
|
45
|
+
<Text style={styles.warningIcon}>⚠️</Text>
|
|
46
|
+
<Text style={styles.warningTitle}>International Travel Alert</Text>
|
|
47
|
+
</View>
|
|
48
|
+
<Text style={styles.warningDesc}>
|
|
49
|
+
Trip to Tokyo departure date is within 90 days. Passport has only 78 days remaining validity. Immigration mandates 180 days.
|
|
50
|
+
</Text>
|
|
51
|
+
<TouchableOpacity
|
|
52
|
+
style={styles.expediteBtn}
|
|
53
|
+
onPress={() => Alert.alert('Renewal Initiated', 'Appointment packet prepared for nearest passport agency.')}
|
|
54
|
+
>
|
|
55
|
+
<Text style={styles.expediteBtnText}>One-Tap Expedite Passport Renewal</Text>
|
|
56
|
+
</TouchableOpacity>
|
|
57
|
+
</View>
|
|
58
|
+
|
|
59
|
+
<ApprovalStack
|
|
60
|
+
approvals={approvals}
|
|
61
|
+
onApprove={handleApprove}
|
|
62
|
+
onReject={handleReject}
|
|
63
|
+
/>
|
|
64
|
+
</View>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const styles = StyleSheet.create({
|
|
69
|
+
container: {
|
|
70
|
+
paddingBottom: 24
|
|
71
|
+
},
|
|
72
|
+
warningCard: {
|
|
73
|
+
backgroundColor: '#311414',
|
|
74
|
+
borderRadius: 14,
|
|
75
|
+
padding: 18,
|
|
76
|
+
marginBottom: 24,
|
|
77
|
+
borderWidth: 1,
|
|
78
|
+
borderColor: '#7F1D1D'
|
|
79
|
+
},
|
|
80
|
+
warningHeader: {
|
|
81
|
+
flexDirection: 'row',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
gap: 8,
|
|
84
|
+
marginBottom: 10
|
|
85
|
+
},
|
|
86
|
+
warningIcon: {
|
|
87
|
+
fontSize: 18
|
|
88
|
+
},
|
|
89
|
+
warningTitle: {
|
|
90
|
+
color: '#F87171',
|
|
91
|
+
fontSize: 15,
|
|
92
|
+
fontWeight: '700'
|
|
93
|
+
},
|
|
94
|
+
warningDesc: {
|
|
95
|
+
color: '#FECACA',
|
|
96
|
+
fontSize: 13,
|
|
97
|
+
lineHeight: 18,
|
|
98
|
+
marginBottom: 16
|
|
99
|
+
},
|
|
100
|
+
expediteBtn: {
|
|
101
|
+
backgroundColor: '#DC2626',
|
|
102
|
+
borderRadius: 8,
|
|
103
|
+
paddingVertical: 12,
|
|
104
|
+
alignItems: 'center'
|
|
105
|
+
},
|
|
106
|
+
expediteBtnText: {
|
|
107
|
+
color: '#FFFFFF',
|
|
108
|
+
fontSize: 13,
|
|
109
|
+
fontWeight: '700'
|
|
110
|
+
}
|
|
111
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StyleSheet, View, Text, TouchableOpacity, Alert } from 'react-native';
|
|
3
|
+
import { OutcomeCard } from '../components/OutcomeCard.js';
|
|
4
|
+
import { ApprovalStack } from '../components/ApprovalStack.js';
|
|
5
|
+
|
|
6
|
+
export function PulseMDMobileScreen() {
|
|
7
|
+
const [approvals, setApprovals] = useState([
|
|
8
|
+
{
|
|
9
|
+
id: 'soap-902',
|
|
10
|
+
agentName: 'PulseMD',
|
|
11
|
+
title: 'Physician Signature: Lumbar Spine MRI Order',
|
|
12
|
+
description: 'Draft SOAP note prepared for Patient #PT-8492. Prior-auth verified: 6-week conservative physical therapy and radiographs confirmed on file.',
|
|
13
|
+
amountFormatted: 'CPT 72148',
|
|
14
|
+
timestamp: '12m ago'
|
|
15
|
+
}
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const handleApprove = (id) => {
|
|
19
|
+
setApprovals(approvals.filter(a => a.id !== id));
|
|
20
|
+
Alert.alert('SOAP Note Signed & Locked', 'Chart note finalized and submitted directly to payer prior-authorization portal.');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleReject = (id) => {
|
|
24
|
+
setApprovals(approvals.filter(a => a.id !== id));
|
|
25
|
+
Alert.alert('Returned for Revision', 'Clinical note marked for follow-up review.');
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View style={styles.container}>
|
|
30
|
+
<OutcomeCard
|
|
31
|
+
title="Clinical Administrative Relief"
|
|
32
|
+
subtitle="PulseMD AI Medical Scribe & Auth Agent"
|
|
33
|
+
metric="2.3 hrs / day saved"
|
|
34
|
+
highlightColor="#8B5CF6"
|
|
35
|
+
details={[
|
|
36
|
+
{ label: 'Chart Notes Drafted Today', value: '14 encounters' },
|
|
37
|
+
{ label: 'Prior-Auth First-Pass Approval', value: '96.4%' },
|
|
38
|
+
{ label: 'Clinician Review Compliance', value: '100% human-signed' }
|
|
39
|
+
]}
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<ApprovalStack
|
|
43
|
+
approvals={approvals}
|
|
44
|
+
onApprove={handleApprove}
|
|
45
|
+
onReject={handleReject}
|
|
46
|
+
/>
|
|
47
|
+
</View>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const styles = StyleSheet.create({
|
|
52
|
+
container: {
|
|
53
|
+
paddingBottom: 24
|
|
54
|
+
}
|
|
55
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StyleSheet, View, Text, TouchableOpacity, Alert } from 'react-native';
|
|
3
|
+
import { OutcomeCard } from '../components/OutcomeCard.js';
|
|
4
|
+
import { ApprovalStack } from '../components/ApprovalStack.js';
|
|
5
|
+
|
|
6
|
+
export function ResolveXMobileScreen() {
|
|
7
|
+
const [approvals, setApprovals] = useState([
|
|
8
|
+
{
|
|
9
|
+
id: 'res-esc-402',
|
|
10
|
+
agentName: 'ResolveX',
|
|
11
|
+
title: 'High-Value Refund Request: Damaged Monitor',
|
|
12
|
+
description: 'Customer reports shattered panel on delivery with photo evidence. Total purchase amount $349.99 exceeds auto-limit ($100).',
|
|
13
|
+
amountFormatted: '$349.99',
|
|
14
|
+
timestamp: '5m ago'
|
|
15
|
+
}
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const handleApprove = (id) => {
|
|
19
|
+
setApprovals(approvals.filter(a => a.id !== id));
|
|
20
|
+
Alert.alert('Refund Executed', 'Immediate refund of $349.99 issued to customer card via Stripe.');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleReject = (id) => {
|
|
24
|
+
setApprovals(approvals.filter(a => a.id !== id));
|
|
25
|
+
Alert.alert('Escalated', 'Transferred to tier-2 human claims team.');
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View style={styles.container}>
|
|
30
|
+
<OutcomeCard
|
|
31
|
+
title="Customer Issue Resolution"
|
|
32
|
+
subtitle="ResolveX Autonomous Care Concierge"
|
|
33
|
+
metric="94.2% Auto-Resolved"
|
|
34
|
+
highlightColor="#3B82F6"
|
|
35
|
+
details={[
|
|
36
|
+
{ label: 'Autonomous Resolutions Today', value: '47 issues fixed' },
|
|
37
|
+
{ label: 'Average Resolution Latency', value: '1.4 seconds' },
|
|
38
|
+
{ label: 'CSAT Post-Resolution', value: '4.85 / 5.0 ⭐' }
|
|
39
|
+
]}
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<View style={styles.statsRow}>
|
|
43
|
+
<View style={styles.statCard}>
|
|
44
|
+
<Text style={styles.statVal}>32</Text>
|
|
45
|
+
<Text style={styles.statLabel}>Auto-Refunds</Text>
|
|
46
|
+
</View>
|
|
47
|
+
<View style={styles.statCard}>
|
|
48
|
+
<Text style={styles.statVal}>11</Text>
|
|
49
|
+
<Text style={styles.statLabel}>Replacements</Text>
|
|
50
|
+
</View>
|
|
51
|
+
<View style={styles.statCard}>
|
|
52
|
+
<Text style={styles.statVal}>4</Text>
|
|
53
|
+
<Text style={styles.statLabel}>Carrier Traces</Text>
|
|
54
|
+
</View>
|
|
55
|
+
</View>
|
|
56
|
+
|
|
57
|
+
<ApprovalStack
|
|
58
|
+
approvals={approvals}
|
|
59
|
+
onApprove={handleApprove}
|
|
60
|
+
onReject={handleReject}
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const styles = StyleSheet.create({
|
|
67
|
+
container: {
|
|
68
|
+
paddingBottom: 24
|
|
69
|
+
},
|
|
70
|
+
statsRow: {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
gap: 12,
|
|
73
|
+
marginBottom: 24
|
|
74
|
+
},
|
|
75
|
+
statCard: {
|
|
76
|
+
flex: 1,
|
|
77
|
+
backgroundColor: '#1E293B',
|
|
78
|
+
borderRadius: 12,
|
|
79
|
+
padding: 16,
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderColor: '#334155'
|
|
83
|
+
},
|
|
84
|
+
statVal: {
|
|
85
|
+
color: '#60A5FA',
|
|
86
|
+
fontSize: 22,
|
|
87
|
+
fontWeight: '800',
|
|
88
|
+
marginBottom: 4
|
|
89
|
+
},
|
|
90
|
+
statLabel: {
|
|
91
|
+
color: '#94A3B8',
|
|
92
|
+
fontSize: 11,
|
|
93
|
+
fontWeight: '600',
|
|
94
|
+
textAlign: 'center'
|
|
95
|
+
}
|
|
96
|
+
});
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StyleSheet, View, Text, TouchableOpacity, Alert, Switch } from 'react-native';
|
|
3
|
+
import { OutcomeCard } from '../components/OutcomeCard.js';
|
|
4
|
+
|
|
5
|
+
export function SentinelMeshMobileScreen() {
|
|
6
|
+
const [agents, setAgents] = useState([
|
|
7
|
+
{ id: 'cashhound-worker', name: 'CashHound Operator', status: 'ACTIVE', spendLimit: '$1,000.00', alerts: 0 },
|
|
8
|
+
{ id: 'resolvex-worker', name: 'ResolveX Care Concierge', status: 'ACTIVE', spendLimit: '$100.00', alerts: 0 },
|
|
9
|
+
{ id: 'localroar-worker', name: 'LocalRoar Growth Bot', status: 'ACTIVE', spendLimit: 'N/A', alerts: 0 },
|
|
10
|
+
{ id: 'pulsemd-worker', name: 'PulseMD Clinical Bot', status: 'GUARDED', spendLimit: 'N/A', alerts: 1 }
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const [globalKillSwitch, setGlobalKillSwitch] = useState(false);
|
|
14
|
+
|
|
15
|
+
const toggleAgentHalt = (id) => {
|
|
16
|
+
setAgents(agents.map(a => {
|
|
17
|
+
if (a.id === id) {
|
|
18
|
+
const nextStatus = a.status === 'ACTIVE' ? 'QUARANTINED' : 'ACTIVE';
|
|
19
|
+
Alert.alert('Sentinel Security Action', `Agent ${a.name} is now ${nextStatus}.`);
|
|
20
|
+
return { ...a, status: nextStatus };
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleGlobalHalt = (val) => {
|
|
27
|
+
setGlobalKillSwitch(val);
|
|
28
|
+
if (val) {
|
|
29
|
+
Alert.alert('EMERGENCY KILL-SWITCH TRIPPED', 'All autonomous agent execution suspended immediately across all tenants.');
|
|
30
|
+
} else {
|
|
31
|
+
Alert.alert('System Resumed', 'Agent execution restored under sandbox governance.');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View style={styles.container}>
|
|
37
|
+
<OutcomeCard
|
|
38
|
+
title="Agent Governance & Sandboxing"
|
|
39
|
+
subtitle="SentinelMesh Zero-Trust Fabric"
|
|
40
|
+
metric="Zero Violations"
|
|
41
|
+
highlightColor="#10B981"
|
|
42
|
+
details={[
|
|
43
|
+
{ label: 'Cryptographic Audit Blocks', value: '1,492 SHA-256 blocks' },
|
|
44
|
+
{ label: 'Runtime Policy Checks', value: '100% verified' },
|
|
45
|
+
{ label: 'Sandbox Isolation', value: 'Active' }
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
{/* Emergency Kill-Switch Bar */}
|
|
50
|
+
<View style={[styles.killSwitchCard, globalKillSwitch && styles.killSwitchActive]}>
|
|
51
|
+
<View style={styles.killSwitchTextContainer}>
|
|
52
|
+
<Text style={styles.killSwitchTitle}>Global Emergency Kill-Switch</Text>
|
|
53
|
+
<Text style={styles.killSwitchSubtitle}>Immediately suspends all agent tool executions</Text>
|
|
54
|
+
</View>
|
|
55
|
+
<Switch
|
|
56
|
+
value={globalKillSwitch}
|
|
57
|
+
onValueChange={handleGlobalHalt}
|
|
58
|
+
trackColor={{ false: '#334155', true: '#EF4444' }}
|
|
59
|
+
thumbColor="#FFFFFF"
|
|
60
|
+
/>
|
|
61
|
+
</View>
|
|
62
|
+
|
|
63
|
+
{/* Roster & Quarantine Controls */}
|
|
64
|
+
<View style={styles.rosterSection}>
|
|
65
|
+
<Text style={styles.sectionTitle}>Agent Authorization Roster</Text>
|
|
66
|
+
{agents.map((ag) => (
|
|
67
|
+
<View key={ag.id} style={styles.agentCard}>
|
|
68
|
+
<View style={styles.agentInfo}>
|
|
69
|
+
<View style={styles.nameRow}>
|
|
70
|
+
<Text style={styles.agentName}>{ag.name}</Text>
|
|
71
|
+
<View style={[styles.statusBadge, ag.status === 'ACTIVE' ? styles.statusActive : styles.statusQuarantine]}>
|
|
72
|
+
<Text style={styles.statusText}>{ag.status}</Text>
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
<Text style={styles.agentLimit}>Auto-Spend Limit: {ag.spendLimit}</Text>
|
|
76
|
+
</View>
|
|
77
|
+
|
|
78
|
+
<TouchableOpacity
|
|
79
|
+
style={[styles.haltBtn, ag.status === 'QUARANTINED' ? styles.resumeBtn : styles.quarantineBtn]}
|
|
80
|
+
onPress={() => toggleAgentHalt(ag.id)}
|
|
81
|
+
>
|
|
82
|
+
<Text style={styles.haltBtnText}>
|
|
83
|
+
{ag.status === 'ACTIVE' ? 'Quarantine' : 'Restore'}
|
|
84
|
+
</Text>
|
|
85
|
+
</TouchableOpacity>
|
|
86
|
+
</View>
|
|
87
|
+
))}
|
|
88
|
+
</View>
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const styles = StyleSheet.create({
|
|
94
|
+
container: {
|
|
95
|
+
paddingBottom: 24
|
|
96
|
+
},
|
|
97
|
+
killSwitchCard: {
|
|
98
|
+
flexDirection: 'row',
|
|
99
|
+
justifyContent: 'space-between',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
backgroundColor: '#1E293B',
|
|
102
|
+
borderRadius: 14,
|
|
103
|
+
padding: 18,
|
|
104
|
+
marginBottom: 24,
|
|
105
|
+
borderWidth: 1,
|
|
106
|
+
borderColor: '#334155'
|
|
107
|
+
},
|
|
108
|
+
killSwitchActive: {
|
|
109
|
+
backgroundColor: '#7F1D1D',
|
|
110
|
+
borderColor: '#EF4444'
|
|
111
|
+
},
|
|
112
|
+
killSwitchTextContainer: {
|
|
113
|
+
flex: 1,
|
|
114
|
+
marginRight: 12
|
|
115
|
+
},
|
|
116
|
+
killSwitchTitle: {
|
|
117
|
+
color: '#F8FAFC',
|
|
118
|
+
fontSize: 15,
|
|
119
|
+
fontWeight: '700'
|
|
120
|
+
},
|
|
121
|
+
killSwitchSubtitle: {
|
|
122
|
+
color: '#94A3B8',
|
|
123
|
+
fontSize: 12,
|
|
124
|
+
marginTop: 4
|
|
125
|
+
},
|
|
126
|
+
rosterSection: {
|
|
127
|
+
marginBottom: 24
|
|
128
|
+
},
|
|
129
|
+
sectionTitle: {
|
|
130
|
+
color: '#F8FAFC',
|
|
131
|
+
fontSize: 16,
|
|
132
|
+
fontWeight: '700',
|
|
133
|
+
marginBottom: 12
|
|
134
|
+
},
|
|
135
|
+
agentCard: {
|
|
136
|
+
flexDirection: 'row',
|
|
137
|
+
justifyContent: 'space-between',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
backgroundColor: '#131B2E',
|
|
140
|
+
borderRadius: 12,
|
|
141
|
+
padding: 16,
|
|
142
|
+
marginBottom: 12,
|
|
143
|
+
borderWidth: 1,
|
|
144
|
+
borderColor: '#1E293B'
|
|
145
|
+
},
|
|
146
|
+
agentInfo: {
|
|
147
|
+
flex: 1,
|
|
148
|
+
marginRight: 12
|
|
149
|
+
},
|
|
150
|
+
nameRow: {
|
|
151
|
+
flexDirection: 'row',
|
|
152
|
+
alignItems: 'center',
|
|
153
|
+
gap: 8,
|
|
154
|
+
marginBottom: 4
|
|
155
|
+
},
|
|
156
|
+
agentName: {
|
|
157
|
+
color: '#F1F5F9',
|
|
158
|
+
fontSize: 15,
|
|
159
|
+
fontWeight: '600'
|
|
160
|
+
},
|
|
161
|
+
statusBadge: {
|
|
162
|
+
paddingHorizontal: 6,
|
|
163
|
+
paddingVertical: 2,
|
|
164
|
+
borderRadius: 4
|
|
165
|
+
},
|
|
166
|
+
statusActive: {
|
|
167
|
+
backgroundColor: 'rgba(16, 185, 129, 0.2)'
|
|
168
|
+
},
|
|
169
|
+
statusQuarantine: {
|
|
170
|
+
backgroundColor: 'rgba(239, 68, 68, 0.2)'
|
|
171
|
+
},
|
|
172
|
+
statusText: {
|
|
173
|
+
color: '#E2E8F0',
|
|
174
|
+
fontSize: 10,
|
|
175
|
+
fontWeight: '700'
|
|
176
|
+
},
|
|
177
|
+
agentLimit: {
|
|
178
|
+
color: '#64748B',
|
|
179
|
+
fontSize: 12
|
|
180
|
+
},
|
|
181
|
+
haltBtn: {
|
|
182
|
+
paddingHorizontal: 12,
|
|
183
|
+
paddingVertical: 8,
|
|
184
|
+
borderRadius: 8
|
|
185
|
+
},
|
|
186
|
+
quarantineBtn: {
|
|
187
|
+
backgroundColor: '#334155',
|
|
188
|
+
borderWidth: 1,
|
|
189
|
+
borderColor: '#475569'
|
|
190
|
+
},
|
|
191
|
+
resumeBtn: {
|
|
192
|
+
backgroundColor: '#10B981'
|
|
193
|
+
},
|
|
194
|
+
haltBtnText: {
|
|
195
|
+
color: '#FFFFFF',
|
|
196
|
+
fontSize: 12,
|
|
197
|
+
fontWeight: '700'
|
|
198
|
+
}
|
|
199
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentOS Self-Healing & Auto-Recovery Engine:
|
|
3
|
+
* Catches tool/API faults, executes intelligent backoff retries, and switches
|
|
4
|
+
* to secondary alternate rails automatically without crashing agent workflows.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const FaultSignature = Object.freeze({
|
|
8
|
+
TRANSIENT_NETWORK: 'TRANSIENT_NETWORK',
|
|
9
|
+
RATE_LIMIT_429: 'RATE_LIMIT_429',
|
|
10
|
+
RAIL_UNAVAILABLE: 'RAIL_UNAVAILABLE',
|
|
11
|
+
AUTH_EXPIRED: 'AUTH_EXPIRED',
|
|
12
|
+
FATAL_LOGIC: 'FATAL_LOGIC'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export class AgentSelfHealer {
|
|
16
|
+
constructor(options = {}) {
|
|
17
|
+
this.maxRetries = options.maxRetries || 2;
|
|
18
|
+
this.baseDelayMs = options.baseDelayMs || 50;
|
|
19
|
+
this.healingAuditLog = [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
classifyError(err) {
|
|
23
|
+
const msg = (err?.message || '').toLowerCase();
|
|
24
|
+
if (msg.includes('429') || msg.includes('rate limit') || msg.includes('too many requests')) {
|
|
25
|
+
return FaultSignature.RATE_LIMIT_429;
|
|
26
|
+
}
|
|
27
|
+
if (msg.includes('econnreset') || msg.includes('etimedout') || msg.includes('timeout') || msg.includes('network')) {
|
|
28
|
+
return FaultSignature.TRANSIENT_NETWORK;
|
|
29
|
+
}
|
|
30
|
+
if (msg.includes('unavailable') || msg.includes('service down') || msg.includes('outage') || msg.includes('503')) {
|
|
31
|
+
return FaultSignature.RAIL_UNAVAILABLE;
|
|
32
|
+
}
|
|
33
|
+
if (msg.includes('unauthorized') || msg.includes('token expired') || msg.includes('401')) {
|
|
34
|
+
return FaultSignature.AUTH_EXPIRED;
|
|
35
|
+
}
|
|
36
|
+
return FaultSignature.FATAL_LOGIC;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async executeWithSelfHealing(taskName, primaryRailFn, failoverRails = [], options = {}) {
|
|
40
|
+
const startTime = Date.now();
|
|
41
|
+
let attempts = 0;
|
|
42
|
+
const history = [];
|
|
43
|
+
|
|
44
|
+
// 1. Try Primary Rail with Exponential Backoff
|
|
45
|
+
while (attempts <= this.maxRetries) {
|
|
46
|
+
attempts++;
|
|
47
|
+
try {
|
|
48
|
+
const result = await primaryRailFn();
|
|
49
|
+
return {
|
|
50
|
+
status: attempts === 1 ? 'SUCCESS_PRIMARY' : 'RECOVERED_VIA_RETRY',
|
|
51
|
+
taskName,
|
|
52
|
+
attempts,
|
|
53
|
+
railUsed: 'PRIMARY',
|
|
54
|
+
result,
|
|
55
|
+
latencyMs: Date.now() - startTime
|
|
56
|
+
};
|
|
57
|
+
} catch (err) {
|
|
58
|
+
const fault = this.classifyError(err);
|
|
59
|
+
history.push({ rail: 'PRIMARY', attempt: attempts, fault, error: err.message });
|
|
60
|
+
|
|
61
|
+
if (fault === FaultSignature.FATAL_LOGIC || attempts > this.maxRetries) {
|
|
62
|
+
break; // Exit retry loop and evaluate failovers
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Exponential backoff delay
|
|
66
|
+
const delay = this.baseDelayMs * Math.pow(2, attempts - 1);
|
|
67
|
+
await new Promise(res => setTimeout(res, delay));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 2. Failover to Alternate Secondary Rails
|
|
72
|
+
for (let i = 0; i < failoverRails.length; i++) {
|
|
73
|
+
const failover = failoverRails[i];
|
|
74
|
+
const railName = failover.name || `FAILOVER_RAIL_${i + 1}`;
|
|
75
|
+
try {
|
|
76
|
+
const result = await failover.fn();
|
|
77
|
+
const record = {
|
|
78
|
+
status: 'RECOVERED_VIA_FAILOVER',
|
|
79
|
+
taskName,
|
|
80
|
+
totalAttempts: attempts + i + 1,
|
|
81
|
+
railUsed: railName,
|
|
82
|
+
result,
|
|
83
|
+
faultsOvercome: history,
|
|
84
|
+
latencyMs: Date.now() - startTime
|
|
85
|
+
};
|
|
86
|
+
this.healingAuditLog.push(record);
|
|
87
|
+
return record;
|
|
88
|
+
} catch (err) {
|
|
89
|
+
history.push({ rail: railName, fault: this.classifyError(err), error: err.message });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// 3. Graceful Degradation / Fallback Action
|
|
94
|
+
const failureRecord = {
|
|
95
|
+
status: 'SELF_HEALING_EXHAUSTED',
|
|
96
|
+
taskName,
|
|
97
|
+
history,
|
|
98
|
+
latencyMs: Date.now() - startTime,
|
|
99
|
+
message: `Self-healing exhausted across primary and ${failoverRails.length} alternate rails.`
|
|
100
|
+
};
|
|
101
|
+
this.healingAuditLog.push(failureRecord);
|
|
102
|
+
throw new Error(failureRecord.message);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentOS Speculative Verifier ("Second Pair of Eyes"):
|
|
3
|
+
* Audits proposed agent actions before they hit the human approval stack.
|
|
4
|
+
* Verifies exact math reconciliation, tone safety, and policy compliance.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const PROHIBITED_COLLECTION_PATTERNS = [
|
|
8
|
+
/police/i,
|
|
9
|
+
/arrest/i,
|
|
10
|
+
/jail/i,
|
|
11
|
+
/criminal charges/i,
|
|
12
|
+
/law enforcement/i,
|
|
13
|
+
/seize your property/i,
|
|
14
|
+
/bankrupt you/i
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export class SpeculativeVerifier {
|
|
18
|
+
verifyAction(action) {
|
|
19
|
+
const issues = [];
|
|
20
|
+
let score = 100;
|
|
21
|
+
|
|
22
|
+
// 1. Math Verification
|
|
23
|
+
if (action.amountCents !== undefined) {
|
|
24
|
+
if (!Number.isSafeInteger(action.amountCents) || action.amountCents <= 0) {
|
|
25
|
+
issues.push('Math Violation: Amount must be a positive integer in minor units');
|
|
26
|
+
score -= 40;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (action.breakdown && Array.isArray(action.breakdown)) {
|
|
30
|
+
const sumParts = action.breakdown.reduce((sum, item) => sum + (item.amountCents || 0), 0);
|
|
31
|
+
if (sumParts !== action.amountCents) {
|
|
32
|
+
issues.push(`Math Discrepancy: Breakdown sum ($${(sumParts / 100).toFixed(2)}) does not match total ($${(action.amountCents / 100).toFixed(2)})`);
|
|
33
|
+
score -= 30;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 2. Prohibited Tone & Coercion Audit
|
|
39
|
+
const textToScan = `${action.title || ''} ${action.description || ''} ${action.messageBody || ''}`;
|
|
40
|
+
for (const pattern of PROHIBITED_COLLECTION_PATTERNS) {
|
|
41
|
+
if (pattern.test(textToScan)) {
|
|
42
|
+
issues.push(`Compliance Violation: Coercive/prohibited debt collection phrase detected (${pattern.source})`);
|
|
43
|
+
score -= 50;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 3. Authority Threshold Check
|
|
49
|
+
if (action.amountCents && action.amountCents > 1000000) {
|
|
50
|
+
// Amounts > $10,000 flagged for executive review
|
|
51
|
+
issues.push('High-Exposure Transaction: Requires secondary executive dual-control signature');
|
|
52
|
+
score -= 15;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const normalizedScore = Math.max(0, score);
|
|
56
|
+
const verified = normalizedScore >= 85 && issues.length === 0;
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
actionId: action.id,
|
|
60
|
+
verified,
|
|
61
|
+
policyAlignmentScore: normalizedScore,
|
|
62
|
+
passedSecondPairOfEyes: verified,
|
|
63
|
+
issues,
|
|
64
|
+
recommendation: verified
|
|
65
|
+
? 'Action verified: Math reconciles and tone complies with regulatory policy.'
|
|
66
|
+
: `Action rejected by Verifier: Address issues: ${issues.join('; ')}`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|